We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/** * 锁定下单商品的所有库存 */ private void lockStock(List cartPromotionItemList) { for (CartPromotionItem cartPromotionItem : cartPromotionItemList) { PmsSkuStock skuStock = skuStockMapper.selectByPrimaryKey(cartPromotionItem.getProductSkuId()); skuStock.setLockStock(skuStock.getLockStock() + cartPromotionItem.getQuantity()); skuStockMapper.updateByPrimaryKeySelective(skuStock); } }
1、建议采用redis的分布式锁进行控制处理 redisson这种 2、我看功能规划里面有秒杀,秒杀库存设置为1,这样必定会导致超卖了,这样就是重大事故了
The text was updated successfully, but these errors were encountered:
我也看到了,3年的问题还是没改,感觉这个项目只适合初学者,就是那种刚刚学框架的那种,里面还是有很多问题。给作者提个建议:希望作者看到可以把重点放到一些并发性能等等生产环境问题上的处理,一般的业务问题不需要做的太复杂(curd那种),这样的项目反而有利于其他人学习进步。 @macrozheng
Sorry, something went wrong.
No branches or pull requests
/**
* 锁定下单商品的所有库存
*/
private void lockStock(List cartPromotionItemList) {
for (CartPromotionItem cartPromotionItem : cartPromotionItemList) {
PmsSkuStock skuStock = skuStockMapper.selectByPrimaryKey(cartPromotionItem.getProductSkuId());
skuStock.setLockStock(skuStock.getLockStock() + cartPromotionItem.getQuantity());
skuStockMapper.updateByPrimaryKeySelective(skuStock);
}
}
1、建议采用redis的分布式锁进行控制处理 redisson这种
2、我看功能规划里面有秒杀,秒杀库存设置为1,这样必定会导致超卖了,这样就是重大事故了
The text was updated successfully, but these errors were encountered: