package logic import ( "app.yhyue.com/moapp/MessageCenter/api/internal/svc" "app.yhyue.com/moapp/MessageCenter/api/internal/types" "app.yhyue.com/moapp/MessageCenter/rpc/messageclient" "app.yhyue.com/moapp/MessageCenter/util" "context" "github.com/zeromicro/go-zero/core/logx" ) type BitmapSaveMsgLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewBitmapSaveMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *BitmapSaveMsgLogic { return &BitmapSaveMsgLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *BitmapSaveMsgLogic) BitmapSaveMsg(req *types.BitmapSaveMsgReq) (resp *types.MultipleSaveMsgResp, err error) { var ( msg = "发送成功" code = 0 ) lsi := l.svcCtx.MessageCenter msgInfo := req.MsgInfo _, err = lsi.BitmapSaveMsg(l.ctx, &messageclient.MultipleSaveMsgReq{ Appid: util.ObjToString(msgInfo["appid"]), Title: util.ObjToString(msgInfo["title"]), Content: util.ObjToString(msgInfo["content"]), MsgType: int64(util.IntAll(msgInfo["msgType"])), Link: util.ObjToString(msgInfo["link"]), UserIds: req.UserIds, MsgLogId: int64(util.IntAll(msgInfo["msgLogId"])), PositionIds: req.PositionIds, Row4: util.ObjToString(msgInfo["row4"]), ProductName: util.ObjToString(msgInfo["productName"]), OrderId: util.ObjToString(msgInfo["orderId"]), OrderMoney: util.ObjToString(msgInfo["orderMoney"]), AppPushUrl: util.ObjToString(msgInfo["appPushUrl"]), WxPushUrl: util.ObjToString(msgInfo["wxPushUrl"]), IosPushUrl: util.ObjToString(msgInfo["iosPushUrl"]), SendUserId: util.ObjToString(msgInfo["sendUserId"]), }) if err != nil { msg = err.Error() code = 0 } return &types.MultipleSaveMsgResp{ Code: int64(code), Message: msg, }, nil }