|
|
@ -183,16 +183,8 @@ class CarInfoHandle |
|
|
|
['car_phone', '<>', ''], |
|
|
|
['car_phone', '<>', ''], |
|
|
|
['car_phone', 'REGEXP', '^1[3-9][0-9]{9}$'] |
|
|
|
['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') |
|
|
|
$query = CarInfoT::field('car_phone,count(*) as count') |
|
|
|
->where($where) |
|
|
|
->where($where) |
|
|
|
->where($map) |
|
|
|
|
|
|
|
->group('car_phone'); |
|
|
|
->group('car_phone'); |
|
|
|
$count = $query->count(); |
|
|
|
$count = $query->count(); |
|
|
|
echo '总计:' . $count . PHP_EOL; |
|
|
|
echo '总计:' . $count . PHP_EOL; |
|
|
@ -200,11 +192,11 @@ class CarInfoHandle |
|
|
|
$peer_phone_number = $data['peer_phone_number']; |
|
|
|
$peer_phone_number = $data['peer_phone_number']; |
|
|
|
$peer_phone_count = $repeat_count = 0; |
|
|
|
$peer_phone_count = $repeat_count = 0; |
|
|
|
cache('shell_process_' . $id, 0, 300); |
|
|
|
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 = []; |
|
|
|
$insert_data = []; |
|
|
|
foreach ($infos as $item) { |
|
|
|
foreach ($infos as $item) { |
|
|
|
if ($item->count >= $peer_phone_number) { |
|
|
|
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) { |
|
|
|
if (count(array_flip(array_flip($card_ids))) <= 1) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|