updatereadbyidlogic.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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{
  25. SendId: quitl.Int64All(encrypt.SE.Decode4Hex(req.SendId)),
  26. EntUserId: req.EntUserId,
  27. NewUserId: req.NewUserId,
  28. PositionId: req.PositionId,
  29. SendType: req.SendType,
  30. UserType: req.UserType,
  31. }
  32. resp, err := l.svcCtx.Message.UpdateReadById(l.ctx, readStateReq)
  33. if err != nil {
  34. return nil, err
  35. }
  36. return &types.CommonRes{
  37. Error_msg: resp.ErrorMsg,
  38. Error_code: int(resp.ErrorCode),
  39. }, nil
  40. }