updatereadbyidlogic.go 1.1 KB

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