12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package contact
- import (
- "context"
- "wechat-api/internal/utils/dberrorhandler"
- "wechat-api/internal/svc"
- "wechat-api/internal/types"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type UpdateWhatsappContactLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- func NewUpdateWhatsappContactLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateWhatsappContactLogic {
- return &UpdateWhatsappContactLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx}
- }
- func (l *UpdateWhatsappContactLogic) UpdateWhatsappContact(req *types.CreateWhatsappContactReq) (*types.BaseMsgResp, error) {
- resp := types.BaseMsgResp{}
- organizationId := l.ctx.Value("organizationId").(uint64)
- _, err := l.svcCtx.DB.Contact.UpdateOneID(*req.Id).
- SetNotNilCc(req.Cc).
- SetNotNilPhone(req.Phone).
- SetType(5).
- SetNotNilMarkname(req.Markname).
- SetOrganizationID(organizationId).
- SetNotNilCarea(req.Carea).
- SetNotNilCage(req.Cage).
- SetNotNilSex(req.Sex).
- SetNotNilCbirtharea(req.Cbirtharea).
- SetNotNilCbirthday(req.Cbirthday).
- SetNotNilCtitle(req.Ctitle).
- SetNotNilCidcardNo(req.CidcardNo).
- SetNotNilCname(req.Cname).
- Save(l.ctx)
- if err != nil {
- return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
- }
- resp.Msg = "更新成功"
- return &resp, nil
- }
|