Commit d32bd475 authored by tangtuo's avatar tangtuo

纪念版nft详情页面加入文件路径 文件名

parent 767bab7a
package com.fzm.common.entity.dto;
import lombok.Data;
/**
* @author tangtuo
* @date 2021/7/22 16:28
*/
@Data
public class ChainDto {
private String author;
private String name;
private String hash;
private String publishAddress;
}
...@@ -34,6 +34,12 @@ public class CommemorateNftVo { ...@@ -34,6 +34,12 @@ public class CommemorateNftVo {
@ApiModelProperty("头像") @ApiModelProperty("头像")
private String avatar; private String avatar;
@ApiModelProperty("文件名")
private String fileName;
@ApiModelProperty("文件路径")
private String fileUrl;
@ApiModelProperty("钱包地址") @ApiModelProperty("钱包地址")
private String publishAddress; private String publishAddress;
...@@ -66,6 +72,8 @@ public class CommemorateNftVo { ...@@ -66,6 +72,8 @@ public class CommemorateNftVo {
this.publishTime = nft.getPublishTime(); this.publishTime = nft.getPublishTime();
this.synopsis = nft.getSynopsis(); this.synopsis = nft.getSynopsis();
this.cover = nft.getCover(); this.cover = nft.getCover();
this.fileName = nft.getFileName();
this.fileUrl = nft.getFileUrl();
} }
} }
...@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.constant.RedisConstant; import com.fzm.common.constant.RedisConstant;
import com.fzm.common.constant.SystemConstant; import com.fzm.common.constant.SystemConstant;
import com.fzm.common.entity.*; import com.fzm.common.entity.*;
import com.fzm.common.entity.dto.ChainDto;
import com.fzm.common.entity.vo.CollectionNftVo; import com.fzm.common.entity.vo.CollectionNftVo;
import com.fzm.common.entity.vo.NftListVo; import com.fzm.common.entity.vo.NftListVo;
import com.fzm.common.enums.ResultCode; import com.fzm.common.enums.ResultCode;
...@@ -113,17 +114,19 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe ...@@ -113,17 +114,19 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
long tokenId = Long.parseLong(split[1]); long tokenId = Long.parseLong(split[1]);
Nft nft = getById(nftDto.getId()); Nft nft = getById(nftDto.getId());
// 构建上链信息 // 构建上链信息
HashMap<String, String> map = new HashMap<>(); ChainDto chainDto = new ChainDto();
map.put("author", nft.getAuthor()); chainDto.setName(nft.getName());
map.put("name", nft.getName()); chainDto.setAuthor(nft.getAuthor());
chainDto.setHash(nft.getFileHash());
chainDto.setPublishAddress(wallet);
Map<String, String> map = new HashMap<>();
map.put("hash", nft.getFileHash()); map.put("hash", nft.getFileHash());
map.put("publishAddress", nft.getPublishAddress()); log.info("加密上链数据: {}", chainDto);
String tokenInfo = JSONUtil.toJsonStr(map); String tradeHash = paraChainClient.evmSetTokenInfo(contractName, tokenId, JSONUtil.toJsonStr(map), wallet, privkey, true);
log.info("加密上链数据: {}", tokenInfo);
String tradeHash = paraChainClient.evmSetTokenInfo(contractName, tokenId, tokenInfo, wallet, privkey, true);
if (StringUtils.isBlank(tradeHash)) { if (StringUtils.isBlank(tradeHash)) {
throw GlobalException.newException(ResultCode.PUBLISH_ERROR, "nft发行失败"); throw GlobalException.newException(ResultCode.PUBLISH_ERROR, "nft发行失败");
} }
log.info("tokenInfo:{}",paraChainClient.evmGetTokenInfo(contractName, paraChainClient.evmQueryAddrByName(contractName), tokenId, wallet));
// 确认交易结果 // 确认交易结果
TxResult txResult = paraChainClient.cycleConfirmTxWithHash(hash, true, 1000); TxResult txResult = paraChainClient.cycleConfirmTxWithHash(hash, true, 1000);
if (!TxStatusEnum.SUCCESS.equals(txResult.getStatus())) { if (!TxStatusEnum.SUCCESS.equals(txResult.getStatus())) {
...@@ -267,7 +270,7 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe ...@@ -267,7 +270,7 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
@Override @Override
public String generateNftId(Integer categoryId) { public String generateNftId(Integer categoryId) {
Category category = categoryService.getCategoryById(categoryId); Category category = categoryService.getById(categoryId);
if (category == null) { if (category == null) {
throw GlobalException.newException(ResultCode.DATA_ERROR, "没找到此类目"); throw GlobalException.newException(ResultCode.DATA_ERROR, "没找到此类目");
} }
......
spring: spring:
profiles: profiles:
active: test active: local
application: application:
name: joying-portal name: joying-portal
servlet: servlet:
......
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