feat(core): harden sessions settlement and credit activity
This commit is contained in:
@@ -3,17 +3,18 @@
|
||||
namespace App\Http\Controllers\Api\V1\Admin\Draw;
|
||||
|
||||
use App\Models\Draw;
|
||||
use App\Models\AdminUser;
|
||||
use App\Lottery\ErrorCode;
|
||||
use App\Models\TicketItem;
|
||||
use App\Models\TicketOrder;
|
||||
use App\Models\AdminUser;
|
||||
use App\Support\ApiMessage;
|
||||
use App\Support\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\SettlementBatch;
|
||||
use App\Support\AdminScopePolicy;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Lottery\ErrorCode;
|
||||
use App\Support\AdminDrawResponsePolicy;
|
||||
use App\Support\AdminScopePolicy;
|
||||
use App\Support\ApiMessage;
|
||||
|
||||
/**
|
||||
* GET /api/v1/admin/draws/{draw}/finance-summary — 单期投注/派彩汇总(客服/财务视角,PRD §15.4)。
|
||||
@@ -22,7 +23,7 @@ use App\Support\ApiMessage;
|
||||
*/
|
||||
final class AdminDrawFinanceSummaryController extends Controller
|
||||
{
|
||||
public function __invoke(\Illuminate\Http\Request $request, Draw $draw): JsonResponse
|
||||
public function __invoke(Request $request, Draw $draw): JsonResponse
|
||||
{
|
||||
$admin = $request->lotteryAdmin();
|
||||
abort_if(! $admin instanceof AdminUser, 401);
|
||||
@@ -58,14 +59,19 @@ final class AdminDrawFinanceSummaryController extends Controller
|
||||
$approxHouseGrossMinor = $totalBetMinor - $totalPayoutMinor;
|
||||
|
||||
$batches = SettlementBatch::query()
|
||||
->with('resultBatch:id,provider_code,provider_name,result_version')
|
||||
->where('draw_id', $drawId)
|
||||
->orderByDesc('id')
|
||||
->limit(30)
|
||||
->get(['id', 'status', 'total_ticket_count', 'total_win_count', 'total_payout_amount', 'total_jackpot_payout_amount', 'finished_at']);
|
||||
->get(['id', 'result_batch_id', 'settle_version', 'status', 'total_ticket_count', 'total_win_count', 'total_payout_amount', 'total_jackpot_payout_amount', 'finished_at']);
|
||||
|
||||
$batchRows = $batches->map(static function (SettlementBatch $b): array {
|
||||
return [
|
||||
'id' => (int) $b->id,
|
||||
'provider_code' => $b->resultBatch?->provider_code,
|
||||
'provider_name' => $b->resultBatch?->provider_name,
|
||||
'result_version' => $b->resultBatch !== null ? (int) $b->resultBatch->result_version : null,
|
||||
'settle_version' => (int) $b->settle_version,
|
||||
'status' => $b->status,
|
||||
'total_ticket_count' => (int) $b->total_ticket_count,
|
||||
'total_win_count' => (int) $b->total_win_count,
|
||||
|
||||
Reference in New Issue
Block a user