laiguoran 5 tahun lalu
induk
melakukan
4f96ef4eae
1 mengubah file dengan 3 tambahan dan 1 penghapusan
  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});