封禁公示到期时间秒/毫秒归一:Java推毫秒,接口与前端统一按秒
This commit is contained in:
@@ -5430,6 +5430,9 @@ function getBanBoard() {
|
|||||||
$out = array();
|
$out = array();
|
||||||
while ($row = $res->fetchArray(SQLITE3_ASSOC)) {
|
while ($row = $res->fetchArray(SQLITE3_ASSOC)) {
|
||||||
$expire = (int) ($row['expire_time'] ?? 0);
|
$expire = (int) ($row['expire_time'] ?? 0);
|
||||||
|
// ★ 单位归一:Java 端 BanEntry 推的是毫秒(13位),公示接口对外统一按秒;
|
||||||
|
// 不归一的话「已过期跳过」判断恒不成立,前端还会把日期显示成 68260 年
|
||||||
|
if ($expire > 100000000000) $expire = intdiv($expire, 1000);
|
||||||
if ($expire > 0 && $expire <= $now) continue; // 跳过已过期的临时封禁
|
if ($expire > 0 && $expire <= $now) continue; // 跳过已过期的临时封禁
|
||||||
$out[] = array(
|
$out[] = array(
|
||||||
'target' => (string) ($row['target'] ?? ''),
|
'target' => (string) ($row['target'] ?? ''),
|
||||||
|
|||||||
+3
-1
@@ -4550,7 +4550,9 @@ function escHtml(s) { return (s||'').replace(/&/g,'&').replace(/</g,'<').
|
|||||||
function banItemHtml(b) {
|
function banItemHtml(b) {
|
||||||
const name = escHtml(b.target || '');
|
const name = escHtml(b.target || '');
|
||||||
const reason = escHtml(b.reason || '违反服务器规则');
|
const reason = escHtml(b.reason || '违反服务器规则');
|
||||||
const expire = parseInt(b.expire_time, 10) || 0;
|
let expire = parseInt(b.expire_time, 10) || 0;
|
||||||
|
// 防御:后端若漏归一(Java 推的是毫秒),这里兜一手,避免显示成 68260 年
|
||||||
|
if (expire > 100000000000) expire = Math.floor(expire / 1000);
|
||||||
const perm = expire === 0 ? '<span class="bperm">永久</span>' : '';
|
const perm = expire === 0 ? '<span class="bperm">永久</span>' : '';
|
||||||
let when = '';
|
let when = '';
|
||||||
if (expire > 0) {
|
if (expire > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user