车架去重调试

master
zcstatham 2 years ago
parent df037b08ef
commit 5c3f404982
  1. 34
      extend/service/CarInfoHandle.php

@ -335,28 +335,26 @@ class CarInfoHandle
$sources = []; $sources = [];
break; break;
} else if ($source_a['car_phone'] == $source['car_phone']) { } else if ($source_a['car_phone'] == $source['car_phone']) {
foreach (['car_no', 'engine_no', 'register_date', 'insurer1_date'] as $key) { if ($source_a['insurer1_date'] != $source['insurer1_date'] && (trim($source_a['insurer1_date']) == '' || $source_a['insurer1_date'] < $source['insurer1_date'])) {
if ($source_a[$key] != $source[$key]) { list($source_a, $source) = [$source, $source_a];
if (trim($source_a[$key]) == '') { CarInfoT::destroy($source['id']);
list($source_a, $source) = [$source, $source_a]; unset($sources[$index]);
CarInfoT::destroy($source['id']); } else if ($source_a['insurer2_date'] != $source['insurer2_date'] && (trim($source_a['insurer2_date']) == '' || $source_a['insurer2_date'] < $source['insurer2_date'])) {
unset($sources[$index]); list($source_a, $source) = [$source, $source_a];
break; CarInfoT::destroy($source['id']);
} else if ($key == 'car_no' && !in_array(strlen($source_a[$key]), [7,8])) { unset($sources[$index]);
list($source_a, $source) = [$source, $source_a]; } else if ($source_a['car_no'] != $source['car_no'] && (trim($source_a['car_no']) == '' || !in_array(strlen($source_a['car_no']), [7,8]))) {
CarInfoT::destroy($source['id']); list($source_a, $source) = [$source, $source_a];
unset($sources[$index]); CarInfoT::destroy($source['id']);
break; unset($sources[$index]);
} }
} if (isset($source[$index])) {
CarInfoT::destroy($source['id']);
unset($sources[$index]);
} }
} else if (!preg_match('/^1[3-9][0-9]{9}/', $source['car_phone'])) { } else if (!preg_match('/^1[3-9][0-9]{9}/', $source['car_phone'])) {
CarInfoT::destroy($source['id']); CarInfoT::destroy($source['id']);
unset($sources[$index]); unset($sources[$index]);
} else if (CarInfoT::where('car_phone', $source['car_phone'])->count() >= 6) {
CarInfoT::destroy($source['id']);
CarInfoT::where('car_phone', $source['car_phone'])->update(['car_phone' => '']);
unset($sources[$index]);
} }
} }
if (empty($sources)) if (empty($sources))

Loading…
Cancel
Save