优化 后台等级设置

This commit is contained in:
2026-04-26 20:37:23 +08:00
parent e69bceeb77
commit b07f4e971a
13 changed files with 753 additions and 14 deletions
@@ -38,6 +38,9 @@ class AdminSystemControllerTest extends TestCase
$response->assertDontSee('vip_payment_app_secret');
$response->assertDontSee('wechat_bot_config');
$response->assertDontSee('chatbot_max_gold');
$response->assertDontSee('levelexp');
$response->assertSee('maxlevel');
$response->assertSee('superlevel');
}
/**
@@ -51,6 +54,9 @@ class AdminSystemControllerTest extends TestCase
$response = $this->actingAs($admin)->put(route('admin.system.update'), [
'sys_name' => '新版聊天室',
'sys_notice' => '新的公共公告',
'levelexp' => '20,80,180',
'maxlevel' => '88',
'superlevel' => '666',
'smtp_host' => 'attacker.smtp.example',
'vip_payment_app_secret' => 'tampered-secret',
'wechat_bot_config' => '{"api":{"bot_key":"stolen"}}',
@@ -69,6 +75,18 @@ class AdminSystemControllerTest extends TestCase
'alias' => 'sys_notice',
'body' => '新的公共公告',
]);
$this->assertDatabaseHas('sysparam', [
'alias' => 'levelexp',
'body' => '10,50,150',
]);
$this->assertDatabaseHas('sysparam', [
'alias' => 'maxlevel',
'body' => '88',
]);
$this->assertDatabaseHas('sysparam', [
'alias' => 'superlevel',
'body' => '89',
]);
// 敏感配置必须保持原值,不能被通用系统页伪造请求覆盖。
$this->assertDatabaseHas('sysparam', [
@@ -128,6 +146,9 @@ class AdminSystemControllerTest extends TestCase
return [
'sys_name' => '原始聊天室',
'sys_notice' => '原始公告',
'levelexp' => '10,50,150',
'maxlevel' => '99',
'superlevel' => '100',
'smtp_host' => 'owner.smtp.example',
'vip_payment_app_secret' => 'owner-secret',
'wechat_bot_config' => '{"api":{"bot_key":"owner-only"}}',