From 5d1fc41db9c48ca7e4beffdfeb789fd6f69f4d2f Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 21 Nov 2022 11:20:03 +0800
Subject: [PATCH] 20221117

---
 src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java |  122 +++++++++++++++++++++++++++++-----------
 1 files changed, 89 insertions(+), 33 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
index 5e0f05a..6cb1639 100644
--- a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
@@ -29,6 +29,8 @@
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.crypto.SecureUtil;
+import cn.hutool.crypto.asymmetric.KeyType;
+import cn.hutool.crypto.asymmetric.RSA;
 import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -570,7 +572,12 @@
             return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_003"));
         }
         //验证资金密码
-        Boolean aBoolean = dappMemberService.validateTransferCode(apiTransferInsideDto.getTransferCode(), dappMemberEntityOut.getId());
+
+        //RSA解密
+        RSA rsa = new RSA(AppContants.PRIVATE_KEY, null);
+        String transferPassword = apiTransferInsideDto.getTransferCode();
+        transferPassword = rsa.decryptStr(transferPassword, KeyType.PrivateKey);
+        Boolean aBoolean = dappMemberService.validateTransferCode(transferPassword, dappMemberEntityOut.getId());
         if(!aBoolean){
             return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_006"));
         }
@@ -597,18 +604,18 @@
          * 否则,计算收益占本金的比例。符合条件允许提现
          */
         //获取用户的总收益
-        BigDecimal totalProfitOut = igtOnHookPlanOrderItemdao.selectTotalProfitByMemberIdAndStateAndIsgoal(memberIdOut,2);
-        if(balance.compareTo(totalProfitOut) > 0){
-            BigDecimal totalAmount = dappWalletCoinEntityOut.getTotalAmount();
-            //用户总收益率
-            BigDecimal divide = totalProfitOut.divide(totalAmount,4,BigDecimal.ROUND_DOWN);
-            //提现条件收益率
-            DataDictionaryCustom outAccountProfitDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getType(), DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getCode());
-            BigDecimal outAccountProfit = outAccountProfitDic.getValue() == null ? new BigDecimal("0.3") : new BigDecimal(outAccountProfitDic.getValue());
-            if(divide.compareTo(outAccountProfit) < 0){
-                return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_004"));
-            }
-        }
+//        BigDecimal totalProfitOut = igtOnHookPlanOrderItemdao.selectTotalProfitByMemberIdAndStateAndIsgoal(memberIdOut,2);
+//        if(balance.compareTo(totalProfitOut) > 0){
+//            BigDecimal totalAmount = dappWalletCoinEntityOut.getTotalAmount();
+//            //用户总收益率
+//            BigDecimal divide = totalProfitOut.divide(totalAmount,4,BigDecimal.ROUND_DOWN);
+//            //提现条件收益率
+//            DataDictionaryCustom outAccountProfitDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getType(), DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getCode());
+//            BigDecimal outAccountProfit = outAccountProfitDic.getValue() == null ? new BigDecimal("0.3") : new BigDecimal(outAccountProfitDic.getValue()).multiply(new BigDecimal(0.01));
+//            if(divide.compareTo(outAccountProfit) < 0){
+//                return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_004"));
+//            }
+//        }
         //提现次数
         DataDictionaryCustom withdrawTimesDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.WITHDRAW_TIMES.getType(), DataDictionaryEnum.WITHDRAW_TIMES.getCode());
         Integer withdrawTimes = Integer.parseInt(withdrawTimesDic.getValue());
@@ -690,8 +697,13 @@
                 || ObjectUtil.isEmpty(apiTransferPasswordDto.getNewTransferPasswordAgain())){
             return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_008"));
         }
+
+        //RSA解密
+        RSA rsa = new RSA(AppContants.PRIVATE_KEY, null);
         String newTransferPassword = apiTransferPasswordDto.getNewTransferPassword();
+        newTransferPassword = rsa.decryptStr(newTransferPassword, KeyType.PrivateKey);
         String newTransferPasswordAgain = apiTransferPasswordDto.getNewTransferPasswordAgain();
+        newTransferPasswordAgain = rsa.decryptStr(newTransferPasswordAgain, KeyType.PrivateKey);
         if(!newTransferPassword.equals(newTransferPasswordAgain)){
             return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_009"));
         }
@@ -699,7 +711,16 @@
         DappMemberEntity dappMemberEntity = LoginUserUtil.getAppUser();
         Long memberId = dappMemberEntity.getId();
         DappMemberEntity memberEntity = dappMemberDao.selectById(memberId);
-        memberEntity.setTransferCode(SecureUtil.md5(apiTransferPasswordDto.getNewTransferPassword()));
+        //验证旧密码是否正确
+        String transferCode = memberEntity.getTransferCode();
+        String oldTransferPassword = apiTransferPasswordDto.getOldTransferPassword();
+        oldTransferPassword = rsa.decryptStr(oldTransferPassword, KeyType.PrivateKey);
+        oldTransferPassword = SecureUtil.md5(oldTransferPassword);
+        if(!oldTransferPassword.equals(transferCode)){
+            return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_0018"));
+        }
+
+        memberEntity.setTransferCode(SecureUtil.md5(newTransferPassword));
         dappMemberDao.updateById(memberEntity);
 
         return new FebsResponse().success().message(MessageSourceUtils.getString("Operation_001"));
@@ -743,7 +764,11 @@
             return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_0017"));
         }
         //验证资金密码
-        Boolean aBoolean = dappMemberService.validateTransferCode(apiTransferOutsideDto.getTransferCode(), memberId);
+        //RSA解密
+        RSA rsa = new RSA(AppContants.PRIVATE_KEY, null);
+        String transferPassword = apiTransferOutsideDto.getTransferCode();
+        transferPassword = rsa.decryptStr(transferPassword, KeyType.PrivateKey);
+        Boolean aBoolean = dappMemberService.validateTransferCode(transferPassword, memberId);
         if(!aBoolean){
             return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_006"));
         }
@@ -760,7 +785,7 @@
             BigDecimal divide = totalProfit.divide(totalAmount,4,BigDecimal.ROUND_DOWN);
             //提现条件收益率
             DataDictionaryCustom outAccountProfitDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getType(), DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getCode());
-            BigDecimal outAccountProfit = outAccountProfitDic.getValue() == null ? new BigDecimal("0.3") : new BigDecimal(outAccountProfitDic.getValue());
+            BigDecimal outAccountProfit = outAccountProfitDic.getValue() == null ? new BigDecimal("0.3") : new BigDecimal(outAccountProfitDic.getValue()).multiply(new BigDecimal(0.01));
             if(divide.compareTo(outAccountProfit) < 0){
                 return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_004"));
             }
@@ -824,8 +849,13 @@
                 || ObjectUtil.isEmpty(apiTransferPasswordDto.getNewTransferPasswordAgain())){
             return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_008"));
         }
+
+        //RSA解密
+        RSA rsa = new RSA(AppContants.PRIVATE_KEY, null);
         String newTransferPassword = apiTransferPasswordDto.getNewTransferPassword();
+        newTransferPassword = rsa.decryptStr(newTransferPassword, KeyType.PrivateKey);
         String newTransferPasswordAgain = apiTransferPasswordDto.getNewTransferPasswordAgain();
+        newTransferPasswordAgain = rsa.decryptStr(newTransferPasswordAgain, KeyType.PrivateKey);
         if(!newTransferPassword.equals(newTransferPasswordAgain)){
             return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_009"));
         }
@@ -836,7 +866,7 @@
         String email = apiTransferPasswordDto.getEmail();
         String wahtsApp = apiTransferPasswordDto.getWahtsApp();
         String telegram = apiTransferPasswordDto.getTelegram();
-        memberEntity.setTransferCode(SecureUtil.md5(apiTransferPasswordDto.getNewTransferPassword()));
+        memberEntity.setTransferCode(SecureUtil.md5(newTransferPassword));
         memberEntity.setRealname(realname);
         memberEntity.setPhone(phone);
         memberEntity.setEmail(email);
@@ -879,7 +909,12 @@
             return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_003"));
         }
         //验证资金密码
