updatemessagereadlogic.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package logic
  2. import (
  3. "context"
  4. "app.yhyue.com/moapp/MessageCenter/rpc/internal/svc"
  5. "app.yhyue.com/moapp/MessageCenter/rpc/message"
  6. "app.yhyue.com/moapp/MessageCenter/service"
  7. "github.com/tal-tech/go-zero/core/logx"
  8. )
  9. type UpdateMessageReadLogic struct {
  10. ctx context.Context
  11. svcCtx *svc.ServiceContext
  12. logx.Logger
  13. }
  14. func NewUpdateMessageReadLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateMessageReadLogic {
  15. return &UpdateMessageReadLogic{
  16. ctx: ctx,
  17. svcCtx: svcCtx,
  18. Logger: logx.WithContext(ctx),
  19. }
  20. }
  21. // 修改用户指定分类下的消息已读未读
  22. func (l *UpdateMessageReadLogic) UpdateMessageRead(in *message.UpdateMessageReadReq) (*message.UpdateMessageReadResp, error) {
  23. // todo: add your logic here and delete this line
  24. status, err := service.MessageService{}.UpdateMessageReadStatus(int(in.MsgType), in.ReceiveUserid, in.AppId)
  25. if status == 0 && err != nil {
  26. return &message.UpdateMessageReadResp{
  27. Code: 1,
  28. Message: "修改消息已读失败",
  29. Status: 0,
  30. }, err
  31. }
  32. return &message.UpdateMessageReadResp{
  33. Code: 1,
  34. Message: "修改消息已读成功",
  35. Status: 1,
  36. }, nil
  37. }