package logic import ( "context" "fmt" it "jyBXSubscribe/api/init" "jyBXSubscribe/api/internal/svc" "jyBXSubscribe/api/internal/types" "jyBXSubscribe/rpc/model/service" "github.com/zeromicro/go-zero/core/logx" ) type SubscribeUpdateLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewSubscribeUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SubscribeUpdateLogic { return &SubscribeUpdateLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } // func (l *SubscribeUpdateLogic) SubscribeUpdate(req *types.SubscribeUpdateReq) (resp *types.CommonResp, err error) { resp = &types.CommonResp{} //出参 if req.UserId == "" { return } subService := &service.SubseribeService{ UserId: req.UserId, Mgo: it.Mgo, } if req.Area != nil { subService.Area = req.Area } if req.Apppush != "" { subService.Apppush = req.Apppush } if req.Buyerclass != nil { subService.Buyerclass = req.Buyerclass } if req.Infotype != nil { subService.Infotype = req.Infotype } if req.Items != nil { subService.Items = req.Items } if req.Mail != "" { subService.Mail = req.Mail } if req.Mailpush != "" { subService.Mailpush = req.Mailpush } if req.Matchway != "" { subService.Matchway = req.Matchway } if req.Otherbuyerclass != "" { subService.Otherbuyerclass = req.Otherbuyerclass } if req.Projectmatch != "" { subService.Projectmatch = req.Projectmatch } if req.Ratemode != "" { subService.Ratemode = req.Ratemode } status, err := subService.Update() if err != nil { resp.Err_code, resp.Err_msg = -1, "修改失败" l.Error(fmt.Sprintf("%+v", req), resp.Err_msg) } else { resp.Data = map[string]interface{}{ "status": status, } } return }