Feat: 实现全屏特效系统(烟花/下雨/雷电),管理员一键触发全房间广播

This commit is contained in:
2026-02-27 14:14:35 +08:00
parent adab033afc
commit 709e0d4975
47 changed files with 621 additions and 1751 deletions

View File

@@ -1,106 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('username', 50)->unique()->comment('用户名');
$table->string('password')->comment('密码 (MD5 or Bcrypt)');
$table->string('email', 250)->nullable()->comment('邮箱');
$table->tinyInteger('sex')->default(0)->comment('性别 (0保密 1男 2女)');
$table->tinyInteger('user_level')->default(1)->comment('用户等级');
$table->dateTime('log_time')->nullable()->comment('登录时间');
$table->integer('visit_num')->default(0)->comment('访问次数');
$table->dateTime('in_time')->nullable()->comment('进房时间');
$table->tinyInteger('out_info')->default(0)->comment('退出信息');
$table->dateTime('out_time')->nullable()->comment('退出时间');
$table->integer('exp_num')->default(0)->index()->comment('经验值');
$table->tinyInteger('f_size')->nullable()->comment('字体大小');
$table->tinyInteger('l_height')->nullable()->comment('行高');
$table->tinyInteger('n_color')->nullable()->comment('名称颜色');
$table->integer('s_color')->nullable()->comment('发言颜色');
$table->string('remand', 250)->nullable()->comment('密码提示问题');
$table->string('answer', 250)->nullable()->comment('密码提示答案');
$table->string('bgcolor', 50)->nullable()->comment('背景颜色');
$table->string('temppass', 20)->nullable()->comment('临时密码');
$table->string('oicq', 30)->nullable()->comment('QQ号');
$table->tinyInteger('saved')->nullable()->comment('是否保存');
$table->string('first_ip', 50)->nullable()->comment('首次IP');
$table->string('last_ip', 50)->nullable()->comment('最后IP');
$table->string('aihaos', 250)->nullable()->comment('爱好');
$table->string('friends', 250)->nullable()->comment('好友列表');
$table->integer('headface')->nullable()->comment('头像');
$table->integer('room_id')->default(0)->index()->comment('所在房间');
$table->tinyInteger('auto_update')->nullable()->comment('自动刷新');
$table->string('ppass', 50)->nullable()->comment('二级密码');
$table->integer('jjb')->default(0)->comment('交友币/金币');
$table->string('love', 50)->nullable()->comment('伴侣');
$table->string('gzdw', 50)->nullable()->comment('工作单位');
$table->integer('photo')->nullable()->comment('照片 (对应原表中文列名照片)');
$table->integer('hj')->default(0)->comment('呼叫状态');
$table->string('djname', 50)->nullable()->comment('等级名称');
$table->string('usersf', 50)->nullable()->comment('用户身份');
$table->integer('yh')->nullable()->comment('隐身状态');
$table->text('userpassword')->nullable()->comment('备用密码');
$table->string('huiyuan', 50)->nullable()->comment('会员组别');
$table->dateTime('hy_time')->nullable()->comment('会员到期时间');
$table->string('tuijian', 50)->nullable()->comment('推荐人');
$table->string('tuijian_ip', 50)->nullable()->comment('推荐IP');
$table->string('xiaohai', 50)->nullable()->comment('小孩');
$table->string('qingren', 50)->nullable()->comment('情人');
$table->string('zhufang', 50)->nullable()->comment('住房');
$table->string('zuoqiimg', 50)->nullable()->comment('坐骑图片');
$table->string('zuoqi', 50)->nullable()->comment('坐骑名称');
$table->integer('guanli')->nullable()->comment('管理员标记');
$table->integer('meili')->nullable()->comment('魅力值');
$table->integer('teshu')->nullable()->comment('特殊权限');
$table->dateTime('xr_time')->nullable()->comment('仙人时间');
$table->dateTime('yx_time')->nullable()->comment('英雄时间');
$table->integer('q1')->nullable();
$table->integer('q2')->nullable();
$table->integer('q3')->nullable();
$table->string('hua', 255)->nullable()->comment('鲜花');
$table->dateTime('sj')->nullable()->comment('注册/更新时间');
$table->string('pig', 255)->nullable()->comment('宠物');
$table->text('qianming')->nullable()->comment('个性签名');
$table->dateTime('q3_time')->nullable();
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};

View File

@@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration')->index();
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};

View File

@@ -1,57 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};

View File

@@ -1,42 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('rooms', function (Blueprint $table) {
$table->id();
$table->string('room_name', 10)->unique()->comment('房间标识/名称');
$table->string('room_auto', 10)->nullable()->comment('房间别名/自动属性');
$table->string('room_owner', 10)->nullable()->comment('房主');
$table->string('room_des', 250)->nullable()->comment('房间描述');
$table->string('room_top', 100)->nullable()->comment('置顶信息');
$table->string('room_title', 250)->nullable()->comment('房间标题');
$table->tinyInteger('room_keep')->default(0)->comment('是否保留');
$table->dateTime('room_time')->nullable()->comment('建立/最后时间');
$table->tinyInteger('room_tt')->default(0)->comment('相关开关');
$table->tinyInteger('room_html')->default(0)->comment('是否允许HTML');
$table->integer('room_exp')->default(0)->comment('所需经验');
$table->dateTime('build_time')->nullable()->comment('建立时间');
$table->tinyInteger('permit_level')->default(1)->comment('允许进入的最低等级');
$table->tinyInteger('door_open')->default(1)->comment('大门是否开启 (1开 0关)');
$table->integer('ooooo')->nullable()->comment('未知/扩展属性o5');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('rooms');
}
};

