saveautoreplymsglogic.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package logic
  2. import (
  3. quitl "app.yhyue.com/moapp/jybase/common"
  4. "app.yhyue.com/moapp/jybase/encrypt"
  5. util "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/entity"
  6. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service"
  7. "context"
  8. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/internal/svc"
  9. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
  10. "github.com/zeromicro/go-zero/core/logx"
  11. )
  12. type SaveAutoReplyMsgLogic struct {
  13. ctx context.Context
  14. svcCtx *svc.ServiceContext
  15. logx.Logger
  16. }
  17. func NewSaveAutoReplyMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SaveAutoReplyMsgLogic {
  18. return &SaveAutoReplyMsgLogic{
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. Logger: logx.WithContext(ctx),
  22. }
  23. }
  24. // 创建会话并且保存信息
  25. func (l *SaveAutoReplyMsgLogic) SaveAutoReplyMsg(in *messagecenter.SaveAutoReplyReq) (*messagecenter.MessageResp, error) {
  26. // todo: add your logic here and delete this line
  27. m := service.MessaggeService{}
  28. error_code, messageId := m.SaveAutoReplyMsg(in.UserType, in.EntId, in.EntUserId, in.UserId, in.Content, in.AppId, in.NowFormat)
  29. error_message := ""
  30. if error_code {
  31. return &messagecenter.MessageResp{
  32. ErrorCode: util.SUCCESS_CODE,
  33. ErrorMsg: error_message,
  34. Data: []*messagecenter.MessageEntity{
  35. {
  36. MessageId: encrypt.SE.Encode2Hex(quitl.InterfaceToStr(messageId)),
  37. },
  38. },
  39. }, nil
  40. } else {
  41. return &messagecenter.MessageResp{
  42. ErrorCode: util.ERROR_CODE,
  43. ErrorMsg: "保存失败",
  44. }, nil
  45. }
  46. }