feat(资产管理): 账号状态列 + 任务变量回写;通用任务 App 回退
- device_account 新增 account_status(schema v21),资产表可手改 - 任务「读取文字」var=account_status 自动回写当前账号;元素不存在=正常 - 计划:任务段没有 open_app 时回退到唯一 App(创作者中心这类通用任务) - 测试/文档同步
This commit is contained in:
@@ -308,6 +308,17 @@ function afHtmlAsset() {
|
||||
(a.in_roster ? '' : ' <span class="label label-warning">账号库没有</span>') +
|
||||
(a.has_dir ? '' : '<div class="text-muted" style="font-size:11px">还没有素材文件夹</div>') + '</td>' +
|
||||
'<td>' + devSel + '</td>' +
|
||||
'<td style="white-space:nowrap">' +
|
||||
(a.account_status
|
||||
? '<span class="label ' + (a.account_status === '正常' ? 'label-success' : 'label-warning') + '">' +
|
||||
esc(a.account_status) + '</span> '
|
||||
: '<span class="text-muted" style="font-size:11px">—</span> ') +
|
||||
(a.in_roster
|
||||
? '<button class="btn btn-xs" title="手动改账号状态" ' +
|
||||
'onclick="afAssetEditStatus(\'' + esc(a.roster_id) + '\',\'' + esc(a.name) + '\',\'' +
|
||||
esc(a.account_status || '') + '\')">改</button>'
|
||||
: '') +
|
||||
'</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>' +
|
||||
' · 已发布 <b style="color:#16a34a">' + (a.done || 0) + '</b>' +
|
||||
@@ -351,9 +362,10 @@ 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:400px">素材库</th><th style="width:140px">最近发布</th><th style="width:190px">操作</th>' +
|
||||
'</tr></thead><tbody>' +
|
||||
(rows || '<tr><td colspan="5" class="empty">' +
|
||||
(rows || '<tr><td colspan="6" class="empty">' +
|
||||
((F.device || F.q) ? '没有符合筛选条件的账号 —— 点「清除筛选」看全部'
|
||||
: '还没有账号 —— 先「导入/维护账号库」,再「批量上传素材」') +
|
||||
'</td></tr>') +
|
||||
@@ -389,6 +401,21 @@ async function afAssetSetDevice(rosterId, deviceName) {
|
||||
await afRefreshAll();
|
||||
}
|
||||
|
||||
// 账号状态:手动编辑(任务里「读取文字」写变量 account_status 时也会自动回写这列)
|
||||
function afAssetEditStatus(rosterId, name, cur) {
|
||||
const v = prompt('『' + name + '』的账号状态(正常 / 账号异常 / 限流…;留空=清空)', cur || '');
|
||||
if (v === null) return;
|
||||
afSaveRosterStatus(rosterId, v);
|
||||
}
|
||||
|
||||
async function afSaveRosterStatus(rosterId, status) {
|
||||
const r = await apiPut('/api/af/roster/' + encodeURIComponent(rosterId),
|
||||
{account_status: status});
|
||||
if (!r || !r.ok) { showToast((r && r.error) || '改账号状态失败', 'error'); return; }
|
||||
showToast('账号状态已更新', 'success');
|
||||
await afRefreshAll();
|
||||
}
|
||||
|
||||
function afAssetScan(name) {
|
||||
afScan(name);
|
||||
}
|
||||
@@ -2013,7 +2040,10 @@ function _afPlanTaskPkg(t) {
|
||||
function _afPlanTaskAppId(t) {
|
||||
const pkg = _afPlanTaskPkg(t);
|
||||
const a = (_af.apps || []).find(function (x) { return x.package === pkg; });
|
||||
return a ? a.id : '';
|
||||
if (a) return a.id;
|
||||
// 通用任务没有 open_app(如「抖音创作者中心」直接在「我」页操作)→ 反查不到包名;
|
||||
// 只登记了一个 App 时直接用它(开场要冷启动 App),多个 App 时不猜。
|
||||
return ((_af.apps || []).length === 1) ? _af.apps[0].id : '';
|
||||
}
|
||||
|
||||
function _afPlanTaskAppName(t) {
|
||||
|
||||
Reference in New Issue
Block a user