panghu 7 ay önce
ebeveyn
işleme
d04b5421f6

+ 1 - 1
app/Console/Commands/CheckOrderExpire.php

@@ -42,7 +42,7 @@ class CheckOrderExpire extends Command
     public function handle()
     {
         while (true){
-            $date = date('Y-m-d H:i:s', time() - 1800);//30分钟
+            $date = date('Y-m-d H:i:s', time() - 60);//30分钟
 
             Order::where('order_status', 1)
                 ->where('created_at', '<=', $date)

+ 16 - 3
app/Http/Controllers/Api/GoodsController.php

@@ -32,9 +32,18 @@ class GoodsController extends ApiController
             ->select(['id as category_id','name'])
             ->orderBy('sort','desc')
             ->get();
+        $data = [];
+        foreach ($list as $value){
+            $goods = Goods::where('is_del',0)
+                ->where('status',1)
+                ->where('shop_id',$shop_id)
+                ->where('category_id',$value['category_id'])->count();
+            if ($goods > 0){
+                $data[] = $value;
+            }
+        }
 
-
-        return $this->apiResponseSuccess('成功',$list);
+        return $this->apiResponseSuccess('成功',$data);
     }
 
     /**
@@ -53,6 +62,7 @@ class GoodsController extends ApiController
             ->select(['id as type','name'])
             ->orderBy('sort','desc')
             ->get();
+        $data = [];
         foreach ($category as $value){
             $list = Goods::where('is_del',0)
                 ->where('status',1)
@@ -65,9 +75,12 @@ class GoodsController extends ApiController
                 $goods->{'num'} = 0;//前端需要
             }
             $value->{'list'} = $list;
+            if (count($list) > 0){
+                $data[] = $value;
+            }
         }
 
-        return $this->apiResponseSuccess('成功',$category);
+        return $this->apiResponseSuccess('成功',$data);
     }
 
     /**