View File

@@ -1,30 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('audit_logs', function (Blueprint $table) {
$table->id();
$table->dateTime('occ_time')->nullable()->index()->comment('发生时间');
$table->text('occ_env')->nullable()->comment('发生环境/详情');
$table->tinyInteger('stype')->default(0)->comment('类别标识');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('audit_logs');
}
};

View File

@@ -1,37 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('guestbooks', function (Blueprint $table) {
$table->id();
$table->string('who', 50)->index()->comment('留言人');
$table->string('towho', 50)->nullable()->index()->comment('给谁留言');
$table->tinyInteger('secret')->default(0)->comment('是否悄悄话 (1是 0否)');
$table->string('ip', 50)->nullable()->comment('留言者IP');
$table->string('email', 250)->nullable()->comment('留言者邮箱');
$table->string('web', 250)->nullable()->comment('留言者网站');
$table->string('addr', 250)->nullable()->comment('留言者地址');
$table->dateTime('post_time')->nullable()->index()->comment('留言时间');
$table->string('text_title', 250)->nullable()->comment('留言标题');
$table->text('text_body')->nullable()->comment('留言内容');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('guestbooks');
}
};

View File

@@ -1,30 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('ip_locks', function (Blueprint $table) {
$table->id();
$table->string('ip', 20)->unique()->comment('封锁的IP');
$table->dateTime('end_time')->nullable()->comment('封禁结束时间');
$table->tinyInteger('act_level')->unsigned()->default(1)->comment('封禁级别');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ip_locks');
}
};

View File

@@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('messages', function (Blueprint $table) {
$table->id();
$table->integer('room_id')->index()->comment('房间ID');
$table->string('from_user', 50)->index()->comment('发送者');
$table->string('to_user', 50)->nullable()->index()->comment('接收者');
$table->text('content')->comment('消息内容');
$table->tinyInteger('is_secret')->default(0)->comment('是否私聊');
$table->string('font_color', 50)->nullable()->comment('字体颜色');
$table->string('action', 50)->nullable()->comment('动作');
$table->dateTime('sent_at')->useCurrent()->index()->comment('发送时间');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('messages');
}
};

View File

@@ -1,30 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('sys_params', function (Blueprint $table) {
$table->id();
$table->string('alias', 50)->unique()->comment('参数别名');
$table->text('guidetxt')->nullable()->comment('参数说明');
$table->text('body')->nullable()->comment('参数值');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('sys_params');
}
};

View File

@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('actions', function (Blueprint $table) {
$table->id();
$table->string('act_name', 50)->unique()->comment('动作名称');
$table->string('alias', 50)->nullable()->comment('动作别名');
$table->string('toall', 200)->nullable()->comment('对所有人表现');
$table->string('toself', 200)->nullable()->comment('对自己的表现');
$table->string('toother', 200)->nullable()->comment('对其他人的表现');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('actions');
}
};

View File

@@ -1,48 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('admin_logs', function (Blueprint $table) {
$table->id();
$table->string('username', 50)->index()->comment('管理员账号');
$table->integer('uu_level')->nullable()->comment('管理员等级');
$table->dateTime('in_time')->nullable()->comment('进入时间');
$table->integer('out_time')->nullable()->comment('离开时间');
$table->text('caozuo')->nullable()->comment('操作详情');
$table->integer('fs_sl')->default(0)->comment('封杀数量');
$table->text('fs_name')->nullable()->comment('封杀名单');
$table->integer('tr_sl')->default(0)->comment('踢人数量');
$table->text('tr_name')->nullable()->comment('踢人名单');
$table->integer('jg_sl')->default(0)->comment('警告数量');
$table->text('jg_name')->nullable()->comment('警告名单');
$table->integer('dj_sl')->default(0)->comment('冻结数量');
$table->text('dj_name')->nullable()->comment('冻结名单');
$table->integer('yjdj_sl')->default(0)->comment('永久冻结数量');
$table->text('yjdj_name')->nullable()->comment('永久冻结名单');
$table->integer('fip_sl')->default(0)->comment('封IP数量');
$table->text('fip_name')->nullable()->comment('封IP名单');
$table->integer('fjj_sl')->default(0)->comment('发奖金数量');
$table->integer('fjy_sl')->default(0)->comment('发经验数量');
$table->integer('flh_sl')->default(0)->comment('发老虎数量');
$table->dateTime('jl_time')->nullable()->index()->comment('记录时间');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('admin_logs');
}
};

View File

@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('friend_calls', function (Blueprint $table) {
$table->id();
$table->string('who', 50)->index()->comment('呼叫人');
$table->string('towho', 50)->index()->comment('被呼叫人');
$table->text('callmess')->nullable()->comment('呼叫信息');
$table->dateTime('calltime')->nullable()->index()->comment('呼叫时间');
$table->tinyInteger('read')->default(0)->comment('是否已读 (1是 0否)');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('friend_calls');
}
};

View File

@@ -1,30 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('friend_requests', function (Blueprint $table) {
$table->id();
$table->string('who', 50)->index()->comment('申请人');
$table->string('towho', 50)->index()->comment('被申请人');
$table->dateTime('sub_time')->nullable()->index()->comment('申请时间');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('friend_requests');
}
};

