|
|
|
@ -83,6 +83,9 @@ class Import extends ImportModel |
|
|
|
|
$this->checkLimit($execlData); |
|
|
|
|
|
|
|
|
|
self::$storeId = $form['store_id'] ?? 0; |
|
|
|
|
foreach ($execlData as &$value) { |
|
|
|
|
$value['B'] = $form['channel']??'zy'; |
|
|
|
|
} |
|
|
|
|
// $obj = new \app\job\service\goods\AdminImport(); |
|
|
|
|
// $service = new \app\job\service\goods\Collector(); |
|
|
|
|
// foreach ($execlData as $item) { |
|
|
|
@ -95,7 +98,7 @@ class Import extends ImportModel |
|
|
|
|
// var_dump(\count($execlData)); |
|
|
|
|
// exit(); |
|
|
|
|
// 新增商品导入记录 |
|
|
|
|
$recordId = $this->addRecord(\count($execlData)); |
|
|
|
|
$recordId = $this->addRecord(\count($execlData), $form['channel'] ?? 'zy'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 调度计划任务 |
|
|
|
@ -103,7 +106,7 @@ class Import extends ImportModel |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 执行批量导入 |
|
|
|
|
* 执行批量更新 |
|
|
|
|
* @param array $form |
|
|
|
|
* @return bool |
|
|
|
|
* @throws BaseException |
|
|
|
@ -137,7 +140,7 @@ class Import extends ImportModel |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// 新增商品导入记录 |
|
|
|
|
$recordId = $this->addRecord(\count($execlData)); |
|
|
|
|
$recordId = $this->addRecord(\count($execlData), $form['channel'] ?? 'zy'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 调度计划任务 |
|
|
|
@ -309,14 +312,15 @@ class Import extends ImportModel |
|
|
|
|
* @param int $totalCount 商品总数量 |
|
|
|
|
* @return int |
|
|
|
|
*/ |
|
|
|
|
private function addRecord(int $totalCount): int |
|
|
|
|
private function addRecord(int $totalCount, string $channel = 'zy'): int |
|
|
|
|
{ |
|
|
|
|
$this->save([ |
|
|
|
|
'total_count' => $totalCount, |
|
|
|
|
'start_time' => \time(), |
|
|
|
|
'fail_log' => [], |
|
|
|
|
'status' => GoodsImportStatusEnum::NORMAL, |
|
|
|
|
'store_id' => self::$storeId |
|
|
|
|
'store_id' => self::$storeId, |
|
|
|
|
'channel' => $channel, |
|
|
|
|
]); |
|
|
|
|
return (int)$this['id']; |
|
|
|
|
} |
|
|
|
|