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:
@@ -50,6 +50,5 @@
|
||||
- 线上生产:已有库用 `php artisan lottery:db-init --no-demo`(含 RBAC sync);常驻 `schedule:work`、`queue:work redis --queue=broadcasts:countdown,broadcasts,default`、`reverb:start`;`CACHE_STORE`/`QUEUE_CONNECTION` 须 Redis;先部署 lotterLaravel 再前端。
|
||||
- `AgentProfileService::upsertForNode` PATCH 缺省键会写 0(占成/回水等),须按 `array_key_exists` 合并既有 profile。
|
||||
- 代理仪表盘/账期「输赢」用本级 `share_profit`;开/关账期仅未绑定代理站点财务;根节点(`depth=0`)profile 仅超管可改。
|
||||
- SSO 钱包盘:首次有效 JWT 调 `GET /api/v1/player/me` 按 `(site_code, site_player_id)` 自动建档;`username`/`nickname` 彩票生成 `nlotto******`,不从主站同步。
|
||||
- 错误 8005(Account suspended):站点不存在/停用或玩家冻结;**生产**按 `admin_sites` 验站点,`.env` `MAIN_SITE_*` 兜底仅 `local/testing`。
|
||||
- 建站即生成 `sso_jwt_secret`/`wallet_api_key`;`main-site/` 须手动对齐 `MAIN_SITE_CODE` 与两把密钥(未设时默认 `main-site`),不会从后台自动同步;`wallet_api_url` 填主站钱包根 URL,勿填彩票 H5。
|
||||
- SSO/接入:首次有效 JWT 调 `GET /api/v1/player/me` 按 `(site_code, site_player_id)` 自动建档;`username`/`nickname` 彩票生成 `nlotto******`;建站生成 `sso_jwt_secret`/`wallet_api_key`,`main-site/` 须手动对齐;`wallet_api_url` 填主站钱包根 URL;8005=站点不存在/停用或玩家冻结(生产按 `admin_sites` 验站)。
|
||||
- 报表 `AdminReportQueryService`:未传日期默认近 30 天;玩家/玩法/回水按 `draws.business_date`;SQLite 对 `business_date` 用 `whereDate` 勿 `whereBetween`(列可能带时间戳);日盈利过滤零活动日。
|
||||
|
||||
@@ -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