materialsavelogic.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/MessageCenter/rpc/messageclient"
  4. "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/svc"
  5. "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/types"
  6. "bp.jydev.jianyu360.cn/BaseService/biService/rpc/biservice"
  7. "context"
  8. "fmt"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. "strings"
  11. )
  12. type MaterialSaveLogic struct {
  13. logx.Logger
  14. ctx context.Context
  15. svcCtx *svc.ServiceContext
  16. }
  17. func NewMaterialSaveLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MaterialSaveLogic {
  18. return &MaterialSaveLogic{
  19. Logger: logx.WithContext(ctx),
  20. ctx: ctx,
  21. svcCtx: svcCtx,
  22. }
  23. }
  24. func (l *MaterialSaveLogic) MaterialSave(req *types.MaterialSaveReq) (resp *types.BiResp, err error) {
  25. // todo: add your logic here and delete this line
  26. res, err := l.svcCtx.BiServiceRpc.MaterialSave(l.ctx, &biservice.MaterialSaveReq{
  27. TaskName: req.TaskName,
  28. TaskDescription: req.TaskDescription,
  29. MaterialContent: req.MaterialContent,
  30. QrcodeUrl: req.QrcodeUrl,
  31. ReceiveUserName: req.ReceiveUserName,
  32. ReceiveUserId: req.ReceiveUserId,
  33. FileUrl: req.FileUrl,
  34. CreateUser: req.CreateUser,
  35. EntId: req.EntId,
  36. ImgWebpage: req.ImgWebpage,
  37. })
  38. if err != nil {
  39. return &types.BiResp{Error_code: res.ErrorCode, Error_msg: res.ErrorMsg}, err
  40. }
  41. msgId := res.MsgId
  42. _, err = l.svcCtx.MessageCenterRpc.UpdateMsgSummary(l.ctx, &messageclient.UpdateMsgSummaryReq{
  43. MsgLogId: msgId,
  44. GroupId: 11,
  45. MsgType: 14,
  46. })
  47. if err != nil {
  48. return &types.BiResp{Error_code: -1, Error_msg: err.Error()}, err
  49. }
  50. _, err = l.svcCtx.MessageCenterRpc.BitmapSaveMsg(l.ctx, &messageclient.MultipleSaveMsgReq{
  51. UserIds: strings.Join(res.UserIdArr, ","),
  52. Title: "您有1个宣传物料需要发布!",
  53. Content: fmt.Sprintf("%s给你分享了运营宣传物料,请及时处理。点击查看详情。", req.CreateUser),
  54. MsgType: 14,
  55. Link: fmt.Sprintf("/swordfish/page_big_pc/message/materialDetail?msgLogId=%d", msgId),
  56. Appid: "10000",
  57. MsgLogId: msgId,
  58. Row4: "",
  59. AppPushUrl: fmt.Sprintf("/jy_mobile/message/materialDetail?msgLogId=%d&id=%d", msgId, msgId),
  60. WxPushUrl: fmt.Sprintf("/jy_mobile/message/materialDetail?msgLogId=%d&id=%d", msgId, msgId),
  61. IosPushUrl: fmt.Sprintf("/jy_mobile/message/materialDetail?msgLogId=%d&id=%d", msgId, msgId),
  62. })
  63. if err != nil {
  64. return &types.BiResp{Error_code: -1, Error_msg: err.Error()}, err
  65. }
  66. return &types.BiResp{Error_code: 1, Error_msg: ""}, err
  67. }