feat: 新增银行卡检查插件及相关依赖与配置文件
This commit is contained in:
@@ -19,6 +19,7 @@ const runner = require("./runner");
|
||||
const queue = require("./queue");
|
||||
const runHistory = require("./run-history");
|
||||
const lastFields = require("./last-fields");
|
||||
const notes = require("./notes");
|
||||
const pluginConfigs = require("./plugin-configs");
|
||||
const scheduler = require("./scheduler");
|
||||
const tasks = require("./tasks");
|
||||
@@ -605,8 +606,17 @@ async function route(req, res, url) {
|
||||
}
|
||||
// 记住本次参数(不含 password 字段),供执行台「恢复上次参数」
|
||||
lastFields.remember(account, plugin.id, body.fields || {}, plugin.fields);
|
||||
// 运行备注:随执行一起落运行记录并回传中心机(用户可能刚改过备注,这里顺手落本机+上报)
|
||||
const noteText = String(body && body.note !== undefined && body.note !== null ? body.note : "").trim();
|
||||
if (noteText) {
|
||||
notes.save(account, plugin.id, noteText);
|
||||
try { await notes.push(account, plugin.id, noteText); } catch (_) { /* 回传失败不阻断执行 */ }
|
||||
}
|
||||
// 提交即入队:返回排队位置,前端据此提示"已加入队列,第 N 位"
|
||||
const r = runner.submitRun(account, plugin, body.fields || {}, { trigger: "manual" });
|
||||
const r = runner.submitRun(account, plugin, body.fields || {}, {
|
||||
trigger: "manual",
|
||||
note: noteText || notes.get(account, plugin.id),
|
||||
});
|
||||
return sendJson(res, 202, {
|
||||
run_id: r.run_id,
|
||||
queue_position: r.queue_position,
|
||||
@@ -841,6 +851,24 @@ async function route(req, res, url) {
|
||||
return sendJson(res, 200, { fields: rec.fields, at: rec.at });
|
||||
}
|
||||
|
||||
// ---------- 插件备注(账号 × 插件 唯一;本机缓存 + 回传中心机)----------
|
||||
if (p === "/api/plugin-notes" && method === "GET") {
|
||||
const account = session.requireLogin(cookies);
|
||||
// 拉取中心机(跨设备一致):失败静默,直接用本机缓存
|
||||
try { await notes.pull(account); } catch (_) { /* 离线继续用本机 */ }
|
||||
return sendJson(res, 200, { ok: true, notes: notes.all(account) });
|
||||
}
|
||||
if (p === "/api/plugin-notes" && method === "POST") {
|
||||
const account = session.requireLogin(cookies);
|
||||
const body = await readJsonBody(req);
|
||||
const pluginId = String((body && body.plugin_id) || "").trim();
|
||||
if (!pluginId) throw Object.assign(new Error("缺少 plugin_id"), { status: 400 });
|
||||
const note = notes.save(account, pluginId, body && body.note);
|
||||
// 回传失败不阻断用户操作(本机已保存,下次拉取/执行时补报)
|
||||
try { await notes.push(account, pluginId, note); } catch (_) { /* 离线:仅本机 */ }
|
||||
return sendJson(res, 200, { ok: true, plugin_id: pluginId, note });
|
||||
}
|
||||
|
||||
// ---------- 场景配置方案(多配置,SQLite 存储)----------
|
||||
if (p === "/api/plugin-configs" && method === "GET") {
|
||||
const account = session.requireLogin(cookies);
|
||||
|
||||
Reference in New Issue
Block a user