You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

251 lines
5.1 KiB

5 days ago
# PSVT协议模块接口文档
## 概述
协议模块支持4种协议类型:隐私协议、用户协议、法律声明、健康敏感信息处理与AI服务授权告知书。初始4条数据,无创建接口,仅支持修改更新文案。
所有接口返回格式统一为:
```json
{
"code": 0,
"message": "success",
"data": {}
}
```
协议类型常量值:
| 常量值 | 含义 |
|--------|------|
| 1 | 隐私协议 |
| 2 | 用户协议 |
| 3 | 法律声明 |
| 4 | 健康敏感信息处理与AI服务授权告知书 |
---
## 一、小程序端接口
### 1. 按类型获取协议详情
- **路由**: `?r=psvt/agreement/get-by-type`
- **请求方式**: GET
- **是否需要登录**: 否(白名单路由)
#### 请求参数
| 参数名 | 类型 | 必填 | 说明 |
|--------|------|------|------|
| type | int | 是 | 协议类型:1-隐私协议,2-用户协议,3-法律声明,4-健康敏感信息处理与AI服务授权告知书 |
#### 响应示例
```json
{
"code": 0,
"message": "success",
"data": {
"id": 1,
"type": 1,
"title": "隐私协议",
"content": "隐私协议内容...",
"version": "V1.0",
"updateTime": "2026-07-17 10:00:00"
}
}
```
#### data字段说明
| 字段名 | 类型 | 说明 |
|--------|------|------|
| id | int | 协议ID |
| type | int | 协议类型 |
| title | string | 协议标题 |
| content | string | 协议内容(富文本) |
| version | string | 版本号 |
| updateTime | string | 最后更新时间 |
#### 错误码
| code | 说明 |
|------|------|
| 1 | 协议类型参数无效 |
| 1 | 协议不存在 |
---
### 2. 获取协议列表
- **路由**: `?r=psvt/agreement/get-list`
- **请求方式**: GET
- **是否需要登录**: 否(白名单路由)
#### 请求参数
#### 响应示例
```json
{
"code": 0,
"message": "success",
"data": [
{
"id": 1,
"type": 1,
"title": "隐私协议",
"content": "隐私协议内容...",
"version": "V1.0",
"updateTime": "2026-07-17 10:00:00"
},
{
"id": 2,
"type": 2,
"title": "用户协议",
"content": "用户协议内容...",
"version": "V1.0",
"updateTime": "2026-07-17 10:00:00"
},
{
"id": 3,
"type": 3,
"title": "法律声明",
"content": "法律声明内容...",
"version": "V1.0",
"updateTime": "2026-07-17 10:00:00"
},
{
"id": 4,
"type": 4,
"title": "健康敏感信息处理与AI服务授权告知书",
"content": "健康敏感信息处理与AI服务授权告知书内容...",
"version": "V1.0",
"updateTime": "2026-07-17 10:00:00"
}
]
}
```
#### data字段说明
data为数组类型,每个元素字段同"按类型获取协议详情"接口的data字段。
---
## 二、PC后台管理端接口
### 1. 获取协议列表
5 days ago
- **路由**: `?r=agreement/get-list`
5 days ago
- **请求方式**: GET
- **是否需要登录**: 是
#### 请求参数
| 参数名 | 类型 | 必填 | 说明 |
|--------|------|------|------|
| search | string | 否 | 搜索关键词(按标题模糊搜索) |
| page | int | 否 | 页码,默认1 |
| count | int | 否 | 每页条数,默认10 |
#### 响应示例
```json
{
"code": 0,
"message": "success",
"data": {
"total": 4,
"pages": 1,
"list": [
{
"id": 1,
"type": 1,
"title": "隐私协议",
"content": "隐私协议内容...",
"version": "V1.0",
"updateTime": "2026-07-17 10:00:00"
},
{
"id": 2,
"type": 2,
"title": "用户协议",
"content": "用户协议内容...",
"version": "V1.0",
"updateTime": "2026-07-17 10:00:00"
},
{
"id": 3,
"type": 3,
"title": "法律声明",
"content": "法律声明内容...",
"version": "V1.0",
"updateTime": "2026-07-17 10:00:00"
},
{
"id": 4,
"type": 4,
"title": "健康敏感信息处理与AI服务授权告知书",
"content": "健康敏感信息处理与AI服务授权告知书内容...",
"version": "V1.0",
"updateTime": "2026-07-17 10:00:00"
}
]
}
}
```
#### data字段说明
| 字段名 | 类型 | 说明 |
|--------|------|------|
| total | int | 总记录数 |
| pages | int | 总页数 |
| list | array | 协议列表,每个元素字段同小程序端 |
---
### 2. 更新协议文案
5 days ago
- **路由**: `?r=agreement/update`
5 days ago
- **请求方式**: POST
- **是否需要登录**: 是
- **事务**: 是
#### 请求参数
| 参数名 | 类型 | 必填 | 说明 |
|--------|------|------|------|
| id | int | 是 | 协议ID |
| title | string | 否 | 协议标题 |
| content | string | 否 | 协议内容(富文本) |
> 注:title和content至少传一个,传入的字段才会更新
#### 响应示例
```json
{
"code": 0,
"message": "更新成功",
"data": {
"id": 1
}
}
```
#### data字段说明
| 字段名 | 类型 | 说明 |
|--------|------|------|
| id | int | 更新的协议ID |
#### 错误码
| code | 说明 |
|------|------|
| 1 | 用户未登录 |
| 1 | 协议ID不能为空 |
| 1 | 协议不存在 |
| 1 | 更新协议失败 |