From c05b52237ef7d4b734d4e6eb8427ba6677e39f46 Mon Sep 17 00:00:00 2001 From: sa0ChunLuyu Date: Wed, 16 Aug 2023 11:35:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=99=AE=E9=80=9A=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E8=B7=AF=E7=94=B1BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/AdminAuthController.php | 21 +++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/AdminAuthController.php b/app/Http/Controllers/AdminAuthController.php index 7c922a2..0f02fc4 100644 --- a/app/Http/Controllers/AdminAuthController.php +++ b/app/Http/Controllers/AdminAuthController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use App\Http\Request\EditAdminAuth; use App\Models\AdminAuth; +use App\Models\AdminAuthGroup; use Illuminate\Http\Request; use Login; use Yo; @@ -92,9 +93,15 @@ class AdminAuthController extends Controller $data['list'] = $auth_group_list; $list[] = $data; } - $auth_group_single = AdminAuth::where('pid', 0)->where('type', 2)->where('del', 2)->orderBy('order', 'desc')->get()->toArray(); + $auth_group_single = AdminAuth::where('pid', 0)->where('type', 2)->where('del', 2)->orderBy('order', 'desc')->get(); + foreach ($auth_group_single as $item) { + $list[] = [ + 'info' => $item, + 'list' => [] + ]; + } return Yo::echo([ - 'list' => array_merge($list, $auth_group_single) + 'list' => $list ]); } @@ -166,14 +173,14 @@ class AdminAuthController extends Controller ->orderBy('order', 'desc')->get(); break; default: - $admin_auth = AdminAuth::find(Login::$info->admin_auth_group); - $auths = json_decode($admin_auth->auths, true); + $admin_auth_group = AdminAuthGroup::find(Login::$info->admin_auth_group); + $auths = json_decode($admin_auth_group->admin_auths, true); $auth_list = AdminAuth::select('id', 'name', 'title', 'icon', 'status') ->where(function ($query) use ($auths, $item) { - $query->whereIn('id', $auths)->where('pid', $item->id)->where('type', 2)->where('check_type', 2)->where('show', 1)->where('status', 1)->where('del', 2); + $query->whereIn('id', $auths)->where('pid', $item->id)->where('type', 2)->where('check', 1)->where('show', 1)->where('status', 1)->where('del', 2); }) - ->orWhere(function ($query) use ($auths, $item) { - $query->where('type', 2)->where('pid', $item->id)->where('check_type', 1)->where('show', 1)->where('status', 1)->where('del', 2); + ->orWhere(function ($query) use ($item) { + $query->where('pid', $item->id)->where('type', 2)->where('check', 2)->where('show', 1)->where('status', 1)->where('del', 2); }) ->orderBy('order', 'desc')->get(); }