fix(qdreader): tidy query and delete menu text
This commit is contained in:
+26
-18
@@ -4,7 +4,7 @@
|
||||
//[author: Hermes]
|
||||
//[service: BOSS]
|
||||
//[class: 工具类]
|
||||
// [version: 2.14.0]
|
||||
// [version: 2.15.0]
|
||||
// [platform: web,qq,wx,tg,tb,fs,we]
|
||||
// [public: false]
|
||||
// [price: 0]
|
||||
@@ -279,7 +279,7 @@ function contentText() {
|
||||
}
|
||||
function usage() {
|
||||
return [
|
||||
"启点读书签到插件 v2.14.0",
|
||||
"启点读书签到插件 v2.15.0",
|
||||
"【一级菜单】",
|
||||
"账号管理:启点账号",
|
||||
"执行查询:启点查询",
|
||||
@@ -917,19 +917,28 @@ function displayMsg(msg) {
|
||||
return msg
|
||||
}
|
||||
function accountName(uid, remarks) {
|
||||
return maskUid(uid) + (remarks && remarks[uid] ? "(" + remarks[uid] + ")" : "")
|
||||
return maskUid(uid) + (remarks && remarks[uid] ? "[" + remarks[uid] + "]" : "")
|
||||
}
|
||||
function compactTaskMsg(msg) {
|
||||
msg = displayMsg(msg)
|
||||
msg = msg.replace(/^完全体任务完成:/, "")
|
||||
msg = msg.replace(/^部分任务失败:/, "")
|
||||
return msg
|
||||
}
|
||||
function formatResultLine(uid, r, remarks, emptyText) {
|
||||
var name = accountName(uid, remarks)
|
||||
if (!r) return "• " + name + ":⚪ " + (emptyText || "暂无执行记录")
|
||||
return "• " + name + ":" + (r.ok ? "✅ " : "❌ ") + displayMsg(r.msg) + (r.time ? "\n 时间:" + shortTime(r.time) : "")
|
||||
if (!r) return "- " + name + ":⚪ " + (emptyText || "暂无执行记录")
|
||||
var status = r.ok ? "✅" : "❌"
|
||||
var line = "- " + name + ":" + status + " " + compactTaskMsg(r.msg)
|
||||
if (r.time) line += "\n 时间:" + shortTime(r.time)
|
||||
return line
|
||||
}
|
||||
function formatRunSummary(log, label, key) {
|
||||
log = log || {}
|
||||
var lines = []
|
||||
lines.push((label || "最近批次") + (key ? ":" + key : ""))
|
||||
lines.push("来源:" + sourceName(log.source) + " | 时间:" + shortTime(log.finishedAt))
|
||||
lines.push("汇总:✅ " + (log.okCount || 0) + " | ❌ " + (log.failCount || 0) + " | 总计 " + (log.total || 0))
|
||||
lines.push("批次:" + (key || log.runId || "最近") + "(" + (label || "最近记录") + ")")
|
||||
lines.push("时间:" + shortTime(log.finishedAt) + " | 来源:" + sourceName(log.source))
|
||||
lines.push("统计:成功 " + (log.okCount || 0) + " / 失败 " + (log.failCount || 0) + " / 总计 " + (log.total || 0))
|
||||
return lines
|
||||
}
|
||||
function queryStatus(targetUid) {
|
||||
@@ -946,21 +955,20 @@ function queryStatus(targetUid) {
|
||||
if (!uids.length) return "当前用户还没有保存启点读书CK"
|
||||
var archiveInfo = latestArchiveForVisible(uids)
|
||||
var useArchive = archiveInfo && (!run || !run.finishedAt)
|
||||
var lines = []
|
||||
var lines = [targetUid ? "启点查询|单账号" : "启点查询|最近签到"]
|
||||
if (useArchive) {
|
||||
var arun = archiveInfo.log || {}
|
||||
lines.push(targetUid ? "启点单账号最近签到记录" : "启点最近签到记录")
|
||||
lines = lines.concat(formatRunSummary(arun, "归档批次", archiveInfo.key))
|
||||
lines.push("结果明细:")
|
||||
lines = lines.concat(formatRunSummary(arun, "归档", archiveInfo.key))
|
||||
lines.push("明细:")
|
||||
for (var ai = 0; ai < uids.length; ai++) lines.push(formatResultLine(uids[ai], archiveInfo.itemMap[String(uids[ai])], remarks, "归档中暂无该账号记录"))
|
||||
return lines.join("\n")
|
||||
}
|
||||
lines.push(targetUid ? "启点单账号最近签到记录" : "启点最近签到记录")
|
||||
if (!targetUid && run && run.finishedAt) lines = lines.concat(formatRunSummary(run, "最近批次", ""))
|
||||
if (!targetUid && run && run.finishedAt) lines = lines.concat(formatRunSummary(run, "最近", ""))
|
||||
else if (run && run.finishedAt) lines.push("时间:" + shortTime(run.finishedAt) + " | 来源:" + sourceName(run.source))
|
||||
lines.push("结果明细:")
|
||||
else lines.push("批次:暂无")
|
||||
lines.push("明细:")
|
||||
for (var i = 0; i < uids.length; i++) lines.push(formatResultLine(uids[i], last[uids[i]], remarks, "暂无执行记录"))
|
||||
if (archiveInfo) lines.push("历史归档:" + archiveInfo.key + "(可用于判断最近一次签到)")
|
||||
if (archiveInfo) lines.push("归档:" + archiveInfo.key)
|
||||
return lines.join("\n")
|
||||
}
|
||||
|
||||
@@ -980,7 +988,7 @@ function accountMenuText(store, bind) {
|
||||
}
|
||||
}
|
||||
lines.push("0、添加/更新账号")
|
||||
lines.push("负编号删除账号,例如 -1")
|
||||
lines.push("-删除账号,例如 -1")
|
||||
lines.push("q、退出")
|
||||
return lines.join("\n")
|
||||
}
|
||||
@@ -1060,7 +1068,7 @@ function accountDetailText(uid, store, bind) {
|
||||
function accountConfigText(uid, store, bind) {
|
||||
var detail = accountDetailText(uid, store, bind)
|
||||
if (/^(无权|未找到)/.test(detail)) return detail
|
||||
return detail + "\n\n账号操作:\n1、修改备注\n2、任务配置\n3、立即签到该账号\n-1、删除该账号\nq、返回/退出"
|
||||
return detail + "\n\n账号操作:\n1、修改备注\n2、任务配置\n3、立即签到该账号\n-删除该账号\nq、返回/退出"
|
||||
}
|
||||
function accountConfigMenu(uid, store, bind) {
|
||||
if (!uid) return reply("未选择账号,已退出")
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//[author: Hermes]
|
||||
//[service: BOSS]
|
||||
//[class: 工具类]
|
||||
// [version: 2.14.0]
|
||||
// [version: 2.15.0]
|
||||
// [platform: web,qq,wx,tg,tb,fs,we]
|
||||
// [public: false]
|
||||
// [price: 0]
|
||||
@@ -279,7 +279,7 @@ function contentText() {
|
||||
}
|
||||
function usage() {
|
||||
return [
|
||||
"启点读书签到插件 v2.14.0",
|
||||
"启点读书签到插件 v2.15.0",
|
||||
"【一级菜单】",
|
||||
"账号管理:启点账号",
|
||||
"执行查询:启点查询",
|
||||
@@ -917,19 +917,28 @@ function displayMsg(msg) {
|
||||
return msg
|
||||
}
|
||||
function accountName(uid, remarks) {
|
||||
return maskUid(uid) + (remarks && remarks[uid] ? "(" + remarks[uid] + ")" : "")
|
||||
return maskUid(uid) + (remarks && remarks[uid] ? "[" + remarks[uid] + "]" : "")
|
||||
}
|
||||
function compactTaskMsg(msg) {
|
||||
msg = displayMsg(msg)
|
||||
msg = msg.replace(/^完全体任务完成:/, "")
|
||||
msg = msg.replace(/^部分任务失败:/, "")
|
||||
return msg
|
||||
}
|
||||
function formatResultLine(uid, r, remarks, emptyText) {
|
||||
var name = accountName(uid, remarks)
|
||||
if (!r) return "• " + name + ":⚪ " + (emptyText || "暂无执行记录")
|
||||
return "• " + name + ":" + (r.ok ? "✅ " : "❌ ") + displayMsg(r.msg) + (r.time ? "\n 时间:" + shortTime(r.time) : "")
|
||||
if (!r) return "- " + name + ":⚪ " + (emptyText || "暂无执行记录")
|
||||
var status = r.ok ? "✅" : "❌"
|
||||
var line = "- " + name + ":" + status + " " + compactTaskMsg(r.msg)
|
||||
if (r.time) line += "\n 时间:" + shortTime(r.time)
|
||||
return line
|
||||
}
|
||||
function formatRunSummary(log, label, key) {
|
||||
log = log || {}
|
||||
var lines = []
|
||||
lines.push((label || "最近批次") + (key ? ":" + key : ""))
|
||||
lines.push("来源:" + sourceName(log.source) + " | 时间:" + shortTime(log.finishedAt))
|
||||
lines.push("汇总:✅ " + (log.okCount || 0) + " | ❌ " + (log.failCount || 0) + " | 总计 " + (log.total || 0))
|
||||
lines.push("批次:" + (key || log.runId || "最近") + "(" + (label || "最近记录") + ")")
|
||||
lines.push("时间:" + shortTime(log.finishedAt) + " | 来源:" + sourceName(log.source))
|
||||
lines.push("统计:成功 " + (log.okCount || 0) + " / 失败 " + (log.failCount || 0) + " / 总计 " + (log.total || 0))
|
||||
return lines
|
||||
}
|
||||
function queryStatus(targetUid) {
|
||||
@@ -946,21 +955,20 @@ function queryStatus(targetUid) {
|
||||
if (!uids.length) return "当前用户还没有保存启点读书CK"
|
||||
var archiveInfo = latestArchiveForVisible(uids)
|
||||
var useArchive = archiveInfo && (!run || !run.finishedAt)
|
||||
var lines = []
|
||||
var lines = [targetUid ? "启点查询|单账号" : "启点查询|最近签到"]
|
||||
if (useArchive) {
|
||||
var arun = archiveInfo.log || {}
|
||||
lines.push(targetUid ? "启点单账号最近签到记录" : "启点最近签到记录")
|
||||
lines = lines.concat(formatRunSummary(arun, "归档批次", archiveInfo.key))
|
||||
lines.push("结果明细:")
|
||||
lines = lines.concat(formatRunSummary(arun, "归档", archiveInfo.key))
|
||||
lines.push("明细:")
|
||||
for (var ai = 0; ai < uids.length; ai++) lines.push(formatResultLine(uids[ai], archiveInfo.itemMap[String(uids[ai])], remarks, "归档中暂无该账号记录"))
|
||||
return lines.join("\n")
|
||||
}
|
||||
lines.push(targetUid ? "启点单账号最近签到记录" : "启点最近签到记录")
|
||||
if (!targetUid && run && run.finishedAt) lines = lines.concat(formatRunSummary(run, "最近批次", ""))
|
||||
if (!targetUid && run && run.finishedAt) lines = lines.concat(formatRunSummary(run, "最近", ""))
|
||||
else if (run && run.finishedAt) lines.push("时间:" + shortTime(run.finishedAt) + " | 来源:" + sourceName(run.source))
|
||||
lines.push("结果明细:")
|
||||
else lines.push("批次:暂无")
|
||||
lines.push("明细:")
|
||||
for (var i = 0; i < uids.length; i++) lines.push(formatResultLine(uids[i], last[uids[i]], remarks, "暂无执行记录"))
|
||||
if (archiveInfo) lines.push("历史归档:" + archiveInfo.key + "(可用于判断最近一次签到)")
|
||||
if (archiveInfo) lines.push("归档:" + archiveInfo.key)
|
||||
return lines.join("\n")
|
||||
}
|
||||
|
||||
@@ -980,7 +988,7 @@ function accountMenuText(store, bind) {
|
||||
}
|
||||
}
|
||||
lines.push("0、添加/更新账号")
|
||||
lines.push("负编号删除账号,例如 -1")
|
||||
lines.push("-删除账号,例如 -1")
|
||||
lines.push("q、退出")
|
||||
return lines.join("\n")
|
||||
}
|
||||
@@ -1060,7 +1068,7 @@ function accountDetailText(uid, store, bind) {
|
||||
function accountConfigText(uid, store, bind) {
|
||||
var detail = accountDetailText(uid, store, bind)
|
||||
if (/^(无权|未找到)/.test(detail)) return detail
|
||||
return detail + "\n\n账号操作:\n1、修改备注\n2、任务配置\n3、立即签到该账号\n-1、删除该账号\nq、返回/退出"
|
||||
return detail + "\n\n账号操作:\n1、修改备注\n2、任务配置\n3、立即签到该账号\n-删除该账号\nq、返回/退出"
|
||||
}
|
||||
function accountConfigMenu(uid, store, bind) {
|
||||
if (!uid) return reply("未选择账号,已退出")
|
||||
|
||||
@@ -333,11 +333,11 @@ test('query falls back to archived sign results after daily log was cleared', ()
|
||||
qdreader_archive_json: JSON.stringify({ '2026-05-18': archiveRun }),
|
||||
};
|
||||
const r = runPlugin({ content: '启点查询', store, userId: 'user-a', listens: ['1'] });
|
||||
assert.match(r.replies[1], /启点最近签到记录/);
|
||||
assert.match(r.replies[1], /归档批次:2026-05-18/);
|
||||
assert.match(r.replies[1], /汇总:✅ 1 | ❌ 1 | 总计 2/);
|
||||
assert.match(r.replies[1], /• 12\*\*\*45(主号):✅ 签到成功/);
|
||||
assert.match(r.replies[1], /• 67\*\*\*90(副号):❌ Cookie失效/);
|
||||
assert.match(r.replies[1], /启点查询|最近签到/);
|
||||
assert.match(r.replies[1], /批次:2026-05-18(归档)/);
|
||||
assert.match(r.replies[1], /统计:成功 1 \/ 失败 1 \/ 总计 2/);
|
||||
assert.match(r.replies[1], /- 12\*\*\*45\[主号\]:✅ 签到成功/);
|
||||
assert.match(r.replies[1], /- 67\*\*\*90\[副号\]:❌ Cookie失效/);
|
||||
});
|
||||
|
||||
test('query output shortens timestamps and long raw messages for readability', () => {
|
||||
@@ -602,10 +602,10 @@ test('query command shows last sign log not account management', () => {
|
||||
};
|
||||
const r = runPlugin({ content: '启点查询', store, userId: 'user-a', listens: ['1'] });
|
||||
assert.match(r.replies[0], /启点查询/);
|
||||
assert.match(r.replies[1], /启点最近签到记录/);
|
||||
assert.match(r.replies[1], /最近批次/);
|
||||
assert.match(r.replies[1], /启点查询|最近签到/);
|
||||
assert.match(r.replies[1], /批次:最近(最近)/);
|
||||
assert.match(r.replies[1], /来源:定时任务/);
|
||||
assert.match(r.replies[1], /汇总:✅ 1 | ❌ 1 | 总计 2/);
|
||||
assert.match(r.replies[1], /统计:成功 1 \/ 失败 1 \/ 总计 2/);
|
||||
assert.match(r.replies[1], /12\*\*\*45/);
|
||||
assert.match(r.replies[1], /主号/);
|
||||
assert.match(r.replies[1], /签到成功/);
|
||||
@@ -629,7 +629,7 @@ test('query menu can inspect a single bound account', () => {
|
||||
assert.match(r.replies[1], /请选择要查询的账号/);
|
||||
assert.match(r.replies[1], /1\. 12\*\*\*45/);
|
||||
assert.match(r.replies[1], /2\. 67\*\*\*90/);
|
||||
assert.match(r.replies[2], /启点单账号最近签到记录/);
|
||||
assert.match(r.replies[2], /启点查询|单账号/);
|
||||
assert.match(r.replies[2], /67\*\*\*90/);
|
||||
assert.match(r.replies[2], /副号/);
|
||||
assert.doesNotMatch(r.replies[2], /12\*\*\*45/);
|
||||
@@ -683,7 +683,7 @@ test('account menu first screen lists accounts and positive number opens config'
|
||||
assert.match(r.replies[0], /账号列表如下/);
|
||||
assert.match(r.replies[0], /1、12\*\*\*45\[主号\]/);
|
||||
assert.match(r.replies[0], /2、67\*\*\*90\[副号\]/);
|
||||
assert.match(r.replies[0], /负编号删除账号/);
|
||||
assert.match(r.replies[0], /-删除账号,例如 -1/);
|
||||
assert.match(r.replies[1], /启点账号详情/);
|
||||
assert.match(r.replies[1], /67\*\*\*90/);
|
||||
assert.match(r.replies[1], /账号操作/);
|
||||
|
||||
Reference in New Issue
Block a user