|
|
|
@ -99,7 +99,7 @@ class GoodsStoreImport extends BaseService |
|
|
|
|
* @throws \think\db\exception\DbException |
|
|
|
|
* @throws \think\db\exception\ModelNotFoundException |
|
|
|
|
*/ |
|
|
|
|
public function batch(array $list, int $recordId, int $storeId, int $merchantId): bool |
|
|
|
|
public function batch(array $list, int $recordId, int $storeId, int $merchantId = 0): bool |
|
|
|
|
{ |
|
|
|
|
$service = new \app\job\service\goods\Collector(); |
|
|
|
|
foreach ($list as $item) { |
|
|
|
@ -109,7 +109,7 @@ class GoodsStoreImport extends BaseService |
|
|
|
|
$this->successCount++; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
$data = $this->createData($item, $storeId); |
|
|
|
|
$data = $this->createData($item, $storeId, $merchantId); |
|
|
|
|
$ret = $service->single($item['D'], $data, $storeId); |
|
|
|
|
if ($ret == false) { |
|
|
|
|
continue; |
|
|
|
@ -202,7 +202,7 @@ class GoodsStoreImport extends BaseService |
|
|
|
|
* @throws \think\db\exception\DbException |
|
|
|
|
* @throws \think\db\exception\ModelNotFoundException |
|
|
|
|
*/ |
|
|
|
|
public function createData(array $original, int $storeId): array |
|
|
|
|
public function createData(array $original, int $storeId, int $merchantId = 0): array |
|
|
|
|
{ |
|
|
|
|
//批量导入销售区域处理 |
|
|
|
|
$region = []; |
|
|
|
@ -272,6 +272,7 @@ class GoodsStoreImport extends BaseService |
|
|
|
|
'goods_type' => 10,//实物 |
|
|
|
|
'goods_status' => 10,//上架 |
|
|
|
|
'store_id' => $storeId, |
|
|
|
|
'merchant_id' => $merchantId, |
|
|
|
|
//'sale_areas' => $arr ? implode("、", $arr) : "", |
|
|
|
|
'region' => $region ? json_encode($region, JSON_UNESCAPED_UNICODE) : "", |
|
|
|
|
'region_text' => $region_text ? json_encode(array_values($region_text), JSON_UNESCAPED_UNICODE) : "", |
|
|
|
|