12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- 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"
- "log"
- )
- type MultipleSaveMsgLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- func NewMultipleSaveMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) MultipleSaveMsgLogic {
- return MultipleSaveMsgLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
- func (l *MultipleSaveMsgLogic) MultipleSaveMsg(req types.MultipleSaveMsgReq) (*types.MultipleSaveMsgResp, error) {
- errCount := 0
- lsi := l.svcCtx.MessageCenter
- msgInfo := req.MsgInfo
- _, err := lsi.MultipleSaveMsg(l.ctx, &messageclient.MultipleSaveMsgReq{
- Appid: util.ObjToString(msgInfo["appid"]),
- SendUserId: util.ObjToString(msgInfo["sendUserId"]),
- 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"]),
- })
- if err != nil {
- log.Println("-------------", err)
- errCount++
- }
- return &types.MultipleSaveMsgResp{
- Code: 1,
- Message: "保存成功",
- ErrCount: int64(errCount),
- }, nil
- }
|