fix
This commit is contained in:
parent
0e752e31fd
commit
10aa0d14f0
|
@ -56,16 +56,14 @@ func (l *GetRecommandProductListLogic) GetRecommandProductList(req *types.GetRec
|
||||||
ignoreProductIds := make([]int64, 0, len(recommendProductList)+1)
|
ignoreProductIds := make([]int64, 0, len(recommendProductList)+1)
|
||||||
ignoreProductIds = append(ignoreProductIds, productInfo.Id)
|
ignoreProductIds = append(ignoreProductIds, productInfo.Id)
|
||||||
productIds := make([]int64, 0, len(recommendProductList))
|
productIds := make([]int64, 0, len(recommendProductList))
|
||||||
for _, v := range recommendProductList {
|
|
||||||
ignoreProductIds = append(ignoreProductIds, v.Id)
|
|
||||||
productIds = append(productIds, v.Id)
|
|
||||||
}
|
|
||||||
//在合并之前记住推荐的产品
|
//在合并之前记住推荐的产品
|
||||||
mapRecommend := make(map[int64]struct{})
|
mapRecommend := make(map[int64]struct{})
|
||||||
for _, v := range recommendProductList {
|
for _, v := range recommendProductList {
|
||||||
|
ignoreProductIds = append(ignoreProductIds, v.Id)
|
||||||
|
productIds = append(productIds, v.Id)
|
||||||
mapRecommend[v.Id] = struct{}{}
|
mapRecommend[v.Id] = struct{}{}
|
||||||
}
|
}
|
||||||
//小于请求的数量则需要从产品表中随机填补上
|
//小于请求的数量则需要从产品表中随机填补上(不包含上面的产品)
|
||||||
lenRecommendProduct := len(recommendProductList)
|
lenRecommendProduct := len(recommendProductList)
|
||||||
if lenRecommendProduct < int(req.Num) {
|
if lenRecommendProduct < int(req.Num) {
|
||||||
appendNum := int(req.Num) - lenRecommendProduct
|
appendNum := int(req.Num) - lenRecommendProduct
|
||||||
|
|
Loading…
Reference in New Issue
Block a user