withdrawmessagelogic.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. Content: req.Content,
  27. Appid: req.Appid,
  28. Type: req.Type,
  29. UserType: req.UserType,
  30. Item: req.Item,
  31. Link: req.Link,
  32. SendId: req.SendId,
  33. })
  34. if err != nil {
  35. return nil, err
  36. }
  37. if r.ErrorCode != 0 {
  38. return nil, errors.New(r.ErrorMsg)
  39. }
  40. return
  41. }