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
47c81d0e
Commit
47c81d0e
authored
Jun 22, 2021
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug
parent
fda0b871
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
4 deletions
+22
-4
UserCenterController.java
...a/com/qkdata/biz/web/controller/UserCenterController.java
+16
-1
UserCenterService.java
...in/java/com/qkdata/biz/web/service/UserCenterService.java
+1
-2
LocalDateTimeDeserializer.java
...om/qkdata/common/converter/LocalDateTimeDeserializer.java
+5
-1
No files found.
src/main/java/com/qkdata/biz/web/controller/UserCenterController.java
View file @
47c81d0e
...
...
@@ -12,9 +12,11 @@ import com.qkdata.biz.sys.service.SysUserService;
import
com.qkdata.biz.web.service.UserCenterService
;
import
com.qkdata.biz.web.vo.*
;
import
com.qkdata.common.annotation.SysLog
;
import
com.qkdata.common.base.exception.BusinessException
;
import
com.qkdata.common.base.model.PageResult
;
import
com.qkdata.common.base.model.Result
;
import
com.qkdata.common.util.UserContext
;
import
com.sun.org.apache.xpath.internal.operations.Bool
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.shiro.authz.annotation.Logical
;
...
...
@@ -97,7 +99,7 @@ public class UserCenterController {
@SysLog
(
"获取视频播放凭证"
)
public
Result
<
GetVideoPlayAuthResponse
>
getCoursePlayVideoUrl
(
@RequestParam
Long
courseId
,
@RequestParam
Long
chaperId
){
//验证权限
userCenterService
.
checkCoursePlayPerm
(
courseId
,
chaperId
);
userCenterService
.
checkCoursePlayPerm
(
courseId
);
GetVideoPlayAuthResponse
response
=
courseService
.
getVideoPlayAuth
(
courseId
,
chaperId
);
return
Result
.
succeed
(
response
);
...
...
@@ -146,4 +148,17 @@ public class UserCenterController {
CourseConsumeRecordModel
model
=
courseConsumeRecordService
.
findUserCourseRecordLast
(
UserContext
.
getUserId
(),
courseId
);
return
Result
.
succeed
(
model
);
}
@ApiOperation
(
"查询用户是否已购买该课程"
)
@GetMapping
(
"/user/course/checkPerm"
)
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_USER
,
BizConstants
.
ROLE_ENTERPRISE_ADMIN
},
logical
=
Logical
.
OR
)
@SysLog
(
"查询用户是否已购买该课程"
)
public
Result
<
Boolean
>
checkPerm
(
@RequestParam
Long
courseId
){
Boolean
flag
=
true
;
try
{
userCenterService
.
checkCoursePlayPerm
(
courseId
);
}
catch
(
BusinessException
e
){
flag
=
false
;
}
return
Result
.
succeed
(
flag
);
}
}
src/main/java/com/qkdata/biz/web/service/UserCenterService.java
View file @
47c81d0e
...
...
@@ -44,9 +44,8 @@ public class UserCenterService {
* 课程收费模式为会员费免,当前用户是否已购买会员,并且在有效期中
* 课程收费模式为付费点播,当前用户是否已购买该课程,并且在效期中
* @param courseId
* @param chaperId
*/
public
void
checkCoursePlayPerm
(
Long
courseId
,
Long
chaperId
)
{
public
void
checkCoursePlayPerm
(
Long
courseId
)
{
String
username
=
UserContext
.
getUser
().
getUsername
();
Long
userId
=
UserContext
.
getUserId
();
FullUserInfo
userInfo
=
sysUserService
.
findFullUserInfo
(
username
);
...
...
src/main/java/com/qkdata/common/converter/LocalDateTimeDeserializer.java
View file @
47c81d0e
...
...
@@ -22,7 +22,11 @@ public class LocalDateTimeDeserializer extends JsonDeserializer<LocalDateTime> {
@Override
public
LocalDateTime
deserialize
(
JsonParser
p
,
DeserializationContext
ctxt
)
throws
IOException
,
JsonProcessingException
{
try
{
return
Instant
.
ofEpochMilli
(
p
.
getLongValue
()).
atZone
(
ZoneId
.
systemDefault
()).
toLocalDateTime
();
if
(
null
!=
p
.
getValueAsString
()
&&
!
""
.
equals
(
p
.
getValueAsString
())){
return
Instant
.
ofEpochMilli
(
p
.
getLongValue
()).
atZone
(
ZoneId
.
systemDefault
()).
toLocalDateTime
();
}
else
{
return
null
;
}
}
catch
(
Exception
e
)
{
log
.
warn
(
"时间转换异常"
,
e
);
return
null
;
...
...
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