master
胡锐 6 months ago
commit 521783d82a
  1. 5
      service/src/main/java/com/hfkj/service/goods/impl/GoodsMsgServiceImpl.java

@ -111,9 +111,9 @@ public class GoodsMsgServiceImpl implements GoodsMsgService {
try {
// 分布式锁占坑
Boolean lock = redisTemplate.opsForValue().setIfAbsent(key, goodsId);
System.out.println("==========================================================lock" + lock);
GoodsMsg goodsMsg = queryDetail(goodsId);
System.out.println("==========================================================goodsMsg" + goodsMsg);
if (goodsMsg != null) {
if(Boolean.TRUE.equals(lock)) {
@ -126,6 +126,7 @@ public class GoodsMsgServiceImpl implements GoodsMsgService {
update(goodsMsg);
} else {
System.out.println("==========================================================加锁失败,重试");
// 加锁失败,重试
Thread.sleep(100);
editSaleNum(goodsId , num , type);

Loading…
Cancel
Save