laiguoran hace 5 años
padre
commit
4f96ef4eae
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      app/service/tender.js

+ 3 - 1
app/service/tender.js

@@ -271,7 +271,9 @@ module.exports = app => {
                 const attList = await this.ctx.service.changeAtt.getAllDataByCondition({ where: { tid: id } });
                 if (attList.length !== 0) {
                     for (const att of attList) {
-                        await fs.unlinkSync(path.join(this.app.baseDir, att.filepath));
+                        if (fs.existsSync(path.join(this.app.baseDir, att.filepath))) {
+                            await fs.unlinkSync(path.join(this.app.baseDir, att.filepath));
+                        }
                     }
                 }
                 await transaction.delete(this.ctx.service.changeAtt.tableName, {tid: id});