重复车架处理,先替换再更新电话

master
zhaocheng 2 years ago
parent 9e11fbb03d
commit 8a439b935b
  1. 34
      extend/service/CarInfoHandle.php

@ -336,6 +336,24 @@ class CarInfoHandle
$car_phone_valid = preg_match('/^1[3-9][0-9]{9}/', $source['car_phone']);
// 当不是标准有效对比无效的情况下,要进行数据对比替换
if (!($car_phone_a_valid && !$car_phone_valid)) {
if (!$car_phone_a_valid && $car_phone_valid) { // 标准无效,对比有效
list($source_a, $source) = [$source, $source_a];
} else if (trim($source_a['insurer1_date']) != trim($source['insurer1_date']) && (trim($source_a['insurer1_date']) == '' || $source_a['insurer1_date'] < $source['insurer1_date'])) {
list($source_a, $source) = [$source, $source_a];
} else if (trim($source_a['insurer2_date']) != trim($source['insurer2_date']) && (trim($source_a['insurer2_date']) == '' || $source_a['insurer2_date'] < $source['insurer2_date'])) {
list($source_a, $source) = [$source, $source_a];
} else if ($source_a['is_export_bmc'] == 0 && $source['is_export_bmc'] > 0) {
list($source_a, $source) = [$source, $source_a];
} else if ($source_a['is_update_bhx'] == 0 && $source['is_update_bhx'] > 0) {
list($source_a, $source) = [$source, $source_a];
} else if ($source_a['is_export_bhx'] == 0 && $source['is_export_bhx'] > 0) {
list($source_a, $source) = [$source, $source_a];
} else if ($source_a['car_no'] != $source['car_no'] && (trim($source_a['car_no']) == '' || !in_array(mb_strlen($source_a['car_no']), [7,8]))) {
list($source_a, $source) = [$source, $source_a];
} else if ($source_a['register_date'] != $source['register_date'] && (trim($source_a['register_date']) == '' || $source_a['register_date'] < $source['register_date'])) {
list($source_a, $source) = [$source, $source_a];
}
if ($car_phone_a_valid && $car_phone_valid) { // 都有效更新电话
$phones = [$source['car_phone']];
$phones_a = [$source_a['car_phone']];
@ -359,22 +377,6 @@ class CarInfoHandle
}
CarInfoT::where('id', $source_a['id'])->update($source_a);
}
} else if (!$car_phone_a_valid && $car_phone_valid) { // 标准无效,对比有效
list($source_a, $source) = [$source, $source_a];
} else if (trim($source_a['insurer1_date']) != trim($source['insurer1_date']) && (trim($source_a['insurer1_date']) == '' || $source_a['insurer1_date'] < $source['insurer1_date'])) {
list($source_a, $source) = [$source, $source_a];
} else if (trim($source_a['insurer2_date']) != trim($source['insurer2_date']) && (trim($source_a['insurer2_date']) == '' || $source_a['insurer2_date'] < $source['insurer2_date'])) {
list($source_a, $source) = [$source, $source_a];
} else if ($source_a['is_export_bmc'] == 0 && $source['is_export_bmc'] > 0) {
list($source_a, $source) = [$source, $source_a];
} else if ($source_a['is_update_bhx'] == 0 && $source['is_update_bhx'] > 0) {
list($source_a, $source) = [$source, $source_a];
} else if ($source_a['is_export_bhx'] == 0 && $source['is_export_bhx'] > 0) {
list($source_a, $source) = [$source, $source_a];
} else if ($source_a['car_no'] != $source['car_no'] && (trim($source_a['car_no']) == '' || !in_array(mb_strlen($source_a['car_no']), [7,8]))) {
list($source_a, $source) = [$source, $source_a];
} else if ($source_a['register_date'] != $source['register_date'] && (trim($source_a['register_date']) == '' || $source_a['register_date'] < $source['register_date'])) {
list($source_a, $source) = [$source, $source_a];
}
}
$this->repeatDataHandle($source, $id, 'frame');

Loading…
Cancel
Save