浏览代码

修复撤销bug

ellisran 1 年之前
父节点
当前提交
20f479a3b9
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      app/service/change_apply_history.js
  2. 1 1
      app/service/change_plan_history.js

+ 1 - 1
app/service/change_apply_history.js

@@ -45,7 +45,7 @@ module.exports = app => {
             const oldList = JSON.parse(data.list_json);
             // 先删后插
             await transaction.delete(this.ctx.service.changeApplyList.tableName, { caid });
-            await transaction.insert(this.ctx.service.changeApplyList.tableName, oldList);
+            if (oldList.length > 0) await transaction.insert(this.ctx.service.changeApplyList.tableName, oldList);
         }
     }
 

+ 1 - 1
app/service/change_plan_history.js

@@ -45,7 +45,7 @@ module.exports = app => {
             const oldList = JSON.parse(data.list_json);
             // 先删后插
             await transaction.delete(this.ctx.service.changePlanList.tableName, { cpid });
-            await transaction.insert(this.ctx.service.changePlanList.tableName, oldList);
+            if (oldList.length > 0) await transaction.insert(this.ctx.service.changePlanList.tableName, oldList);
         }
     }