puzhibing
2023-06-30 f58cca364b731eac2d60a440ffaa804be3cd43fd
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/service/impl/AppUserServiceImpl.java
@@ -176,7 +176,19 @@
            appUser.setInviterType(signInToRegister.getInviterType());
            this.insert(appUser);
            //发送优惠券
            boolean lock = redisUtil.lock();
            boolean lock = redisUtil.lock(5);
            if(!lock){
                int num1 = 1;
                while (num1 <= 10){
                    Thread.sleep(3000);//等待3秒
                    lock = redisUtil.lock(5);
                    if(lock){
                        break;
                    }else{
                        num1++;
                    }
                }
            }
            if(lock){
                List<CouponWarpper> list = pushCoupon(appUser.getId());
                redisUtil.unlock();
@@ -212,7 +224,7 @@
            userToCoupon.setCouponTotal(coupon.getCouponSendQuantity() > coupon.getRemainingQuantity() ?
                    coupon.getRemainingQuantity() : coupon.getCouponSendQuantity());
            userToCoupon.setValidCount(userToCoupon.getCouponTotal());
            userToCoupon.setExpireTime(new Date(System.currentTimeMillis() + (coupon.getCouponValidity() * 24 * 60 * 60 * 1000)));
            userToCoupon.setExpireTime(new Date(System.currentTimeMillis() + (coupon.getCouponValidity().longValue() * 24L * 60L * 60L * 1000L)));
            userToCouponService.insert(userToCoupon);
            coupon.setRemainingQuantity(coupon.getCouponSendQuantity() > coupon.getRemainingQuantity() ? 0 :