Commit 2aa2c508 by 杨树贤

修改导入以及导入等级脚本

parent 3bb1b79e
......@@ -38,7 +38,7 @@ class SetSupplierFollowUp extends Command
// $service->importSupplierGroup(true);
// $service->changeSupplierType();
// $service->generateYunxinAccount(true);
$service->reSyncSupplierToErp();
$service->importSupplierLevel();
// $service->makeSupplierSystemTagAbnormal();
}
}
......@@ -802,4 +802,31 @@ class DataService
}
}
}
//导入公司性质
public function importSupplierLevel($isUpdate = false)
{
ini_set('memory_limit', -1);
$filePath = public_path('data') . DIRECTORY_SEPARATOR . 'supplier_level_20220816.csv';
try {
Excel::selectSheetsByIndex(0)->load($filePath, function ($reader) use ($isUpdate) {
$reader->sheet('supplier_level_20220816', function () use ($reader, $isUpdate) {
$suppliers = $reader->all()->toArray();
foreach ($suppliers as $supplier) {
$supplierCode = trim($supplier[1]);
$level = trim($supplier[16]);
echo "修改供应商 $supplierCode 等级为 $level" . PHP_EOL;
if ($isUpdate) {
SupplierChannelModel::where('supplier_code', $supplierCode)->update([
'level' => $level,
]);
}
}
});
});
} catch (\Exception $exception) {
dd($exception);
}
}
}
\ No newline at end of file
......@@ -62,8 +62,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route::match(['get', 'post'], '/test', function () {
// (new \App\Http\Services\DataService())->initSystemTag();
\App\Model\SupplierChannelModel::where('supplier_id', 6148)->update([
'status' => 2
]);
(new \App\Http\Services\DataService())->importSupplierLevel();
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment