@@ -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
@@ -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);