添加市场
This commit is contained in:
@@ -92,8 +92,8 @@ class ProductImport implements ToCollection
|
||||
*/
|
||||
private function parseRow(array $cells, Collection $categories, array $leafIds): array
|
||||
{
|
||||
[$name, $categoryName, $supplierName, $spec, $unit, $costPrice, $sort, $stock, $shelfLife, $statusText, $remark] =
|
||||
array_pad(array_slice($cells, 0, 11), 11, null);
|
||||
[$name, $categoryName, $supplierName, $market, $spec, $unit, $costPrice, $sort, $stock, $shelfLife, $statusText, $remark] =
|
||||
array_pad(array_slice($cells, 0, 12), 12, null);
|
||||
|
||||
$errors = [];
|
||||
|
||||
@@ -120,6 +120,11 @@ class ProductImport implements ToCollection
|
||||
$errors[] = '供应商名称最长 100 个字符';
|
||||
}
|
||||
|
||||
$market = (string) $market;
|
||||
if (mb_strlen($market) > 50) {
|
||||
$errors[] = '市场最长 50 个字符';
|
||||
}
|
||||
|
||||
$spec = (string) $spec;
|
||||
if (mb_strlen($spec) > 100) {
|
||||
$errors[] = '规格/包规最长 100 个字符';
|
||||
@@ -169,6 +174,7 @@ class ProductImport implements ToCollection
|
||||
'category_id' => $categoryId,
|
||||
'supplier_id' => 0, // 写入阶段按 supplier_name 解析(匹配或自动创建)
|
||||
'supplier_name' => $supplierName, // 写入阶段解析,不入 product 表
|
||||
'market' => $market,
|
||||
'name' => $name,
|
||||
'spec' => $spec,
|
||||
'unit' => $unit,
|
||||
|
||||
Reference in New Issue
Block a user