From c7a7bc8551457ac5b6de0a383397aa9e6bb50d9b Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Mon, 13 Jun 2022 19:15:19 +0800 Subject: [PATCH] fix --- src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java index 33382ee..612a694 100644 --- a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java @@ -151,11 +151,13 @@ BigDecimal fee = fundflow.getFee(); DappMemberEntity member = dappMemberDao.selectById(fundflow.getMemberId()); + List<DappMemberEntity> parents; if (StrUtil.isBlank(member.getRefererId()) || "0".equals(member.getRefererId())) { - return; + parents = new ArrayList<>(); + } else { + List<String> inviteIds = StrUtil.split(member.getRefererId(), ','); + parents = dappMemberDao.selectParentsList(inviteIds, 6);; } - List<String> inviteIds = StrUtil.split(member.getRefererId(), ','); - List<DappMemberEntity> parents = dappMemberDao.selectParentsList(inviteIds, 6); DataDictionaryCustom miniHoldCoin = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(AppContants.DIC_TYPE_SYSTEM_SETTING, AppContants.DIC_VALUE_MINI_HOLD_COIN_LIMIT); DataDictionaryCustom slipPointSetting = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(AppContants.DIC_TYPE_SLIP_POINT_SETTING, AppContants.DIC_TYPE_SLIP_POINT_SETTING); @@ -313,6 +315,22 @@ dappFundFlowDao.updateById(fundFlow); } } + + // 判断系统是否启动,如满足条件则启动系统 + String hasStart = redisUtils.getString(AppContants.SYSTEM_START_FLAG); + if (!"start".equals(hasStart)) { + DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(AppContants.DIC_TYPE_SYSTEM_SETTING, AppContants.DIC_VALUE_SYSTEM_START_TARGET); + BigDecimal target = new BigDecimal(dic.getValue()); + + // 若源池中的USDT达到或超过8万U,则启动整个系统 + BigDecimal balance = ChainService.getInstance(ChainEnum.BSC_USDT_SOURCE.name()).balanceOf(ChainEnum.BSC_USDT_SOURCE.getAddress()); + if (target.compareTo(balance) < 1) { + redisUtils.set(AppContants.SYSTEM_START_FLAG, "start"); + + // 启动系统 + startSystem(); + } + } } @Override -- Gitblit v1.9.1