Procházet zdrojové kódy

订单生成即时账单补充提交

Zhouzhendong před 5 roky
rodič
revize
7dcb4d7023

+ 1 - 2
app/Jobs/OrderCreateInstantBill.php

@@ -36,8 +36,7 @@ class OrderCreateInstantBill implements ShouldQueue
     public function handle(OrderService $service)
     {
         try{
-            $bool = $service->createInstantBill($this->order);
-            if (!$bool)LogService::log(__METHOD__,"EXCEPTION-订单生成即时账单",$this->order->toJson());
+            $service->createInstantBill($this->order);
         }catch (\Exception $e){
             LogService::log(__METHOD__,"ERROR-订单生成即时账单",$this->order->toJson()." | ".$e->getMessage());
         }

+ 9 - 3
tests/Services/OwnerPriceExpressService/OwnerPriceExpressServiceTest.php

@@ -185,13 +185,19 @@ class OwnerPriceExpressServiceTest extends  TestCase
             "initial_weight_price" => 2,     //初始单价 4.8
             "additional_weight_price"=>2.2,  //续重单价
         ]);
-        $model->owners()->sync([1]);
-        $model->logistics()->sync([1]);
-        $result = $this->service->matching(18.6,1,1,1);
+        $owner = factory(Owner::class)->create([
+            "user_owner_group_id" => 1
+        ]);
+        $logistic = factory(Logistic::class)->create();
+        $model->owners()->sync([$owner->id]);
+        $model->logistics()->sync([$logistic->id]);
+        $result = $this->service->matching(18.6,$owner->id,$logistic->id,1);
         $this->assertEquals(18,$result);
         $model->owners()->sync([]);
         $model->logistics()->sync([]);
         OwnerPriceExpressProvince::destroy($detail->id);
+        Owner::destroy($owner->id);
+        Logistic::destroy($logistic->id);
     }
 
 

+ 4 - 4
tests/Services/OwnerPriceOperationService/OwnerPriceOperationServiceTest.php

@@ -137,9 +137,9 @@ class OwnerPriceOperationServiceTest extends  TestCase
             /** @var Mock $mock */
             $mock->shouldReceive("matchFeature")->andReturn(true);
         });
-        $result = $this->service->matchRule(["packages"=>[["commodity"=>"测试","amount"=>55]]],[],$this->data["owners"][0]["id"],$this->data["commodities"][0]["sku"],"入库");
+        $result = $this->service->matchRule(["packages"=>[["commodity"=>"测试","amount"=>55,"sku"=>$this->data["commodities"][0]["sku"]]]],[],$this->data["owners"][0]["id"],"入库");
         $this->assertEquals(12.88,$result);
-        $result = $this->service->matchRule(["packages"=>[["commodity"=>"测试","amount"=>57]]],[],$this->data["owners"][0]["id"],$this->data["commodities"][0]["sku"],"出库");
+        $result = $this->service->matchRule(["packages"=>[["commodity"=>"测试","amount"=>57,"sku"=>$this->data["commodities"][0]["sku"]]]],[],$this->data["owners"][0]["id"],"出库");
         $this->assertEquals(99.5,$result);
     }
     /**
@@ -147,9 +147,9 @@ class OwnerPriceOperationServiceTest extends  TestCase
      */
     public function testMatchRule1()
     {
-        $result = $this->service->matchRule(["packages"=>[["commodity"=>"测试","amount"=>56]]],[],$this->data["owners"][0]["id"],$this->data["commodities"][0]["sku"],"入库");
+        $result = $this->service->matchRule(["packages"=>[["commodity"=>"测试","amount"=>56,"sku"=>$this->data["commodities"][0]["sku"]]]],[],$this->data["owners"][0]["id"],"入库");
         $this->assertEquals(26.64,$result);
-        $result = $this->service->matchRule(["packages"=>[["commodity"=>"测试","amount"=>58]]],[],$this->data["owners"][0]["id"],$this->data["commodities"][0]["sku"],"出库");
+        $result = $this->service->matchRule(["packages"=>[["commodity"=>"测试","amount"=>58,"sku"=>$this->data["commodities"][0]["sku"]]]],[],$this->data["owners"][0]["id"],"出库");
         $this->assertEquals(58.4,$result);
     }