-        Boolean aBoolean = dappMemberService.validateTransferCode(apiUpdatePasswordDto.getTransferCode(), memberEntity.getId());
+
+        //RSA解密
+        String transferCode = apiUpdatePasswordDto.getTransferCode();
+        RSA rsa = new RSA(AppContants.PRIVATE_KEY, null);
+        transferCode = rsa.decryptStr(transferCode, KeyType.PrivateKey);
+        Boolean aBoolean = dappMemberService.validateTransferCode(transferCode, memberEntity.getId());
         if(!aBoolean){
             return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_006"));
         }
@@ -888,13 +923,16 @@
                 || ObjectUtil.isEmpty(apiUpdatePasswordDto.getNewTransferPasswordAgain())){
             return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_008"));
         }
+
         String newTransferPassword = apiUpdatePasswordDto.getNewTransferPassword();
+        newTransferPassword = rsa.decryptStr(newTransferPassword, KeyType.PrivateKey);
         String newTransferPasswordAgain = apiUpdatePasswordDto.getNewTransferPasswordAgain();
+        newTransferPasswordAgain = rsa.decryptStr(newTransferPasswordAgain, KeyType.PrivateKey);
         if(!newTransferPassword.equals(newTransferPasswordAgain)){
             return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_009"));
         }
 
-        memberEntity.setPassword(SecureUtil.md5(apiUpdatePasswordDto.getNewTransferPassword()));
+        memberEntity.setPassword(SecureUtil.md5(newTransferPassword));
         dappMemberDao.updateById(memberEntity);
 
         String redisKey = AppContants.REDIS_KEY_SIGN + memberEntity.getId();
@@ -917,13 +955,18 @@
                 || ObjectUtil.isEmpty(apiResetPasswordDto.getNewPasswordAgain())){
             return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_008"));
         }
+
+        //RSA解密
+        RSA rsa = new RSA(AppContants.PRIVATE_KEY, null);
         String newPassword = apiResetPasswordDto.getNewPassword();
+        newPassword = rsa.decryptStr(newPassword, KeyType.PrivateKey);
         String newPasswordAgain = apiResetPasswordDto.getNewPasswordAgain();
+        newPasswordAgain = rsa.decryptStr(newPasswordAgain, KeyType.PrivateKey);
         if(!newPassword.equals(newPasswordAgain)){
             return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_009"));
         }
         DappMemberEntity memberEntity = dappMemberDao.selectById(memberId);
-        memberEntity.setPassword(SecureUtil.md5(apiResetPasswordDto.getNewPassword()));
+        memberEntity.setPassword(SecureUtil.md5(newPassword));
         dappMemberDao.updateById(memberEntity);
 
         String redisKey = AppContants.REDIS_KEY_SIGN + memberEntity.getId();
@@ -944,7 +987,8 @@
                 BigDecimal multiply = totalProfit.multiply(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
                 DappMemberEntity dappMemberEntityLEVEL_IB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_IB);
                 DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_IB.getId());
-                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0){
+                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0
+                    || 2 != dappMemberEntityLEVEL_IB.getIsOnHook()){
                     dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_IB.getId(),multiply);
                     DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                             dappMemberEntityLEVEL_IB.getId(),dappWalletCoinEntity.getAvailableAmount(),
@@ -965,7 +1009,8 @@
                 multiply = totalProfit.multiply(multiply);
                 DappMemberEntity dappMemberEntityLEVEL_FIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_FIB);
                 DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_FIB.getId());
-                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0
+                        || 2 != dappMemberEntityLEVEL_FIB.getIsOnHook()){
                     dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_FIB.getId(), multiply);
                     DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                             dappMemberEntityLEVEL_FIB.getId(),dappWalletCoinEntity.getAvailableAmount(),
@@ -987,7 +1032,8 @@
                 multiply = totalProfit.multiply(multiply);
                 DappMemberEntity dappMemberEntityLEVEL_CIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_CIB);
                 DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_CIB.getId());
-                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0
+                        || 2 != dappMemberEntityLEVEL_CIB.getIsOnHook()){
                     dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_CIB.getId(), multiply);
                     DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                             dappMemberEntityLEVEL_CIB.getId(),dappWalletCoinEntity.getAvailableAmount(),
@@ -1011,7 +1057,8 @@
                 multiply = totalProfit.multiply(multiply);
                 DappMemberEntity dappMemberEntityLEVEL_AIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_AIB);
                 DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_AIB.getId());
