closechatsessionlogic.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package logic
  2. import (
  3. util "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/entity"
  4. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/internal/svc"
  5. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
  6. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service"
  7. "context"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type CloseChatSessionLogic struct {
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. logx.Logger
  14. }
  15. func NewCloseChatSessionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CloseChatSessionLogic {
  16. return &CloseChatSessionLogic{
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. Logger: logx.WithContext(ctx),
  20. }
  21. }
  22. // 会话关闭
  23. func (l *CloseChatSessionLogic) CloseChatSession(in *messagecenter.CloseSessionReq) (*messagecenter.ChatSessionResp, error) {
  24. // todo: add your logic here and delete this line
  25. m := service.MessaggeService{}
  26. fool := m.CloseChatSession(in)
  27. error_message := ""
  28. error_code := int64(0)
  29. if fool {
  30. error_code = util.SUCCESS_CODE
  31. error_message = ""
  32. } else {
  33. error_code = util.ERROR_CODE
  34. error_message = "修改失败"
  35. }
  36. return &messagecenter.ChatSessionResp{
  37. ErrorCode: error_code,
  38. ErrorMsg: error_message,
  39. }, nil
  40. }