From 5c3f404982718da1011f0e88117a933f29e675b5 Mon Sep 17 00:00:00 2001 From: zcstatham <578322713@qq.com> Date: Tue, 30 Aug 2022 01:03:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E6=9E=B6=E5=8E=BB=E9=87=8D=E8=B0=83?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/service/CarInfoHandle.php | 34 +++++++++++++++----------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/extend/service/CarInfoHandle.php b/extend/service/CarInfoHandle.php index 7c9ae4d..3ce7240 100644 --- a/extend/service/CarInfoHandle.php +++ b/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))