新增:双色球彩票后台管理(阶段三)
🎛️ 后台游戏配置页 - lottery 参数标签完整配置(14个参数分组展示) 开奖时间/购票限制/奖池分配/固定小奖/超级期 - 双色球专属手动操作区(仿神秘箱子风格) ✅ 当前期次状态展示(实时加载) ✅ 手动开新期(含确认弹窗) ✅ 强制立即开奖(含二次确认防误触) 🔌 后台接口 - POST /admin/lottery/open-issue 手动开期 - POST /admin/lottery/force-draw 强制开奖 - GameConfigController 新增两个 JsonResponse 方法 📋 全局开关 - 与所有现有游戏一致,后台 toggle 即时生效(60s缓存刷新) - 默认关闭,管理员开启后调度器自动接管
This commit is contained in:
@@ -15,6 +15,8 @@ namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\GameConfig;
|
||||
use App\Models\LotteryIssue;
|
||||
use App\Services\LotteryService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -97,8 +99,51 @@ class GameConfigController extends Controller
|
||||
$typeNames = ['normal' => '普通箱', 'rare' => '稀有箱', 'trap' => '黑化箱'];
|
||||
|
||||
return response()->json([
|
||||
'ok' => true,
|
||||
'ok' => true,
|
||||
'message' => "✅ 已投放「{$typeNames[$boxType]}」到 #1 房间,暗号将实时发送到公屏!",
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动开启新一期双色球彩票。
|
||||
*
|
||||
* 仅在当前无进行中期次时生效,防止重复开期。
|
||||
*/
|
||||
public function openLotteryIssue(): JsonResponse
|
||||
{
|
||||
if (! GameConfig::isEnabled('lottery')) {
|
||||
return response()->json(['ok' => false, 'message' => '双色球彩票未开启,请先开启游戏。']);
|
||||
}
|
||||
|
||||
if (LotteryIssue::currentIssue()) {
|
||||
return response()->json(['ok' => false, 'message' => '当前已有进行中的期次,无需重复开期。']);
|
||||
}
|
||||
|
||||
\App\Jobs\OpenLotteryIssueJob::dispatch();
|
||||
|
||||
return response()->json(['ok' => true, 'message' => '✅ 已排队开期任务,新期次将就绪建立!']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员强制立即开奖(测试专用)。
|
||||
*
|
||||
* 将当前 open 或 closed 期次直接投入开奖队列。
|
||||
*/
|
||||
public function forceLotteryDraw(LotteryService $lottery): JsonResponse
|
||||
{
|
||||
$issue = LotteryIssue::query()
|
||||
->whereIn('status', ['open', 'closed'])
|
||||
->latest()
|
||||
->first();
|
||||
|
||||
if (! $issue) {
|
||||
return response()->json(['ok' => false, 'message' => '当前无可开奖的期次。']);
|
||||
}
|
||||
|
||||
// 强制将状态改为 closed
|
||||
$issue->update(['status' => 'closed']);
|
||||
\App\Jobs\DrawLotteryJob::dispatch($issue->fresh());
|
||||
|
||||
return response()->json(['ok' => true, 'message' => "✅ 开奖任务已入队,第 {$issue->issue_no} 期将就绪开奖!"]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user