cqp il y a 2 mois
Parent
commit
7914c5a973

+ 7 - 2
app/Console/Commands/CustomerWriteReport.php

@@ -72,12 +72,17 @@ class CustomerWriteReport extends Command
         Customer::where("del_time",0)
             ->where('enter_time','>=', $lastMonthStamp)
             ->where('enter_time','<=', $nowStamp)
-            ->orderBy('enter_time','asc')
-            ->select('id as customer_id','title','model_type','consulting_product_new','enter_time','address2','top_depart_id','customer_from','car_type')
+            ->orderBy('id')
+            ->select('id','title','model_type','consulting_product_new','enter_time','address2','top_depart_id','customer_from','car_type')
             ->chunkById(200, function ($data) use($provinceMap, $cityMap, $countyMap,$nowStamp){
                 // 开启事务
                 DB::transaction(function () use ($data, $provinceMap, $cityMap, $countyMap, $nowStamp) {
                     $dataArray = $data->toArray();
+                    foreach ($dataArray as $key => $value){
+                        $dataArray[$key]['customer_id'] = $value['id'];
+                        unset($dataArray[$key]['id']);
+                    }
+
                     list($main, $main_depart) = $this->processingData($dataArray, $provinceMap, $cityMap, $countyMap, $nowStamp);
                     if (! empty($main)) {
                         $customer_ids = array_column($dataArray, 'customer_id');

+ 1 - 1
app/Console/Commands/SalesWriteReport.php

@@ -84,7 +84,7 @@ class SalesWriteReport extends Command
         SalesOrder::where("del_time",0)
             ->where('crt_time','>=', $lastMonthStamp)
             ->where('crt_time','<=', $nowStamp)
-            ->orderBy('crt_time','asc')
+            ->orderBy('id')
             ->chunkById(200, function ($data) use($nowStamp, $area){
                 // 开启事务
                 DB::transaction(function () use ($data, $nowStamp, $area) {