|
|
|
@ -183,16 +183,8 @@ class CarInfoHandle |
|
|
|
|
['car_phone', '<>', ''], |
|
|
|
|
['car_phone', 'REGEXP', '^1[3-9][0-9]{9}$'] |
|
|
|
|
]; |
|
|
|
|
$map = []; |
|
|
|
|
if (isset($data['export_date1']) && $data['export_date1'] != '') { |
|
|
|
|
$map[] = ['register_date', '>=', $data['export_date1']]; |
|
|
|
|
} |
|
|
|
|
if (isset($data['export_date2']) && $data['export_date2'] != '') { |
|
|
|
|
$map[] = ['register_date', '<=', $data['export_date2']]; |
|
|
|
|
} |
|
|
|
|
$query = CarInfoT::field('car_phone,count(*) as count') |
|
|
|
|
->where($where) |
|
|
|
|
->where($map) |
|
|
|
|
->group('car_phone'); |
|
|
|
|
$count = $query->count(); |
|
|
|
|
echo '总计:' . $count . PHP_EOL; |
|
|
|
@ -200,11 +192,11 @@ class CarInfoHandle |
|
|
|
|
$peer_phone_number = $data['peer_phone_number']; |
|
|
|
|
$peer_phone_count = $repeat_count = 0; |
|
|
|
|
cache('shell_process_' . $id, 0, 300); |
|
|
|
|
$query->chunk(3000, function ($infos) use (&$current, &$peer_phone_count, &$repeat_count, $count, $id, $peer_phone_number, $map) { |
|
|
|
|
$query->chunk(3000, function ($infos) use (&$current, &$peer_phone_count, &$repeat_count, $count, $id, $peer_phone_number) { |
|
|
|
|
$insert_data = []; |
|
|
|
|
foreach ($infos as $item) { |
|
|
|
|
if ($item->count >= $peer_phone_number) { |
|
|
|
|
$card_ids = CarInfoT::where('car_phone', $item->car_phone)->where($map)->column('car_number'); |
|
|
|
|
$card_ids = CarInfoT::where('car_phone', $item->car_phone)->column('car_number'); |
|
|
|
|
if (count(array_flip(array_flip($card_ids))) <= 1) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|