feat: 添加通知微服务,支持站内通知已读状态
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"juwan-backend/app/notification/rpc/internal/svc"
|
||||
"juwan-backend/app/notification/rpc/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetNotificationsByIdLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetNotificationsByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetNotificationsByIdLogic {
|
||||
return &GetNotificationsByIdLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetNotificationsByIdLogic) GetNotificationsById(in *pb.GetNotificationsByIdReq) (*pb.GetNotificationsByIdResp, error) {
|
||||
n, err := l.svcCtx.NotificationModelRO.Notifications.Get(l.ctx, in.GetId())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &pb.GetNotificationsByIdResp{Notifications: entNotificationToPb(n)}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user