Sfoglia il codice sorgente

游戏倍数、充值上限修改

石田成 1 mese fa
parent
commit
f9c40a6fd6

+ 1 - 1
game-business/src/main/java/com/game/business/controller/AppGameItemController.java

@@ -230,7 +230,7 @@ public class AppGameItemController extends BaseController
 
         for (int i = 0; i < itemList.size(); i++) {
             AppGameItem gameItem = itemList.get(i);
-            gameItem.setItemMultiple(Integer.valueOf(configArry[i]));
+            gameItem.setItemMultiple(Double.valueOf(configArry[i]));
             appGameItemService.updateAppGameItem(gameItem);
         }
         return R.ok("同步成功");

+ 26 - 15
game-business/src/main/java/com/game/business/controller/AppUserController.java

@@ -161,6 +161,9 @@ public class AppUserController extends BaseController
             appUserService.updateUserAmount(tran);
             BigDecimal rate = BigDecimal.ZERO;
             if(null != userChargeDto.getRate() && userChargeDto.getRate() > 0 && userChargeDto.getAmount() > 0){
+                if(userChargeDto.getRate() > 1){
+                    return R.fail("超过最大手续费扣除");
+                }
                 //扣除手续费
                 FinTranRecord rateTran = new FinTranRecord();
                 BeanUtils.copyProperties(tran,rateTran);
@@ -180,22 +183,30 @@ public class AppUserController extends BaseController
             }
             double give = 0;
 //            if(null != userChargeDto.getGiveAmount() && userChargeDto.getGiveAmount() > 0){
-                give = BigDecimal.valueOf(userChargeDto.getAmount().doubleValue()
-                        * appUsersChargeService.isChargeToday(userChargeDto.getUserId())).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue();
-                //赠送
-                FinTranRecord giveTran = new FinTranRecord();
-                BeanUtils.copyProperties(tran,giveTran);
-                if(TranCurrencyType.Balance.getType() == giveTran.getCurrencyType()){
-                    giveTran.setDiamondCoinChange(give);
-                }else if(TranCurrencyType.Coin.getType() == giveTran.getCurrencyType()){
-                    giveTran.setCoinChange(give);
+                //今日已赠送金额
+                double todayGiveMoney = appUsersChargeService.isChargeToday(userChargeDto.getUserId());
+                double giveRate = todayGiveMoney>0?0.02:0.1; //当然首充10% 否则2%
+                if(todayGiveMoney < 2000) { //当日2000封顶
+                    give = BigDecimal.valueOf(userChargeDto.getAmount().doubleValue()
+                            * giveRate).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                    if((give + todayGiveMoney) > 2000){
+                        give = give - (give + todayGiveMoney - 2000); //赠送金额超过2000则扣减多出的余额
+                    }
+                    //赠送
+                    FinTranRecord giveTran = new FinTranRecord();
+                    BeanUtils.copyProperties(tran, giveTran);
+                    if (TranCurrencyType.Balance.getType() == giveTran.getCurrencyType()) {
+                        giveTran.setDiamondCoinChange(give);
+                    } else if (TranCurrencyType.Coin.getType() == giveTran.getCurrencyType()) {
+                        giveTran.setCoinChange(give);
+                    }
+                    giveTran.setTranType3(FinTranType3.CHARGE_IN_SEND.getType());
+                    giveTran.setTranType2(FinTranType3.CHARGE_IN_SEND.getTranType2().getType());
+                    giveTran.setTranType1(userChargeDto.getType() == 1 ? FinTranType1.U_Income_Coin_Balance.getType() : FinTranType1.U_Income_Coin.getType());
+                    giveTran.setRemarks("充值赠送");
+                    giveTran.setId(null);
+                    appUserService.updateUserAmount(giveTran);
                 }
-                giveTran.setTranType3(FinTranType3.CHARGE_IN_SEND.getType());
-                giveTran.setTranType2(FinTranType3.CHARGE_IN_SEND.getTranType2().getType());
-                giveTran.setTranType1(userChargeDto.getType() == 1?FinTranType1.U_Income_Coin_Balance.getType():FinTranType1.U_Income_Coin.getType());
-                giveTran.setRemarks("充值赠送");
-                giveTran.setId(null);
-                appUserService.updateUserAmount(giveTran);
 //            }
             AppUser afterUser = appUserService.selectAppUserByUserid(userChargeDto.getUserId());
             //充值记录

+ 1 - 1
game-business/src/main/java/com/game/business/domain/AppGameItem.java

@@ -46,7 +46,7 @@ private static final long serialVersionUID=1L;
     @ApiModelProperty(value = "选项倍数")
     @Excel(name = "选项倍数")
     @TableField(value = "item_multiple")
-    private Integer itemMultiple;
+    private Double itemMultiple;
 
     /** 选项值(第三方同步) */
     @ApiModelProperty(value = "选项值(第三方同步)")

+ 6 - 3
game-business/src/main/java/com/game/business/service/impl/AppUsersChargeServiceImpl.java

@@ -130,8 +130,11 @@ public class AppUsersChargeServiceImpl extends ServiceImpl<AppUsersChargeMapper,
         queryWrapper.eq(AppUsersCharge::getStatus,1);
         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"));
-        int count = appUsersChargeMapper.selectCount(queryWrapper).intValue();
-        double rate = count>0?0.02:0.1;
-        return rate;
+        List<AppUsersCharge> appUsersCharges = appUsersChargeMapper.selectList(queryWrapper);
+        double money = 0;
+        if(null != appUsersCharges && appUsersCharges.size() > 0){
+            money = appUsersCharges.stream().mapToDouble(e->null==e.getCoinGive()?0.00:e.getCoinGive().doubleValue()).sum();
+        }
+        return money;
     }
 }

+ 3 - 0
game-ui/src/views/business/user/index.vue

@@ -878,6 +878,9 @@ export default {
       var that =this;
       this.$refs["chargeForm"].validate(valid => {
         if (valid) {
+          if(that.chargeForm.isRate != 1){
+            that.chargeForm.rate = null;
+          }
           if(that.chargeForm.channelId == -1 && (undefined == that.chargeForm.rate || null == that.chargeForm.rate)){
             this.$modal.msgError("请输入手续费比例");
             return;