72 lines
2.5 KiB
PHP
72 lines
2.5 KiB
PHP
|
|
<?php
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 文件功能:创建系统参数表(sysparam)
|
|||
|
|
* 复刻原版 ASP 聊天室的 sysparam 系统配置表
|
|||
|
|
* 存储等级-经验阈值、系统开关等管理员可配置项
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
use Illuminate\Database\Migrations\Migration;
|
|||
|
|
use Illuminate\Database\Schema\Blueprint;
|
|||
|
|
use Illuminate\Support\Facades\DB;
|
|||
|
|
use Illuminate\Support\Facades\Schema;
|
|||
|
|
|
|||
|
|
return new class extends Migration
|
|||
|
|
{
|
|||
|
|
/**
|
|||
|
|
* 创建 sysparam 表并插入默认等级经验配置
|
|||
|
|
*/
|
|||
|
|
public function up(): void
|
|||
|
|
{
|
|||
|
|
Schema::create('sysparam', function (Blueprint $table) {
|
|||
|
|
$table->id();
|
|||
|
|
$table->string('alias', 100)->unique()->comment('参数别名(唯一标识)');
|
|||
|
|
$table->text('body')->nullable()->comment('参数值');
|
|||
|
|
$table->string('guidetxt', 500)->nullable()->comment('参数说明(后台显示)');
|
|||
|
|
$table->timestamps();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 插入默认的等级经验配置(管理员可在后台修改)
|
|||
|
|
// 格式:逗号分隔,每项为"等级所需的累计经验值"
|
|||
|
|
// 例如:等级1需要10经验,等级2需要50,等级3需要150...
|
|||
|
|
DB::table('sysparam')->insert([
|
|||
|
|
[
|
|||
|
|
'alias' => 'levelexp',
|
|||
|
|
'body' => '10,50,150,400,800,1500,3000,5000,8000,12000,18000,25000,35000,50000,80000',
|
|||
|
|
'guidetxt' => '等级经验阈值配置(逗号分隔)。第N个数字表示升到N级所需的累计经验值。例如:10,50,150 表示1级需10经验,2级需50经验,3级需150经验。',
|
|||
|
|
'created_at' => now(),
|
|||
|
|
'updated_at' => now(),
|
|||
|
|
],
|
|||
|
|
[
|
|||
|
|
'alias' => 'exp_per_heartbeat',
|
|||
|
|
'body' => '1',
|
|||
|
|
'guidetxt' => '每次心跳(约60秒)增加的经验值',
|
|||
|
|
'created_at' => now(),
|
|||
|
|
'updated_at' => now(),
|
|||
|
|
],
|
|||
|
|
[
|
|||
|
|
'alias' => 'superlevel',
|
|||
|
|
'body' => '16',
|
|||
|
|
'guidetxt' => '管理员级别(= 最高等级 + 1,拥有最高权限的等级阈值)',
|
|||
|
|
'created_at' => now(),
|
|||
|
|
'updated_at' => now(),
|
|||
|
|
],
|
|||
|
|
[
|
|||
|
|
'alias' => 'maxlevel',
|
|||
|
|
'body' => '15',
|
|||
|
|
'guidetxt' => '用户最高可达等级',
|
|||
|
|
'created_at' => now(),
|
|||
|
|
'updated_at' => now(),
|
|||
|
|
],
|
|||
|
|
]);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 回滚:删除 sysparam 表
|
|||
|
|
*/
|
|||
|
|
public function down(): void
|
|||
|
|
{
|
|||
|
|
Schema::dropIfExists('sysparam');
|
|||
|
|
}
|
|||
|
|
};
|