9 files modified
1 files added
| | |
| | | */ |
| | | BSC_USDT("BSC", "0x977a9ddfb965a9a3416fa72ca7f91c4949c18f25", |
| | | "0xefe98e00cd227b6322e892c82fcbd8eadf119c3188b7e574bc624f65405d61bf", |
| | | "https://data-seed-prebsc-2-s1.binance.org:8545", |
| | | "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd", |
| | | "https://bsc-dataseed1.ninicoin.io", |
| | | "0x55d398326f99059fF775485246999027B3197955", |
| | | ""), |
| | | |
| | | /** |
| | |
| | | */ |
| | | BSC_TFC("BSC", "0x977a9ddfb965a9a3416fa72ca7f91c4949c18f25", |
| | | "0xefe98e00cd227b6322e892c82fcbd8eadf119c3188b7e574bc624f65405d61bf", |
| | | "https://data-seed-prebsc-2-s1.binance.org:8545", |
| | | "0xdd92ea2f41d807a60b29004bf7db807d8ac09212", |
| | | "https://bsc-dataseed1.ninicoin.io", |
| | | "0x6c6835e60e7dBaD7a60112a6371271e8eb79ee68", |
| | | ""), |
| | | |
| | | /** |
| | |
| | | */ |
| | | BSC_TFC_SOURCE("BSC", "0x4EbDCA102623b46a47042D580dddAdE2a53D057F", |
| | | "0x81c2c02d0c106c1e32ab060a37f6eb279c0649c30ea5cc1c4951e6a8dd4e963c", |
| | | "https://data-seed-prebsc-2-s1.binance.org:8545", |
| | | "0xdd92ea2f41d807a60b29004bf7db807d8ac09212", |
| | | "https://bsc-dataseed1.ninicoin.io", |
| | | "0x6c6835e60e7dBaD7a60112a6371271e8eb79ee68", |
| | | ""), |
| | | |
| | | /** |
| | |
| | | */ |
| | | BSC_USDT_SOURCE("BSC", "0x4EbDCA102623b46a47042D580dddAdE2a53D057F", |
| | | "0x81c2c02d0c106c1e32ab060a37f6eb279c0649c30ea5cc1c4951e6a8dd4e963c", |
| | | "https://data-seed-prebsc-2-s1.binance.org:8545", |
| | | "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd", |
| | | "https://bsc-dataseed1.ninicoin.io", |
| | | "0x55d398326f99059fF775485246999027B3197955", |
| | | ""), |
| | | |
| | | /** |
| | |
| | | */ |
| | | BSC_TFC_MAKE("BSC", "0xBae24dAa3aB94cfF8114a16A4267D769b3a651F8", |
| | | "0xc0cabaf5f1fce227e5f1b8a7f83a5dc28972389ffc59559d7852ce8d27c3bec4", |
| | | "https://data-seed-prebsc-2-s1.binance.org:8545", |
| | | "0xdd92ea2f41d807a60b29004bf7db807d8ac09212", |
| | | "https://bsc-dataseed1.ninicoin.io", |
| | | "0x6c6835e60e7dBaD7a60112a6371271e8eb79ee68", |
| | | ""), |
| | | |
| | | /** |
| | |
| | | */ |
| | | BSC_TFC_TECH("BSC", "0xD998DA7362360eFC6daDFEd6E9a32E70640d7600", |
| | | "", |
| | | "https://data-seed-prebsc-2-s1.binance.org:8545", |
| | | "0xdd92ea2f41d807a60b29004bf7db807d8ac09212", |
| | | "https://bsc-dataseed1.ninicoin.io", |
| | | "0x6c6835e60e7dBaD7a60112a6371271e8eb79ee68", |
| | | ""), |
| | | |
| | | /** |
| | |
| | | */ |
| | | BSC_TFC_REWARD("BSC", "0xBae24dAa3aB94cfF8114a16A4267D769b3a651F8", |
| | | "0xc0cabaf5f1fce227e5f1b8a7f83a5dc28972389ffc59559d7852ce8d27c3bec4", |
| | | "https://data-seed-prebsc-2-s1.binance.org:8545", |
| | | "0xdd92ea2f41d807a60b29004bf7db807d8ac09212", |
| | | "https://bsc-dataseed1.ninicoin.io", |
| | | "0x6c6835e60e7dBaD7a60112a6371271e8eb79ee68", |
| | | ""); |
| | | |
| | | private String chain; |
| | |
| | | |
| | | @ApiModelProperty(value = "每页数量", example = "10") |
| | | private Integer pageSize; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private String inviteId; |
| | | } |
| | |
| | | * 激活状态 1-已激活 2-未激活 |
| | | */ |
| | | private Integer activeStatus; |
| | | |
| | | /** |
| | | * 滑点分享链 |
| | | */ |
| | | private String feeProfitIds; |
| | | } |
| | |
| | | package cc.mrbird.febs.dapp.mapper; |
| | | |
| | | import cc.mrbird.febs.dapp.dto.TeamListDto; |
| | | import cc.mrbird.febs.dapp.entity.DappMemberEntity; |
| | | import cc.mrbird.febs.dapp.vo.TeamListVo; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | BigDecimal selectAllBalance(@Param("accountType") String accountType); |
| | | |
| | | List<DappMemberEntity> selectMemberByAccountType(@Param("accountType") String accountType); |
| | | |
| | | List<DappMemberEntity> selectChildMemberDirectOrNot(@Param("inviteId") String inviteId, @Param("type") Integer type); |
| | | |
| | | BigDecimal selectChildHoldAmount(@Param("inviteId") String inviteId); |
| | | |
| | | IPage<TeamListVo> selectTeamListInPage(@Param("record") TeamListDto teamListDto, Page<TeamListDto> page); |
| | | } |
| | |
| | | boolean flag = false; |
| | | String parentId = refererId; |
| | | String ids = ""; |
| | | String feeProfitIds = ""; |
| | | |
| | | int i = 1; |
| | | List<DataDictionaryCustom> feeProfitDic = dataDictionaryCustomMapper.selectDicByType(AppContants.DIC_TYPE_DISTRIBUTE_PROP); |
| | | while (!flag && StringUtils.isNotBlank(parentId)) { |
| | | if (StrUtil.isBlank(ids)) { |
| | | ids += parentId; |
| | |
| | | ids += ("," + parentId); |
| | | } |
| | | |
| | | if (i <= feeProfitDic.size()) { |
| | | if (StrUtil.isBlank(feeProfitIds)) { |
| | | feeProfitIds += parentId; |
| | | } else { |
| | | feeProfitIds += ("," + parentId); |
| | | } |
| | | } |
| | | |
| | | i++; |
| | | DappMemberEntity parentMember = dappMemberDao.selectMemberInfoByInviteId(parentId); |
| | | if (parentMember == null) { |
| | | break; |
| | | } |
| | | parentId = parentMember.getRefererId(); |
| | | if(StringUtils.isBlank(parentId)){ |
| | | if(StringUtils.isBlank(parentId) || "0".equals(parentId)){ |
| | | break; |
| | | } |
| | | if (parentMember.getRefererId().equals(parentMember.getInviteId())) { |
| | |
| | | } |
| | | } |
| | | member.setRefererIds(ids); |
| | | member.setFeeProfitIds(feeProfitIds); |
| | | } |
| | | dappMemberDao.updateById(member); |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<TeamListVo> findTeamList(TeamListDto teamListDto) { |
| | | |
| | | return new ArrayList<>(); |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | Page<TeamListDto> page = new Page<>(teamListDto.getPageNum(), teamListDto.getPageSize()); |
| | | teamListDto.setInviteId(member.getInviteId()); |
| | | return dappMemberDao.selectTeamListInPage(teamListDto, page).getRecords(); |
| | | } |
| | | } |
| | |
| | | |
| | | OnlineTransferUtil.addTransfer(parent.getAddress(), total, fundflow.getType(), 1, ChainEnum.BSC_TFC_SOURCE.name(), AppContants.SYMBOL_COIN, batchNo); |
| | | |
| | | DappFundFlowEntity distribFlow = new DappFundFlowEntity(parent.getId(), total, 4, 2, BigDecimal.ZERO); |
| | | dappFundFlowDao.insert(distribFlow); |
| | | |
| | | nodeAmount = nodeAmount.subtract(total); |
| | | i++; |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void mining() { |
| | | log.info("挖矿"); |
| | | ContractChainService contract = ChainService.getInstance(ChainEnum.BSC_TFC.name()); |
| | | // 发行量 |
| | | BigInteger totalSupply = contract.totalSupply(); |
| | |
| | | |
| | | Map<String, BigDecimal> map = dappFundFlowDao.selectAmountTotalByType(member.getId()); |
| | | WalletInfoVo walletInfo = new WalletInfoVo(); |
| | | List<DappMemberEntity> direct = dappMemberDao.selectChildMemberDirectOrNot(member.getInviteId(), 1); |
| | | List<DappMemberEntity> notDirect = dappMemberDao.selectChildMemberDirectOrNot(member.getInviteId(), 2); |
| | | BigDecimal childHoldAmount = dappMemberDao.selectChildHoldAmount(member.getInviteId()); |
| | | |
| | | walletInfo.setTotalChild(10000); |
| | | walletInfo.setDirectCnt(100); |
| | | walletInfo.setTotalChildCoin(BigDecimal.valueOf(1)); |
| | | walletInfo.setTotalChild(notDirect.size()); |
| | | walletInfo.setDirectCnt(direct.size()); |
| | | walletInfo.setTotalChildCoin(childHoldAmount); |
| | | walletInfo.setTeamReward(map.get("teamReward")); |
| | | walletInfo.setMiningAmount(map.get("mine")); |
| | | return walletInfo; |
| | |
| | | |
| | | <select id="selectAmountTotalByType" resultType="java.util.HashMap"> |
| | | select |
| | | case when type=1 then amount end buy, |
| | | case when type=2 then amount end sale, |
| | | case when type=3 then amount end mine, |
| | | case when type=4 then amount end teamReward |
| | | from (select type, sum(amount) amount from dapp_fund_flow |
| | | where member_id=#{memberId} |
| | | MAX(if(type = 1, a.amount, 0)) buy |
| | | , MAX(if(type = 2, a.amount, 0)) sale |
| | | , MAX(if(type = 3, a.amount, 0)) mine |
| | | , MAX(if(type = 4, a.amount, 0)) teamReward |
| | | from (select type, sum(amount) amount |
| | | from dapp_fund_flow |
| | | where member_id=22 |
| | | group by type |
| | | ) a |
| | | </select> |
| | | </mapper> |
| | |
| | | account_type=#{accountType} |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectChildMemberDirectOrNot" resultType="cc.mrbird.febs.dapp.entity.DappMemberEntity"> |
| | | select * from dapp_member |
| | | <where> |
| | | <if test="type==1"> |
| | | and referer_id=#{inviteId} |
| | | </if> |
| | | <if test="type==2"> |
| | | and find_in_set(#{inviteId}, fee_profit_ids) |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectChildHoldAmount" resultType="java.math.BigDecimal"> |
| | | select ifnull(sum(balance),0) from dapp_member |
| | | where find_in_set(#{inviteId}, fee_profit_ids) |
| | | </select> |
| | | |
| | | <select id="selectTeamListInPage" resultType="cc.mrbird.febs.dapp.vo.TeamListVo"> |
| | | select |
| | | concat(left(a.address,5), '******', right(a.address,5)) address, |
| | | (select count(1) from dapp_member b where find_in_set(a.invite_id, b.fee_profit_ids) |
| | | ) count, |
| | | (select ifnull(sum(c.balance),0) from dapp_member c where find_in_set(a.invite_id, c.fee_profit_ids) |
| | | ) coinCount |
| | | from dapp_member a |
| | | where find_in_set(#{record.inviteId}, a.fee_profit_ids) |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | package cc.mrbird.febs; |
| | | |
| | | import cc.mrbird.febs.common.contants.AppContants; |
| | | import cc.mrbird.febs.dapp.entity.DappMemberEntity; |
| | | import cc.mrbird.febs.dapp.entity.DataDictionaryCustom; |
| | | import cc.mrbird.febs.dapp.mapper.DappMemberDao; |
| | | import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2022-06-09 |
| | | **/ |
| | | @SpringBootTest |
| | | public class MemberTest { |
| | | |
| | | @Autowired |
| | | private DappMemberDao dappMemberDao; |
| | | |
| | | @Autowired |
| | | private DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | |
| | | @Test |
| | | public void refererIdsTest() { |
| | | DappMemberEntity member = dappMemberDao.selectById(24); |
| | | |
| | | boolean flag = false; |
| | | String parentId = "35087336"; |
| | | String ids = ""; |
| | | String feeProfitIds = ""; |
| | | |
| | | int i = 1; |
| | | List<DataDictionaryCustom> feeProfitDic = dataDictionaryCustomMapper.selectDicByType(AppContants.DIC_TYPE_DISTRIBUTE_PROP); |
| | | while (!flag && StringUtils.isNotBlank(parentId)) { |
| | | if (StrUtil.isBlank(ids)) { |
| | | ids += parentId; |
| | | } else { |
| | | ids += ("," + parentId); |
| | | } |
| | | |
| | | if (i <= 4) { |
| | | if (StrUtil.isBlank(feeProfitIds)) { |
| | | feeProfitIds += parentId; |
| | | } else { |
| | | feeProfitIds += ("," + parentId); |
| | | } |
| | | } |
| | | |
| | | i++; |
| | | DappMemberEntity parentMember = dappMemberDao.selectMemberInfoByInviteId(parentId); |
| | | if (parentMember == null) { |
| | | break; |
| | | } |
| | | parentId = parentMember.getRefererId(); |
| | | if(StringUtils.isBlank(parentId) || "0".equals(parentId)){ |
| | | break; |
| | | } |
| | | if (parentMember.getRefererId().equals(parentMember.getInviteId())) { |
| | | flag = true; |
| | | } |
| | | } |
| | | member.setRefererIds(ids); |
| | | member.setFeeProfitIds(feeProfitIds); |
| | | } |
| | | } |