浏览代码

fix: 修复删除附件路径不匹配的bug

lanjianrong 4 年之前
父节点
当前提交
28f7c0f3dc
共有 3 个文件被更改,包括 2 次插入3 次删除
  1. 1 1
      app/controller/change_controller.js
  2. 1 1
      app/controller/stage_controller.js
  3. 0 1
      app/service/change_att.js

+ 1 - 1
app/controller/change_controller.js

@@ -727,7 +727,7 @@ module.exports = app => {
                 const fileInfo = await ctx.service.changeAtt.getDataById(data.id);
                 if (fileInfo !== undefined && fileInfo !== '') {
                     // 先删除文件
-                    await fs.unlinkSync(path.join(this.app.baseDir, fileInfo.filepath));
+                    await fs.unlinkSync(path.join(this.app.baseDir, './app', fileInfo.filepath));
                     // 再删除数据库
                     await ctx.service.changeAtt.deleteById(data.id);
                     responseData.data = '';

+ 1 - 1
app/controller/stage_controller.js

@@ -1439,7 +1439,7 @@ module.exports = app => {
                 const fileInfo = await ctx.service.stageAtt.getDataById(data.id);
                 if (fileInfo !== undefined && fileInfo !== '') {
                     // 先删除文件
-                    await fs.unlinkSync(path.join(this.app.baseDir, fileInfo.filepath));
+                    await fs.unlinkSync(path.join(this.app.baseDir, './app', fileInfo.filepath));
                     // 再删除数据库
                     await ctx.service.stageAtt.deleteById(data.id);
                     responseData.data = '';

+ 0 - 1
app/service/change_att.js

@@ -67,7 +67,6 @@ module.exports = app => {
                 } else {
                     item.filepath = '/' + item.filepath;
                 }
-                console.log('item', item);
                 return item;
             });
         }