feat: 添加评价微服务,支持密封互评与订单状态联动
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"juwan-backend/app/review/rpc/internal/svc"
|
||||
"juwan-backend/app/review/rpc/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetReviewsByIdLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetReviewsByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetReviewsByIdLogic {
|
||||
return &GetReviewsByIdLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetReviewsByIdLogic) GetReviewsById(in *pb.GetReviewsByIdReq) (*pb.GetReviewsByIdResp, error) {
|
||||
r, err := l.svcCtx.ReviewModelRO.Reviews.Get(l.ctx, in.GetId())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &pb.GetReviewsByIdResp{Reviews: entReviewToPb(r)}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user