|
@@ -1,14 +1,22 @@
|
|
|
package com.fs.course.controller;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
+import com.fs.common.core.domain.model.LoginUser;
|
|
|
+import com.fs.common.utils.ServletUtils;
|
|
|
+import com.fs.course.config.CourseConfig;
|
|
|
import com.fs.course.mapper.FsUserCourseMapper;
|
|
|
import com.fs.course.mapper.FsUserCourseVideoMapper;
|
|
|
import com.fs.course.param.FsCourseRedPacketLogParam;
|
|
|
import com.fs.course.vo.FsCourseRedPacketLogListPVO;
|
|
|
+import com.fs.framework.web.service.TokenService;
|
|
|
import com.fs.his.utils.PhoneUtil;
|
|
|
import com.fs.his.vo.OptionsVO;
|
|
|
+import com.fs.system.service.ISysConfigService;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -46,8 +54,10 @@ public class FsCourseRedPacketLogController extends BaseController
|
|
|
FsUserCourseMapper fsUserCourseMapper;
|
|
|
@Autowired
|
|
|
FsUserCourseVideoMapper fsUserCourseVideoMapper;
|
|
|
-
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private TokenService tokenService;
|
|
|
+ @Autowired
|
|
|
+ private ISysConfigService configService;
|
|
|
/**
|
|
|
* 查询短链课程看课记录列表
|
|
|
*/
|
|
@@ -135,7 +145,16 @@ public class FsCourseRedPacketLogController extends BaseController
|
|
|
@GetMapping("/courseList")
|
|
|
public R courseList()
|
|
|
{
|
|
|
- List<OptionsVO> optionsVOS = fsUserCourseMapper.selectFsUserCourseAllList();
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ Long userId = loginUser.getUser().getUserId();
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
+ CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
+ List<OptionsVO> optionsVOS = new ArrayList<>();
|
|
|
+ if (ObjectUtil.isNotEmpty(config.getIsBound())&&config.getIsBound()){
|
|
|
+ optionsVOS = fsUserCourseMapper.selectFsUserCourseAllListByUserId(userId);
|
|
|
+ }else {
|
|
|
+ optionsVOS = fsUserCourseMapper.selectFsUserCourseAllList();
|
|
|
+ }
|
|
|
return R.ok().put("list", optionsVOS);
|
|
|
}
|
|
|
|