Browse Source

过滤金币充值赠送

dos 2 months ago
parent
commit
3d3b0409d6

+ 3 - 2
game-business/src/main/java/com/game/business/controller/AppUserController.java

@@ -194,9 +194,10 @@ public class AppUserController extends BaseController
                 appUserService.updateUserAmount(rateTran);*/
             }
             double give = 0;
+            if(userChargeDto.getType() == 1) { //金币充值不赠送
 //            if(null != userChargeDto.getGiveAmount() && userChargeDto.getGiveAmount() > 0){
                 //今日已赠送金额
-                double todayGiveMoney = appUsersChargeService.isChargeToday(userChargeDto.getUserId());
+                double todayGiveMoney = appUsersChargeService.isChargeToday(userChargeDto.getUserId(),userChargeDto.getType());
                 double giveRate = todayGiveMoney>0?0.02:0.1; //当然首充10% 否则2%
                 if(todayGiveMoney < 2000) { //当日2000封顶
                     give = BigDecimal.valueOf(userChargeDto.getAmount().doubleValue()
@@ -219,7 +220,7 @@ public class AppUserController extends BaseController
                     giveTran.setId(null);
                     appUserService.updateUserAmount(giveTran);
                 }
-//            }
+            }
             AppUser afterUser = appUserService.selectAppUserByUserid(userChargeDto.getUserId());
             //充值记录
             AppUsersCharge appUsersCharge = new AppUsersCharge();

+ 1 - 1
game-business/src/main/java/com/game/business/service/IAppUsersChargeService.java

@@ -69,7 +69,7 @@ public interface IAppUsersChargeService extends IService<AppUsersCharge> {
     /**
      * 查询返佣比例
      * */
-    public double isChargeToday(Long userId);
+    public double isChargeToday(Long userId,int coinType);
 
     AppUsersCharge selectByOrderNo(String orderNo);
 }

+ 2 - 1
game-business/src/main/java/com/game/business/service/impl/AppUsersChargeServiceImpl.java

@@ -123,11 +123,12 @@ public class AppUsersChargeServiceImpl extends ServiceImpl<AppUsersChargeMapper,
 
     @Override
     @DataSource(DataSourceType.SLAVE)
-    public double isChargeToday(Long userId) {
+    public double isChargeToday(Long userId,int coinType) {
         Date now = new Date();
         LambdaQueryWrapper<AppUsersCharge> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(AppUsersCharge::getUid,userId);
         queryWrapper.eq(AppUsersCharge::getStatus,1);
+        queryWrapper.eq(AppUsersCharge::getCoinType,coinType);
         queryWrapper.ge(AppUsersCharge::getUpdateTime, DateUtil.format(now,"yyyy-MM-dd").concat(" 00:00:00"));
         queryWrapper.le(AppUsersCharge::getUpdateTime, DateUtil.format(now,"yyyy-MM-dd").concat(" 23:59:59"));
         List<AppUsersCharge> appUsersCharges = appUsersChargeMapper.selectList(queryWrapper);