车架去重调试

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

@ -335,28 +335,26 @@ class CarInfoHandle
$sources = [];
break;
} else if ($source_a['car_phone'] == $source['car_phone']) {
foreach (['car_no', 'engine_no', 'register_date', 'insurer1_date'] as $key) {
if ($source_a[$key] != $source[$key]) {
if (trim($source_a[$key]) == '') {
list($source_a, $source) = [$source, $source_a];
CarInfoT::destroy($source['id']);
unset($sources[$index]);
break;
} else if ($key == 'car_no' && !in_array(strlen($source_a[$key]), [7,8])) {
list($source_a, $source) = [$source, $source_a];
CarInfoT::destroy($source['id']);
unset($sources[$index]);
break;
}
}
if ($source_a['insurer1_date'] != $source['insurer1_date'] && (trim($source_a['insurer1_date']) == '' || $source_a['insurer1_date'] < $source['insurer1_date'])) {
list($source_a, $source) = [$source, $source_a];
CarInfoT::destroy($source['id']);
unset($sources[$index]);
} else if ($source_a['insurer2_date'] != $source['insurer2_date'] && (trim($source_a['insurer2_date']) == '' || $source_a['insurer2_date'] < $source['insurer2_date'])) {
list($source_a, $source) = [$source, $source_a];
CarInfoT::destroy($source['id']);
unset($sources[$index]);
} else if ($source_a['car_no'] != $source['car_no'] && (trim($source_a['car_no']) == '' || !in_array(strlen($source_a['car_no']), [7,8]))) {
list($source_a, $source) = [$source, $source_a];
CarInfoT::destroy($source['id']);
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'])) {
CarInfoT::destroy($source['id']);
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))

Loading…
Cancel
Save