Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fzm-joying
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lei
fzm-joying
Commits
837b634e
Commit
837b634e
authored
Jul 28, 2021
by
tangtuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分布式锁加上过期时间
nft详情页面加上文件名 文件地址字段
parent
ef434138
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
5 deletions
+19
-5
CollectionNftVo.java
...c/main/java/com/fzm/common/entity/vo/CollectionNftVo.java
+4
-0
NftVo.java
...-common/src/main/java/com/fzm/common/entity/vo/NftVo.java
+8
-0
CommemorateNftService.java
...in/java/com/fzm/common/service/CommemorateNftService.java
+1
-1
CommemorateNftServiceImpl.java
...om/fzm/common/service/impl/CommemorateNftServiceImpl.java
+3
-2
NftMapper.xml
joying-common/src/main/resources/mapper/NftMapper.xml
+1
-0
CommemorateNftController.java
...a/com/fzm/portal/controller/CommemorateNftController.java
+1
-1
NftController.java
...rc/main/java/com/fzm/portal/controller/NftController.java
+1
-1
No files found.
joying-common/src/main/java/com/fzm/common/entity/vo/CollectionNftVo.java
View file @
837b634e
...
...
@@ -32,6 +32,9 @@ public class CollectionNftVo {
@ApiModelProperty
(
"nft编号"
)
private
String
nftId
;
@ApiModelProperty
(
"是否是纪念版nft 0-否 1-是"
)
private
Integer
isCommemorate
;
public
CollectionNftVo
(
Nft
nft
,
Category
category
)
{
this
.
id
=
nft
.
getId
();
this
.
theme
=
nft
.
getTheme
();
...
...
@@ -39,5 +42,6 @@ public class CollectionNftVo {
this
.
category
=
category
.
getCategoryName
();
this
.
name
=
nft
.
getName
();
this
.
cover
=
nft
.
getCover
();
this
.
isCommemorate
=
nft
.
getIsCommemorate
();
}
}
joying-common/src/main/java/com/fzm/common/entity/vo/NftVo.java
View file @
837b634e
...
...
@@ -47,6 +47,12 @@ public class NftVo {
@ApiModelProperty
(
"剧本hash"
)
private
String
fileHash
;
@ApiModelProperty
(
"文件名"
)
private
String
fileName
;
@ApiModelProperty
(
"文件地址"
)
private
String
fileUrl
;
@ApiModelProperty
(
"发行时间"
)
private
String
publishTime
;
...
...
@@ -85,5 +91,7 @@ public class NftVo {
this
.
userId
=
nft
.
getUserId
();
this
.
cover
=
nft
.
getCover
();
this
.
collection
=
false
;
this
.
fileName
=
nft
.
getFileName
();
this
.
fileUrl
=
nft
.
getFileUrl
();
}
}
joying-common/src/main/java/com/fzm/common/service/CommemorateNftService.java
View file @
837b634e
...
...
@@ -24,5 +24,5 @@ public interface CommemorateNftService extends IService<CommemorateNft> {
* @param id
* @return
*/
Boolean
receive
(
Integer
id
);
Boolean
receive
(
Integer
id
)
throws
InterruptedException
;
}
joying-common/src/main/java/com/fzm/common/service/impl/CommemorateNftServiceImpl.java
View file @
837b634e
...
...
@@ -32,6 +32,7 @@ import org.springframework.stereotype.Service;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.concurrent.TimeUnit
;
/**
* @author tangtuo
...
...
@@ -103,11 +104,11 @@ public class CommemorateNftServiceImpl extends ServiceImpl<CommemorateNftMapper,
}
@Override
public
Boolean
receive
(
Integer
id
)
{
public
Boolean
receive
(
Integer
id
)
throws
InterruptedException
{
User
user
=
userService
.
getUserByToken
();
// 加锁,避免一个用户可以并发领取
RLock
lock
=
redisson
.
getLock
(
"receive:nft:"
+
user
.
getId
());
boolean
tryLock
=
lock
.
tryLock
();
boolean
tryLock
=
lock
.
tryLock
(
30
,
TimeUnit
.
SECONDS
);
if
(!
tryLock
){
throw
GlobalException
.
newException
(
ResultCode
.
RECEIVE_ERROR
,
"操作频繁"
);
}
...
...
joying-common/src/main/resources/mapper/NftMapper.xml
View file @
837b634e
...
...
@@ -17,6 +17,7 @@
a.name,
a.theme,
a.nft_id,
a.is_commemorate,
b.category_name as category
from tb_nft a left join tb_category b on a.category_id = b.id
where a.id in (
...
...
joying-portal/src/main/java/com/fzm/portal/controller/CommemorateNftController.java
View file @
837b634e
...
...
@@ -91,7 +91,7 @@ public class CommemorateNftController {
@Authentication
@PostMapping
(
"/receive"
)
@ApiOperation
(
value
=
"领取纪念版nft"
)
public
ResponseModel
<
Boolean
>
receive
(
@RequestParam
Integer
id
)
{
public
ResponseModel
<
Boolean
>
receive
(
@RequestParam
Integer
id
)
throws
InterruptedException
{
Boolean
result
=
commemorateNftService
.
receive
(
id
);
return
ResponseModel
.
success
(
result
);
}
...
...
joying-portal/src/main/java/com/fzm/portal/controller/NftController.java
View file @
837b634e
...
...
@@ -92,7 +92,7 @@ public class NftController {
@GetMapping
(
"/list"
)
@ApiOperation
(
value
=
"获取nft列表"
)
public
ResponseModel
list
(
@ApiParam
(
value
=
"当前页码"
)
@RequestParam
Integer
pageNum
,
public
ResponseModel
<
List
<
Nft
>>
list
(
@ApiParam
(
value
=
"当前页码"
)
@RequestParam
Integer
pageNum
,
@ApiParam
(
value
=
"每页记录数"
)
@RequestParam
Integer
pageSize
,
@ApiParam
(
value
=
"类目id,查询所有的时候传null"
)
@RequestParam
(
required
=
false
)
Integer
categoryId
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment