withdrawmessagelogic.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package logic
  2. import (
  3. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
  4. "context"
  5. "errors"
  6. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/svc"
  7. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/types"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type WithdrawMessageLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewWithdrawMessageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WithdrawMessageLogic {
  16. return &WithdrawMessageLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *WithdrawMessageLogic) WithdrawMessage(req *types.ReadWithdrawReq) (resp *types.CommonRes, err error) {
  23. // todo: add your logic here and delete this line
  24. r, err := l.svcCtx.Message.WithdrawMessage(l.ctx, &messagecenter.ReadWithdrawReq{
  25. MessageId: req.MessageId,
  26. Appid: req.Appid,
  27. NewUserId: req.NewUserId,
  28. UserType: req.UserType,
  29. EntUserId: req.EntUserId,
  30. })
  31. if err != nil {
  32. return nil, err
  33. }
  34. if r.ErrorCode != 0 {
  35. return nil, errors.New(r.ErrorMsg)
  36. }
  37. return
  38. }