getunreadcountlogic.go 885 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/MessageCenter/service"
  4. "context"
  5. "app.yhyue.com/moapp/MessageCenter/rpc/internal/svc"
  6. "app.yhyue.com/moapp/MessageCenter/rpc/message"
  7. "github.com/tal-tech/go-zero/core/logx"
  8. )
  9. type GetUnreadCountLogic struct {
  10. ctx context.Context
  11. svcCtx *svc.ServiceContext
  12. logx.Logger
  13. }
  14. func NewGetUnreadCountLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUnreadCountLogic {
  15. return &GetUnreadCountLogic{
  16. ctx: ctx,
  17. svcCtx: svcCtx,
  18. Logger: logx.WithContext(ctx),
  19. }
  20. }
  21. // 查询指定用户未读消息合计
  22. func (l *GetUnreadCountLogic) GetUnreadCount(in *message.GetUnreadCountRequest) (*message.GetUnreadCountResponse, error) {
  23. m := &service.MessageService{}
  24. code, msg ,count:= m.CountUnread(in.UserId,in.Appid)
  25. return &message.GetUnreadCountResponse{
  26. Code: code,
  27. Message: msg,
  28. Count: count,
  29. }, nil
  30. }