wangqifan 3 жил өмнө
parent
commit
c0bc3c4487

+ 15 - 18
src/main/java/com/izouma/nineth/service/UserBalanceService.java

@@ -502,23 +502,20 @@ public class UserBalanceService {
 
     public void airDrop(Long userId, Long checkResult) {
         Long collectionId = Long.valueOf(sysConfigService.getString("recharge_collectionId"));
-        Long count = assetRepo.countAllByCollectionIdAndUserIdAndSource(collectionId, userId, AssetSource.OFFICIAL);
-        long shouldAirDrop = checkResult - count;
-        if (count >= 1) {
-            User user = userRepo.findById(userId).orElseThrow(new BusinessException("暂无该用户"));
-            airDropService.create(AirDrop.builder()
-                    .name("春节充值空投福卡")
-                    .remark("recharge:" + userId)
-                    .type(AirDropType.asset)
-                    .userIds(Collections.singletonList(userId))
-                    .collectionId(collectionId)
-                    .targets(Collections
-                            .singletonList(new DropTarget(user.getId(), user.getPhone(), user
-                                    .getNickname(), Math.toIntExact(shouldAirDrop))))
-                    .auto(true)
-                    .companyId(1L)
-                    .build());
-        }
+        User user = userRepo.findById(userId).orElseThrow(new BusinessException("暂无该用户"));
+        airDropService.create(AirDrop.builder()
+                .name("春节充值空投福卡")
+                .remark("recharge:" + userId)
+                .type(AirDropType.asset)
+                .userIds(Collections.singletonList(userId))
+                .collectionId(collectionId)
+                .targets(Collections
+                        .singletonList(new DropTarget(user.getId(), user.getPhone(), user
+                                .getNickname(), Math.toIntExact(checkResult))))
+                .auto(true)
+                .companyId(1L)
+                .build());
+
     }
 
     public Long checkRechargeSum(BigDecimal recharge) {
@@ -526,7 +523,7 @@ public class UserBalanceService {
         if (compare1 >= 0) {
             int compare2 = recharge.compareTo(BigDecimal.valueOf(10000));
             if (compare2 >= 0) {
-                return 3L;
+                return 2L;
             }
             return 1L;
         }