政策新闻接口文档
接口列表
1. 新闻列表
- 接口地址:
POST /api/v1/news/list
- 请求方式:POST
- Content-Type:application/json
请求参数
| 参数名 |
类型 |
必填 |
默认值 |
说明 |
| page |
int |
否 |
1 |
页码 |
| limit |
int |
否 |
10 |
每页数量 |
| keyword |
string |
否 |
- |
关键词搜索(标题模糊匹配) |
| category |
int |
否 |
- |
分类筛选 |
| sort_type |
int |
否 |
2 |
排序方式:1-时间倒序,2-排序倒序,3-浏览量倒序 |
响应示例
{
"code": 200,
"message": "success",
"data": {
"list": [
{
"id": 1,
"sid": 0,
"school_name": "",
"title": "新闻标题",
"content": "新闻内容",
"answer": "回答内容",
"sort": 100,
"look_num": 500,
"created_at": "2024-05-27 10:00:00",
"category_enum": 1,
"link": "",
"module_type": 4,
"sub_module_type": 4,
"description": "新闻内容摘要...",
"category_labels": {
"enum_type": 1,
"value_text": "政策解读"
}
}
],
"total": 100,
"page": 1,
"limit": 10
}
}
分类标签对照表
| enum_type |
value_text |
| 1 |
政策解读 |
| 2 |
考试信息 |
| 3 |
院校动态 |
| 4 |
重要公告 |
| 100 |
招生计划 |
| 101 |
招生简章 |
2. 新闻详情
- 接口地址:
POST /api/v1/news/detail
- 请求方式:POST
- Content-Type:application/json
请求参数
| 参数名 |
类型 |
必填 |
说明 |
| id |
int |
是 |
资讯ID |
响应示例
{
"code": 200,
"message": "success",
"data": {
"id": 1,
"sid": 0,
"title": "新闻标题",
"content": "新闻内容",
"answer": "回答内容",
"sort": 100,
"link": "",
"look_num": 501,
"created_at": "2024-05-27 10:00",
"category_enum": 1,
"category_labels": {
"enum_type": 1,
"value_text": "政策解读"
},
"related_news": [
{
"id": 2,
"title": "相关新闻标题",
"created_at": "2024-05-26 10:00"
}
]
}
}
错误响应示例
{
"code": 400,
"message": "ID不能为空",
"data": {}
}
{
"code": 400,
"message": "资讯不存在",
"data": {}
}