materialsavelogic.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. package logic
  2. import (
  3. IC "bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/config"
  4. "bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/svc"
  5. "bp.jydev.jianyu360.cn/BaseService/biService/rpc/pb"
  6. "bp.jydev.jianyu360.cn/BaseService/biService/service"
  7. "context"
  8. "fmt"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. )
  11. type MaterialSaveLogic struct {
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. logx.Logger
  15. }
  16. func NewMaterialSaveLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MaterialSaveLogic {
  17. return &MaterialSaveLogic{
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. Logger: logx.WithContext(ctx),
  21. }
  22. }
  23. func (l *MaterialSaveLogic) MaterialSave(in *pb.MaterialSaveReq) (*pb.MaterialSaveResp, error) {
  24. // todo: add your logic here and delete this line
  25. //先插入消息记录表
  26. msgId, err := service.MaterialSave(in, IC.IC.MaterialMsg.Title, fmt.Sprintf(IC.IC.MaterialMsg.Title, in.CreateUser))
  27. if msgId == 0 || err != nil {
  28. return &pb.MaterialSaveResp{
  29. ErrorCode: -1,
  30. ErrorMsg: err.Error(),
  31. MsgId: msgId,
  32. }, nil
  33. }
  34. //获取分发人的userid
  35. userIdArr := service.GetSendUserId(in.ReceiveUserId, in.EntId)
  36. return &pb.MaterialSaveResp{
  37. ErrorCode: 1,
  38. ErrorMsg: "",
  39. MsgId: msgId,
  40. UserIdArr: userIdArr,
  41. }, nil
  42. /*//调用消息中台
  43. userResp, err := l.svcCtx.MessageCenterRpc.NewUserMsg(l.ctx, &messageclient.NewUserInsertMsgReq{
  44. UserIds: strings.Join(userIdArr, ","),
  45. Title: IC.IC.MaterialMsg.Title,
  46. Content: fmt.Sprintf(IC.IC.MaterialMsg.Title, in.CreateUser),
  47. MsgType: 14,
  48. Link: "",
  49. Appid: "10000",
  50. Row4: "",
  51. Identity: "",
  52. AppPushUrl:,
  53. WxPushUrl:,
  54. IosPushUrl:,
  55. })*/
  56. }