Commit a842320a by linjinhong

fix:修改问题

parent 25a79519
...@@ -413,6 +413,7 @@ export default { ...@@ -413,6 +413,7 @@ export default {
let dirPath = path.join(process.cwd(), `./print/Input`); let dirPath = path.join(process.cwd(), `./print/Input`);
if (!fs.existsSync(dirPath)) { if (!fs.existsSync(dirPath)) {
console.log(`目录不存在: ${dirPath}`); console.log(`目录不存在: ${dirPath}`);
res.json({ code: 500, msg: `目录不存在: ${dirPath}` });
return; return;
} }
try { try {
...@@ -426,14 +427,17 @@ export default { ...@@ -426,14 +427,17 @@ export default {
console.log(`已删除文件: ${fullPath}`); console.log(`已删除文件: ${fullPath}`);
} }
} }
res.json({ code: 200, msg: `已删除文件: ${deletedFiles.join(",")}` }); res.json({ code: 200, msg: `删除成功!`, data: deletedFiles });
} catch (error) { } catch (error) {
let msg = "";
if (error.code === "ENOENT") { if (error.code === "ENOENT") {
msg = `目录不存在: ${dirPath}`;
console.warn(`目录不存在: ${dirPath}`); console.warn(`目录不存在: ${dirPath}`);
} else { } else {
msg = `清理错误: ${error.message}`;
console.error(`清理错误: ${error.message}`); console.error(`清理错误: ${error.message}`);
} }
res.json({ code: 500, msg: error.message }); res.json({ code: 500, msg: msg });
} }
}, },
saveToPng: async (req, res) => { saveToPng: async (req, res) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment