refactor: 修改产品属性类型
This commit is contained in:
@@ -74,6 +74,7 @@ class ProductAttr
|
||||
public function save()
|
||||
{
|
||||
$post = request()->post([
|
||||
'attr_type' => 2,
|
||||
'attr_name' => '',
|
||||
'is_system' => 0,
|
||||
]);
|
||||
@@ -100,13 +101,15 @@ class ProductAttr
|
||||
}
|
||||
|
||||
// 添加属性特征
|
||||
foreach ($props as &$prop) {
|
||||
$prop['attr_id'] = $attr_ret->id;
|
||||
}
|
||||
unset($prop);
|
||||
$props_ret = (new ProductAttrPropModel)->saveAll($props);
|
||||
if ($props_ret->isEmpty()) {
|
||||
throw new \Exception("操作失败");
|
||||
if (!empty($props)) {
|
||||
foreach ($props as &$prop) {
|
||||
$prop['attr_id'] = $attr_ret->id;
|
||||
}
|
||||
unset($prop);
|
||||
$props_ret = (new ProductAttrPropModel)->saveAll($props);
|
||||
if ($props_ret->isEmpty()) {
|
||||
throw new \Exception("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
ProductAttrModel::commit();
|
||||
@@ -125,7 +128,8 @@ class ProductAttr
|
||||
{
|
||||
$id = request()->param('id');
|
||||
$put = request()->put([
|
||||
'attr_name' => '',
|
||||
'attr_type',
|
||||
'attr_name',
|
||||
'is_system' => 0,
|
||||
]);
|
||||
$attr = array_merge($put, ['language_id' => request()->lang_id]);
|
||||
|
||||
Reference in New Issue
Block a user