|
|
@@ -92,6 +92,9 @@ class ThemeService
|
|
|
if (empty($goodsIds)) {
|
|
|
$content[$moduleKey]['content']['data'] = [];
|
|
|
break;
|
|
|
+// $goods_info = Goods::where(['status'=>1])->field('id')->select()->toArray();
|
|
|
+// $goods_id_arr = array_column($goods_info,'id');
|
|
|
+// $goodsIds = array_rand($goods_id_arr,1);
|
|
|
}
|
|
|
|
|
|
//todo 商品需要根据顺序排序
|
|
|
@@ -139,6 +142,9 @@ class ThemeService
|
|
|
if (empty($goodsIds)) {
|
|
|
$content[$moduleKey]['content']['data'][$dataKey]['data'] = [];
|
|
|
break;
|
|
|
+// $goods_info = Goods::where(['status'=>1])->field('id')->select()->toArray();
|
|
|
+// $goods_id_arr = array_column($goods_info,'id');
|
|
|
+// $goodsIds = array_rand($goods_id_arr,1);
|
|
|
}
|
|
|
//todo 商品需要根据顺序排序
|
|
|
$orderField = implode(',', $goodsIds);
|
|
|
@@ -668,7 +674,21 @@ class ThemeService
|
|
|
|
|
|
$notGoodsIds = array_unique(array_column($cartList,'goods_id'));
|
|
|
$categoryIds = array_unique(array_column($cartList,'category_id'));
|
|
|
+ if(empty($notGoodsIds) || empty($categoryIds)){
|
|
|
+ $goods_info = Goods::alias('g')->leftJoin('goods_category_index gci','g.id=gci.goods_id')->field('g.id,gci.category_id')->where('g.status = 1')->select()->toArray();
|
|
|
+ $key_Arr = array_keys($goods_info);
|
|
|
+ $gc_key = array_rand($key_Arr,1);
|
|
|
+ $goods_card_info = $goods_info[$gc_key];
|
|
|
+ $notGoodsIds[] = $goods_card_info['id'];
|
|
|
+ if((count($goods_card_info['category_id'])>1)){
|
|
|
+ $key_Arr1 = array_keys($goods_card_info['category_id']);
|
|
|
+ $gc_key1 = array_rand($key_Arr1,1);
|
|
|
+ $categoryIds[]=$goods_card_info['category_id'][$gc_key1];
|
|
|
+ }else{
|
|
|
+ $categoryIds[]=$goods_card_info['category_id'][0];
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
break;
|
|
|
case ThemePageEnum::TYPE_MEMBER_CENTRE://个人中心推荐商品
|
|
|
|