记得上下班打卡 | git大法好,push需谨慎

Commit bb54a6bb authored by 胡佳晨's avatar 胡佳晨

修改下单接口

parent 6156a814
...@@ -134,7 +134,13 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -134,7 +134,13 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
throw new Exception("无权购买"); throw new Exception("无权购买");
} }
} }
int surplusGeneral = redisUtils.decrSkuStock(pre, skuId, number); int surplusGeneral;
if (pre != null) {
surplusGeneral = redisUtils.decrSkuStock(pre, skuId.split(pre)[0], number);
} else {
surplusGeneral = redisUtils.decrSkuStock(pre, skuId, number);
}
skuAndPreListAndNumber.add(skuId + "," + pre + "," + number); skuAndPreListAndNumber.add(skuId + "," + pre + "," + number);
//库存回滚 //库存回滚
if (surplusGeneral < 0) { if (surplusGeneral < 0) {
...@@ -166,7 +172,11 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -166,7 +172,11 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
String skuId = array[0]; String skuId = array[0];
String pre = array[1]; String pre = array[1];
int number = Integer.parseInt(array[2]); int number = Integer.parseInt(array[2]);
if (pre != null) {
redisUtils.incrSkuStock(pre, skuId.split(pre)[0], number);
} else {
redisUtils.incrSkuStock(pre, skuId, number); redisUtils.incrSkuStock(pre, skuId, number);
}
if (noZhengzaiOrder(uid)) { if (noZhengzaiOrder(uid)) {
redisUtils.decrSkuCountByUid(uid, skuId, number); redisUtils.decrSkuCountByUid(uid, skuId, number);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment