Merge branch 'rediect' into 251114-feature-course-online

This commit is contained in:
吴季分
2025-11-25 14:34:24 +08:00
6 changed files with 70 additions and 3 deletions

View File

@@ -34,6 +34,7 @@ public class UrlSecurityFilterImpl implements IUrlSecurityFilter{
noLoginUrls.add("/xboe/m/exam/alone-extend/save"); noLoginUrls.add("/xboe/m/exam/alone-extend/save");
noLoginUrls.add("/xboe/m/course/manage/test"); noLoginUrls.add("/xboe/m/course/manage/test");
noLoginUrls.add("/xboe/m/course/manage/redirectDetail");
} }
@Override @Override

View File

@@ -1,5 +1,6 @@
package com.xboe.module.course.api; package com.xboe.module.course.api;
import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -7,7 +8,9 @@ import java.util.stream.Collectors;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import cn.hutool.http.Header;
import cn.hutool.http.useragent.UserAgentUtil;
import com.boe.feign.api.infrastructure.entity.CommonSearchVo; import com.boe.feign.api.infrastructure.entity.CommonSearchVo;
import com.boe.feign.api.infrastructure.entity.Dict; import com.boe.feign.api.infrastructure.entity.Dict;
import com.xboe.api.ThirdApi; import com.xboe.api.ThirdApi;
@@ -17,6 +20,7 @@ import com.xboe.module.course.service.*;
import com.xboe.module.course.vo.CoursePageVo; import com.xboe.module.course.vo.CoursePageVo;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.parameters.P; import org.springframework.security.core.parameters.P;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@@ -97,6 +101,18 @@ public class CourseManageApi extends ApiBaseController{
IDataUserSyncService userSyncService; IDataUserSyncService userSyncService;
@Resource @Resource
private ThirdApi thirdApi; private ThirdApi thirdApi;
@Value("${boe.pcPageUrl}")
private String pcPageUrl;
@Value("${boe.h5PageUrl}")
private String h5PageUrl;
@Value("${boe.h5LoginUrl}")
private String h5LoginUrl;
@Value("${boe.pcLoginUrl}")
private String pcLoginUrl;
// @PostMapping("/test") // @PostMapping("/test")
// public JsonResponse<PageList<Course>> findTest(Pagination pager,CourseQueryDto dto){ // public JsonResponse<PageList<Course>> findTest(Pagination pager,CourseQueryDto dto){
@@ -1292,4 +1308,40 @@ public class CourseManageApi extends ApiBaseController{
courseService.saveTip(aid); courseService.saveTip(aid);
return success(true); return success(true);
} }
/**
* 扫描二维码重定向
* @param courseId 课程id
* @param request
* @param response
* @throws IOException
*/
@GetMapping("/redirectDetail")
public void redirectDetail(
@NotNull Long courseId,
HttpServletRequest request,
HttpServletResponse response) throws IOException {
boolean isMobile = UserAgentUtil.parse(request.getHeader(Header.USER_AGENT.toString())).isMobile();
String baseUrl = isMobile ? h5PageUrl : pcPageUrl;
String loginUrl = isMobile ? h5LoginUrl : pcLoginUrl;
CurrentUser currentUser;
try {
currentUser = getCurrent();
} catch (Exception e) {
log.warn("获取当前用户信息异常跳转至登录页。课程ID: {}", courseId, e);
response.sendRedirect(loginUrl);
return;
}
if (currentUser == null) {
log.info("用户未登录跳转至登录页。课程ID: {}", courseId);
response.sendRedirect(loginUrl);
return;
}
log.info("跳转到课程详情页课程ID: {}, 用户ID: {}", courseId, currentUser.getAccountId());
response.sendRedirect(baseUrl + courseId);
}
} }

View File

@@ -1,5 +1,9 @@
boe: boe:
domain: http://192.168.0.253 domain: http://192.168.0.253
pcPageUrl: ${boe.domain}/pc/course/studyindex?id=
h5PageUrl: ${boe.domain}/mobile/pages/study/courseStudy?id=
pcLoginUrl: ${boe.domain}/web/
h5LoginUrl: ${boe.domain}/m/loginuser
spring: spring:
servlet: servlet:
multipart: multipart:

View File

@@ -128,7 +128,10 @@ jasypt:
boe: boe:
domain: http://10.251.132.75 domain: http://10.251.132.75
pcPageUrl: ${boe.domain}/pc/course/studyindex?id=
h5PageUrl: ${boe.domain}/mobile/pages/study/courseStudy?id=
pcLoginUrl: ${boe.domain}/web/
h5LoginUrl: ${boe.domain}/m/loginuser
ok: ok:
http: http:
connect-timeout: 30 connect-timeout: 30

View File

@@ -153,7 +153,10 @@ jasypt:
boe: boe:
domain: http://10.251.186.27 domain: http://10.251.186.27
pcPageUrl: ${boe.domain}/pc/course/studyindex?id=
h5PageUrl: ${boe.domain}/mobile/pages/study/courseStudy?id=
pcLoginUrl: ${boe.domain}/web/
h5LoginUrl: ${boe.domain}/m/loginuser
ok: ok:
http: http:
connect-timeout: 30 connect-timeout: 30

View File

@@ -52,6 +52,10 @@ ok:
keep-alive-duration: 300 keep-alive-duration: 300
boe: boe:
domain: http://127.0.0.1 domain: http://127.0.0.1
pcPageUrl: ${boe.domain}/pc/course/studyindex?id=
h5PageUrl: ${boe.domain}/mobile/pages/study/courseStudy?id=
pcLoginUrl: ${boe.domain}/web/
h5LoginUrl: ${boe.domain}/m/loginuser
orgTree: orgTree:
orgTreeList: ${boe.domain}/userbasic/org/list orgTreeList: ${boe.domain}/userbasic/org/list
orgChildTreeList: ${boe.domain}/userbasic/org/childOrgs orgChildTreeList: ${boe.domain}/userbasic/org/childOrgs