| | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @author |
| | | * @date 2022-03-17 |
| | | **/ |
| | | @Service |
| | |
| | | } |
| | | |
| | | @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("提现失败"); |
| | | } |