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
382a5a1b
Commit
382a5a1b
authored
Aug 04, 2021
by
tangtuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
回滚代码
纪念版nft开放游客模式
parent
0c753b62
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
7 deletions
+3
-7
RedisConstant.java
.../src/main/java/com/fzm/common/constant/RedisConstant.java
+1
-1
CommemorateNftServiceImpl.java
...om/fzm/common/service/impl/CommemorateNftServiceImpl.java
+2
-6
No files found.
joying-common/src/main/java/com/fzm/common/constant/RedisConstant.java
View file @
382a5a1b
...
...
@@ -29,7 +29,7 @@ public class RedisConstant {
/**
* 纪念版nft领取成员列表
*/
public
static
final
String
COMMEMORATE_NFT_MEMBERS_PREFIX
=
"commemorate
-n
ft:members:"
;
public
static
final
String
COMMEMORATE_NFT_MEMBERS_PREFIX
=
"commemorate
N
ft:members:"
;
...
...
joying-common/src/main/java/com/fzm/common/service/impl/CommemorateNftServiceImpl.java
View file @
382a5a1b
...
...
@@ -119,12 +119,9 @@ public class CommemorateNftServiceImpl extends ServiceImpl<CommemorateNftMapper,
}
// 先判断当前用户有没有领取过此纪念版nft
if
(
redisUtil
.
zScore
(
RedisConstant
.
COMMEMORATE_NFT_MEMBERS_PREFIX
+
id
,
user
.
getId
().
toString
())
!=
null
)
{
if
(
redisUtil
.
sIsMember
(
RedisConstant
.
COMMEMORATE_NFT_MEMBERS_PREFIX
+
id
,
user
.
getId
().
toString
())
)
{
throw
GlobalException
.
newException
(
ResultCode
.
FAILED
,
"此纪念版nft每个用户只能领取一次"
);
}
/*if (redisUtil.sIsMember(RedisConstant.COMMEMORATE_NFT_MEMBERS_PREFIX + id, user.getId().toString())) {
throw GlobalException.newException(ResultCode.FAILED, "此纪念版nft每个用户只能领取一次");
}*/
// 获取此纪念版nft发行数的信号量
RSemaphore
semaphore
=
redisson
.
getSemaphore
(
RedisConstant
.
COMMEMORATE_NFT_PREFIX
+
id
);
// 判断纪念版nft有没有被领取完
...
...
@@ -164,8 +161,7 @@ public class CommemorateNftServiceImpl extends ServiceImpl<CommemorateNftMapper,
nft
.
setIsCommemorate
(
SystemConstant
.
BOOLEAN_DATA_TRUE
);
nftService
.
save
(
nft
);
// 领取完毕,把当前用户id加入到纪念版nft的领取记录中
redisUtil
.
zAdd
(
RedisConstant
.
COMMEMORATE_NFT_MEMBERS_PREFIX
+
id
,
user
.
getId
().
toString
(),
availablePermits
);
//redisUtil.sAdd(RedisConstant.COMMEMORATE_NFT_MEMBERS_PREFIX + id, user.getId().toString());
redisUtil
.
sAdd
(
RedisConstant
.
COMMEMORATE_NFT_MEMBERS_PREFIX
+
id
,
user
.
getId
().
toString
());
return
true
;
}
finally
{
lock
.
unlock
();
...
...
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