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
89742fb6
Commit
89742fb6
authored
Jun 03, 2021
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新播放课程验证逻辑
parent
d38cdb01
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
UserCenterService.java
...in/java/com/qkdata/biz/web/service/UserCenterService.java
+18
-18
No files found.
src/main/java/com/qkdata/biz/web/service/UserCenterService.java
View file @
89742fb6
package
com
.
qkdata
.
biz
.
web
.
service
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.qkdata.biz.enums.AccountTypeEnum
;
import
com.qkdata.biz.enums.CourseAllowEnum
;
import
com.qkdata.biz.enums.CourseChargeModelEnum
;
import
com.qkdata.biz.enums.CourseStatusEnum
;
import
com.qkdata.biz.management.entity.CoursePO
;
import
com.qkdata.biz.management.entity.UserCourseAuthPO
;
import
com.qkdata.biz.management.entity.UserFavoritesPO
;
import
com.qkdata.biz.management.service.CourseService
;
import
com.qkdata.biz.management.service.UserCourseAuthService
;
import
com.qkdata.biz.management.service.UserFavoritesService
;
import
com.qkdata.biz.management.vo.QueryFavoriteCourseModel
;
import
com.qkdata.biz.sys.service.SysUserService
;
...
...
@@ -30,6 +34,8 @@ public class UserCenterService {
private
CourseService
courseService
;
@Autowired
private
UserFavoritesService
userFavoritesService
;
@Autowired
private
UserCourseAuthService
userCourseAuthService
;
/**
* 验证当前登陆用户是否有播放该课程和章节的权限
...
...
@@ -63,11 +69,11 @@ public class UserCenterService {
if
(!
allow
){
throw
new
BusinessException
(
"当前课程指已定企业观看,您不符合条件,请联系客服务人员"
);
}
}
}
else
{
if
(
course
.
getChargeModel
()
==
CourseChargeModelEnum
.
FREE
){
return
;
}
else
if
(
course
.
getChargeModel
()
==
CourseChargeModelEnum
.
VIP_FREE
){
if
(
userInfo
.
getVipStartTime
()
==
null
||
userInfo
.
getVipEndTime
()
==
null
){
if
(
userInfo
.
getType
()
==
AccountTypeEnum
.
USER
){
throw
new
BusinessException
(
"您还不是会员,请先成为会员再观看"
);
}
LocalDateTime
now
=
LocalDateTime
.
now
();
...
...
@@ -75,22 +81,16 @@ public class UserCenterService {
throw
new
BusinessException
(
"您的会员已过期,请续费后再观看"
);
}
}
else
if
(
course
.
getChargeModel
()
==
CourseChargeModelEnum
.
PAY
){
// UserGetVipRecordPO userGetVipRecordPO = userGetVipRecordService.getOne(Wrappers.<UserGetVipRecordPO>lambdaQuery()
// .eq(UserGetVipRecordPO::getUserId,userId)
// .eq(UserGetVipRecordPO::getCourseId,courseId)
// .eq(UserGetVipRecordPO::getType,UserPayRecordTypeEnum.SINGLE_COURSE)
// .orderByDesc(BasePO::getCreateTime)
// .last("limit 1"));
// if (userGetVipRecordPO == null){
// throw new BusinessException("当前课程为付费课程,请购买后再观看");
// }
// Integer validPeriod = course.getValidPeriod();
// LocalDateTime startTime = userGetVipRecordPO.getCreateTime();
// LocalDateTime endTime = startTime.plusHours(validPeriod);
// LocalDateTime now = LocalDateTime.now();
// if (!(now.isAfter(startTime) && now.isBefore(endTime))){
// throw new BusinessException("您购买的该课程已过期,请重新购买");
// }
UserCourseAuthPO
authPO
=
userCourseAuthService
.
getOne
(
Wrappers
.<
UserCourseAuthPO
>
lambdaQuery
().
eq
(
UserCourseAuthPO:
:
getUserId
,
userId
).
eq
(
UserCourseAuthPO:
:
getCourseId
,
courseId
));
if
(
authPO
==
null
{
throw
new
BusinessException
(
"当前课程为付费课程,请购买后再观看"
);
}
LocalDateTime
now
=
LocalDateTime
.
now
();
if
(!(
now
.
isAfter
(
authPO
.
getStartTime
())
&&
now
.
isBefore
(
authPO
.
getEndTime
()))){
throw
new
BusinessException
(
"您购买的该课程已过期,请重新购买"
);
}
}
}
...
...
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