|
@@ -520,6 +520,8 @@ class ImportService extends Service
|
|
|
if(in_array($t,$array_clean)) return [false, '产品编码:'. $value[1] .'在文件中重复出现'];
|
|
|
$array_clean[] = $t;
|
|
|
|
|
|
+ $value[2] = $this->convertHyphens($value[2]);
|
|
|
+
|
|
|
if(! empty($value[8])){
|
|
|
if(! isset($map_attr[$value[8]])) return [false, '产品属性不存在' . $value[8]];
|
|
|
$value[8] = $map_attr[$value[8]];
|
|
@@ -726,6 +728,16 @@ class ImportService extends Service
|
|
|
return [true, ''];
|
|
|
}
|
|
|
|
|
|
+ function convertHyphens($string) {
|
|
|
+ // 定义要被替换的字符
|
|
|
+ $search = array('-', '-', '—'); // 全角连字符、半角连字符 和 破折号
|
|
|
+ $replace = '-'; // 替换成半角连字符
|
|
|
+
|
|
|
+ // 执行替换
|
|
|
+ $res = str_replace($search, $replace, $string);
|
|
|
+ return $res;
|
|
|
+ }
|
|
|
+
|
|
|
function generateTitleToIdMap($tree, $prefix = '') {
|
|
|
$result = [];
|
|
|
|