|
|
|
@ -574,8 +574,8 @@ public class ConfluxServiceImpl implements ConfluxService {
|
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
@SneakyThrows |
|
|
|
|
public void getNftData(HttpServletResponse response, HttpServletRequest request, String filePath) { |
|
|
|
|
String path=nftConfig.getDirectoryPath()+DateUtils.dateToDir(new Date())+"\\"+filePath; |
|
|
|
|
public void getNftData(HttpServletResponse response, HttpServletRequest request,String year, String filePath) { |
|
|
|
|
String path=nftConfig.getDirectoryPath()+year+"\\"+filePath; |
|
|
|
|
File file = new File(path); |
|
|
|
|
// 3.拼接响应头,返回文件名字等信息
|
|
|
|
|
response.setHeader("content-type", "application/json"); |
|
|
|
@ -594,7 +594,8 @@ public class ConfluxServiceImpl implements ConfluxService {
|
|
|
|
|
try { |
|
|
|
|
//元数据地址
|
|
|
|
|
String directoryPath = nftConfig.getDirectoryPath(); |
|
|
|
|
String strDir = directoryPath + DateUtils.dateToDir(new Date()); |
|
|
|
|
String year=DateUtils.dateToDir(new Date()); |
|
|
|
|
String strDir = directoryPath + year; |
|
|
|
|
File file = new File(strDir); |
|
|
|
|
if (!file.exists()) { |
|
|
|
|
//创建文件夹
|
|
|
|
@ -615,7 +616,7 @@ public class ConfluxServiceImpl implements ConfluxService {
|
|
|
|
|
log.info("文件创建成功"); |
|
|
|
|
//写入内容
|
|
|
|
|
BufferedWriter writer = new BufferedWriter(new FileWriter(filePath)); |
|
|
|
|
String fileUri = ConfluxArt.NFT_NAME + checkArgs.getStrName() + ConfluxArt.NFT_DESCRIPTION + checkArgs.getDescription() + ConfluxArt.NFT_IMAGE + checkArgs.getStrUri() + "\"\n}"; |
|
|
|
|
String fileUri = ConfluxArt.NFT_NAME + checkArgs.getStrName() + ConfluxArt.NFT_DESCRIPTION + checkArgs.getStrDescription()+ ConfluxArt.NFT_IMAGE + checkArgs.getStrUri() + "\"\n}"; |
|
|
|
|
writer.write(fileUri); |
|
|
|
|
writer.flush(); |
|
|
|
|
writer.close(); |
|
|
|
@ -623,7 +624,8 @@ public class ConfluxServiceImpl implements ConfluxService {
|
|
|
|
|
log.info("文件创建失败"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return AjaxResult.success("创建元数据成功!", fileName); |
|
|
|
|
String tokenUri=nftConfig.getNftDataUrL()+year+"/"+fileName; |
|
|
|
|
return AjaxResult.success("创建元数据成功!", tokenUri); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("元数据创建失败!{}", e); |
|
|
|
|
return AjaxResult.error(); |
|
|
|
|