fix qdreader message window and nested result

This commit is contained in:
2026-05-20 22:26:49 +08:00
parent c850f2bbbe
commit e035a760de
5 changed files with 96 additions and 7 deletions
+6
View File
@@ -198,3 +198,9 @@ node tests/qdreader_plugin.test.mjs
- `finishWatch` 的上游/签名网关响应可能使用小写 `result=9`,现在和 `Result=9` 一样按“已受理,需回查”处理,避免激励任务误报 `任务 ... 失败`
- 大咖荐书继续使用上游 base62 token,不再回退十进制 token;若线上仍返回“参数错误”,优先确认 Autman 已重新导入本版本,而不是旧版只请求一次 `pullmessage`
## v2.10.2 现场失败修正
- `finishWatch` 兼容响应码嵌在 `data/Data.result` 的网关包装形态,避免空 message 时继续误报具体任务失败。
- 大咖荐书恢复执行时间窗口限制:仅北京时间 20:00-22:00 执行,其他时间标记为跳过,不再调用消息接口导致“参数错误”。
+17 -3
View File
@@ -4,7 +4,7 @@
//[author: Hermes]
//[service: BOSS]
//[class: 工具类]
//[version: 2.10.1]
//[version: 2.10.2]
//[platform: web,qq,wx,tg,tb,fs,we]
//[public: false]
//[price: 0]
@@ -276,7 +276,7 @@ function contentText() {
}
function usage() {
return [
"启点读书签到插件 v2.10.1",
"启点读书签到插件 v2.10.2",
"【一级菜单】",
"账号管理:启点账号",
"执行查询:启点查询",
@@ -404,7 +404,14 @@ function qidianRequest(path, method, data, cookie) {
if (typeof out === "string") out = safeJsonParse(out, out)
return out
}
function resultCode(obj) { return obj && (obj.Result !== undefined ? obj.Result : obj.result !== undefined ? obj.result : obj.Code !== undefined ? obj.Code : obj.code !== undefined ? obj.code : obj.retcode) }
function resultCode(obj) {
if (!obj) return undefined
var keys = ["Result", "result", "Code", "code", "retcode", "RetCode"]
for (var i = 0; i < keys.length; i++) if (obj[keys[i]] !== undefined) return obj[keys[i]]
var data = obj.Data || obj.data || obj.ResultData || obj.resultData
if (data && typeof data === "object") for (var j = 0; j < keys.length; j++) if (data[keys[j]] !== undefined) return data[keys[j]]
return undefined
}
function resultOk(obj) {
var code = resultCode(obj)
var status = obj && (obj.status || obj.Status)
@@ -695,11 +702,18 @@ function recentCreateTime(v) {
var now = (new Date()).getTime()
return now - t >= 0 && now - t <= 24 * 60 * 60 * 1000
}
function beijingHour(dateLike) { return beijingDate(dateLike).getUTCHours() }
function messageBoxWindowLabel() { return "20:00-22:00" }
function messageBoxAllowedNow() {
var h = beijingHour()
return h >= 20 && h < 22
}
function orderIdFromText(s) {
var m = String(s || "").match(/orderId=([a-f0-9]+)/i)
return m ? m[1] : ""
}
function doMessageBox(cookie) {
if (!messageBoxAllowedNow()) return { name: "大咖荐书", ok: true, skipped: true, msg: "不在执行时间 " + messageBoxWindowLabel() + ",已跳过", path: "https://magev6.if.qidian.com/argus/api/v2/message/pullmessage" }
var token = messageTokenFromCookie(cookie)
if (!token) return { name: "大咖荐书", ok: true, msg: "缺少消息 token,已跳过", path: "https://magev6.if.qidian.com/argus/api/v2/message/pullmessage" }
var baseParams = { token: token, type: "0", pg: "1", pz: "10" }