添加日志

This commit is contained in:
zhaolongfei
2024-11-08 19:01:56 +08:00
parent 425a1edf01
commit f28d120688

View File

@@ -14,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
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.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@@ -99,7 +100,8 @@ public class CourseWareApi extends ApiBaseController {
* @throws Exception * @throws Exception
*/ */
@GetMapping("/resource") @GetMapping("/resource")
public JsonResponse<String> getVideo(HttpServletRequest request, HttpServletResponse response, String sign) throws Exception { public JsonResponse<String> getVideo(HttpServletRequest request, HttpServletResponse response, String sign,
@CookieValue(name = "token",required = false)String token) throws Exception {
if (StringUtils.isBlank(sign)) { if (StringUtils.isBlank(sign)) {
return badRequest("非法请求"); return badRequest("非法请求");
@@ -119,10 +121,10 @@ public class CourseWareApi extends ApiBaseController {
if(!has) { if(!has) {
return badRequest("页面不存在"); return badRequest("页面不存在");
} }
String token = request.getHeader("Xboe-Access-Token"); // String token = request.getHeader("Xboe-Access-Token");
if (StringUtils.isEmpty(token)) { // if (StringUtils.isEmpty(token)) {
token = request.getHeader("token"); // token = request.getHeader("token");
} // }
// 读取cookies中的时间 // 读取cookies中的时间
// String cookieTime = getSignTimeCookie(request); // String cookieTime = getSignTimeCookie(request);
// if (StringUtils.isBlank(cookieTime)) { // if (StringUtils.isBlank(cookieTime)) {