package logic import ( "app.yhyue.com/moapp/message/db" "context" "github.com/zeromicro/go-zero/core/logx" "jyBXSubscribe/rpc/internal/svc" "jyBXSubscribe/rpc/type/bxsubscribe" "jyBXSubscribe/rpc/util" ) type SetUserLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger } func NewSetUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetUserLogic { return &SetUserLogic{ ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } // 用户邮箱保存 func (l *SetUserLogic) SetUser(in *bxsubscribe.SetUserInfoReq) (*bxsubscribe.StatusResp, error) { // todo: add your logic here and delete this line set := map[string]interface{}{ "o_pushset.s_email": in.Mail, } update := false if in.PositionType == 0 { update = db.Mgo.Update(util.USER, map[string]interface{}{"userid": in.UserId}, map[string]interface{}{ "$set": set, }, true, false) } else { update = db.Mgo.Update(util.USER, map[string]interface{}{"entId": in.EntId, "user_id": in.EntUserId}, map[string]interface{}{ "$set": set, }, true, false) } if update { return &bxsubscribe.StatusResp{Status: 0}, nil } else { return &bxsubscribe.StatusResp{ Status: 1}, nil } }