feat: 更新玩法配置管理,简化字段并增强功能

- 将玩法相关的显示名称字段统一为 `display_name`,移除多语言字段。
- 在 `PlayTypePatchController` 中新增即时切换玩法开关的功能,并推送大厅更新。
- 优化多个控制器和服务中的权限检查与数据处理逻辑,提升代码可读性与维护性。
This commit is contained in:
2026-05-25 14:34:24 +08:00
parent 270d2e9af1
commit e27a00f260
74 changed files with 4469 additions and 280 deletions

View File

@@ -0,0 +1,45 @@
<?php
use App\Models\AuditLog;
use App\Models\AdminUser;
use App\Models\Draw;
use App\Lottery\DrawStatus;
use Illuminate\Support\Facades\Hash;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
test('admin api audit middleware records draw reopen', function (): void {
$admin = AdminUser::query()->create([
'username' => 'audit_reopen_admin',
'name' => 'Audit Reopen',
'email' => null,
'password' => Hash::make('secret-strong'),
'status' => 0,
]);
grantSuperAdminRole($admin);
$token = $admin->createToken('test', ['*'], now()->addDay())->plainTextToken;
$draw = Draw::query()->create([
'draw_no' => '20260525-099',
'business_date' => '2026-05-25',
'sequence_no' => 99,
'status' => DrawStatus::Cooldown->value,
'cooling_end_time' => now()->addMinutes(10),
'settle_version' => 0,
]);
$before = AuditLog::query()->count();
$this->withHeader('Authorization', 'Bearer '.$token)
->postJson("/api/v1/admin/draws/{$draw->id}/reopen", ['reason' => 'audit test'])
->assertOk();
expect(AuditLog::query()->count())->toBe($before + 1);
/** @var AuditLog $row */
$row = AuditLog::query()->latest('id')->first();
expect($row->module_code)->toBe('draw')
->and($row->action_code)->toBe('reopen')
->and($row->operator_id)->toBe($admin->id);
});