Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
online-edu-backend
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Redmine
Redmine
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
online-edu
online-edu-backend
Commits
5594c14e
Commit
5594c14e
authored
Sep 02, 2021
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixbug
parent
178b7146
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
MainPageController.java
...ava/com/qkdata/biz/web/controller/MainPageController.java
+10
-3
No files found.
src/main/java/com/qkdata/biz/web/controller/MainPageController.java
View file @
5594c14e
...
...
@@ -22,6 +22,7 @@ import com.qkdata.common.jwt.JWTService;
import
com.qkdata.common.oauth.AuthorizedUser
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.util.StringUtils
;
...
...
@@ -34,6 +35,7 @@ import java.util.List;
@Api
(
tags
=
"首页数据获取-手机端"
)
@RestController
@RequestMapping
(
"/api/web/mainPage"
)
@Slf4j
public
class
MainPageController
{
@Autowired
private
SwiperConfigService
swiperConfigService
;
...
...
@@ -67,17 +69,22 @@ public class MainPageController {
@ApiOperation
(
"首页推存课程列表"
)
@PostMapping
(
"/course/recommend/list"
)
@SysLog
(
"首页推存课程列表"
)
public
PageResult
<
SearchCourseResultModel
>
recommendCourseList
(
@RequestBody
SearchCourseConditionModel
model
,
HttpServletRequest
request
)
throws
IOException
{
public
PageResult
<
SearchCourseResultModel
>
recommendCourseList
(
@RequestBody
SearchCourseConditionModel
model
,
HttpServletRequest
request
)
{
return
courseService
.
mainPageRecommendList
(
model
,
getUserFromToken
(
request
));
}
private
AuthorizedUser
getUserFromToken
(
HttpServletRequest
request
)
throws
IOException
{
private
AuthorizedUser
getUserFromToken
(
HttpServletRequest
request
){
AuthorizedUser
authUser
=
null
;
String
token
=
getRequestToken
(
request
);
if
(
StrUtil
.
isNotBlank
(
token
)){
if
(
StrUtil
.
isNotBlank
(
token
)
&&
!
"null"
.
equals
(
token
)){
try
{
DecodedJWT
decodedJWT
=
jwtService
.
decode
(
token
);
String
userJson
=
decodedJWT
.
getClaim
(
"user"
).
asString
();
ObjectMapper
mapper
=
new
ObjectMapper
();
authUser
=
mapper
.
readValue
(
userJson
,
AuthorizedUser
.
class
);
}
catch
(
IOException
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
}
return
authUser
;
}
...
...
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