导入
This commit is contained in:
@@ -89,7 +89,6 @@ class SkuController extends BaseController
|
|||||||
|
|
||||||
public function import(Request $request)
|
public function import(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
$file = $request->file('file');
|
$file = $request->file('file');
|
||||||
if (!$file) return $this->error('未上传文件');;
|
if (!$file) return $this->error('未上传文件');;
|
||||||
|
|
||||||
@@ -161,7 +160,12 @@ class SkuController extends BaseController
|
|||||||
$skuAttribute = SkuAttribute::where('attr_name', $item[0])
|
$skuAttribute = SkuAttribute::where('attr_name', $item[0])
|
||||||
->where('category_id', $data['category_id'])->first();
|
->where('category_id', $data['category_id'])->first();
|
||||||
if (empty($skuAttribute)) {
|
if (empty($skuAttribute)) {
|
||||||
continue;
|
$skuAttribute = SkuAttribute::create([
|
||||||
|
'attr_name' => $item[0],
|
||||||
|
'attr_value' => $item[1],
|
||||||
|
'category_id' => $data['category_id'],
|
||||||
|
'attr_type' => 'text'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
$attr['attr_id'] = $skuAttribute->id;
|
$attr['attr_id'] = $skuAttribute->id;
|
||||||
$attr['category_id'] = $data['category_id'];
|
$attr['category_id'] = $data['category_id'];
|
||||||
|
|||||||
Reference in New Issue
Block a user