fix: 修复后端竞态/安全/数据处理问题并移除冗余 outImage 列
首次激活改条件更新消除并发竞态;备份恢复补模型全集与版本校验防清库; 审核列表分页总数、操作日志未捕获 Promise、出库导入重复码、加密密钥可编辑、 溯源码盐以 env 为准、证书按 originKey reconcile、env 加载去重等修复; 新增 parseBigId 防非法入参 500、全局安全响应头、去除 SVG 上传、接入 throttler 限流、 入队失败补偿、hashData 稳定序列化、无效码负缓存、看板已激活口径调整; 移除冗余 TraceCode.outImage 列统一 outImages(迁移 drop_trace_code_out_image)。
This commit is contained in:
@@ -47,7 +47,6 @@ export class ImportProcessor extends WorkerHost {
|
||||
where: { id: code.id },
|
||||
data: {
|
||||
outTime: row.outTime ?? undefined,
|
||||
outImage: imageItems[0]?.key || undefined,
|
||||
outImages: imageItems.length
|
||||
? imageItems.map((item) => ({ key: item.key, name: item.name, type: item.type || 'image' }))
|
||||
: undefined,
|
||||
@@ -68,16 +67,22 @@ export class ImportProcessor extends WorkerHost {
|
||||
|
||||
const resultUrl = await this.buildResultFile(sessionId);
|
||||
const status = fail === 0 ? JobStatus.SUCCESS : success === 0 ? JobStatus.FAILED : JobStatus.PARTIAL;
|
||||
const imported = fail === 0;
|
||||
const session = await this.prisma.outboundImportSession.findUnique({ where: { id: sessionId }, select: { fileKey: true } });
|
||||
await this.prisma.$transaction([
|
||||
this.prisma.outboundImportSession.update({
|
||||
where: { id: sessionId },
|
||||
data: { status: fail === 0 ? 'IMPORTED' : 'FAILED' },
|
||||
data: { status: imported ? 'IMPORTED' : 'FAILED', fileKey: imported ? null : undefined },
|
||||
}),
|
||||
this.prisma.job.update({
|
||||
where: { id: jobId },
|
||||
data: { total: rows.length, successCount: success, failCount: fail, status, resultFileUrl: resultUrl },
|
||||
}),
|
||||
]);
|
||||
// 导入成功后删除原始上传 ZIP,避免长期占用存储(预览图片已成为业务数据,保留)
|
||||
if (imported && session?.fileKey) {
|
||||
await this.storage.remove(session.fileKey).catch((e) => this.logger.warn(`删除导入 ZIP 失败:${(e as Error).message}`));
|
||||
}
|
||||
this.logger.log(`出库导入完成:成功 ${success},失败 ${fail}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user