-                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0
+                        || 2 != dappMemberEntityLEVEL_AIB.getIsOnHook()){
                     dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(), multiply);
                     DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                             dappMemberEntityLEVEL_AIB.getId(),dappWalletCoinEntity.getAvailableAmount(),
@@ -1037,7 +1084,8 @@
                 multiply = totalProfit.multiply(multiply);
                 DappMemberEntity dappMemberEntityLEVEL_GIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GIB);
                 DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_GIB.getId());
-                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0
+                        || 2 != dappMemberEntityLEVEL_GIB.getIsOnHook()){
                     dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(), multiply);
                     DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                             dappMemberEntityLEVEL_GIB.getId(),dappWalletCoinEntity.getAvailableAmount(),
@@ -1065,7 +1113,8 @@
                 multiply = totalProfit.multiply(multiply);
                 DappMemberEntity dappMemberEntityLEVEL_BP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_BP);
                 DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_BP.getId());
-                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0
+                        || 2 != dappMemberEntityLEVEL_BP.getIsOnHook()){
                     dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(), multiply);
                     DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                             dappMemberEntityLEVEL_BP.getId(),dappWalletCoinEntity.getAvailableAmount(),
@@ -1095,7 +1144,8 @@
                 multiply = totalProfit.multiply(multiply);
                 DappMemberEntity dappMemberEntityLEVEL_SP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_SP);
                 DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_SP.getId());
-                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0
+                        || 2 != dappMemberEntityLEVEL_SP.getIsOnHook()){
                     dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(), multiply);
                     DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                             dappMemberEntityLEVEL_SP.getId(),dappWalletCoinEntity.getAvailableAmount(),
@@ -1127,7 +1177,8 @@
                 multiply = totalProfit.multiply(multiply);
                 DappMemberEntity dappMemberEntityLEVEL_GP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GP);
                 DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_GP.getId());
-                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0
+                        || 2 != dappMemberEntityLEVEL_GP.getIsOnHook()){
                     dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(), multiply);
                     DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                             dappMemberEntityLEVEL_GP.getId(),dappWalletCoinEntity.getAvailableAmount(),
@@ -1147,7 +1198,8 @@
                 DappMemberEntity dappMemberEntityLEVEL_AIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_AIB);
 
                 DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_AIB.getId());
-                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0
+                        || 2 != dappMemberEntityLEVEL_AIB.getIsOnHook()){
                     dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(), multiply);
                     DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                             dappMemberEntityLEVEL_AIB.getId(),dappWalletCoinEntity.getAvailableAmount(),
@@ -1163,7 +1215,8 @@
                 DappMemberEntity dappMemberEntityLEVEL_GIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GIB);
 
                 DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_GIB.getId());
-                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0
+                        || 2 != dappMemberEntityLEVEL_GIB.getIsOnHook()){
                     dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(), multiply);
                     DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                             dappMemberEntityLEVEL_GIB.getId(),dappWalletCoinEntity.getAvailableAmount(),
@@ -1179,7 +1232,8 @@
                 DappMemberEntity dappMemberEntityLEVEL_BP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_BP);
 
                 DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_BP.getId());
-                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0
+                        || 2 != dappMemberEntityLEVEL_BP.getIsOnHook()){
                     dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(), multiply);
                     DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                             dappMemberEntityLEVEL_BP.getId(),dappWalletCoinEntity.getAvailableAmount(),
@@ -1195,7 +1249,8 @@
                 DappMemberEntity dappMemberEntityLEVEL_SP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_SP);
 
                 DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_SP.getId());
-                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0
+                        || 2 != dappMemberEntityLEVEL_SP.getIsOnHook()){
                     dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(), multiply);
                     DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                             dappMemberEntityLEVEL_SP.getId(),dappWalletCoinEntity.getAvailableAmount(),
@@ -1211,7 +1266,8 @@
                 DappMemberEntity dappMemberEntityLEVEL_GP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GP);
 
                 DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_GP.getId());
-                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+                if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0
+                        || 2 != dappMemberEntityLEVEL_GP.getIsOnHook()){
                     dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(), multiply);
                     DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                             dappMemberEntityLEVEL_GP.getId(),dappWalletCoinEntity.getAvailableAmount(),

--
Gitblit v1.9.1