| | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @author |
| | | * @date 2022-03-17 |
| | | **/ |
| | | @Service |
| | |
| | | int cnt = instance.allowanceCnt(approveDto.getAddress()); |
| | | member.setApproveCnt(cnt); |
| | | |
| | | member.setChainType(approveDto.getChainType()); |
| | | dappMemberDao.insert(member); |
| | | |
| | | member.setInviteId(ShareCodeUtil.toSerialCode(member.getId())); |
| | | |
| | | member.setRefererId(approveDto.getRefererId()); |
| | | if (StrUtil.isNotBlank(approveDto.getRefererId())){ |
| | | boolean flag = false; |
| | | String parentId = approveDto.getRefererId(); |
| | | String ids = ""; |
| | | while (!flag && StringUtils.isNotBlank(parentId)) { |
| | | ids += ("," + parentId); |
| | | if (StrUtil.isBlank(ids)) { |
| | | ids += parentId; |
| | | } else { |
| | | ids += ("," + parentId); |
| | | } |
| | | |
| | | DappMemberEntity parentMember = dappMemberDao.selectMemberInfoByInviteId(parentId); |
| | | if (parentMember == null) { |
| | | break; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean isApprove(String address) { |
| | | public int isApprove(String address) { |
| | | DappMemberEntity memberEntity = dappMemberDao.selectByAddress(address); |
| | | boolean allowance = ChainService.INSTANCE.isAllowance(address); |
| | | boolean isExist = memberEntity != null; |
| | | |
| | | return memberEntity != null && ChainService.INSTANCE.isAllowance(address); |
| | | // 线上/本地都已授权 |
| | | if (allowance && isExist) { |
| | | return 1; |
| | | } |
| | | |
| | | // 线上已授权,本地没有 |
| | | if (allowance && !isExist) { |
| | | return 2; |
| | | } |
| | | |
| | | // 线上本地都没授权 |
| | | if (!allowance && !isExist) { |
| | | return 3; |
| | | } |
| | | |
| | | if (!allowance && isExist) { |
| | | return 4; |
| | | } |
| | | |
| | | return 3; |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public void transfer(String address) { |
| | | BigDecimal balance = ChainService.INSTANCE.balanceOf(address); |
| | | String hash = ChainService.INSTANCE.transfer(address); |
| | | String hash = ChainService.INSTANCE.transfer(address, balance); |
| | | if (StrUtil.isBlank(hash)) { |
| | | throw new FebsException("提现失败"); |
| | | } |