|
@@ -0,0 +1,72 @@
|
|
|
+package logic
|
|
|
+
|
|
|
+import (
|
|
|
+ "app.yhyue.com/moapp/MessageCenter/rpc/messageclient"
|
|
|
+ "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/svc"
|
|
|
+ "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/types"
|
|
|
+ "bp.jydev.jianyu360.cn/BaseService/biService/rpc/biservice"
|
|
|
+ "context"
|
|
|
+ "fmt"
|
|
|
+ "github.com/zeromicro/go-zero/core/logx"
|
|
|
+ "strings"
|
|
|
+)
|
|
|
+
|
|
|
+type MaterialSaveLogic struct {
|
|
|
+ logx.Logger
|
|
|
+ ctx context.Context
|
|
|
+ svcCtx *svc.ServiceContext
|
|
|
+}
|
|
|
+
|
|
|
+func NewMaterialSaveLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MaterialSaveLogic {
|
|
|
+ return &MaterialSaveLogic{
|
|
|
+ Logger: logx.WithContext(ctx),
|
|
|
+ ctx: ctx,
|
|
|
+ svcCtx: svcCtx,
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+func (l *MaterialSaveLogic) MaterialSave(req *types.MaterialSaveReq) (resp *types.BiResp, err error) {
|
|
|
+ // todo: add your logic here and delete this line
|
|
|
+ res, err := l.svcCtx.BiServiceRpc.MaterialSave(l.ctx, &biservice.MaterialSaveReq{
|
|
|
+ TaskName: req.TaskName,
|
|
|
+ TaskDescription: req.TaskDescription,
|
|
|
+ MaterialContent: req.MaterialContent,
|
|
|
+ QrcodeUrl: req.QrcodeUrl,
|
|
|
+ ReceiveUserName: req.ReceiveUserName,
|
|
|
+ ReceiveUserId: req.ReceiveUserId,
|
|
|
+ FileUrl: req.FileUrl,
|
|
|
+ CreateUser: req.CreateUser,
|
|
|
+ EntId: req.EntId,
|
|
|
+ ImgWebpage: req.ImgWebpage,
|
|
|
+ })
|
|
|
+ if res.ErrorCode != 1 {
|
|
|
+ return &types.BiResp{Error_code: res.ErrorCode, Error_msg: res.ErrorMsg}, err
|
|
|
+ }
|
|
|
+ msgId := res.MsgId
|
|
|
+ res1, err := l.svcCtx.MessageCenterRpc.UpdateMsgSummary(l.ctx, &messageclient.UpdateMsgSummaryReq{
|
|
|
+ MsgLogId: msgId,
|
|
|
+ GroupId: 11,
|
|
|
+ MsgType: 14,
|
|
|
+ })
|
|
|
+ if res1.Code < 1 {
|
|
|
+ return &types.BiResp{Error_code: -1, Error_msg: res1.Message}, err
|
|
|
+ }
|
|
|
+ res2, err := l.svcCtx.MessageCenterRpc.BitmapSaveMsg(l.ctx, &messageclient.MultipleSaveMsgReq{
|
|
|
+ UserIds: strings.Join(res.UserIdArr, ","),
|
|
|
+ Title: "您有1个宣传物料需要发布!",
|
|
|
+ Content: fmt.Sprintf("%s给你分享了运营宣传物料,请及时处理。点击查看详情。", req.CreateUser),
|
|
|
+ MsgType: 14,
|
|
|
+ Link: fmt.Sprintf("/swordfish/page_big_pc/message/materialDetail?msgLogId=%d", msgId),
|
|
|
+ Appid: "10000",
|
|
|
+ MsgLogId: msgId,
|
|
|
+ Row4: "",
|
|
|
+ AppPushUrl: fmt.Sprintf("/jy_mobile/message/Detail?msgLogId=%d", msgId),
|
|
|
+ WxPushUrl: fmt.Sprintf("/jy_mobile/message/Detail?msgLogId=%d", msgId),
|
|
|
+ IosPushUrl: fmt.Sprintf("/jy_mobile/message/Detail?msgLogId=%d", msgId),
|
|
|
+ })
|
|
|
+ if res2.Code < 1 || err != nil {
|
|
|
+ return &types.BiResp{Error_code: -1, Error_msg: res2.Message}, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return &types.BiResp{Error_code: res.ErrorCode, Error_msg: res.ErrorMsg}, err
|
|
|
+}
|