From 73cec23b7f3bd52f68ccd4727a00711477e6ebcf Mon Sep 17 00:00:00 2001 From: zcstatham <578322713@qq.com> Date: Thu, 8 Sep 2022 20:47:28 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=94=B5=E8=AF=9D=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E8=B0=83=E8=AF=954?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/service/CarInfoHandle.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/extend/service/CarInfoHandle.php b/extend/service/CarInfoHandle.php index 73a46f3..d38aca4 100644 --- a/extend/service/CarInfoHandle.php +++ b/extend/service/CarInfoHandle.php @@ -153,8 +153,11 @@ class CarInfoHandle ->where('repeat_frame_t.source', $data['source_id']); } else if ($data['export_table'] == 'peer_phone_t') { $query = $query->rightJoin('peer_phone_t', 'peer_phone_t.phone = car_info_t.car_phone') - ->field('car_info_t.*')->order('car_info_t.car_phone asc') - ->where([['peer_phone_t.source', '=', $data['source_id']],['car_info_t.car_number', 'REGEXP', '^[1-9][[:digit:]]{7}((0[[:digit:]])|(1[0-2]))(([0|1|2][[:digit:]])|3[0-1])[[:digit:]]{3}$|^[1-9][[:digit:]]{5}[1-9][[:digit:]]{3}((0[[:digit:]])|(1[0-2]))(([0|1|2][[:digit:]])|3[0-1])[[:digit:]]{3}([0-9]|X)$']]); + ->where('peer_phone_t.source', $data['source_id']) + ->where('car_info_t.car_number', 'REGEXP', '^[1-9][[:digit:]]{7}((0[[:digit:]])|(1[0-2]))(([0|1|2][[:digit:]])|3[0-1])[[:digit:]]{3}$|^[1-9][[:digit:]]{5}[1-9][[:digit:]]{3}((0[[:digit:]])|(1[0-2]))(([0|1|2][[:digit:]])|3[0-1])[[:digit:]]{3}([0-9]|X)$') + ->field('car_info_t.*')->order('car_info_t.car_phone asc'); + $query->first(); + echo $query->getLastSql();exit(); } }else { $query = $query->order('register_date asc'); From 101c6df5952055b185d82d81760b76cd85ac7ce6 Mon Sep 17 00:00:00 2001 From: zcstatham <578322713@qq.com> Date: Thu, 8 Sep 2022 21:05:52 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=94=B5=E8=AF=9D=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E8=B0=83=E8=AF=955?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/service/CarInfoHandle.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/extend/service/CarInfoHandle.php b/extend/service/CarInfoHandle.php index d38aca4..d14d3a8 100644 --- a/extend/service/CarInfoHandle.php +++ b/extend/service/CarInfoHandle.php @@ -141,7 +141,7 @@ class CarInfoHandle if (count($map_or2) > 0) { $map_or2 = array_merge([['car_info_t.insurer1_date', '=', ''], ['car_info_t.insurer2_date', '<>', '']], $map_or2); } - $query = CarInfoT::where($where)->where(function ($query) use ($map_or1, $map_or2) { + $query = CarInfoT::where(empty($where) ? 1:$where)->where(function ($query) use ($map_or1, $map_or2) { if (count($map_or1) > 0 && count($map_or2) > 0) { $query->whereOr([$map_or1, $map_or2]); } @@ -156,8 +156,6 @@ class CarInfoHandle ->where('peer_phone_t.source', $data['source_id']) ->where('car_info_t.car_number', 'REGEXP', '^[1-9][[:digit:]]{7}((0[[:digit:]])|(1[0-2]))(([0|1|2][[:digit:]])|3[0-1])[[:digit:]]{3}$|^[1-9][[:digit:]]{5}[1-9][[:digit:]]{3}((0[[:digit:]])|(1[0-2]))(([0|1|2][[:digit:]])|3[0-1])[[:digit:]]{3}([0-9]|X)$') ->field('car_info_t.*')->order('car_info_t.car_phone asc'); - $query->first(); - echo $query->getLastSql();exit(); } }else { $query = $query->order('register_date asc'); From 8c30bd5125d8389bc8fa672e61420fd7316cd6ad Mon Sep 17 00:00:00 2001 From: zcstatham <578322713@qq.com> Date: Thu, 8 Sep 2022 21:33:25 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=94=B5=E8=AF=9D=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E8=B0=83=E8=AF=956?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/service/CarInfoHandle.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/extend/service/CarInfoHandle.php b/extend/service/CarInfoHandle.php index d14d3a8..8f94859 100644 --- a/extend/service/CarInfoHandle.php +++ b/extend/service/CarInfoHandle.php @@ -149,16 +149,16 @@ class CarInfoHandle if ($data['export_type'] == 'repeat') { if ($data['export_table'] == 'repeat_frame_t') { $query = RepeatFrameT::leftjoin('car_info_t', 'repeat_frame_t.car_frame_no = car_info_t.car_frame_no') - ->field('car_info_t.*')->order('car_info_t.register_date asc') + ->field('car_info_t.*')->order('car_info_t.id asc') ->where('repeat_frame_t.source', $data['source_id']); } else if ($data['export_table'] == 'peer_phone_t') { $query = $query->rightJoin('peer_phone_t', 'peer_phone_t.phone = car_info_t.car_phone') ->where('peer_phone_t.source', $data['source_id']) ->where('car_info_t.car_number', 'REGEXP', '^[1-9][[:digit:]]{7}((0[[:digit:]])|(1[0-2]))(([0|1|2][[:digit:]])|3[0-1])[[:digit:]]{3}$|^[1-9][[:digit:]]{5}[1-9][[:digit:]]{3}((0[[:digit:]])|(1[0-2]))(([0|1|2][[:digit:]])|3[0-1])[[:digit:]]{3}([0-9]|X)$') - ->field('car_info_t.*')->order('car_info_t.car_phone asc'); + ->field('car_info_t.*')->order('car_info_t.id asc'); } }else { - $query = $query->order('register_date asc'); + $query = $query->order('car_info_t.id asc'); } $count = $query->count(); $count = $count <= $data['export_limit'] || $data['export_limit'] == 0 ? $count : $data['export_limit']; @@ -653,8 +653,9 @@ class CarInfoHandle } $limit -= 3000; $end = $info->pop(); - $lastRegisterDate = is_array($end) ? $end['register_date'] : $end->getData('register_date'); - $limit > 0 && ($info = $query->where('register_date', '>=', $lastRegisterDate)->limit($limit >= 3000 ? 3000 : $limit)->select()); + $lastRegisterDate = is_array($end) ? $end['id'] : $end->getData('id'); + $query_1 = clone $query; + $limit > 0 && ($info = $query_1->where('car_info_t.id', '>=', $lastRegisterDate)->limit($limit >= 3000 ? 3000 : $limit)->select()); } } } @@ -708,8 +709,9 @@ class CarInfoHandle } $limit -= 3000; $end = $info->pop(); - $lastRegisterDate = is_array($end) ? $end['register_date'] : $end->getData('register_date'); - $limit > 0 && ($info = $query->where('register_date', '>=', $lastRegisterDate)->limit($limit >= 3000 ? 3000 : $limit)->select()); + $lastRegisterDate = is_array($end) ? $end['id'] : $end->getData('id'); + $query_1 = clone $query; + $limit > 0 && ($info = $query_1->where('car_info_t.id', '>=', $lastRegisterDate)->limit($limit >= 3000 ? 3000 : $limit)->select()); } } $writer = new Xlsx($spreadsheet);