View File

@@ -1,30 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('ip_logs', function (Blueprint $table) {
$table->id();
$table->string('ip', 50)->index()->comment('登录IP');
$table->dateTime('sdate')->nullable()->index()->comment('登录时间');
$table->string('uuname', 50)->index()->comment('登录用户名');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ip_logs');
}
};

View File

@@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('marriages', function (Blueprint $table) {
$table->id();
$table->string('hyname', 50)->index()->comment('夫');
$table->string('hyname1', 50)->index()->comment('妻');
$table->dateTime('hytime')->nullable()->comment('结婚时间');
$table->string('hygb', 50)->nullable()->comment('婚姻状态/广播');
$table->string('hyjb', 50)->nullable()->comment('婚姻级别');
$table->integer('i')->nullable()->comment('亲密度/属性');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('marriages');
}
};

View File

@@ -1,29 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('room_descriptions', function (Blueprint $table) {
$table->id();
$table->string('alias', 10)->unique()->comment('房间别名关联');
$table->string('describ', 254)->nullable()->comment('房间详细描述文本');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('room_descriptions');
}
};

View File

@@ -1,30 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('scroll_ads', function (Blueprint $table) {
$table->id();
$table->string('ad_title', 250)->comment('广告/公告标题');
$table->string('ad_link', 250)->nullable()->comment('链接地址');
$table->tinyInteger('ad_new_flag')->default(0)->comment('新窗口打开标识 (1是 0否)');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('scroll_ads');
}
};

View File

@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('user_items', function (Blueprint $table) {
$table->id();
$table->string('name', 50)->index()->comment('使用者');
$table->dateTime('times')->nullable()->index()->comment('获得时间');
$table->text('gg')->nullable()->comment('道具类型/说明');
$table->integer('dayy')->nullable()->comment('道具天数/数量');
$table->string('lx', 50)->nullable()->comment('道具种类');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('user_items');
}
};

View File

@@ -1,34 +0,0 @@
<?php
/**
* 文件功能:为 rooms 表添加 visit_num人气/访问量)字段
* 用于记录房间的总访问人次,每次用户进入房间时递增
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* 添加 visit_num 字段到 rooms
*/
public function up(): void
{
Schema::table('rooms', function (Blueprint $table) {
$table->unsignedBigInteger('visit_num')->default(0)->after('ooooo')
->comment('房间人气(总访问人次)');
});
}
/**
* 回滚:移除 visit_num 字段
*/
public function down(): void
{
Schema::table('rooms', function (Blueprint $table) {
$table->dropColumn('visit_num');
});
}
};

View File

@@ -1,71 +0,0 @@
<?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');
}
};

View File

@@ -1,73 +0,0 @@
<?php
/**
* 文件功能创建自动动作事件表autoact
* 复刻原版 ASP 聊天室的 autoact
* 存储系统随机事件(好运/坏运/经验/金币奖惩等)
* 管理员可在后台增删改这些事件
*/
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
{
/**
* 创建 autoact 表并插入默认随机事件
*/
public function up(): void
{
Schema::create('autoact', function (Blueprint $table) {
$table->id();
$table->string('text_body', 500)->comment('事件文本内容(支持变量替换)');
$table->string('event_type', 20)->default('neutral')->comment('事件类型good=好运, bad=坏运, neutral=中性');
$table->integer('exp_change')->default(0)->comment('经验变化值(正=奖励, 负=惩罚)');
$table->integer('jjb_change')->default(0)->comment('金币变化值(正=奖励, 负=惩罚)');
$table->boolean('enabled')->default(true)->comment('是否启用');
$table->timestamps();
});
// 插入默认随机事件
$events = [
// 好运事件(奖励经验/金币)
['text_body' => '🎉 恭喜【{username}】路遇仙人指点,获得 100 经验值!', 'event_type' => 'good', 'exp_change' => 100, 'jjb_change' => 0],
['text_body' => '💰 【{username}】在路边捡到一袋金币,获得 500 金币!', 'event_type' => 'good', 'exp_change' => 0, 'jjb_change' => 500],
['text_body' => '🌟 天降祥瑞!【{username}】获得 200 经验 + 200 金币!', 'event_type' => 'good', 'exp_change' => 200, 'jjb_change' => 200],
['text_body' => '🎊 【{username}】参加武林大会获胜,奖励 300 经验!', 'event_type' => 'good', 'exp_change' => 300, 'jjb_change' => 0],
['text_body' => '🏆 【{username}】完成了一个神秘任务,获得 150 金币!', 'event_type' => 'good', 'exp_change' => 0, 'jjb_change' => 150],
['text_body' => '✨ 【{username}】领悟了一招绝学,经验暴增 500', 'event_type' => 'good', 'exp_change' => 500, 'jjb_change' => 0],
['text_body' => '🎁 系统随机赠送【{username}】100 金币,请查收!', 'event_type' => 'good', 'exp_change' => 0, 'jjb_change' => 100],
// 坏运事件(扣除经验/金币)
['text_body' => '💀 【{username}】不小心踩到陷阱,损失 50 经验!', 'event_type' => 'bad', 'exp_change' => -50, 'jjb_change' => 0],
['text_body' => '😱 【{username}】遭遇山贼打劫,被抢走 100 金币!', 'event_type' => 'bad', 'exp_change' => 0, 'jjb_change' => -100],
['text_body' => '🌧️ 【{username}】在雨中迷路,消耗 80 经验值。', 'event_type' => 'bad', 'exp_change' => -80, 'jjb_change' => 0],
['text_body' => '🐍 【{username}】被毒蛇咬了一口,损失 30 经验和 50 金币!', 'event_type' => 'bad', 'exp_change' => -30, 'jjb_change' => -50],
// 中性事件(纯文字,不奖惩)
['text_body' => '🔮 星海小博士:【{username}】今天运势不错,继续加油!', 'event_type' => 'neutral', 'exp_change' => 0, 'jjb_change' => 0],
['text_body' => '📜 星海小博士:有人说"坚持就是胜利",【{username}】觉得呢?', 'event_type' => 'neutral', 'exp_change' => 0, 'jjb_change' => 0],
['text_body' => '🌈 星海小博士:【{username}】今天心情如何?记得多喝水哦!', 'event_type' => 'neutral', 'exp_change' => 0, 'jjb_change' => 0],
['text_body' => '🎵 星海小博士:送给【{username}】一首歌,祝你天天开心!', 'event_type' => 'neutral', 'exp_change' => 0, 'jjb_change' => 0],
];
$now = now();
foreach ($events as &$event) {
$event['enabled'] = true;
$event['created_at'] = $now;
$event['updated_at'] = $now;
}
DB::table('autoact')->insert($events);
}
/**
* 回滚:删除 autoact
*/
public function down(): void
{
Schema::dropIfExists('autoact');
}
};

