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