updatereadbyidlogic.go 1018 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package logic
  2. import (
  3. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
  4. "context"
  5. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/svc"
  6. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/types"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type UpdateReadByIdLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewUpdateReadByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateReadByIdLogic {
  15. return &UpdateReadByIdLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *UpdateReadByIdLogic) UpdateReadById(req *types.ReadStateReq) (*types.CommonRes, error) {
  22. readStateReq := &messagecenter.ReadStateReq{MessageId: req.MessageId}
  23. resp, err := l.svcCtx.Message.UpdateReadById(l.ctx, readStateReq)
  24. if err != nil {
  25. return nil, err
  26. }
  27. return &types.CommonRes{
  28. Error_msg: resp.ErrorMsg,
  29. Error_code: int(resp.ErrorCode),
  30. }, nil
  31. }