View File

@@ -1,33 +0,0 @@
<?php
/**
* 文件功能:为 rooms 表添加 announcement公告/祝福语)字段
* 有权限的用户可以设置房间公告,显示在聊天室顶部滚动条
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* 添加 announcement 字段
*/
public function up(): void
{
Schema::table('rooms', function (Blueprint $table) {
$table->string('announcement', 500)->nullable()->after('room_des')->comment('房间公告/祝福语(滚动显示)');
});
}
/**
* 回滚
*/
public function down(): void
{
Schema::table('rooms', function (Blueprint $table) {
$table->dropColumn('announcement');
});
}
};

View File

@@ -1,33 +0,0 @@
<?php
/**
* 文件功能:将 users 表的 s_color 字段从 integer 改为 varchar
* 以便直接存储 hex 颜色字符串(如 #ff0000与前端颜色选择器格式一致
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* 执行迁移s_color integer 改为 varchar(10)
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->string('s_color', 10)->nullable()->comment('发言颜色hex如 #ff0000')->change();
});
}
/**
* 回滚s_color varchar 改回 integer
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->integer('s_color')->nullable()->comment('发言颜色')->change();
});
}
};

View File

@@ -1,81 +0,0 @@
<?php
/**
* 文件功能:补充缺失的 sysparam 系统参数记录
* 代码中引用了多个参数但原始迁移只种子了 4 条,
* 此迁移使用 insertOrIgnore 补充缺失的参数配置
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* 补充缺失的系统参数记录(使用 insertOrIgnore 避免重复)
*/
public function up(): void
{
$now = now();
DB::table('sysparam')->insertOrIgnore([
[
'alias' => 'level_kick',
'body' => '10',
'guidetxt' => '踢人所需等级(管理员可在聊天室踢出用户的最低等级)',
'created_at' => $now,
'updated_at' => $now,
],
[
'alias' => 'level_mute',
'body' => '8',
'guidetxt' => '禁言所需等级(管理员可在聊天室禁言用户的最低等级)',
'created_at' => $now,
'updated_at' => $now,
],
[
'alias' => 'level_ban',
'body' => '12',
'guidetxt' => '封号所需等级(管理员可封禁用户账号的最低等级)',
'created_at' => $now,
'updated_at' => $now,
],
[
'alias' => 'level_banip',
'body' => '14',
'guidetxt' => '封IP所需等级管理员可封禁用户IP地址的最低等级',
'created_at' => $now,
'updated_at' => $now,
],
[
'alias' => 'level_announcement',
'body' => '10',
'guidetxt' => '设置公告所需等级(可修改房间公告/祝福语的最低等级)',
'created_at' => $now,
'updated_at' => $now,
],
[
'alias' => 'auto_event_chance',
'body' => '10',
'guidetxt' => '随机事件触发概率百分比1-100每次心跳时按此概率触发随机事件',
'created_at' => $now,
'updated_at' => $now,
],
]);
}
/**
* 回滚:删除补充的参数记录
*/
public function down(): void
{
DB::table('sysparam')->whereIn('alias', [
'level_kick',
'level_mute',
'level_ban',
'level_banip',
'level_announcement',
'auto_event_chance',
])->delete();
}
};

View File

