count('users');
// 2. 投票主题总数
$totalTopics = $db->count('vote');
// 3. 进行中的投票数
$now = date('Y-m-d H:i:s');
$activeTopics = $db->count('vote', "status = 1 AND statime <= '$now' AND endtime >= '$now'");
// 4. 总投票记录数
$totalVotes = $db->count('recs');
// 最近投票记录
$recentVotes = [];
$sql = "SELECT r.*, u.username, v.title
FROM " . $db->table('recs') . " r
LEFT JOIN " . $db->table('users') . " u ON r.user_id = u.id
LEFT JOIN " . $db->table('vote') . " v ON r.topic_id = v.id
ORDER BY r.vote_time DESC LIMIT 10";
$result = $db->query($sql);
if ($result) {
while ($row = $result->fetch_assoc()) {
$recentVotes[] = $row;
}
}
// 最近操作日志
$recentLogs = [];
$sql = "SELECT l.*, u.username
FROM " . $db->table('logs') . " l
LEFT JOIN " . $db->table('users') . " u ON l.user_id = u.id
ORDER BY l.logtime DESC LIMIT 10";
$result = $db->query($sql);
if ($result) {
while ($row = $result->fetch_assoc()) {
$recentLogs[] = $row;
}
}
// 页面标题
$pageTitle = "管理后台";
?>
-
最近操作日志
| 用户 |
操作类型 |
操作内容 |
IP地址 |
时间 |
|
|
|
|
|
| 暂无操作日志 |