moonsflyer 5 kuukautta sitten
vanhempi
commit
ed40261399
1 muutettua tiedostoa jossa 21 lisäystä ja 0 poistoa
  1. 21 0
      app/common/service/ThemeService.php

+ 21 - 0
app/common/service/ThemeService.php

@@ -728,6 +728,27 @@ class ThemeService
                 }
                 }
             }
             }
         }
         }
+        if(empty($goodsList)){
+            $goodsList = [];
+            $goodsLists = Goods::alias('G')
+                ->join('goods_category_index GCI','G.id = GCI.goods_id')
+                ->where('G.status = 1')
+                ->field('G.id,name,image,min_price as sell_price,min_lineation_price as lineation_price')
+                ->group("G.id")
+                ->orderRaw($orderRaw)
+                ->limit(20)
+                ->select()->toarray();
+
+            $key_Arr = array_keys($goodsLists);
+            $gc_key =  array_rand($key_Arr,4);
+            foreach ($goodsLists as $k=>$v){
+                foreach($gc_key as $gk=>$gv){
+                    if($k==$gk){
+                        $goodsList[]=$v;
+                    }
+                }
+            }
+        }
         return $goodsList;
         return $goodsList;
     }
     }
 }
 }