feat: 增强环境配置与开发服务,支持局域网访问及币种管理

This commit is contained in:
2026-05-21 16:24:41 +08:00
parent 699d43fbd4
commit 7a6048de10
60 changed files with 1321 additions and 443 deletions

View File

@@ -0,0 +1,41 @@
<?php
use App\Models\Currency;
use App\Lottery\ErrorCode;
use Database\Seeders\CurrencySeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
beforeEach(function (): void {
$this->seed(CurrencySeeder::class);
});
test('public currency index returns enabled currencies with decimal places', function () {
Currency::query()->create([
'code' => 'JPY',
'name' => 'Japanese Yen',
'decimal_places' => 0,
'is_enabled' => true,
'is_bettable' => false,
]);
Currency::query()->create([
'code' => 'TEST',
'name' => 'Disabled Currency',
'decimal_places' => 4,
'is_enabled' => false,
'is_bettable' => false,
]);
$response = $this->getJson('/api/v1/currencies');
$response->assertOk()
->assertJsonPath('code', ErrorCode::Success->value)
->assertJsonCount(3, 'data.items')
->assertJsonPath('data.items.0.code', 'NPR')
->assertJsonPath('data.items.0.decimal_places', 2)
->assertJsonPath('data.items.1.code', 'JPY')
->assertJsonPath('data.items.1.decimal_places', 0)
->assertJsonPath('data.items.2.code', 'USD');
});