This commit is contained in:
张成
2026-04-16 17:39:25 +08:00
parent df0aacc782
commit a45418883c
6 changed files with 212 additions and 63 deletions

View File

@@ -485,8 +485,9 @@ class PlaAccountService {
finalParams.keyword = account.keyword;
}
// get_job_listcommand 只约定 pageCount + tabLabel与前端一致入库 keyword 由 jobManager 用 tabLabel 推导
// get_job_list优先使用调用方显式传入的 tabLabel仅在未传时回退到 resume_info.deliver_tab_label
if (commandTypeSnake === 'get_job_list') {
const passedTabLabel = finalParams.tabLabel != null ? String(finalParams.tabLabel).trim() : '';
try {
const resume_info = db.getModel('resume_info');
const resume = await resume_info.findOne({
@@ -494,7 +495,7 @@ class PlaAccountService {
order: [['last_modify_time', 'DESC']],
attributes: ['deliver_tab_label']
});
if (resume && resume.deliver_tab_label) {
if (!passedTabLabel && resume && resume.deliver_tab_label) {
finalParams.tabLabel = String(resume.deliver_tab_label).trim();
}
} catch (e) {
@@ -639,6 +640,35 @@ class PlaAccountService {
command_params: JSON.stringify(commandParams)
};
// 防止 result 超长导致 "Data too long for column 'result'"
const serialize_retry_result_for_db = (value) => {
const max_length = 60000;
try {
let text = JSON.stringify(value || {});
if (text.length <= max_length) {
return text;
}
const summary = {
success: !!(value && value.success),
message: (value && value.message) ? String(value.message) : '重试结果过长,已摘要存储',
truncated: true,
raw_length: text.length,
preview: text.substring(0, 1000)
};
text = JSON.stringify(summary);
if (text.length > max_length) {
return text.substring(0, max_length - 12) + '...[已截断]';
}
return text;
} catch (error) {
return JSON.stringify({
success: false,
message: '结果序列化失败',
error: error.message || 'unknown'
});
}
};
// 执行指令并同步更新当前指令记录状态
const start_time = new Date();
try {
@@ -650,7 +680,7 @@ class PlaAccountService {
start_time: start_time,
end_time: end_time,
duration: end_time.getTime() - start_time.getTime(),
result: JSON.stringify(result || {})
result: serialize_retry_result_for_db(result)
});
return {