修改排序

This commit is contained in:
liaofei 2023-04-10 11:08:46 +08:00
parent 691cf845aa
commit 5ad4d21f75
2 changed files with 2 additions and 2 deletions

View File

@ -39,6 +39,6 @@ class SystemRouteCate extends BaseModel
*/
public function children()
{
return $this->hasMany(SystemRoute::class, 'id', 'cate_id')->field(['id', 'cate_id', 'name', 'path', 'method'])->order('add_time desc');
return $this->hasMany(SystemRoute::class, 'cate_id', 'id')->field(['id', 'cate_id', 'name', 'path', 'method'])->order('add_time desc');
}
}

View File

@ -82,7 +82,7 @@ class SystemRouteServices extends BaseServices
public function getTreeList(array $where, string $appName = 'adminapi')
{
$list = app()->make(SystemRouteCateServices::class)
->selectList(['app_name' => $appName], '*', 0, 0, 'id asc', [
->selectList(['app_name' => $appName], '*', 0, 0, 'id asc,sort desc', [
'children' => function ($query) use ($where) {
$query->where('app_name', $where['app_name'])
->when('' !== $where['name_like'], function ($q) use ($where) {