fix(订单中心):一键成片逻辑优化,兼容素材数量为4个的订单
This commit is contained in:
@@ -137,6 +137,80 @@ stateDiagram-v2
|
||||
|
||||
### 4. 关键接口设计
|
||||
|
||||
#### 4.0 获取访问Token(OAuth2)
|
||||
|
||||
**接口地址:** `POST /api-uaa/oauth/token`
|
||||
|
||||
**认证方式:** HTTP Basic(`Authorization: Basic base64(clientId:clientSecret)`)
|
||||
|
||||
**请求头:**
|
||||
- `Authorization: Basic {base64(clientId:clientSecret)}`
|
||||
- `Content-Type: application/x-www-form-urlencoded`
|
||||
|
||||
**授权模式与参数:**
|
||||
- 密码验证码模式(推荐)
|
||||
- `grant_type=password_code`
|
||||
- `username` 用户名
|
||||
- `password` 密码
|
||||
- `validCode` 校验码(图形/短信)
|
||||
- `deviceId` 设备ID(可用于风控)
|
||||
- 密码模式
|
||||
- `grant_type=password`
|
||||
- `username`
|
||||
- `password`
|
||||
- 客户端模式(服务器到服务器)
|
||||
- `grant_type=client_credentials`
|
||||
- 刷新令牌
|
||||
- `grant_type=refresh_token`
|
||||
- `refresh_token` 刷新令牌
|
||||
|
||||
**响应示例:**
|
||||
```json
|
||||
{
|
||||
"access_token": "eyJraWQiOi...",
|
||||
"token_type": "Bearer",
|
||||
"expires_in": 3600,
|
||||
"refresh_token": "def50200...",
|
||||
"scope": "all openid profile"
|
||||
}
|
||||
```
|
||||
|
||||
**调用示例:**
|
||||
|
||||
- 密码验证码模式
|
||||
```bash
|
||||
curl -X POST 'https://{gateway}/api-uaa/oauth/token' \
|
||||
-H 'Authorization: Basic {base64(clientId:clientSecret)}' \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded' \
|
||||
-d 'grant_type=password_code&username=admin&password=123456&validCode=abcd&deviceId=web'
|
||||
```
|
||||
|
||||
- 密码模式
|
||||
```bash
|
||||
curl -X POST 'https://{gateway}/api-uaa/oauth/token' \
|
||||
-H 'Authorization: Basic {base64(clientId:clientSecret)}' \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded' \
|
||||
-d 'grant_type=password&username=admin&password=123456'
|
||||
```
|
||||
|
||||
- 客户端模式
|
||||
```bash
|
||||
curl -X POST 'https://{gateway}/api-uaa/oauth/token' \
|
||||
-H 'Authorization: Basic {base64(clientId:clientSecret)}' \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded' \
|
||||
-d 'grant_type=client_credentials'
|
||||
```
|
||||
|
||||
- 刷新令牌
|
||||
```bash
|
||||
curl -X POST 'https://{gateway}/api-uaa/oauth/token' \
|
||||
-H 'Authorization: Basic {base64(clientId:clientSecret)}' \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded' \
|
||||
-d 'grant_type=refresh_token&refresh_token={refresh_token}'
|
||||
```
|
||||
|
||||
> 说明:可用客户端在 `oauth_client_details` 管理(如 `webApp`、`app`、`zlt` 等示例);令牌类型支持不透明令牌与JWT,网关域名与前缀以实际环境为准。
|
||||
|
||||
#### 4.1 设备执行任务API
|
||||
|
||||
**接口地址:** `POST /api-device/execute/task`
|
||||
|
||||
Reference in New Issue
Block a user