getunreadcountlogic.go 990 B

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