pref: 增加服务类优化UI版面

This commit is contained in:
Ying
2023-06-19 14:32:30 +08:00
parent 27eda6f37f
commit 2b8f874450
148 changed files with 3933 additions and 9286 deletions

View File

@@ -50,34 +50,14 @@ class AdminRules extends AdminController
}
// 获取总数
$total = $this->model->count();
$total = $this->model->where($where)->count();
$list = $this->model->where($where)->order('sort asc')->select()->toArray();
foreach ($list as $key => $value) {
$list[$key]['title'] = __($value['title']);
}
// 自定义查询
if (count($list) < $total) {
$parentNode = []; // 查找父节点
foreach ($list as $key => $value) {
if ($value['pid'] !== 0 && !list_search($list,['id'=>$value['pid']])) {
$parentNode[] = $this->parentNode($value['pid']);
}
}
foreach ($parentNode as $key => $value) {
$list = array_merge($list,$value);
}
}
$rules = $this->model->getListTree();
return $this->success('获取成功', '',[
'item'=> $list,
'rules'=> $rules
],
count($list),0);
$rules = list_to_tree($list,'id','pid','children',0);
return $this->success('获取成功', '/',$rules, $total);
}