|
@@ -0,0 +1,62 @@
|
|
|
|
+package logic
|
|
|
|
+
|
|
|
|
+import (
|
|
|
|
+ IC "bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/config"
|
|
|
|
+ "bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/svc"
|
|
|
|
+ "bp.jydev.jianyu360.cn/BaseService/biService/rpc/pb"
|
|
|
|
+ "bp.jydev.jianyu360.cn/BaseService/biService/service"
|
|
|
|
+ "context"
|
|
|
|
+ "fmt"
|
|
|
|
+ "github.com/zeromicro/go-zero/core/logx"
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+type MaterialSaveLogic struct {
|
|
|
|
+ ctx context.Context
|
|
|
|
+ svcCtx *svc.ServiceContext
|
|
|
|
+ logx.Logger
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func NewMaterialSaveLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MaterialSaveLogic {
|
|
|
|
+ return &MaterialSaveLogic{
|
|
|
|
+ ctx: ctx,
|
|
|
|
+ svcCtx: svcCtx,
|
|
|
|
+ Logger: logx.WithContext(ctx),
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func (l *MaterialSaveLogic) MaterialSave(in *pb.MaterialSaveReq) (*pb.MaterialSaveResp, error) {
|
|
|
|
+ // todo: add your logic here and delete this line
|
|
|
|
+ //先插入消息记录表
|
|
|
|
+ msgId, err := service.MaterialSave(in, IC.IC.MaterialMsg.Title, fmt.Sprintf(IC.IC.MaterialMsg.Title, in.CreateUser))
|
|
|
|
+ if msgId == 0 || err != nil {
|
|
|
|
+ return &pb.MaterialSaveResp{
|
|
|
|
+ ErrorCode: -1,
|
|
|
|
+ ErrorMsg: err.Error(),
|
|
|
|
+ MsgId: msgId,
|
|
|
|
+ }, nil
|
|
|
|
+ }
|
|
|
|
+ //获取分发人的userid
|
|
|
|
+ userIdArr := service.GetSendUserId(in.ReceiveUserId, in.EntId)
|
|
|
|
+ return &pb.MaterialSaveResp{
|
|
|
|
+ ErrorCode: 1,
|
|
|
|
+ ErrorMsg: "",
|
|
|
|
+ MsgId: msgId,
|
|
|
|
+ UserIdArr: userIdArr,
|
|
|
|
+ }, nil
|
|
|
|
+
|
|
|
|
+ /*//调用消息中台
|
|
|
|
+ userResp, err := l.svcCtx.MessageCenterRpc.NewUserMsg(l.ctx, &messageclient.NewUserInsertMsgReq{
|
|
|
|
+ UserIds: strings.Join(userIdArr, ","),
|
|
|
|
+ Title: IC.IC.MaterialMsg.Title,
|
|
|
|
+ Content: fmt.Sprintf(IC.IC.MaterialMsg.Title, in.CreateUser),
|
|
|
|
+ MsgType: 14,
|
|
|
|
+ Link: "",
|
|
|
|
+ Appid: "10000",
|
|
|
|
+ Row4: "",
|
|
|
|
+ Identity: "",
|
|
|
|
+ AppPushUrl:,
|
|
|
|
+ WxPushUrl:,
|
|
|
|
+ IosPushUrl:,
|
|
|
|
+ })*/
|
|
|
|
+
|
|
|
|
+}
|