导入行重复处理修复

master
zcstatham 2 years ago
parent bf4cb311de
commit d806da099e
  1. 4
      extend/service/CarInfoHandle.php

@ -38,7 +38,7 @@ class CarInfoHandle
cache('shell_process_' . $id, 0, 300); cache('shell_process_' . $id, 0, 300);
Db::execute('ALTER TABLE car_info_t DISABLE KEYS;'); Db::execute('ALTER TABLE car_info_t DISABLE KEYS;');
for ($i = 2; $i < $lines; $i += 2000) { for ($i = 2; $i < $lines; $i += 2000) {
$insert_data = FileSystem::getFileBlockData($filename, $i, $i + 2000, function ($str) use ($id) { $insert_data = FileSystem::getFileBlockData($filename, $i, $i + 1999, function ($str) use ($id) {
$keys = ['duty_no', 'register_date', 'car_man', 'car_number', 'car_phone', 'car_frame_no', 'car_no', 'engine_no', 'factory_model', 'purchase_price', 'source']; $keys = ['duty_no', 'register_date', 'car_man', 'car_number', 'car_phone', 'car_frame_no', 'car_no', 'engine_no', 'factory_model', 'purchase_price', 'source'];
$keys_len = count($keys); $keys_len = count($keys);
$arr = explode(',', $str); $arr = explode(',', $str);
@ -490,8 +490,6 @@ 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(($row - 1) / $highestRow * 100, 3), 300); cache('shell_process_' . $id, round(($row - 1) / $highestRow * 100, 3), 300);

Loading…
Cancel
Save