| | |
| | | |
| | | @Override |
| | | public int boxSurprise() { |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | |
| | | DappWalletCoinEntity walletCoin = dappWalletCoinDao.selectByMemberId(member.getId()); |
| | | if (walletCoin.getBoxCnt() < 1) { |
| | | throw new FebsException("盲盒数量不足"); |
| | | } |
| | | // 功能升级 |
| | | throw new FebsException(MessageSourceUtils.getString("box_surprise_002")); |
| | | |
| | | walletCoin.setBoxCnt(walletCoin.getBoxCnt() - 1); |
| | | dappWalletCoinDao.updateById(walletCoin); |
| | | |
| | | BoxUtil.Box box = BoxUtil.openBox(); |
| | | |
| | | DappFundFlowEntity boxFundFlow = new DappFundFlowEntity(member.getId(), new BigDecimal(box.getIndex()), 6, 2, BigDecimal.ZERO); |
| | | dappFundFlowDao.insert(boxFundFlow); |
| | | |
| | | new Thread(() -> { |
| | | try { |
| | | int count = box.getIndex(); |
| | | while (count > 0) { |
| | | ChainService.getInstance(ChainEnum.BSC_NFT_SDC.name()).safeMintNFT(member.getAddress()); |
| | | Thread.sleep(5000); |
| | | count--; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("发放卡牌错误", e); |
| | | } |
| | | }).start(); |
| | | |
| | | return box.getIndex(); |
| | | // DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | // |
| | | // DappWalletCoinEntity walletCoin = dappWalletCoinDao.selectByMemberId(member.getId()); |
| | | // if (walletCoin.getBoxCnt() < 1) { |
| | | // throw new FebsException(MessageSourceUtils.getString("box_surprise_001")); |
| | | // } |
| | | // |
| | | // walletCoin.setBoxCnt(walletCoin.getBoxCnt() - 1); |
| | | // dappWalletCoinDao.updateById(walletCoin); |
| | | // |
| | | // BoxUtil.Box box = BoxUtil.openBox(); |
| | | // |
| | | // DappFundFlowEntity boxFundFlow = new DappFundFlowEntity(member.getId(), new BigDecimal(box.getIndex()), 6, 2, BigDecimal.ZERO); |
| | | // dappFundFlowDao.insert(boxFundFlow); |
| | | // |
| | | // new Thread(() -> { |
| | | // try { |
| | | // int count = box.getIndex(); |
| | | // while (count > 0) { |
| | | // ChainService.getInstance(ChainEnum.BSC_NFT_SDC.name()).safeMintNFT(member.getAddress()); |
| | | // Thread.sleep(5000); |
| | | // count--; |
| | | // } |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // log.error("发放卡牌错误", e); |
| | | // } |
| | | // }).start(); |
| | | // |
| | | // return box.getIndex(); |
| | | } |
| | | } |