后台内容模块功能完善
This commit is contained in:
@@ -80,4 +80,31 @@ class Attribute extends \think\Model {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static function getField($model, $ac = "add"){
|
||||
$list = [];
|
||||
$group = $model['attr_group'];
|
||||
|
||||
$map = [];
|
||||
$map[] = ['model_id', '=', $model['id']];
|
||||
if ($ac == 'add') {
|
||||
$map[] = ['is_show', 'IN', [1, 2]];
|
||||
}else if ($ac == 'edit') {
|
||||
$map[] = ['is_show', 'IN', [1, 3]];
|
||||
}
|
||||
|
||||
$row = self::where('model_id', $model['id'])
|
||||
->select()
|
||||
->append(['option'])
|
||||
->toArray();
|
||||
foreach ($row as $key => $value) {
|
||||
if (isset($group[$value['group_id']])) {
|
||||
$list[$group[$value['group_id']]['label']][] = $value;
|
||||
}else{
|
||||
$list[$value['group_id']][] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user