diff --git a/app/service/systems/store_warehouse.js b/app/service/systems/store_warehouse.js index ea24806..7cba590 100644 --- a/app/service/systems/store_warehouse.js +++ b/app/service/systems/store_warehouse.js @@ -407,12 +407,13 @@ class SettingStoreWarehouseService extends Service { 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}) + // 清除签约策略缓存(sw_policy:{storeId}:{warehouseId}): + // 该缓存内嵌 policy_config 快照与 allowOversell 判定,策略变更(如开启允许超卖)后必须失效, + // 否则奇门推送订单会继续读取旧快照,导致超卖开关生效前仍提示库存不足。 const relation = await this.ctx.model.StoreWarehouse.findByPk(normalizedId, { attributes: [ 'store_id', 'warehouse_id' ], raw: true,