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
62fa82b7
Commit
62fa82b7
authored
Aug 04, 2021
by
tangtuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
纪念版nft页面开放游客模式
parent
43f2e6a1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
CommemorateNftController.java
...a/com/fzm/portal/controller/CommemorateNftController.java
+9
-1
No files found.
joying-portal/src/main/java/com/fzm/portal/controller/CommemorateNftController.java
View file @
62fa82b7
...
@@ -20,6 +20,7 @@ import com.fzm.common.utils.RedisUtil;
...
@@ -20,6 +20,7 @@ import com.fzm.common.utils.RedisUtil;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
io.swagger.annotations.ApiParam
;
import
org.apache.commons.lang3.StringUtils
;
import
org.redisson.api.RSemaphore
;
import
org.redisson.api.RSemaphore
;
import
org.redisson.api.RedissonClient
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -99,7 +100,7 @@ public class CommemorateNftController {
...
@@ -99,7 +100,7 @@ public class CommemorateNftController {
//@Authentication
//@Authentication
@GetMapping
(
"/get/{id}"
)
@GetMapping
(
"/get/{id}"
)
@ApiOperation
(
value
=
"纪念版nft详情页"
)
@ApiOperation
(
value
=
"纪念版nft详情页"
)
public
ResponseModel
<
CommemorateNftVo
>
getById
(
@PathVariable
Integer
id
,
@RequestHeader
String
Authorization
)
{
public
ResponseModel
<
CommemorateNftVo
>
getById
(
@PathVariable
Integer
id
,
@RequestHeader
(
required
=
false
)
String
Authorization
)
{
CommemorateNft
nft
=
commemorateNftService
.
getById
(
id
);
CommemorateNft
nft
=
commemorateNftService
.
getById
(
id
);
if
(
nft
==
null
)
{
if
(
nft
==
null
)
{
throw
GlobalException
.
newException
(
ResultCode
.
DATA_ERROR
,
"此纪念版nft已下架"
);
throw
GlobalException
.
newException
(
ResultCode
.
DATA_ERROR
,
"此纪念版nft已下架"
);
...
@@ -107,6 +108,11 @@ public class CommemorateNftController {
...
@@ -107,6 +108,11 @@ public class CommemorateNftController {
User
user
=
userService
.
getById
(
nft
.
getUserId
());
User
user
=
userService
.
getById
(
nft
.
getUserId
());
CommemorateNftVo
commemorateNftVo
=
new
CommemorateNftVo
(
nft
,
user
);
CommemorateNftVo
commemorateNftVo
=
new
CommemorateNftVo
(
nft
,
user
);
commemorateNftVo
.
setCategory
(
categoryService
.
getById
(
nft
.
getCategoryId
()).
getCategoryName
());
commemorateNftVo
.
setCategory
(
categoryService
.
getById
(
nft
.
getCategoryId
()).
getCategoryName
());
// 未登录状态
if
(
StringUtils
.
isBlank
(
Authorization
)
||
"Bearer null"
.
equals
(
Authorization
))
{
commemorateNftVo
.
setStatus
(
1
);
}
else
{
// 已登录
RSemaphore
semaphore
=
redisson
.
getSemaphore
(
RedisConstant
.
COMMEMORATE_NFT_PREFIX
+
id
);
RSemaphore
semaphore
=
redisson
.
getSemaphore
(
RedisConstant
.
COMMEMORATE_NFT_PREFIX
+
id
);
int
permits
=
semaphore
.
availablePermits
();
int
permits
=
semaphore
.
availablePermits
();
commemorateNftVo
.
setReceiveCount
(
nft
.
getCount
()
-
permits
);
commemorateNftVo
.
setReceiveCount
(
nft
.
getCount
()
-
permits
);
...
@@ -122,6 +128,8 @@ public class CommemorateNftController {
...
@@ -122,6 +128,8 @@ public class CommemorateNftController {
commemorateNftVo
.
setStatus
(
2
);
commemorateNftVo
.
setStatus
(
2
);
}
}
}
}
}
return
ResponseModel
.
success
(
commemorateNftVo
);
return
ResponseModel
.
success
(
commemorateNftVo
);
}
}
...
...
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