wesmiler 20 godzin temu
rodzic
commit
2f381c5636

+ 1 - 6
app/Http/Middleware/WebAuth.php

@@ -23,10 +23,7 @@ class WebAuth extends Middleware
      */
     public function handle($request, Closure $next, ...$guards)
     {
-        $action = app('request')->route()->getAction();
-        $controller = class_basename($action['controller']);
-        list($controller, $action) = explode('@', $controller);
-        $noLoginActs = ['LoginController','UploadController','IndexController'];
+        $userId = 0;
         $token = $request->headers->get('Authorization');
         if (strpos($token, 'Bearer ') !== false) {
             $token = str_replace("Bearer ", null, $token);
@@ -35,8 +32,6 @@ class WebAuth extends Middleware
                 // JWT解密token
                 $userId = JwtService::make()->verifyToken($token);
 
-            }else{
-                return response()->json(message(1035, false, [], 403))->setEncodingOptions(256);
             }
         } else {
             $userId = 0;

+ 19 - 1
app/Services/Common/OrderService.php

@@ -12,6 +12,8 @@
 namespace App\Services\Common;
 
 use App\Models\ActionLogModel;
+use App\Models\OrderCommissionModel;
+use App\Models\OrderGoodsModel;
 use App\Models\OrderModel;
 use App\Services\BaseService;
 use App\Services\MpService;
@@ -277,12 +279,28 @@ class OrderService extends BaseService
             return ['code' => 1, 'msg' => '参数错误'];
         }
 
+        $this->model->where('mark',0)->where('create_time','<=', 600)->delete();
+        OrderGoodsModel::where('mark',0)->where('create_time','<=', 600)->delete();
+        OrderCommissionModel::where('mark',0)->where('create_time','<=', 600)->delete();
+
+        DB::beginTransaction();
         if (is_array($id)) {
+            $orders = $this->model->whereIn('id', $id)->pluck('order_no');
             $result = $this->model->whereIn('id', $id)->update(['mark' => 0]);
+            if($orders){
+                OrderGoodsModel::whereIn('order_no', $orders)->update(['mark' => 0]);
+                OrderCommissionModel::whereIn('order_no', $orders)->update(['mark' => 0]);
+            }
+
         } else {
+            $orderNo = $this->model->where('id', $id)->value('order_no');
             $result = $this->model->where('id', $id)->update(['mark' => 0]);
+            if($orderNo){
+                OrderGoodsModel::where('order_no', $orderNo)->update(['mark' => 0]);
+                OrderCommissionModel::where('order_no', $orderNo)->update(['mark' => 0]);
+            }
         }
-
+        DB::commit();
         if ($result) {
             ActionLogModel::setTitle("删除订单");
             ActionLogModel::record();