优化扩展功能
This commit is contained in:
@@ -77,7 +77,7 @@ class Attribute extends \think\Model {
|
||||
}
|
||||
|
||||
protected function getTypeTextAttr($value, $data) {
|
||||
$config_type_list = Config::get('config.config_type_list');
|
||||
$config_type_list = Config::get('config.config_type_list') ?? [];
|
||||
$type = [];
|
||||
foreach ($config_type_list as $key => $value) {
|
||||
$type[$value['key']] = $value['label'];
|
||||
@@ -111,6 +111,9 @@ class Attribute extends \think\Model {
|
||||
$map[] = ['model_id', '=', $data['model_id']];
|
||||
}
|
||||
$row = Db::name($extra[0])->where($map)->select()->toArray();
|
||||
if(empty($row)){
|
||||
return [];
|
||||
}
|
||||
if ($extra[1] == 'tree') {
|
||||
$row = (new Tree())->toFormatTree($row);
|
||||
foreach ($row as $val) {
|
||||
@@ -146,7 +149,7 @@ class Attribute extends \think\Model {
|
||||
$map[] = ['is_show', 'IN', [1, 3]];
|
||||
}
|
||||
|
||||
$row = self::where($map)
|
||||
$row = self::where($map)->order('sort asc, id desc')
|
||||
->select()
|
||||
->append(['option'])
|
||||
->toArray();
|
||||
|
||||
Reference in New Issue
Block a user