21 lines
635 B
PHP
21 lines
635 B
PHP
<?php
|
|
/**
|
|
* 碎片处理统计接口 GET /api/preliminary/stats.php
|
|
* 返回:总数 / 今日新增
|
|
*/
|
|
require_once __DIR__ . '/../common/db.php';
|
|
require_once __DIR__ . '/../common/response.php';
|
|
require_once __DIR__ . '/../common/auth.php';
|
|
|
|
checkPermission('preliminary');
|
|
|
|
$pdo = DB::getInstance()->getPdo();
|
|
|
|
$total = (int)$pdo->query("SELECT COUNT(*) FROM preliminary_data WHERE is_active = 1")->fetchColumn();
|
|
$today = (int)$pdo->query("SELECT COUNT(*) FROM preliminary_data WHERE is_active = 1 AND DATE(created_at) = CURDATE()")->fetchColumn();
|
|
|
|
Response::success([
|
|
'total' => $total,
|
|
'today' => $today,
|
|
]);
|