@@ -1,95 +0,0 @@
<?php
/**
* 文件功能:将等级系统从 15 级扩展到 99
* - maxlevel: 15 99(用户最高等级)
* - superlevel: 16 100(管理员等级)
* - levelexp: 重新生成 99 级的经验阶梯
* - 管理权限等级按比例调整到新体系
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* 更新等级系统参数至 99 级体系
*/
public function up(): void
{
// 生成 99 级经验阶梯(使用 level^2.5 的幂次曲线,确保平滑递增)
$thresholds = [];
for ($level = 1; $level <= 99; $level++) {
// 公式10 * level^2.5,取整到十位数,保持数据整洁
$exp = (int) (ceil(10 * pow($level, 2.5) / 10) * 10);
$thresholds[] = $exp;
}
$levelExpStr = implode(',', $thresholds);
$now = now();
// 更新核心等级参数
DB::table('sysparam')->where('alias', 'maxlevel')
->update(['body' => '99', 'guidetxt' => '用户最高可达等级', 'updated_at' => $now]);
DB::table('sysparam')->where('alias', 'superlevel')
->update(['body' => '100', 'guidetxt' => '管理员级别(= 最高等级 + 1拥有最高权限的等级阈值', 'updated_at' => $now]);
DB::table('sysparam')->where('alias', 'levelexp')
->update(['body' => $levelExpStr, 'updated_at' => $now]);
// 按比例调整管理权限等级(原体系 /15新体系 /99
// 禁言8/15 ≈ 53% → 50级
DB::table('sysparam')->where('alias', 'level_mute')
->update(['body' => '50', 'updated_at' => $now]);
// 踢人10/15 ≈ 67% → 60级
DB::table('sysparam')->where('alias', 'level_kick')
->update(['body' => '60', 'updated_at' => $now]);
// 设公告10/15 ≈ 67% → 60级
DB::table('sysparam')->where('alias', 'level_announcement')
->update(['body' => '60', 'updated_at' => $now]);
// 封号12/15 = 80% → 80级
DB::table('sysparam')->where('alias', 'level_ban')
->update(['body' => '80', 'updated_at' => $now]);
// 封IP14/15 ≈ 93% → 90级
DB::table('sysparam')->where('alias', 'level_banip')
->update(['body' => '90', 'updated_at' => $now]);
}
/**
* 回滚:恢复到原始 15 级体系
*/
public function down(): void
{
$now = now();
DB::table('sysparam')->where('alias', 'maxlevel')
->update(['body' => '15', 'updated_at' => $now]);
DB::table('sysparam')->where('alias', 'superlevel')
->update(['body' => '16', 'updated_at' => $now]);
DB::table('sysparam')->where('alias', 'levelexp')
->update(['body' => '10,50,150,400,800,1500,3000,5000,8000,12000,18000,25000,35000,50000,80000', 'updated_at' => $now]);
DB::table('sysparam')->where('alias', 'level_mute')
->update(['body' => '8', 'updated_at' => $now]);
DB::table('sysparam')->where('alias', 'level_kick')
->update(['body' => '10', 'updated_at' => $now]);
DB::table('sysparam')->where('alias', 'level_announcement')
->update(['body' => '10', 'updated_at' => $now]);
DB::table('sysparam')->where('alias', 'level_ban')
->update(['body' => '12', 'updated_at' => $now]);
DB::table('sysparam')->where('alias', 'level_banip')
->update(['body' => '14', 'updated_at' => $now]);
}
};

View File

@@ -1,64 +0,0 @@
<?php
/**
* 文件功能:添加钓鱼系统参数到 sysparam
* 配置钓鱼花费金币、冷却时间、等待上钩时间范围
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* 插入钓鱼相关系统参数
*/
public function up(): void
{
$now = now();
DB::table('sysparam')->insertOrIgnore([
[
'alias' => 'fishing_cost',
'body' => '5',
'guidetxt' => '每次钓鱼花费金币数量',
'created_at' => $now,
'updated_at' => $now,
],
[
'alias' => 'fishing_cooldown',
'body' => '300',
'guidetxt' => '钓鱼冷却时间默认300秒=5分钟',
'created_at' => $now,
'updated_at' => $now,
],
[
'alias' => 'fishing_wait_min',
'body' => '8',
'guidetxt' => '钓鱼最短等待上钩时间(秒)',
'created_at' => $now,
'updated_at' => $now,
],
[
'alias' => 'fishing_wait_max',
'body' => '15',
'guidetxt' => '钓鱼最长等待上钩时间(秒)',
'created_at' => $now,
'updated_at' => $now,
],
]);
}
/**
* 回滚:删除钓鱼参数
*/
public function down(): void
{
DB::table('sysparam')->whereIn('alias', [
'fishing_cost',
'fishing_cooldown',
'fishing_wait_min',
'fishing_wait_max',
])->delete();
}
};

View File

