From d983c1f0c7d1bba8ae0773a76bc204543501c11b Mon Sep 17 00:00:00 2001 From: zhaocheng <578322713@qq.com> Date: Fri, 12 Aug 2022 14:57:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E4=BF=A1=E6=81=AF=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E6=A0=BC=E5=BC=8F=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/service/CarInfoHandle.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/extend/service/CarInfoHandle.php b/extend/service/CarInfoHandle.php index 68a2a4c..b705427 100644 --- a/extend/service/CarInfoHandle.php +++ b/extend/service/CarInfoHandle.php @@ -475,7 +475,7 @@ class CarInfoHandle for ($row = 2; $row <= $highestRow; $row++) { $row_array[] = [ 'duty_no' => $worksheet->getCellByColumnAndRow(1, $row)->getValue(), - 'register_date' => $worksheet->getCellByColumnAndRow(2, $row)->getValue(), + 'register_date' => date('Y-m-d', strtotime($worksheet->getCellByColumnAndRow(2, $row)->getValue())), 'car_man' => $worksheet->getCellByColumnAndRow(3, $row)->getValue(), 'car_number' => $worksheet->getCellByColumnAndRow(4, $row)->getValue(), 'car_phone' => $worksheet->getCellByColumnAndRow(5, $row)->getValue(), @@ -487,10 +487,12 @@ class CarInfoHandle 'create_timestamp' => $now, 'update_timestamp' => $now ]; + + if ($row >= 1000) { Db::name('car_info_t')->insertAll($row_array); - cache('shell_process_' . $id, round(($i + 2000) / $lines * 100, 3), 300); - echo '当前进度:' . round(round(($i + 2000) / $lines * 100, 3)) . PHP_EOL; + cache('shell_process_' . $id, round(($row - 1) / $highestRow * 100, 3), 300); + echo '当前进度:' . round(round(($row - 1) / $highestRow * 100, 3)) . PHP_EOL; $row_array = []; } }