- 在多个控制器中更新玩家相关数据的查询,新增 'nickname' 字段以增强玩家信息的完整性。 - 在 AdminDashboardSnapshotBuilder 中引入平台风险统计,提供锁定金额和使用百分比的概览。 - 更新 AdminReportQueryService 以返回更详细的统计数据,包括总投注、总中奖和总派彩金额。 - 增强测试用例以验证新增字段和统计功能的准确性。
57 lines
2.2 KiB
PHP
57 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api\V1\Admin\Settlement;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Support\AdminApiList;
|
|
use App\Models\SettlementBatch;
|
|
use Illuminate\Http\JsonResponse;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\TicketSettlementDetail;
|
|
|
|
/**
|
|
* GET /api/v1/admin/settlement-batches/{batch}/details — 该批次下注单结算明细分页。
|
|
*/
|
|
final class AdminSettlementBatchDetailsController extends Controller
|
|
{
|
|
public function __invoke(Request $request, SettlementBatch $batch): JsonResponse
|
|
{
|
|
$p = AdminApiList::readPaging($request);
|
|
|
|
$paginator = TicketSettlementDetail::query()
|
|
->where('settlement_batch_id', $batch->id)
|
|
->with([
|
|
'ticketItem:id,ticket_no,play_code,player_id',
|
|
'ticketItem.player:id,site_code,username,nickname,site_player_id',
|
|
'ticketItem.order:id,currency_code',
|
|
])
|
|
->orderBy('id')
|
|
->paginate($p['perPage'], ['*'], 'page', $p['page']);
|
|
|
|
return AdminApiList::jsonWith($paginator, function ($row) {
|
|
/** @var TicketSettlementDetail $row */
|
|
$item = $row->ticketItem;
|
|
$player = $item?->player;
|
|
$order = $item?->order;
|
|
|
|
return [
|
|
'id' => (int) $row->id,
|
|
'ticket_item_id' => (int) $row->ticket_item_id,
|
|
'ticket_no' => $item?->ticket_no,
|
|
'play_code' => $item?->play_code,
|
|
'currency_code' => $order?->currency_code,
|
|
'player_id' => $item?->player_id,
|
|
'site_code' => $player?->site_code,
|
|
'site_player_id' => $player?->site_player_id,
|
|
'username' => $player?->username,
|
|
'nickname' => $player?->nickname,
|
|
'matched_prize_tier' => $row->matched_prize_tier,
|
|
'win_amount' => (int) $row->win_amount,
|
|
'jackpot_allocation_amount' => (int) $row->jackpot_allocation_amount,
|
|
'match_detail_json' => $row->match_detail_json,
|
|
'created_at' => $row->created_at?->toIso8601String(),
|
|
];
|
|
}, ['batch_id' => (int) $batch->id]);
|
|
}
|
|
}
|