소스 검색

作业计费:toArray引起的驼峰转换下划线的问题

Zhouzhendong 5 년 전
부모
커밋
962b20dee6
3개의 변경된 파일10개의 추가작업 그리고 8개의 파일을 삭제
  1. 6 6
      app/Feature.php
  2. 3 1
      app/Http/Controllers/TestController.php
  3. 1 1
      app/Services/OwnerPriceOperationService.php

+ 6 - 6
app/Feature.php

@@ -32,14 +32,14 @@ class Feature extends Model
     const TYPE_NODE = [0,5,6,8,9,10]; //标注二级类型
     const TYPE_NODE = [0,5,6,8,9,10]; //标注二级类型
     const MAPPING = [
     const MAPPING = [
         "store" => [
         "store" => [
-            0 => "storeItems.name",
+            0 => "store_items.name",
             1 => "stored_method",
             1 => "stored_method",
-            5 => "storeItems.commodity.remark",
-            6 => "storeItems.commodity.length",
+            5 => "store_items.commodity.remark",
+            6 => "store_items.commodity.length",
             7 => "remark",
             7 => "remark",
-            8 => "storeItems.amount",
-            9 => "storeItems.commodity",
-            10=> "storeItems.total",
+            8 => "store_items.amount",
+            9 => "store_items.commodity",
+            10=> "store_items.total",
             11=> "warehouse.name",
             11=> "warehouse.name",
         ],
         ],
         "order" => [
         "order" => [

+ 3 - 1
app/Http/Controllers/TestController.php

@@ -166,7 +166,9 @@ class TestController extends Controller
 
 
     public function test()
     public function test()
     {
     {
-        throw new Exception();
+        $service = new StoreService();
+        $store = Store::query()->find(118900);
+        $service->createInstantBill($store);
         return view("test");
         return view("test");
     }
     }
 
 

+ 1 - 1
app/Services/OwnerPriceOperationService.php

@@ -379,7 +379,7 @@ class OwnerPriceOperationService
         if ($first && is_array($first))$first = reset($first);
         if ($first && is_array($first))$first = reset($first);
         else return $matchObject;
         else return $matchObject;
         if (!$first)return $matchObject;
         if (!$first)return $matchObject;
-        if (is_array($first[$nextObj])){
+        if ($nextObj && is_array($first[$nextObj])){
             $result = [];
             $result = [];
             foreach ($matchObject[$need] as $arr)$result = array_merge($result,$arr[$nextObj]);
             foreach ($matchObject[$need] as $arr)$result = array_merge($result,$arr[$nextObj]);
             return $this->resetChildNodeMapping($result,$columnMapping);
             return $this->resetChildNodeMapping($result,$columnMapping);