feat: enhance reporting and dashboard functionalities
- Updated AGENTS.md to clarify SSO wallet integration and error handling for account status. - Refactored date handling in AdminReportQueryService and related classes to use precise date filtering for financial reports. - Improved query logic in AdminDashboardSnapshotBuilder, AgentDashboardOverviewBuilder, and SiteDashboardOverviewBuilder to ensure accurate activity statistics based on business dates.
This commit is contained in:
@@ -175,7 +175,7 @@ final class AdminDashboardSnapshotBuilder
|
||||
|
||||
$currencyQuery = TicketOrder::query()
|
||||
->join('draws', 'draws.id', '=', 'ticket_orders.draw_id')
|
||||
->where('draws.business_date', $today);
|
||||
->whereDate('draws.business_date', $today);
|
||||
AdminDataScope::applyEloquentViaPlayer($currencyQuery, $admin);
|
||||
$this->applyRequestedScopeViaPlayer($currencyQuery, $scope);
|
||||
$currencyCode = (string) ($currencyQuery->value('ticket_orders.currency_code') ?? '');
|
||||
|
||||
@@ -154,7 +154,8 @@ final class AdminReportQueryService
|
||||
|
||||
$activityQuery = DB::table('draws as d')
|
||||
->join('ticket_orders as o', 'o.draw_id', '=', 'd.id')
|
||||
->whereBetween('d.business_date', [$dateFrom, $dateTo]);
|
||||
->whereDate('d.business_date', '>=', $dateFrom)
|
||||
->whereDate('d.business_date', '<=', $dateTo);
|
||||
AdminDataScope::applyToTicketOrdersViaPlayer($activityQuery, $context?->admin, 'o');
|
||||
$activity = $activityQuery
|
||||
->selectRaw('COUNT(DISTINCT d.id) as draw_count')
|
||||
|
||||
@@ -160,9 +160,10 @@ final class AgentDashboardOverviewBuilder
|
||||
}
|
||||
|
||||
$base = DB::table('ticket_orders as o')
|
||||
->join('draws as d', 'd.id', '=', 'o.draw_id')
|
||||
->join('players as p', 'p.id', '=', 'o.player_id')
|
||||
->whereIn('p.agent_node_id', $subtreeIds)
|
||||
->whereDate('o.created_at', $today);
|
||||
->whereDate('d.business_date', $today);
|
||||
|
||||
$latestBetAt = (clone $base)->max('o.created_at');
|
||||
|
||||
|
||||
@@ -96,9 +96,10 @@ final class SiteDashboardOverviewBuilder
|
||||
private function todayActivityStats(string $siteCode, string $today): array
|
||||
{
|
||||
$base = DB::table('ticket_orders as o')
|
||||
->join('draws as d', 'd.id', '=', 'o.draw_id')
|
||||
->join('players as p', 'p.id', '=', 'o.player_id')
|
||||
->where('p.site_code', $siteCode)
|
||||
->whereDate('o.created_at', $today);
|
||||
->whereDate('d.business_date', $today);
|
||||
|
||||
$latestBetAt = (clone $base)->max('o.created_at');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user