zilong 4 năm trước cách đây
mục cha
commit
3a3acc608b

+ 11 - 9
app/Http/Controllers/Api/V1/OrderController.php

xqd xqd
@@ -420,7 +420,7 @@ class OrderController extends AuthController
     {
         $req = request()->post();
         $this->validate(request(), [
-            'list_type' => 'required|in:1,2,3',
+            'list_type' => 'required|in:0,1,2,3',
             'product_type' => 'integer',
             'order_status' => 'integer',
             'time_sort' => 'in:0,1'
@@ -432,14 +432,16 @@ class OrderController extends AuthController
             $builder->where('product_type', $req['product_type']);
         }
         else {
-            if ($req['list_type'] == 1) {
-                $builder->whereIn('product_type', [1,2]);
-            }
-            elseif ($req['list_type'] == 2) {
-                $builder->whereIn('product_type', [3,4,5]);
-            }
-            elseif ($req['list_type'] == 3) {
-                $builder->where('product_type', 6);
+            if (!empty($req['list_type'])) {
+                if ($req['list_type'] == 1) {
+                    $builder->whereIn('product_type', [1,2]);
+                }
+                elseif ($req['list_type'] == 2) {
+                    $builder->whereIn('product_type', [3,4,5]);
+                }
+                elseif ($req['list_type'] == 3) {
+                    $builder->where('product_type', 6);
+                }
             }
         }
         if (!empty($req['order_status'])) {

+ 1 - 1
app/Http/Controllers/Api/V1/VaccineController.php

xqd
@@ -17,7 +17,7 @@ class VaccineController extends AuthController
         $req = request()->post();
         $this->validate(request(), [
             'name' => 'max:50',
-            'type' => 'in:1,2',
+            'type' => 'in:0,1,2',
             'sort_type' => 'in:1,2',
         ]);