updatereadbyidlogic.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package logic
  2. import (
  3. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service"
  4. "context"
  5. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/internal/svc"
  6. "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type UpdateReadByIdLogic struct {
  10. ctx context.Context
  11. svcCtx *svc.ServiceContext
  12. logx.Logger
  13. }
  14. func NewUpdateReadByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateReadByIdLogic {
  15. return &UpdateReadByIdLogic{
  16. ctx: ctx,
  17. svcCtx: svcCtx,
  18. Logger: logx.WithContext(ctx),
  19. }
  20. }
  21. // 根据消息修改已读状态
  22. func (l *UpdateReadByIdLogic) UpdateReadById(in *messagecenter.ReadStateReq) (*messagecenter.CurrencyResp, error) {
  23. // todo: add your logic here and delete this line
  24. m := service.MessaggeService{}
  25. fool := m.UpdateReadById(in)
  26. error_message := ""
  27. error_code := int64(0)
  28. if fool {
  29. error_code = int64(0)
  30. error_message = ""
  31. } else {
  32. error_code = int64(1)
  33. error_message = "修改失败"
  34. }
  35. return &messagecenter.CurrencyResp{
  36. ErrorCode: error_code,
  37. ErrorMsg: error_message,
  38. }, nil
  39. }