产品编辑

This commit is contained in:
2025-12-23 09:43:51 +08:00
parent 5f87899156
commit 60fdd57da9
2 changed files with 13 additions and 1 deletions
+8 -1
View File
@@ -64,7 +64,14 @@ class SkuController extends BaseController
if (isset($data['spec_json'])){
$data['spec'] = json_decode($data['spec_json'], true);
foreach ($data['spec'] as $k=>$v){
$data['spec'][$k]['attr_type'] = SkuAttribute::where('id', $v['attr_id'])->value('attr_type');
$skuAttribute = SkuAttribute::where('category_id',$data['category_id'])
->where('attr_name', $v['attr_name'])->first();
if ($skuAttribute){
$data['spec'][$k]['attr_id'] = $skuAttribute['id'];
$data['spec'][$k]['attr_type'] = $skuAttribute['attr_type'];
}else{
$data['spec'][$k]['attr_type'] = SkuAttribute::where('id', $v['attr_id'])->value('attr_type');
}
}
}
if (isset($data['category_id']))