bug下单时普通商品库存不足
This commit is contained in:
@ -306,7 +306,7 @@ public class StoreOrderController {
|
||||
public ApiResult<Boolean> comment(@Valid @RequestBody ProductReplyParam param){
|
||||
YxUser user = LocalUser.getUser();
|
||||
storeOrderService.orderComment(user,param.getUnique(),
|
||||
EmojiParser.removeAllEmojis(param.getComment()),
|
||||
param.getComment(),
|
||||
param.getPics(),param.getProductScore(),param.getServiceScore());
|
||||
return ApiResult.ok();
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ public class AuthService {
|
||||
YxUser returnUser = null;
|
||||
if(yxUser == null){
|
||||
//过滤掉表情
|
||||
String nickname = EmojiParser.removeAllEmojis(wxMpUser.getNickname());
|
||||
String nickname = wxMpUser.getNickname();
|
||||
log.info("昵称:{}", nickname);
|
||||
//用户保存
|
||||
String ip = IpUtil.getRequestIp();
|
||||
|
@ -148,19 +148,22 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
//先处理商品库存,活动商品也要处理,因为共享库存
|
||||
int product = storeProductMapper.decStockIncSales(num,productId);
|
||||
if(product == 0) {
|
||||
throw new YshopException("商品库存不足");
|
||||
throw new YshopException("共享商品库存不足");
|
||||
}
|
||||
//处理商品外层显示的库存
|
||||
int res = 0;
|
||||
if("combination".equals(type)){
|
||||
res = storeProductMapper.decCombinationStockIncSales(num,productId,activityId);
|
||||
int combinationRes = storeProductMapper.decCombinationStockIncSales(num,productId,activityId);
|
||||
if(combinationRes == 0) {
|
||||
throw new YshopException("拼团商品库存不足");
|
||||
}
|
||||
}else if("seckill".equals(type)){
|
||||
res = storeProductMapper.decSeckillStockIncSales(num,productId,activityId);
|
||||
int seckillRes = storeProductMapper.decSeckillStockIncSales(num,productId,activityId);
|
||||
if(seckillRes == 0) {
|
||||
throw new YshopException("秒杀商品库存不足");
|
||||
}
|
||||
}
|
||||
//todo 处理砍价库存
|
||||
if(res == 0) {
|
||||
throw new YshopException("商品库存不足");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user