12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- 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 err != nil {
- return &types.BiResp{Error_code: res.ErrorCode, Error_msg: res.ErrorMsg}, err
- }
- msgId := res.MsgId
- //log.Println("***************88", msgId)
- _, err = l.svcCtx.MessageCenterRpc.UpdateMsgSummary(l.ctx, &messageclient.UpdateMsgSummaryReq{
- MsgLogId: msgId,
- GroupId: 11,
- MsgType: 14,
- })
- if err != nil {
- return &types.BiResp{Error_code: -1, Error_msg: err.Error()}, err
- }
- _, 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/materialDetail?msgLogId=%d&id=%d", msgId, msgId),
- WxPushUrl: fmt.Sprintf("/jy_mobile/message/materialDetail?msgLogId=%d&id=%d", msgId, msgId),
- IosPushUrl: fmt.Sprintf("/jy_mobile/message/materialDetail?msgLogId=%d&id=%d", msgId, msgId),
- })
- if err != nil {
- return &types.BiResp{Error_code: -1, Error_msg: err.Error()}, err
- }
- return &types.BiResp{Error_code: 1, Error_msg: ""}, err
- }
|