@@ -1,129 +0,0 @@
<?php
/**
* 文件功能:创建 vip_levels 会员等级配置表
* 存储会员等级名称、图标、颜色、倍率、专属模板等配置
* 后台可完整 CRUD 管理
*/
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
{
/**
* 创建 vip_levels 表并填充默认数据
*/
public function up(): void
{
Schema::create('vip_levels', function (Blueprint $table) {
$table->id();
$table->string('name', 50)->comment('会员名称(如:白银会员)');
$table->string('icon', 20)->default('⭐')->comment('等级图标/emoji');
$table->string('color', 10)->default('#f59e0b')->comment('等级颜色hex');
$table->decimal('exp_multiplier', 3, 1)->default(1.0)->comment('经验倍率');
$table->decimal('jjb_multiplier', 3, 1)->default(1.0)->comment('金币倍率');
$table->text('join_templates')->nullable()->comment('进入聊天室专属欢迎语 JSON 数组');
$table->text('leave_templates')->nullable()->comment('离开聊天室专属提示语 JSON 数组');
$table->tinyInteger('sort_order')->default(0)->comment('排序(越大越高级)');
$table->integer('price')->default(0)->comment('赞助金额(元,供展示参考)');
$table->integer('duration_days')->default(30)->comment('有效天数0=永久)');
$table->timestamps();
});
// 默认种子数据(后台可随时修改/删除/新增)
$now = now();
DB::table('vip_levels')->insert([
[
'name' => '白银会员',
'icon' => '🥈',
'color' => '#94a3b8',
'exp_multiplier' => 1.5,
'jjb_multiplier' => 1.2,
'join_templates' => json_encode([
'白银贵宾{username}乘坐银色马车缓缓驶入,气质不凡!',
'白银贵宾{username}手持银色令牌,大步流星走了进来!',
], JSON_UNESCAPED_UNICODE),
'leave_templates' => json_encode([
'白银贵宾{username}挥了挥手,潇洒离去',
'白银贵宾{username}骑着银色骏马飘然而去',
], JSON_UNESCAPED_UNICODE),
'sort_order' => 1,
'price' => 10,
'duration_days' => 30,
'created_at' => $now,
'updated_at' => $now,
],
[
'name' => '黄金会员',
'icon' => '🥇',
'color' => '#f59e0b',
'exp_multiplier' => 2.0,
'jjb_multiplier' => 1.5,
'join_templates' => json_encode([
'黄金贵宾{username}踩着金光闪闪的地毯,王者归来!',
'黄金贵宾{username}开着金色豪车呼啸而至,全场瞩目!',
], JSON_UNESCAPED_UNICODE),
'leave_templates' => json_encode([
'黄金贵宾{username}乘金色祥云腾空而去,霸气侧漏!',
'黄金贵宾{username}微微拱手,金光一闪消失不见',
], JSON_UNESCAPED_UNICODE),
'sort_order' => 2,
'price' => 30,
'duration_days' => 30,
'created_at' => $now,
'updated_at' => $now,
],
[
'name' => '钻石会员',
'icon' => '💎',
'color' => '#3b82f6',
'exp_multiplier' => 3.0,
'jjb_multiplier' => 2.0,
'join_templates' => json_encode([
'钻石贵宾{username}踏着星辰大海从天而降,万众敬仰!',
'钻石贵宾{username}驾驭钻石巨龙破空而来,威震四方!',
], JSON_UNESCAPED_UNICODE),
'leave_templates' => json_encode([
'钻石贵宾{username}化作一道星光冲天而去,令人叹服!',
'钻石贵宾{username}乘坐钻石飞船消失在银河尽头',
], JSON_UNESCAPED_UNICODE),
'sort_order' => 3,
'price' => 50,
'duration_days' => 30,
'created_at' => $now,
'updated_at' => $now,
],
[
'name' => '至尊会员',
'icon' => '👑',
'color' => '#a855f7',
'exp_multiplier' => 5.0,
'jjb_multiplier' => 3.0,
'join_templates' => json_encode([
'👑至尊{username}御驾亲临!九天雷鸣,万物俯首!众卿接驾!',
'👑至尊{username}脚踏七彩祥云,身披紫金龙袍,驾临此地!天地为之变色!',
], JSON_UNESCAPED_UNICODE),
'leave_templates' => json_encode([
'👑至尊{username}龙袍一甩,紫气东来,瞬间消失在九天之上!',
'👑至尊{username}御驾回宫,百鸟齐鸣相送!',
], JSON_UNESCAPED_UNICODE),
'sort_order' => 4,
'price' => 100,
'duration_days' => 30,
'created_at' => $now,
'updated_at' => $now,
],
]);
}
/**
* 回滚:删除 vip_levels
*/
public function down(): void
{
Schema::dropIfExists('vip_levels');
}
};

View File

@@ -1,38 +0,0 @@
<?php
/**
* 文件功能:在 users 表添加 vip_level_id 外键
* 关联 vip_levels 表,标识用户的会员等级
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* 添加 vip_level_id 字段(如果不存在)并建立外键
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
// 列可能已在之前失败的迁移中创建,仅在不存在时添加
if (! Schema::hasColumn('users', 'vip_level_id')) {
$table->unsignedBigInteger('vip_level_id')->nullable()->after('huiyuan')->comment('会员等级ID');
}
$table->foreign('vip_level_id')->references('id')->on('vip_levels')->nullOnDelete();
});
}
/**
* 回滚:删除 vip_level_id 字段
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropForeign(['vip_level_id']);
$table->dropColumn('vip_level_id');
});
}
};

View File

@@ -1,70 +0,0 @@
<?php
/**
* 文件功能:创建 AI 厂商配置表和 AI 使用日志表
*
* ai_provider_configs 存储多个 AI 厂商的 API 配置(密钥、端点、模型等)
* ai_usage_logs 记录每次 AI 接口调用的 token 消耗和响应信息
*
* @author ChatRoom Laravel
*
* @version 1.0.0
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* 执行迁移:创建 AI 相关的两张数据表
*/
public function up(): void
{
// AI 厂商配置表
Schema::create('ai_provider_configs', function (Blueprint $table) {
$table->id();
$table->string('provider', 50)->index()->comment('厂商标识(如 deepseek, qwen, openai');
$table->string('name', 100)->comment('厂商显示名称');
$table->text('api_key')->comment('API Key加密存储');
$table->string('api_endpoint', 255)->comment('API 端点地址');
$table->string('model', 100)->comment('使用的模型名称');
$table->decimal('temperature', 3, 2)->default(0.30)->comment('温度参数');
$table->integer('max_tokens')->default(2048)->comment('最大 Token 数');
$table->boolean('is_enabled')->default(true)->index()->comment('是否启用');
$table->boolean('is_default')->default(false)->comment('是否为默认厂商');
$table->integer('sort_order')->default(0)->comment('排序(故障转移时按此顺序)');
$table->timestamps();
});
// AI 使用日志表
Schema::create('ai_usage_logs', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete()->comment('使用者');
$table->string('provider', 50)->comment('AI 厂商标识');
$table->string('model', 100)->comment('使用的模型');
$table->string('action', 50)->default('chatbot')->comment('操作类型');
$table->integer('prompt_tokens')->default(0)->comment('输入 Token 数');
$table->integer('completion_tokens')->default(0)->comment('输出 Token 数');
$table->integer('total_tokens')->default(0)->comment('总 Token 数');
$table->decimal('cost', 10, 6)->default(0)->comment('费用');
$table->integer('response_time_ms')->default(0)->comment('响应时间(毫秒)');
$table->boolean('success')->default(true)->comment('是否成功');
$table->text('error_message')->nullable()->comment('错误信息');
$table->timestamps();
// 索引
$table->index(['provider', 'created_at']);
});
}
/**
* 回滚迁移:删除 AI 相关的两张数据表
*/
public function down(): void
{
Schema::dropIfExists('ai_usage_logs');
Schema::dropIfExists('ai_provider_configs');
}
};

