新增老虎机游戏:①slot_machine_logs表+模型(8种权重图案/判奖) ②SlotMachineController(扣费/随机/赔付/诅咒/三7全服广播) ③前台面板(三列滚轮动画/逐列停止/赔率说明/历史记录) ④CurrencySource三个枚举
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 文件功能:老虎机游戏记录表迁移
|
||||
*
|
||||
* 每次转动老虎机产生一条记录,包含三列图案、结果类型、赔付金额。
|
||||
*/
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* 创建 slot_machine_logs 表。
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('slot_machine_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('user_id')->comment('玩家 ID');
|
||||
$table->string('reel1', 10)->comment('第一列图案 key');
|
||||
$table->string('reel2', 10)->comment('第二列图案 key');
|
||||
$table->string('reel3', 10)->comment('第三列图案 key');
|
||||
$table->enum('result_type', ['jackpot', 'triple_gem', 'triple', 'pair', 'curse', 'miss'])
|
||||
->comment('结果类型');
|
||||
$table->unsignedInteger('cost')->comment('消耗金币');
|
||||
$table->integer('payout')->default(0)->comment('净赔付金额(正=赢,负=输)');
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_id', 'created_at']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 回滚迁移。
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('slot_machine_logs');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user