|
@@ -219,7 +219,7 @@ public class DetailServiceImpl implements IDetailService {
|
|
|
});
|
|
|
|
|
|
courseInfoVO.setCourseDetail(courseDetailVOList);
|
|
|
- courseInfoVO.setHasDiscount(checkOrderOrFree(loginUser.getId(),courseInfoVO.getCategoryId()));
|
|
|
+ courseInfoVO.setHasDiscount(checkOrderOrFree(loginUser.getId(),courseInfoVO.getCategoryId(),id));
|
|
|
return courseInfoVO;
|
|
|
}
|
|
|
|
|
@@ -230,9 +230,14 @@ public class DetailServiceImpl implements IDetailService {
|
|
|
* @param categoryId
|
|
|
* @return
|
|
|
*/
|
|
|
- private Boolean checkOrderOrFree(String userId, String categoryId) {
|
|
|
+ private Boolean checkOrderOrFree(String userId, String categoryId, String coursesId) {
|
|
|
+ Date startTime = appCoursesMapper.selectById(coursesId).getStartTime();
|
|
|
+ if (startTime != null && startTime.before(new Date())) {
|
|
|
+ return Boolean.FALSE; // 课程已过期,视为非首次购买
|
|
|
+ }
|
|
|
//查询当前用户的所有课程订单
|
|
|
- List<AppOrder> appOrders = appOrderMapper.selectList(Wrappers.<AppOrder>lambdaQuery().eq(AppOrder::getUserId, userId).eq(AppOrder::getType, CommonConstant.ORDER_TYPE_2));
|
|
|
+ List<AppOrder> appOrders = appOrderMapper.selectList(Wrappers.<AppOrder>lambdaQuery().eq(AppOrder::getUserId, userId)
|
|
|
+ .eq(AppOrder::getType, CommonConstant.ORDER_TYPE_2));
|
|
|
if (CollUtil.isNotEmpty(appOrders)){
|
|
|
for (AppOrder appOrder : appOrders) {
|
|
|
if(null != appOrder){
|
|
@@ -263,7 +268,7 @@ public class DetailServiceImpl implements IDetailService {
|
|
|
courseInfoVO.setPriceType(isFirstPurchase(user.getId()));
|
|
|
courseInfoVO.setCover(list.get(0));
|
|
|
courseInfoVO.setPeriod(Math.toIntExact(appCoursesPriceRulesMapper.selectCount(Wrappers.<AppCoursesPriceRules>lambdaQuery().eq(AppCoursesPriceRules::getCoursesId, appCourses.getId()))));
|
|
|
- courseInfoVO.setHasDiscount(checkOrderOrFree(user.getId(), appCourses.getCategoryId()));
|
|
|
+ courseInfoVO.setHasDiscount(checkOrderOrFree(user.getId(), appCourses.getCategoryId(),appCourses.getId()));
|
|
|
AppSite appSite = appSiteMapper.selectById(appCourses.getAddressSiteId());
|
|
|
if (appSite!=null){
|
|
|
courseInfoVO.setAddress(appSite.getAddress());
|