materialsavelogic.go 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. //log.Println("***************88", msgId)
  43. _, err = l.svcCtx.MessageCenterRpc.UpdateMsgSummary(l.ctx, &messageclient.UpdateMsgSummaryReq{
  44. MsgLogId: msgId,
  45. GroupId: 11,
  46. MsgType: 14,
  47. })
  48. if err != nil {
  49. return &types.BiResp{Error_code: -1, Error_msg: err.Error()}, err
  50. }
  51. _, err = l.svcCtx.MessageCenterRpc.BitmapSaveMsg(l.ctx, &messageclient.MultipleSaveMsgReq{
  52. UserIds: strings.Join(res.UserIdArr, ","),
  53. Title: "您有1个宣传物料需要发布!",
  54. Content: fmt.Sprintf("%s给你分享了运营宣传物料,请及时处理。点击查看详情。", req.CreateUser),
  55. MsgType: 14,
  56. Link: fmt.Sprintf("/swordfish/page_big_pc/message/materialDetail?msgLogId=%d", msgId),
  57. Appid: "10000",
  58. MsgLogId: msgId,
  59. Row4: "",
  60. AppPushUrl: fmt.Sprintf("/jy_mobile/message/materialDetail?msgLogId=%d&id=%d", msgId, msgId),
  61. WxPushUrl: fmt.Sprintf("/jy_mobile/message/materialDetail?msgLogId=%d&id=%d", msgId, msgId),
  62. IosPushUrl: fmt.Sprintf("/jy_mobile/message/materialDetail?msgLogId=%d&id=%d", msgId, msgId),
  63. })
  64. if err != nil {
  65. return &types.BiResp{Error_code: -1, Error_msg: err.Error()}, err
  66. }
  67. return &types.BiResp{Error_code: 1, Error_msg: ""}, err
  68. }