fix(计划): 定时触发补 app context;账号状态加检测时间与历史记录
- _fire 内调用 run_plan(修复 18:00 Working outside application context,无运行记录) - device_account 新增 status_checked_at;新表 account_status_log(schema v23) - 每次检测/手改留痕;资产表显示检测时间 + 「记录」弹窗 - API /api/af/account_status_logs;备份标签/文档/测试同步
This commit is contained in:
@@ -332,8 +332,12 @@ function afHtmlAsset() {
|
||||
(a.in_roster
|
||||
? '<button class="btn btn-xs" title="手动改账号状态" ' +
|
||||
'onclick="afAssetEditStatus(\'' + esc(a.roster_id) + '\',\'' + esc(a.name) + '\',\'' +
|
||||
esc(a.account_status || '') + '\')">改</button>'
|
||||
esc(a.account_status || '') + '\')">改</button> ' +
|
||||
'<button class="btn btn-xs" onclick="afAssetStatusLogs(\'' + esc(a.name) + '\')">记录</button>'
|
||||
: '') +
|
||||
(a.status_checked_at
|
||||
? '<div class="text-muted" style="font-size:11px;margin-top:2px">检测 ' +
|
||||
esc(a.status_checked_at) + '</div>' : '') +
|
||||
'</td>' +
|
||||
'<td><button class="btn btn-xs btn-primary" onclick="afAssetOpenAccount(\'' + esc(a.name) + '\')">' +
|
||||
'入库 <b>' + (a.total || 0) + '</b> · 未发布 <b style="color:#b45309">' + (a.pending || 0) + '</b>' +
|
||||
@@ -390,7 +394,7 @@ function afHtmlAsset() {
|
||||
'</div>' +
|
||||
'<table class="table"><thead><tr>' +
|
||||
'<th style="width:230px">账号</th><th style="width:210px">所属手机</th>' +
|
||||
'<th style="width:150px">账号状态</th>' +
|
||||
'<th style="width:190px">账号状态</th>' +
|
||||
'<th style="width:400px">素材库</th><th style="width:140px">最近发布</th><th style="width:190px">操作</th>' +
|
||||
'</tr></thead><tbody>' +
|
||||
(rows || '<tr><td colspan="6" class="empty">' +
|
||||
@@ -444,6 +448,31 @@ async function afSaveRosterStatus(rosterId, status) {
|
||||
await afRefreshAll();
|
||||
}
|
||||
|
||||
async function afAssetStatusLogs(name) {
|
||||
const r = await apiGet('/api/af/account_status_logs?name=' +
|
||||
encodeURIComponent(name) + '&limit=100');
|
||||
if (!r || !r.ok) { showToast((r && r.error) || '读取状态记录失败', 'error'); return; }
|
||||
const rows = (r.rows || []).map(function (x) {
|
||||
const good = (x.status === '正常' || x.status === '账号正常');
|
||||
const st = x.status
|
||||
? '<span class="label ' + (good ? 'label-success' : 'label-warning') + '">' +
|
||||
esc(x.status) + '</span>'
|
||||
: '<span class="text-muted">(空)</span>';
|
||||
return '<tr><td style="white-space:nowrap">' + esc(x.detected_at || '') + '</td>' +
|
||||
'<td>' + st + '</td><td>' + esc(x.device_name || '') + '</td>' +
|
||||
'<td>' + esc(x.source || '') + '</td></tr>';
|
||||
}).join('');
|
||||
document.getElementById('modal-title').textContent = '账号状态记录 · ' + name;
|
||||
document.getElementById('modal-body').innerHTML =
|
||||
'<table class="table"><thead><tr><th>时间</th><th>状态</th><th>设备</th>' +
|
||||
'<th>来源</th></tr></thead><tbody>' +
|
||||
(rows || '<tr><td colspan="4" class="empty">还没有检测记录</td></tr>') +
|
||||
'</tbody></table>';
|
||||
document.getElementById('modal-footer').innerHTML =
|
||||
'<button class="btn" onclick="closeModal()">关闭</button>';
|
||||
showModal();
|
||||
}
|
||||
|
||||
function afAssetScan(name) {
|
||||
afScan(name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user