This commit is contained in:
laodaming
2023-10-20 11:46:51 +08:00
parent 6253acf53c
commit 82f1e3984f
5 changed files with 13 additions and 17 deletions

View File

@@ -20,21 +20,21 @@ import (
"github.com/zeromicro/go-zero/core/logx"
)
type GetRecommandProductListLogic struct {
type GetRecommendProductListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewGetRecommandProductListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetRecommandProductListLogic {
return &GetRecommandProductListLogic{
func NewGetRecommendProductListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetRecommendProductListLogic {
return &GetRecommendProductListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *GetRecommandProductListLogic) GetRecommandProductList(req *types.GetRecommandProductListReq, userinfo *auth.UserInfo) (resp *basic.Response) {
func (l *GetRecommendProductListLogic) GetRecommendProductList(req *types.GetRecommendProductListReq, userinfo *auth.UserInfo) (resp *basic.Response) {
if req.Num > 100 || req.Num < 0 {
req.Num = 4
}
@@ -60,10 +60,6 @@ func (l *GetRecommandProductListLogic) GetRecommandProductList(req *types.GetRec
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get recommend product list")
}
//超过了截取
if len(recommendProductList) > int(req.Num) {
recommendProductList = recommendProductList[:req.Num]
}
}
//资源id集合
resourceIds := make([]string, 0, 50)