peixue-dev/Archive/[一次性]直接测试专项课程接口-2026-02-01.md

49 lines
1.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 直接测试专项课程接口
## 测试步骤
### 1. 检查后端是否启动
打开浏览器访问:
```
http://localhost:8089/api/special-course/list
```
### 2. 使用Postman测试
- URL: `http://localhost:8089/api/special-course/list`
- Method: GET
- Headers:
- `Content-Type: application/json`
- `X-Tenant-Id: 1`
### 3. 检查后端控制台
应该能看到以下日志:
```
=== 专项课程列表接口被调用 ===
category: null
tenantId: 1
查询到 X 条专项课程数据
```
## 如果看不到日志
说明请求被拦截器拦截了,需要检查:
1. **JwtInterceptor** - 是否已经修改并重新编译?
2. **WebMvcConfig** - 是否正确配置了排除路径?
3. **后端是否重启** - 修改后是否重新启动了服务?
## 验证修改是否生效
打开文件:`peidu/backend/src/main/java/com/peidu/interceptor/JwtInterceptor.java`
检查第 28-31 行是否是:
```java
// 验证token - 如果token无效也放行让Controller决定是否需要登录
if (!jwtUtil.validateToken(token)) {
System.out.println("token验证失败但仍然放行游客模式");
return true; // 改为放行,不抛出异常
}
```
如果不是,说明修改没有保存或没有编译。