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

@@ -3,10 +3,15 @@
use App\Models\Player;
use App\Lottery\ErrorCode;
use App\Models\PlayerWallet;
use Database\Seeders\CurrencySeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
beforeEach(function (): void {
$this->seed(CurrencySeeder::class);
});
test('wallet balance creates lottery wallet row and returns zeros', function () {
$player = Player::query()->create([
'site_code' => 'test',
@@ -49,3 +54,19 @@ test('wallet balance rejects illegal currency query', function () {
->assertStatus(400)
->assertJsonPath('code', ErrorCode::WalletInvalidCurrency->value);
});
test('wallet balance rejects currency that is not configured or disabled', function () {
$player = Player::query()->create([
'site_code' => 'test',
'site_player_id' => 'p3',
'username' => null,
'nickname' => null,
'default_currency' => 'NPR',
'status' => 0,
]);
$this->withHeader('Authorization', 'Bearer dev:'.$player->id)
->getJson('/api/v1/wallet/balance?currency=ABC')
->assertStatus(400)
->assertJsonPath('code', ErrorCode::WalletInvalidCurrency->value);
});