feat: update algorithm integrations and point cloud overlays
This commit is contained in:
@@ -162,6 +162,25 @@ export const appRouter = router({
|
||||
await db.deleteTaskCadFile(input.id);
|
||||
return { success: true };
|
||||
}),
|
||||
|
||||
// 检查 CAD 文件是否已有三角化采样缓存(.cad_sample_cache/ 目录下存在对应 PLY)
|
||||
hasSampleCache: protectedProcedure
|
||||
.input(z.object({ cadFileIds: z.array(z.number()) }))
|
||||
.query(async ({ input }) => {
|
||||
const result: Record<number, boolean> = {};
|
||||
for (const id of input.cadFileIds) {
|
||||
const row = await db.getTaskCadFileById(id);
|
||||
if (!row?.filePath) { result[id] = false; continue; }
|
||||
const cacheDir = path.join(path.dirname(row.filePath), '.cad_sample_cache');
|
||||
try {
|
||||
const files = fs.readdirSync(cacheDir);
|
||||
result[id] = files.some(f => f.endsWith('.ply'));
|
||||
} catch {
|
||||
result[id] = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}),
|
||||
}),
|
||||
|
||||
// ─── 检测任务 ──────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user