Commit b5d16b08 authored by tangtuo's avatar tangtuo

修改nft发行逻辑

parent 2d9bbf38
...@@ -89,12 +89,13 @@ public class CommemorateNftServiceImpl extends ServiceImpl<CommemorateNftMapper, ...@@ -89,12 +89,13 @@ public class CommemorateNftServiceImpl extends ServiceImpl<CommemorateNftMapper,
if (StringUtils.isBlank(tradeHash)) { if (StringUtils.isBlank(tradeHash)) {
throw GlobalException.newException(ResultCode.PUBLISH_ERROR, "nft发行失败"); throw GlobalException.newException(ResultCode.PUBLISH_ERROR, "nft发行失败");
} }
String realHash = paraChainClient.getRealTxHashFromGrp(hash);
// 确认交易结果 // 确认交易结果
TxResult txResult = paraChainClient.cycleConfirmTxWithHash(realHash, false, 1000); TxResult txResult = paraChainClient.cycleConfirmTxWithHash(hash, true, 1000);
if (!TxStatusEnum.SUCCESS.equals(txResult.getStatus())) { if (!TxStatusEnum.SUCCESS.equals(txResult.getStatus())) {
throw GlobalException.newException(ResultCode.PUBLISH_ERROR, txResult.getErrMsg().getValue()); throw GlobalException.newException(ResultCode.PUBLISH_ERROR, txResult.getErrMsg().getValue());
} }
String realHash = paraChainClient.getRealTxHashFromGrp(hash);
commemorateNft.setNftHash(realHash).setTokenId(tokenId).setPublishTime(new Date()); commemorateNft.setNftHash(realHash).setTokenId(tokenId).setPublishTime(new Date());
save(commemorateNft); save(commemorateNft);
// 使用nft发行量作为Redisson信号量限制领取次数 // 使用nft发行量作为Redisson信号量限制领取次数
......
...@@ -111,7 +111,6 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe ...@@ -111,7 +111,6 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
String[] split = txHash.split("-"); String[] split = txHash.split("-");
String hash = split[0]; String hash = split[0];
long tokenId = Long.parseLong(split[1]); long tokenId = Long.parseLong(split[1]);
String realHash = paraChainClient.getRealTxHashFromGrp(hash);
Nft nft = getById(nftDto.getId()); Nft nft = getById(nftDto.getId());
// 构建上链信息 // 构建上链信息
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
...@@ -126,10 +125,11 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe ...@@ -126,10 +125,11 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
throw GlobalException.newException(ResultCode.PUBLISH_ERROR, "nft发行失败"); throw GlobalException.newException(ResultCode.PUBLISH_ERROR, "nft发行失败");
} }
// 确认交易结果 // 确认交易结果
TxResult txResult = paraChainClient.cycleConfirmTxWithHash(realHash, false, 1000); TxResult txResult = paraChainClient.cycleConfirmTxWithHash(hash, true, 1000);
if (!TxStatusEnum.SUCCESS.equals(txResult.getStatus())) { if (!TxStatusEnum.SUCCESS.equals(txResult.getStatus())) {
throw GlobalException.newException(ResultCode.PUBLISH_ERROR, txResult.getErrMsg().getValue()); throw GlobalException.newException(ResultCode.PUBLISH_ERROR, txResult.getErrMsg().getValue());
} }
String realHash = paraChainClient.getRealTxHashFromGrp(hash);
nft.setNftHash(realHash); nft.setNftHash(realHash);
nft.setTokenId(tokenId); nft.setTokenId(tokenId);
nft.setPublishTime(new Date()); nft.setPublishTime(new Date());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment