fix(storeWarehouse): 策略变更后写入并失效签约策略缓存,避免奇门推单读取旧超卖快照
This commit is contained in:
parent
51f6b27d6a
commit
c0331cd68f
@ -407,12 +407,13 @@ class SettingStoreWarehouseService extends Service {
|
|||||||
transaction,
|
transaction,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
return;
|
} else {
|
||||||
|
await this.app.setCacheAsync(this.getPolicyConfigCacheKey(normalizedId), policyConfig, 86400 * 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.app.setCacheAsync(this.getPolicyConfigCacheKey(normalizedId), policyConfig, 86400 * 30);
|
// 清除签约策略缓存(sw_policy:{storeId}:{warehouseId}):
|
||||||
|
// 该缓存内嵌 policy_config 快照与 allowOversell 判定,策略变更(如开启允许超卖)后必须失效,
|
||||||
// 清除签约策略缓存(sw_policy:{storeId}:{warehouseId})
|
// 否则奇门推送订单会继续读取旧快照,导致超卖开关生效前仍提示库存不足。
|
||||||
const relation = await this.ctx.model.StoreWarehouse.findByPk(normalizedId, {
|
const relation = await this.ctx.model.StoreWarehouse.findByPk(normalizedId, {
|
||||||
attributes: [ 'store_id', 'warehouse_id' ],
|
attributes: [ 'store_id', 'warehouse_id' ],
|
||||||
raw: true,
|
raw: true,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user