Pārlūkot izejas kodu

称重锁异常 临时记录

ajun 4 gadi atpakaļ
vecāks
revīzija
e2d53183eb
1 mainītis faili ar 9 papildinājumiem un 1 dzēšanām
  1. 9 1
      app/Services/weight/WeightService.php

+ 9 - 1
app/Services/weight/WeightService.php

@@ -15,6 +15,8 @@ use App\Waybill;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Support\Carbon;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Log;
 
 class WeightService
 {
@@ -77,7 +79,13 @@ class WeightService
 
 
         // 5、更新包裹信息
-        $bool = $this->updateOrderPackage($orderPackage, $params, $measuringMachine);
+        try {
+            $bool = $this->updateOrderPackage($orderPackage, $params, $measuringMachine);
+        } catch (\Exception $e) {
+            $result = DB::select('select * from information_schema.innodb_trx');
+            Log::warning("包裹称重",["message"=>json_encode($result),"param"=>json_encode($result)]);
+            return $this->getWeightMessage($orderPackage, $e->getMessage());
+        }
         // 6、称重时间
         if ($bool) $this->afterApply($orderPackage);
         else {