导入信息日期格式处理

master
zhaocheng 2 years ago
parent 1582c54d09
commit d983c1f0c7
  1. 8
      extend/service/CarInfoHandle.php

@ -475,7 +475,7 @@ class CarInfoHandle
for ($row = 2; $row <= $highestRow; $row++) { for ($row = 2; $row <= $highestRow; $row++) {
$row_array[] = [ $row_array[] = [
'duty_no' => $worksheet->getCellByColumnAndRow(1, $row)->getValue(), '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_man' => $worksheet->getCellByColumnAndRow(3, $row)->getValue(),
'car_number' => $worksheet->getCellByColumnAndRow(4, $row)->getValue(), 'car_number' => $worksheet->getCellByColumnAndRow(4, $row)->getValue(),
'car_phone' => $worksheet->getCellByColumnAndRow(5, $row)->getValue(), 'car_phone' => $worksheet->getCellByColumnAndRow(5, $row)->getValue(),
@ -487,10 +487,12 @@ class CarInfoHandle
'create_timestamp' => $now, 'create_timestamp' => $now,
'update_timestamp' => $now 'update_timestamp' => $now
]; ];
if ($row >= 1000) { if ($row >= 1000) {
Db::name('car_info_t')->insertAll($row_array); Db::name('car_info_t')->insertAll($row_array);
cache('shell_process_' . $id, round(($i + 2000) / $lines * 100, 3), 300); cache('shell_process_' . $id, round(($row - 1) / $highestRow * 100, 3), 300);
echo '当前进度:' . round(round(($i + 2000) / $lines * 100, 3)) . PHP_EOL; echo '当前进度:' . round(round(($row - 1) / $highestRow * 100, 3)) . PHP_EOL;
$row_array = []; $row_array = [];
} }
} }

Loading…
Cancel
Save