|
@@ -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');
|