| | |
| | | import cc.mrbird.febs.dapp.entity.*; |
| | | import cc.mrbird.febs.dapp.mapper.*; |
| | | import cc.mrbird.febs.dapp.service.DappWalletService; |
| | | import cc.mrbird.febs.dapp.utils.BoxUtil; |
| | | import cc.mrbird.febs.dapp.vo.WalletInfoVo; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | public Map<String, BigDecimal> calPrice(PriceDto priceDto) { |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | |
| | | |
| | | String hasStart = redisUtils.getString(AppContants.SYSTEM_START_FLAG); |
| | | if (!"start".equals(hasStart)) { |
| | | HashMap<String, BigDecimal> map = new HashMap<>(); |
| | |
| | | map.put("y", y); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public int boxSurprise() { |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | |
| | | DappIdoAssetsEntity idoAssets = dappIdoAssetsDao.selectByMemberId(member.getId()); |
| | | if (idoAssets.getBoxCnt() < 1) { |
| | | throw new FebsException("盲盒数量不足"); |
| | | } |
| | | |
| | | idoAssets.setBoxCnt(idoAssets.getBoxCnt() - 1); |
| | | dappIdoAssetsDao.updateById(idoAssets); |
| | | |
| | | BoxUtil.Box box = BoxUtil.openBox(); |
| | | |
| | | DappFundFlowEntity boxFundFlow = new DappFundFlowEntity(member.getId(), new BigDecimal(box.getIndex()), 6, 2, BigDecimal.ZERO); |
| | | dappFundFlowDao.insert(boxFundFlow); |
| | | |
| | | new Thread(() -> { |
| | | int count = box.getIndex(); |
| | | while(count > 0) { |
| | | log.info("卡牌+1"); |
| | | ChainService.getInstance(ChainEnum.BSC_NFT_SDC.name()).safeMintNFT(member.getAddress()); |
| | | count--; |
| | | } |
| | | }).start(); |
| | | |
| | | return box.getIndex(); |
| | | } |
| | | } |