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
d32e3b4d
Commit
d32e3b4d
authored
Jul 21, 2021
by
tangtuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
我的nft列表接口新增二维码展示
parent
d65ecdb6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
NftController.java
...rc/main/java/com/fzm/portal/controller/NftController.java
+14
-8
No files found.
joying-portal/src/main/java/com/fzm/portal/controller/NftController.java
View file @
d32e3b4d
...
...
@@ -17,10 +17,7 @@ import com.fzm.common.model.ResponseModel;
import
com.fzm.common.service.CategoryService
;
import
com.fzm.common.service.NftService
;
import
com.fzm.common.service.UserService
;
import
com.fzm.common.utils.JwtUtil
;
import
com.fzm.common.utils.OssUtil
;
import
com.fzm.common.utils.QRCodeUtil
;
import
com.fzm.common.utils.RedisUtil
;
import
com.fzm.common.utils.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
...
...
@@ -112,7 +109,7 @@ public class NftController {
if
(
nft
==
null
)
{
throw
GlobalException
.
newException
(
ResultCode
.
DATA_ERROR
,
"没找到此nft的详情"
);
}
User
user
=
userService
.
get
ById
(
nft
.
getUserId
());
User
user
=
userService
.
get
UserByWallet
(
nft
.
getPublishAddress
());
if
(
user
==
null
)
{
throw
GlobalException
.
newException
(
ResultCode
.
DATA_ERROR
,
"没找到此nft的发布人的信息"
);
}
...
...
@@ -132,14 +129,23 @@ public class NftController {
@Authentication
@GetMapping
(
"/list/current"
)
@ApiOperation
(
value
=
"获取我的nft列表"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
listCurrent
(
@ApiParam
(
value
=
"类目id,查询全部的时候传null"
)
@RequestParam
(
required
=
false
)
Integer
categoryId
)
{
List
<
Nft
>
list
=
nftService
.
listCurrent
(
categoryId
,
JwtUtil
.
getUserIdFromToken
(
request
.
getHeader
(
"Authorization"
)));
public
ResponseModel
<
Map
<
String
,
Object
>>
listCurrent
(
@ApiParam
(
value
=
"类目id,查询全部的时候传null"
)
@RequestParam
(
required
=
false
)
Integer
categoryId
)
throws
Exception
{
Integer
userId
=
JwtUtil
.
getUserIdFromToken
(
request
.
getHeader
(
"Authorization"
));
List
<
Nft
>
list
=
nftService
.
listCurrent
(
categoryId
,
userId
);
List
<
CollectionNftVo
>
nftVoList
=
list
.
stream
()
.
map
(
nft
->
new
CollectionNftVo
(
nft
,
categoryService
.
getCategoryById
(
nft
.
getCategoryId
())))
.
collect
(
Collectors
.
toList
());
HashMap
<
String
,
Object
>
result
=
new
HashMap
<>(
4
);
User
user
=
userService
.
getById
(
userId
);
// 生成二维码
HashMap
<
String
,
Object
>
qrCodeMap
=
new
HashMap
<>();
qrCodeMap
.
put
(
"nickname"
,
user
.
getNickname
());
qrCodeMap
.
put
(
"avatar"
,
user
.
getAvatar
());
qrCodeMap
.
put
(
"wallet"
,
user
.
getWallet
());
String
qrCode
=
QRCodeUtil
.
encode
(
JsonUtil
.
toJson
(
qrCodeMap
),
null
,
false
);
HashMap
<
String
,
Object
>
result
=
new
HashMap
<>(
8
);
result
.
put
(
"list"
,
nftVoList
);
result
.
put
(
"size"
,
nftVoList
.
size
());
result
.
put
(
"qrCode"
,
qrCode
);
return
ResponseModel
.
success
(
result
);
}
...
...
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