View File

@@ -1,49 +0,0 @@
<?php
/**
* 文件功能:补充警告(level_warn)和冻结(level_freeze)所需等级的系统参数
*
* 使管理员各操作均有独立的等级门槛配置。
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* 插入警告和冻结等级参数
*/
public function up(): void
{
$now = now();
DB::table('sysparam')->insertOrIgnore([
[
'alias' => 'level_warn',
'body' => '5',
'guidetxt' => '警告所需等级(管理员可在聊天室警告用户的最低等级)',
'created_at' => $now,
'updated_at' => $now,
],
[
'alias' => 'level_freeze',
'body' => '14',
'guidetxt' => '冻结账号所需等级(管理员可冻结用户账号的最低等级)',
'created_at' => $now,
'updated_at' => $now,
],
]);
}
/**
* 回滚:删除补充的参数记录
*/
public function down(): void
{
DB::table('sysparam')->whereIn('alias', [
'level_warn',
'level_freeze',
])->delete();
}
};

View File

@@ -1,51 +0,0 @@
<?php
/**
* 文件功能为用户表添加缺失的字段sign、question、answer
*
* 用于个性签名和密码保护问题功能。
* 使用 hasColumn 检查避免重复添加。
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* 添加 sign、question、answer 字段(已存在则跳过)
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
if (! Schema::hasColumn('users', 'sign')) {
$table->string('sign', 255)->nullable()->after('sex')->comment('个性签名');
}
if (! Schema::hasColumn('users', 'question')) {
$table->string('question', 100)->nullable()->after('email')->comment('密保问题');
}
if (! Schema::hasColumn('users', 'answer')) {
$table->string('answer', 100)->nullable()->after('question')->comment('密保答案');
}
});
}
/**
* 回滚:删除字段
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$columns = [];
foreach (['sign', 'question', 'answer'] as $col) {
if (Schema::hasColumn('users', $col)) {
$columns[] = $col;
}
}
if ($columns) {
$table->dropColumn($columns);
}
});
}
};

View File

@@ -1,33 +0,0 @@
<?php
/**
* 文件功能:将 users 表中 usersf头像文件名的大写后缀 .GIF 全部转为小写 .gif
*
* 统一文件名大小写,避免 Linux 服务器上因大小写敏感导致图片加载失败。
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* usersf 列中的 .GIF 后缀转为 .gif
*/
public function up(): void
{
DB::table('users')
->where('usersf', 'LIKE', '%.GIF')
->update(['usersf' => DB::raw("REPLACE(usersf, '.GIF', '.gif')")]);
}
/**
* 回滚:将 .gif 转回 .GIF
*/
public function down(): void
{
DB::table('users')
->where('usersf', 'LIKE', '%.gif')
->update(['usersf' => DB::raw("REPLACE(usersf, '.gif', '.GIF')")]);
}
};

View File

@@ -1,42 +0,0 @@
<?php
/**
* 文件功能:向 sysparam 表插入排行榜显示人数配置项
*
* 新增 leaderboard_limit 参数,后台可动态配置排行榜每个榜单显示人数。
*
* @author ChatRoom Laravel
*
* @version 1.0.0
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* 插入排行榜显示人数配置记录
*/
public function up(): void
{
// 避免重复插入
$exists = DB::table('sysparam')->where('alias', 'leaderboard_limit')->exists();
if (! $exists) {
DB::table('sysparam')->insert([
'alias' => 'leaderboard_limit',
'body' => '20',
'guidetxt' => '🏆 排行榜每榜显示人数',
]);
}
}
/**
* 回滚:删除配置记录
*/
public function down(): void
{
DB::table('sysparam')->where('alias', 'leaderboard_limit')->delete();
}
};

View File

