后台内容模块功能完善

This commit is contained in:
2020-03-31 16:17:45 +08:00
parent de73484cca
commit 85d33da0d4
24 changed files with 386 additions and 251 deletions

View File

@@ -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;
}
}