|
|
|
@ -201,9 +201,6 @@ class GoodsStoreImport extends BaseService |
|
|
|
|
*/ |
|
|
|
|
public function createData(array $original, int $storeId): array |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
//$channel = Channel::where('name', $original["B"])->find(); |
|
|
|
|
|
|
|
|
|
//批量导入销售区域处理 |
|
|
|
|
$region = []; |
|
|
|
|
$region_text = []; |
|
|
|
@ -227,7 +224,8 @@ class GoodsStoreImport extends BaseService |
|
|
|
|
foreach ($regions as $key => $value) { |
|
|
|
|
$regionsnew[$value['pid']][] = $value; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// echo "<pre>"; |
|
|
|
|
// print_r($regionsnew); |
|
|
|
|
foreach ($regionsnew as $pid => $value) { |
|
|
|
|
$privince = Region::withoutGlobalScope()->where('id', $pid)->find(); |
|
|
|
|
$region_text[$pid]['name'] = $privince['name'] ?? ""; |
|
|
|
@ -239,11 +237,19 @@ class GoodsStoreImport extends BaseService |
|
|
|
|
} |
|
|
|
|
$region_text[$pid]['citys'] = $citys; |
|
|
|
|
} |
|
|
|
|
unset($pid); |
|
|
|
|
|
|
|
|
|
foreach ($region_text as $pid => &$item) { |
|
|
|
|
//如果传入的是整个省份 |
|
|
|
|
if (count($item['citys']) == Region::withoutGlobalScope()->whereIn('pid', $pid)->count()) { |
|
|
|
|
$item['citys'] = []; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// echo "<pre>"; |
|
|
|
|
// print_r($region_text); |
|
|
|
|
// print_r($region); |
|
|
|
|
// exit(); |
|
|
|
|
// echo "<pre>"; |
|
|
|
|
// print_r($region_text); |
|
|
|
|
// print_r($region); |
|
|
|
|
// exit(); |
|
|
|
|
// 整理商品数据 |
|
|
|
|
$data = [ |
|
|
|
|
'cmmdty_model' => $original["A"], |
|
|
|
|