|
|
@@ -37,6 +37,7 @@ import com.alipay.api.response.AlipayTradeAppPayResponse;
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.fs.common.config.FSSysConfig;
|
|
|
+import com.fs.common.constant.LiveKeysConstant;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
|
import com.fs.common.core.redis.service.StockDeductService;
|
|
|
@@ -4668,6 +4669,10 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
goods.setStock(goods.getStock() - Integer.parseInt(liveOrder.getTotalNum()));
|
|
|
goods.setSales(goods.getSales() + Integer.parseInt(liveOrder.getTotalNum()));
|
|
|
liveGoodsMapper.updateLiveGoods(goods);
|
|
|
+ // 清除商品详情缓存,确保 liveGoodsDetail 接口返回最新库存
|
|
|
+ String productDetailCacheKey = String.format(LiveKeysConstant.PRODUCT_DETAIL_CACHE, liveOrder.getProductId());
|
|
|
+ redisCache.deleteObject(productDetailCacheKey);
|
|
|
+ log.info("清除商品详情缓存:{}", productDetailCacheKey);
|
|
|
LiveGoods liveGoods = new LiveGoods();
|
|
|
liveGoods.setGoodsId(goods.getGoodsId());
|
|
|
liveGoods.setStock(goods.getStock() - Integer.parseInt(liveOrder.getTotalNum()));
|