Forráskód Böngészése

称重更新防丢失

Zhouzhendong 4 éve
szülő
commit
10a8ea456f
1 módosított fájl, 3 hozzáadás és 2 törlés
  1. 3 2
      app/Jobs/WeightUpdateInstantBill.php

+ 3 - 2
app/Jobs/WeightUpdateInstantBill.php

@@ -19,11 +19,11 @@ class WeightUpdateInstantBill implements ShouldQueue
     /**
      * Create a new job instance.
      *
-     * @param OrderPackage $package
+     * @param OrderPackage|null $package
      *
      * @return void
      */
-    public function __construct(OrderPackage $package)
+    public function __construct(?OrderPackage $package)
     {
         $this->package = $package;
     }
@@ -38,6 +38,7 @@ class WeightUpdateInstantBill implements ShouldQueue
      */
     public function handle(OrderService $service)
     {
+        if (!$this->package)return;
         if (!$this->package->weight)return;
         $this->package->loadMissing("order");
         if (!$this->package->order)return;