feat(admin): 增加玩家密码管理与角色边界

This commit is contained in:
wchino
2026-07-21 21:11:07 +08:00
parent cec2fd7c4f
commit ba54444979
32 changed files with 845 additions and 34 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Support;
use App\Models\AdminRole;
use Illuminate\Support\Facades\DB;
final class InvalidPlatformAgentRoleCleanup
{
public static function run(): int
{
$agentRoleId = DB::table('admin_roles')
->where('scope_type', AdminRole::SCOPE_SYSTEM)
->where('slug', PlatformSystemRoles::SLUG_AGENT)
->value('id');
if ($agentRoleId === null) {
return 0;
}
return DB::table('admin_user_site_roles')
->where('role_id', (int) $agentRoleId)
->whereNotExists(static function ($query): void {
$query->selectRaw('1')
->from('admin_user_agents as cleanup_uag')
->whereColumn('cleanup_uag.admin_user_id', 'admin_user_site_roles.admin_user_id');
})
->delete();
}
}