getclassunreadcountlogic.go 1005 B

1234567891011121314151617181920212223242526272829303132333435
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/MessageCenter/rpc/messageclient"
  4. "context"
  5. "app.yhyue.com/moapp/MessageCenter/rpc/internal/svc"
  6. "app.yhyue.com/moapp/MessageCenter/service"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type GetClassUnreadCountLogic struct {
  10. ctx context.Context
  11. svcCtx *svc.ServiceContext
  12. logx.Logger
  13. }
  14. func NewGetClassUnreadCountLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetClassUnreadCountLogic {
  15. return &GetClassUnreadCountLogic{
  16. ctx: ctx,
  17. svcCtx: svcCtx,
  18. Logger: logx.WithContext(ctx),
  19. }
  20. }
  21. // 查询指定用户指定分类的未读消息合计
  22. func (l *GetClassUnreadCountLogic) GetClassUnreadCount(in *messageclient.GetClassUnreadCountReq) (*messageclient.GetUnreadCountResponse, error) {
  23. // todo: add your logic here and delete this line
  24. code, msg, count := service.ClassCountUnread(int(in.MsgType), in.UserId, in.Appid)
  25. return &messageclient.GetUnreadCountResponse{
  26. Code: code,
  27. Message: msg,
  28. Count: count,
  29. }, nil
  30. }