Commit 1b83ec13 authored by tangtuo's avatar tangtuo

nft下载

parent a30a18db
...@@ -355,8 +355,12 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe ...@@ -355,8 +355,12 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
if (nft == null) { if (nft == null) {
throw GlobalException.newException(ResultCode.DATA_ERROR, "没找到此nft详情"); throw GlobalException.newException(ResultCode.DATA_ERROR, "没找到此nft详情");
} }
if (SystemConstant.BOOLEAN_DATA_FALSE.equals(nft.getIsArchives()) || SystemConstant.BOOLEAN_DATA_TRUE.equals(nft.getIsGrant())) { String token = request.getHeader("Authorization");
throw GlobalException.newException(ResultCode.FILE_DOWNLOAD_ERROR, "当前文件不支持下载"); Integer userId = JwtUtil.getUserIdFromToken(token);
if (!userId.equals(nft.getUserId())){
if (SystemConstant.BOOLEAN_DATA_FALSE.equals(nft.getIsArchives()) || SystemConstant.BOOLEAN_DATA_TRUE.equals(nft.getIsGrant())) {
throw GlobalException.newException(ResultCode.FILE_DOWNLOAD_ERROR, "当前文件不支持下载");
}
} }
ossUtil.downloadFile(nft.getFileUrl(), nft.getFileName()); ossUtil.downloadFile(nft.getFileUrl(), nft.getFileName());
} }
......
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