feat: new chain

This commit is contained in:
hashbro
2026-08-11 03:27:54 +08:00
parent 41023b16f4
commit 4983077085
17 changed files with 94 additions and 47 deletions
+7 -4
View File
@@ -17,7 +17,7 @@ class DashboardStatsService
* range?: string,
* channel_id?: string,
* channel_exact?: bool,
* agent_user_id?: int,
* agent_user_id?: ?int,
* agent?: ?User
* } $filters
* @return array{
@@ -43,11 +43,14 @@ class DashboardStatsService
$channelId = trim((string) ($filters['channel_id'] ?? ''));
$channelExact = (bool) ($filters['channel_exact'] ?? false);
$agent = $filters['agent'] ?? null;
$agentUserId = (int) ($filters['agent_user_id'] ?? 0);
$agentUserId = array_key_exists('agent_user_id', $filters)
? $filters['agent_user_id']
: null;
$agentUserId = $agentUserId === null ? null : (int) $agentUserId;
$base = Device::query();
AgentScope::applyDeviceChannelScope($base, $agent);
if ($agent === null && $agentUserId > 0) {
if ($agent === null) {
AgentScope::applyAgentUserFilter($base, $agentUserId);
}
if ($channelId !== '') {
@@ -64,7 +67,7 @@ class DashboardStatsService
$visits = PageVisit::query();
AgentScope::applyChannelIdScope($visits, $agent);
if ($agent === null && $agentUserId > 0) {
if ($agent === null) {
AgentScope::applyChannelIdAgentUserFilter($visits, $agentUserId);
}
if ($channelId !== '') {