bitmapsavemsglogic.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/MessageCenter/api/internal/svc"
  4. "app.yhyue.com/moapp/MessageCenter/api/internal/types"
  5. "app.yhyue.com/moapp/MessageCenter/rpc/messageclient"
  6. "app.yhyue.com/moapp/MessageCenter/util"
  7. "context"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type BitmapSaveMsgLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewBitmapSaveMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *BitmapSaveMsgLogic {
  16. return &BitmapSaveMsgLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *BitmapSaveMsgLogic) BitmapSaveMsg(req *types.BitmapSaveMsgReq) (resp *types.MultipleSaveMsgResp, err error) {
  23. var (
  24. msg = "发送成功"
  25. code = 0
  26. )
  27. lsi := l.svcCtx.MessageCenter
  28. msgInfo := req.MsgInfo
  29. _, err = lsi.BitmapSaveMsg(l.ctx, &messageclient.BitmapSaveMsgReq{
  30. Appid: util.ObjToString(msgInfo["appid"]),
  31. Title: util.ObjToString(msgInfo["title"]),
  32. Content: util.ObjToString(msgInfo["content"]),
  33. MsgType: int64(util.IntAll(msgInfo["msgType"])),
  34. Link: util.ObjToString(msgInfo["link"]),
  35. UserIds: req.UserIds,
  36. MsgLogId: int64(util.IntAll(msgInfo["msgLogId"])),
  37. PositionIds: req.PositionIds,
  38. Row4: util.ObjToString(msgInfo["row4"]),
  39. ProductName: util.ObjToString(msgInfo["productName"]),
  40. OrderId: util.ObjToString(msgInfo["orderId"]),
  41. OrderMoney: util.ObjToString(msgInfo["orderMoney"]),
  42. AppPushUrl: util.ObjToString(msgInfo["appPushUrl"]),
  43. WxPushUrl: util.ObjToString(msgInfo["wxPushUrl"]),
  44. IosPushUrl: util.ObjToString(msgInfo["iosPushUrl"]),
  45. SendUserId: util.ObjToString(msgInfo["sendUserId"]),
  46. })
  47. if err != nil {
  48. msg = err.Error()
  49. code = 0
  50. }
  51. return &types.MultipleSaveMsgResp{
  52. Code: int64(code),
  53. Message: msg,
  54. }, nil
  55. }