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 {
@ApiModelProperty("头像")
private String avatar;
@ApiModelProperty("文件名")
private String fileName;
@ApiModelProperty("文件路径")
private String fileUrl;
@ApiModelProperty("钱包地址")
private String publishAddress;
......@@ -66,6 +72,8 @@ public class CommemorateNftVo {
this.publishTime = nft.getPublishTime();
this.synopsis = nft.getSynopsis();
this.cover = nft.getCover();
this.fileName = nft.getFileName();
this.fileUrl = nft.getFileUrl();
}
}
......@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.constant.RedisConstant;
import com.fzm.common.constant.SystemConstant;
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.NftListVo;
import com.fzm.common.enums.ResultCode;
......@@ -113,17 +114,19 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
long tokenId = Long.parseLong(split[1]);
Nft nft = getById(nftDto.getId());
// 构建上链信息
HashMap<String, String> map = new HashMap<>();
map.put("author", nft.getAuthor());
map.put("name", nft.getName());
ChainDto chainDto = new ChainDto();
chainDto.setName(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("publishAddress", nft.getPublishAddress());
String tokenInfo = JSONUtil.toJsonStr(map);
log.info("加密上链数据: {}", tokenInfo);
String tradeHash = paraChainClient.evmSetTokenInfo(contractName, tokenId, tokenInfo, wallet, privkey, true);
log.info("加密上链数据: {}", chainDto);
String tradeHash = paraChainClient.evmSetTokenInfo(contractName, tokenId, JSONUtil.toJsonStr(map), wallet, privkey, true);
if (StringUtils.isBlank(tradeHash)) {
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);
if (!TxStatusEnum.SUCCESS.equals(txResult.getStatus())) {
......@@ -267,7 +270,7 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
@Override
public String generateNftId(Integer categoryId) {
Category category = categoryService.getCategoryById(categoryId);
Category category = categoryService.getById(categoryId);
if (category == null) {
throw GlobalException.newException(ResultCode.DATA_ERROR, "没找到此类目");
}
......
spring:
profiles:
active: test
active: local
application:
name: joying-portal
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