完善猜成语过期与答题记录逻辑

This commit is contained in:
pllx
2026-04-29 10:32:12 +08:00
parent 2f9b2eed64
commit 5962d6d2b3
11 changed files with 685 additions and 115 deletions
+5 -2
View File
@@ -184,6 +184,10 @@ Schedule::call(function () {
return;
}
// 先统一结算超时回合,避免旧题长期占用进行中状态。
$roomId = 1;
app(\App\Services\IdiomGameService::class)->expireActiveRoundsForRoom($roomId);
$config = \App\Models\GameConfig::forGame('idiom')?->params ?? [];
$interval = (int) ($config['auto_start_interval'] ?? 0);
if ($interval <= 0) {
@@ -191,7 +195,6 @@ Schedule::call(function () {
}
// 检查每个房间是否有进行中的回合(先只处理 1 号房间)
$roomId = 1;
$activeRound = \App\Models\IdiomGameRound::where('room_id', $roomId)
->whereIn('status', ['pending', 'active'])
->first();
@@ -219,7 +222,7 @@ Schedule::call(function () {
$rewardGold = (int) ($config['reward_gold'] ?? 50);
$rewardExp = (int) ($config['reward_exp'] ?? 30);
// 创建新回合
// 创建新回合,并以 started_at 作为后续过期判断起点。
$round = \App\Models\IdiomGameRound::create([
'room_id' => $roomId,
'idiom_id' => $idiom->id,