feat: 客户端在线统计(按项目日/周/月在线用户数)
This commit is contained in:
1 parent
c98f761275
commit
70fda65889
9 files changed
+509
No files matched your search
@@ -81,6 +81,22 @@ class InstallationController extends Controller
|
||||
$this->success($stats);
|
||||
}
|
||||
|
||||
/**
|
||||
* 在线统计:当前在线 + 日/周/月在线用户数 + 趋势 + 分项目
|
||||
* GET /api/installations/online-stats?period=day|week|month&project_id=
|
||||
*/
|
||||
public function onlineStats(): void
|
||||
{
|
||||
$user = $this->getCurrentUser() ?: [];
|
||||
$projectId = !empty($_GET['project_id']) ? (int) $_GET['project_id'] : null;
|
||||
$period = $_GET['period'] ?? 'day';
|
||||
if (!in_array($period, ['day', 'week', 'month'], true)) {
|
||||
$period = 'day';
|
||||
}
|
||||
|
||||
$this->success(InstallationService::onlineStats($user, $projectId, $period));
|
||||
}
|
||||
|
||||
/**
|
||||
* 安装详情
|
||||
* GET /api/installations/{id}
|
||||
|
||||
Reference in new issue
Block a user