仰望星辰工作室

better-staridc-MNBT

Z zfhsh first commit 2 个月前
1<?php
2/**
3 * 管理员端 - 操作日志
4 */
5if (!defined('IN_CRONLITE')) {
6 exit;
7}
8mnbt_admin_include('head');
9
10$page = max(1, (int)($_GET['page_num'] ?? 1));
11$logs = zjmf_log_list_all($page, 30);
12$result_labels = [
13 'success' => '成功',
14 'failed' => '失败',
15];
16$result_classes = [
17 'success' => 'badge-success',
18 'failed' => 'badge-danger',
19];
20$title = $title ?? '操作日志';
21?>
22<div class="container-fluid p-t-15">
23 <div class="card">
24 <div class="card-header"><h4 style="display:inline-block">操作日志</h4></div>
25 <div class="card-body">
26 <p class="text-muted">记录商品同步、开通、主机操作、升级等关键动作(内容已脱敏,不含密码/密钥)。</p>
27 <div class="table-responsive">
28 <table class="table table-bordered table-hover">
29 <thead>
30 <tr>
31 <th>ID</th>
32 <th>供应商</th>
33 <th>用户</th>
34 <th>订单号</th>
35 <th>操作</th>
36 <th>结果</th>
37 <th>内容</th>
38 <th>时间</th>
39 </tr>
40 </thead>
41 <tbody>
42 <?php if (empty($logs['list'])): ?>
43 <tr><td colspan="8" class="text-center text-muted">暂无日志</td></tr>
44 <?php else: ?>
45 <?php foreach ($logs['list'] as $l): ?>
46 <tr>
47 <td><?= (int)$l['id'] ?></td>
48 <td><?= htmlspecialchars($l['supplier_name'] ?: '-') ?></td>
49 <td><?= htmlspecialchars($l['user_name'] ?: ('ID ' . (int)$l['user_id'])) ?></td>
50 <td class="small text-muted"><?= htmlspecialchars($l['order_no'] ?: '-') ?></td>
51 <td><?= htmlspecialchars($l['action']) ?></td>
52 <td>
53 <span class="badge <?= htmlspecialchars($result_classes[$l['result']] ?? 'badge-secondary') ?>">
54 <?= htmlspecialchars($result_labels[$l['result']] ?? $l['result']) ?>
55 </span>
56 </td>
57 <td class="small"><?= htmlspecialchars($l['content'] ?: '-') ?></td>
58 <td class="small"><?= htmlspecialchars($l['created_at']) ?></td>
59 </tr>
60 <?php endforeach; ?>
61 <?php endif; ?>
62 </tbody>
63 </table>
64 </div>
65
66 <?php
67 $total_pages = max(1, (int)ceil($logs['total'] / $logs['per_page']));
68 $current_page = (int)$logs['page'];
69 if ($total_pages > 1):
70 $qs = http_build_query(['p' => 'zjmfmanager_reserve', 'page' => 'logs']);
71 ?>
72 <nav>
73 <ul class="pagination pagination-sm">
74 <?php if ($current_page > 1): ?>
75 <li class="page-item"><a class="page-link"
76 href="plugin.php?<?= htmlspecialchars(
77 $qs . '&page_num=' . ($current_page - 1), ENT_QUOTES
78 ) ?>">上一页</a></li>
79 <?php endif; ?>
80 <li class="page-item disabled"><span class="page-link">
81 第 <?= $current_page ?> / <?= $total_pages ?> 页(共 <?= (int)$logs['total'] ?> 条)
82 </span></li>
83 <?php if ($current_page < $total_pages): ?>
84 <li class="page-item"><a class="page-link"
85 href="plugin.php?<?= htmlspecialchars(
86 $qs . '&page_num=' . ($current_page + 1), ENT_QUOTES
87 ) ?>">下一页</a></li>
88 <?php endif; ?>
89 </ul>
90 </nav>
91 <?php endif; ?>
92 </div>
93 </div>
94</div>