ソースを参照

清除缓存,防止树结构混乱

laiguoran 3 年 前
コミット
2de0e48eea
2 ファイル変更13 行追加0 行削除
  1. 10 0
      app/base/base_tree_service.js
  2. 3 0
      app/service/change_audit_list.js

+ 10 - 0
app/base/base_tree_service.js

@@ -351,6 +351,16 @@ class TreeService extends Service {
     _cacheMaxLid(mid, maxId) {
         this.cache.set(this.setting.keyPre + mid , maxId, 'EX', this.ctx.app.config.cacheTime);
     }
+    /**
+     * 移除最大节点id
+     *
+     * @param {Number} mid - master id
+     * @return {Number}
+     * @private
+     */
+    async _removeCacheMaxLid(mid) {
+        return await this.cache.del(this.setting.keyPre + mid);
+    }
 
     /**
      * 更新order

+ 3 - 0
app/service/change_audit_list.js

@@ -914,6 +914,9 @@ module.exports = app => {
                     total_price: sum.total_price,
                     deal_tp: sum.deal_tp,
                 });
+                // 清除修订及台账的maxLid缓存,防止树结构混乱
+                await this.ctx.service.reviseBills._removeCacheMaxLid(tid);
+                await this.ctx.service.ledger._removeCacheMaxLid(tid);
             }
         }