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 NewUserSaveMsgLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewNewUserSaveMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *NewUserSaveMsgLogic { return &NewUserSaveMsgLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *NewUserSaveMsgLogic) NewUserSaveMsg(req *types.NewUserSaveMsgReq) (resp *types.NewUserSaveMsgResp, err error) { lsi := l.svcCtx.MessageCenter msgInfo := req.MsgInfo /*msgLogId, err := (msgInfo["msgLogId"]).(json.Number).Int64() msgType, err := (msgInfo["msgType"]).(json.Number).Int64() fmt.Println("msgInfo:", msgInfo)*/ _, err = lsi.NewUserMsg(l.ctx, &messageclient.NewUserInsertMsgReq{ Appid: util.ObjToString(msgInfo["appid"]), Title: util.ObjToString(msgInfo["title"]), Content: util.ObjToString(msgInfo["content"]), MsgType: util.Int64All(msgInfo["msgType"]), Link: util.ObjToString(msgInfo["link"]), UserIds: req.UserIds, MsgLogId: util.Int64All(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"]), }) if err != nil { return &types.NewUserSaveMsgResp{ Code: 1, Message: err.Error(), }, nil } return &types.NewUserSaveMsgResp{ Code: 1, Message: "保存成功", }, nil }