@@ -1,50 +0,0 @@
<?php
/**
* 文件功能:向 sysparam 表插入金币奖励和经验奖励相关配置项
*
* 新增 jjb_per_heartbeat每次心跳金币奖励配置
* 并更新 exp_per_heartbeat 的描述以说明支持范围格式。
*
* @author ChatRoom Laravel
*
* @version 1.0.0
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* 插入金币奖励配置记录,更新经验描述
*/
public function up(): void
{
// 金币奖励配置默认0=关闭,可设为 "1" 或 "1-5" 范围格式)
if (! DB::table('sysparam')->where('alias', 'jjb_per_heartbeat')->exists()) {
DB::table('sysparam')->insert([
'alias' => 'jjb_per_heartbeat',
'body' => '1-3',
'guidetxt' => '💰 每次心跳金币奖励(支持固定值如"1",或范围如"1-5"设为0关闭',
]);
}
// 更新经验配置描述(说明支持范围格式)
DB::table('sysparam')
->where('alias', 'exp_per_heartbeat')
->update(['guidetxt' => '⚡ 每次心跳经验奖励(支持固定值如"1",或范围如"1-10"设为0关闭']);
}
/**
* 回滚:删除金币配置记录
*/
public function down(): void
{
DB::table('sysparam')->where('alias', 'jjb_per_heartbeat')->delete();
DB::table('sysparam')
->where('alias', 'exp_per_heartbeat')
->update(['guidetxt' => '每次心跳经验值']);
}
};

View File

@@ -1,57 +0,0 @@
<?php
/**
* 文件功能:创建 gifts 礼物表并填充默认鲜花数据
*
* 礼物系统支持后台管理多种花/礼物类型,每种有不同的金币消耗和魅力增量。
* 图片存放在 public/images/gifts/ 目录下。
*
* @author ChatRoom Laravel
*
* @version 1.0.0
*/
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
{
/**
* 创建 gifts 表并填充默认礼物数据
*/
public function up(): void
{
Schema::create('gifts', function (Blueprint $table) {
$table->id();
$table->string('name', 50)->comment('礼物名称');
$table->string('emoji', 10)->comment('显示图标/emoji');
$table->string('image', 100)->nullable()->comment('礼物图片路径(相对 /images/gifts/');
$table->unsignedInteger('cost')->default(0)->comment('消耗金币数');
$table->unsignedInteger('charm')->default(1)->comment('增加魅力值');
$table->unsignedTinyInteger('sort_order')->default(0)->comment('排序(越小越靠前)');
$table->boolean('is_active')->default(true)->comment('是否启用');
$table->timestamps();
});
// 填充默认鲜花数据(图片文件名与 sort_order 对应)
DB::table('gifts')->insert([
['name' => '小雏菊', 'emoji' => '🌼', 'image' => 'daisy.png', 'cost' => 5, 'charm' => 1, 'sort_order' => 1, 'is_active' => true, 'created_at' => now(), 'updated_at' => now()],
['name' => '玫瑰花', 'emoji' => '🌹', 'image' => 'rose.png', 'cost' => 10, 'charm' => 2, 'sort_order' => 2, 'is_active' => true, 'created_at' => now(), 'updated_at' => now()],
['name' => '向日葵', 'emoji' => '🌻', 'image' => 'sunflower.png', 'cost' => 20, 'charm' => 5, 'sort_order' => 3, 'is_active' => true, 'created_at' => now(), 'updated_at' => now()],
['name' => '樱花束', 'emoji' => '🌸', 'image' => 'sakura.png', 'cost' => 50, 'charm' => 12, 'sort_order' => 4, 'is_active' => true, 'created_at' => now(), 'updated_at' => now()],
['name' => '满天星', 'emoji' => '💐', 'image' => 'bouquet.png', 'cost' => 100, 'charm' => 30, 'sort_order' => 5, 'is_active' => true, 'created_at' => now(), 'updated_at' => now()],
['name' => '蓝色妖姬', 'emoji' => '🪻', 'image' => 'bluerose.png', 'cost' => 200, 'charm' => 66, 'sort_order' => 6, 'is_active' => true, 'created_at' => now(), 'updated_at' => now()],
['name' => '钻石花冠', 'emoji' => '👑', 'image' => 'crown.png', 'cost' => 520, 'charm' => 188, 'sort_order' => 7, 'is_active' => true, 'created_at' => now(), 'updated_at' => now()],
]);
}
/**
* 回滚:删除 gifts
*/
public function down(): void
{
Schema::dropIfExists('gifts');
}
};

View File

@@ -1,50 +0,0 @@
<?php
/**
* 文件功能:填充聊天魅力值相关的系统参数
*
* 包括:异性聊天魅力值、同性聊天魅力值、每小时魅力上限
*
* @author ChatRoom Laravel
* @version 1.0.0
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* 插入聊天魅力相关的 sysparam 配置项
*/
public function up(): void
{
DB::table('sysparam')->insert([
[
'alias' => 'charm_cross_sex',
'body' => '2',
'guidetxt' => '异性聊天每条消息增加的魅力值(男→女 或 女→男)',
],
[
'alias' => 'charm_same_sex',
'body' => '1',
'guidetxt' => '同性聊天每条消息增加的魅力值(男→男 或 女→女)',
],
[
'alias' => 'charm_hourly_limit',
'body' => '20',
'guidetxt' => '每小时通过聊天获取的魅力值上限(防刷屏)',
],
]);
}
/**
* 回滚:删除聊天魅力相关配置
*/
public function down(): void
{
DB::table('sysparam')
->whereIn('alias', ['charm_cross_sex', 'charm_same_sex', 'charm_hourly_limit'])
->delete();
}
};