feat: 增强管理员 API 鉴权,新增 token 有效天数配置,更新相关异常处理与错误码引用

This commit is contained in:
2026-05-09 11:26:39 +08:00
parent 8a70c029f6
commit f1b38ef421
13 changed files with 124 additions and 42 deletions

View File

@@ -1,5 +1,6 @@
<?php
use App\Lottery\ErrorCode;
use App\Models\Player;
use App\Models\PlayerWallet;
use Illuminate\Foundation\Testing\RefreshDatabase;
@@ -22,7 +23,7 @@ test('wallet balance creates lottery wallet row and returns zeros', function ()
])->getJson('/api/v1/wallet/balance');
$response->assertOk()
->assertJsonPath('code', 0)
->assertJsonPath('code', ErrorCode::Success->value)
->assertJsonPath('data.balance', 0)
->assertJsonPath('data.frozen_balance', 0)
->assertJsonPath('data.currency_code', 'NPR')
@@ -45,5 +46,5 @@ test('wallet balance rejects illegal currency query', function () {
$this->withHeader('Authorization', 'Bearer dev:'.$player->id)
->getJson('/api/v1/wallet/balance?currency=!!')
->assertStatus(400)
->assertJsonPath('code', 1005);
->assertJsonPath('code', ErrorCode::WalletInvalidCurrency->value);
});