feat: 增强后台设置校验、代理权限控制与财务审计能力
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Models\AdminUser;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
/*
|
||||
@@ -104,3 +106,32 @@ function bindAdminUserToAgent(AdminUser $admin, int $agentNodeId): void
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
function ensureAdminActionCatalogSeeded(): void
|
||||
{
|
||||
if (! Schema::hasTable('admin_action_catalog')) {
|
||||
Schema::create('admin_action_catalog', static function ($table): void {
|
||||
$table->id();
|
||||
$table->string('code')->unique();
|
||||
$table->string('name');
|
||||
$table->unsignedTinyInteger('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
$now = Carbon::now();
|
||||
foreach ([
|
||||
['code' => 'view', 'name' => '查看'],
|
||||
['code' => 'manage', 'name' => '管理'],
|
||||
] as $row) {
|
||||
DB::table('admin_action_catalog')->updateOrInsert(
|
||||
['code' => $row['code']],
|
||||
[
|
||||
'name' => $row['name'],
|
||||
'status' => 1,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user