feat(wallet): 增强资金流水和信用账本的公共类型过滤,支持游戏结算和账单结算
This commit is contained in:
@@ -36,6 +36,16 @@ final class WalletTransactionListController extends Controller
|
||||
|
||||
private const ALLOWED_STATUS = ['posted', 'pending_reconcile', 'reversed'];
|
||||
|
||||
/** 后台筛选兼容玩家端资金流水公共类型,也接受底层 biz_type。 */
|
||||
private const PUBLIC_BIZ_TYPE_MAP = [
|
||||
'transfer_in' => ['transfer_in'],
|
||||
'transfer_out' => ['transfer_out'],
|
||||
'refund' => ['transfer_out_refund'],
|
||||
'reversal' => ['reversal', 'bet_reverse'],
|
||||
'bet' => ['bet_deduct', 'bet'],
|
||||
'prize' => ['settle_payout', 'prize', 'jackpot_manual_payout'],
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
private readonly PlayerLedgerLogsService $ledgerLogs,
|
||||
) {}
|
||||
@@ -101,7 +111,16 @@ final class WalletTransactionListController extends Controller
|
||||
}
|
||||
|
||||
if (! empty($validated['biz_type'])) {
|
||||
$query->where('biz_type', trim((string) $validated['biz_type']));
|
||||
$bizTypes = $this->resolveBizTypeFilter((string) $validated['biz_type']);
|
||||
if ($bizTypes === []) {
|
||||
return ApiResponse::success([
|
||||
'items' => [],
|
||||
'total' => 0,
|
||||
'page' => $page,
|
||||
'per_page' => $perPage,
|
||||
]);
|
||||
}
|
||||
$query->whereIn('biz_type', $bizTypes);
|
||||
}
|
||||
|
||||
if ($request->boolean('abnormal')) {
|
||||
@@ -167,4 +186,25 @@ final class WalletTransactionListController extends Controller
|
||||
'auth_source' => $p?->auth_source,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
private function resolveBizTypeFilter(string $raw): array
|
||||
{
|
||||
$parts = array_filter(array_map('trim', explode(',', $raw)));
|
||||
if ($parts === []) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$resolved = [];
|
||||
foreach ($parts as $part) {
|
||||
$key = strtolower($part);
|
||||
foreach (self::PUBLIC_BIZ_TYPE_MAP[$key] ?? [$key] as $bizType) {
|
||||
$resolved[] = $bizType;
|
||||
}
|
||||
}
|
||||
|
||||
return array_values(array_unique($resolved));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user