Browse Source

状态机制验证

sunhao 5 years ago
parent
commit
5c00d6adf5
1 changed files with 12 additions and 0 deletions
  1. 12 0
      app/Http/Controllers/Admin/OrderController.php

+ 12 - 0
app/Http/Controllers/Admin/OrderController.php

@@ -1028,6 +1028,18 @@ class OrderController extends Controller
1028 1028
         if($order->status == 2 || $order->status == 0){
1029 1029
             $order->verify_time = date('Y-m-d H:i:s'); //审核时间
1030 1030
         }
1031
+
1032
+        //获取可变更状态
1033
+        $enableStatus = $this->getEnableStatus($old_status);
1034
+        if( !empty($enableStatus) ){
1035
+            $statusArr = array_column($enableStatus, 'status');
1036
+            if( !in_array($order->status, $statusArr) ){
1037
+                return redirect('/admin/order/index')->with('info', '异常操作');
1038
+            }
1039
+        }else{
1040
+            return redirect('/admin/order/index');
1041
+        }
1042
+
1031 1043
         DB::beginTransaction();
1032 1044
         try{
1033 1045
             $res = $order ->save();