|
|
@ -47,8 +47,11 @@ class CarInfoHandle |
|
|
|
}); |
|
|
|
}); |
|
|
|
$values = array_slice($arr, 0, $keys_len); |
|
|
|
$values = array_slice($arr, 0, $keys_len); |
|
|
|
$values[$keys_len - 1] = $id; |
|
|
|
$values[$keys_len - 1] = $id; |
|
|
|
return array_combine($keys, $values); |
|
|
|
$data = array_combine($keys, $values); |
|
|
|
|
|
|
|
$data['register_date'] = date('Y-m-d', strtotime($data['register_date'])); |
|
|
|
|
|
|
|
return $data; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
Db::name('car_info_t')->insertAll($insert_data); |
|
|
|
Db::name('car_info_t')->insertAll($insert_data); |
|
|
|
cache('shell_process_' . $id, round(($i + 2000) / $lines * 100, 3), 300); |
|
|
|
cache('shell_process_' . $id, round(($i + 2000) / $lines * 100, 3), 300); |
|
|
|
echo '当前进度:' . round(round(($i + 2000) / $lines * 100, 3)) . PHP_EOL; |
|
|
|
echo '当前进度:' . round(round(($i + 2000) / $lines * 100, 3)) . PHP_EOL; |
|
|
@ -475,7 +478,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 +490,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 = []; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|