refactor: 优化代码结构和类型定义
feat(types): 添加express.d.ts类型引用 style: 格式化express.d.ts中的接口定义 refactor: 移除未使用的AntFC类型导入 chore: 删除自动生成的.umi-production文件 feat: 添加店铺管理相关表和初始化脚本 docs: 更新安全规则和交互指南文档 refactor: 统一使用FC类型替代React.FC perf: 优化图表组件导入方式 style: 添加.prettierrc配置文件 refactor: 调整组件导入顺序和结构 feat: 添加平台库存管理路由 fix: 修复订单同步时的库存检查逻辑 docs: 更新RBAC设计和租户管理文档 refactor: 优化部门控制器代码
This commit is contained in:
@@ -1311,6 +1311,413 @@ Authorization: Bearer <token>
|
||||
}
|
||||
```
|
||||
|
||||
## 15. 店铺管理接口
|
||||
|
||||
### 15.1 获取我的店铺列表
|
||||
|
||||
**请求**:
|
||||
- 方法:GET
|
||||
- 路径:/api/shops/my-shops
|
||||
- 认证:需要登录
|
||||
|
||||
**响应**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": [
|
||||
{
|
||||
"id": "shop_1",
|
||||
"tenantId": "tenant_1",
|
||||
"name": "TikTok店铺A",
|
||||
"platform": "TIKTOK",
|
||||
"platformAccountId": "account_1",
|
||||
"departmentId": "dept_1_1",
|
||||
"status": "ACTIVE",
|
||||
"lastSyncAt": "2026-03-29T10:00:00Z",
|
||||
"createdAt": "2026-01-01T00:00:00Z",
|
||||
"updatedAt": "2026-03-29T10:00:00Z"
|
||||
}
|
||||
],
|
||||
"error": null
|
||||
}
|
||||
```
|
||||
|
||||
### 15.2 获取店铺详情
|
||||
|
||||
**请求**:
|
||||
- 方法:GET
|
||||
- 路径:/api/shops/:id
|
||||
- 认证:需要店铺成员权限
|
||||
|
||||
**响应**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"id": "shop_1",
|
||||
"tenantId": "tenant_1",
|
||||
"name": "TikTok店铺A",
|
||||
"platform": "TIKTOK",
|
||||
"platformAccountId": "account_1",
|
||||
"departmentId": "dept_1_1",
|
||||
"status": "ACTIVE",
|
||||
"config": {},
|
||||
"lastSyncAt": "2026-03-29T10:00:00Z",
|
||||
"createdAt": "2026-01-01T00:00:00Z",
|
||||
"updatedAt": "2026-03-29T10:00:00Z"
|
||||
},
|
||||
"error": null
|
||||
}
|
||||
```
|
||||
|
||||
### 15.3 创建店铺
|
||||
|
||||
**请求**:
|
||||
- 方法:POST
|
||||
- 路径:/api/shops
|
||||
- 认证:需要店铺拥有者权限
|
||||
- 内容类型:application/json
|
||||
- 请求体:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "TikTok店铺A",
|
||||
"platform": "TIKTOK",
|
||||
"platformAccountId": "account_1",
|
||||
"departmentId": "dept_1_1",
|
||||
"config": {}
|
||||
}
|
||||
```
|
||||
|
||||
**响应**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"id": "shop_1",
|
||||
"name": "TikTok店铺A",
|
||||
"platform": "TIKTOK",
|
||||
"status": "INACTIVE",
|
||||
"createdAt": "2026-03-29T10:00:00Z"
|
||||
},
|
||||
"error": null
|
||||
}
|
||||
```
|
||||
|
||||
### 15.4 更新店铺信息
|
||||
|
||||
**请求**:
|
||||
- 方法:PUT
|
||||
- 路径:/api/shops/:id
|
||||
- 认证:需要店铺拥有者权限
|
||||
- 内容类型:application/json
|
||||
- 请求体:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "TikTok店铺A(更新)",
|
||||
"departmentId": "dept_1_2"
|
||||
}
|
||||
```
|
||||
|
||||
**响应**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"id": "shop_1",
|
||||
"name": "TikTok店铺A(更新)",
|
||||
"platform": "TIKTOK",
|
||||
"status": "ACTIVE",
|
||||
"updatedAt": "2026-03-29T10:30:00Z"
|
||||
},
|
||||
"error": null
|
||||
}
|
||||
```
|
||||
|
||||
### 15.5 刷新店铺授权
|
||||
|
||||
**请求**:
|
||||
- 方法:POST
|
||||
- 路径:/api/shops/:id/refresh-auth
|
||||
- 认证:需要店铺拥有者权限
|
||||
|
||||
**响应**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"success": true,
|
||||
"message": "授权已刷新"
|
||||
},
|
||||
"error": null
|
||||
}
|
||||
```
|
||||
|
||||
### 15.6 删除店铺
|
||||
|
||||
**请求**:
|
||||
- 方法:DELETE
|
||||
- 路径:/api/shops/:id
|
||||
- 认证:需要店铺拥有者权限
|
||||
|
||||
**响应**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": null,
|
||||
"error": null
|
||||
}
|
||||
```
|
||||
|
||||
### 15.7 获取店铺成员列表
|
||||
|
||||
**请求**:
|
||||
- 方法:GET
|
||||
- 路径:/api/shops/:shopId/members
|
||||
- 认证:需要店铺成员权限
|
||||
|
||||
**响应**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": [
|
||||
{
|
||||
"id": "member_1",
|
||||
"shopId": "shop_1",
|
||||
"userId": "user_1",
|
||||
"userName": "李主管",
|
||||
"userEmail": "manager@crawlful.com",
|
||||
"role": "admin",
|
||||
"permissions": ["product:read", "product:write", "order:read"],
|
||||
"assignedBy": "user_admin",
|
||||
"assignedAt": "2026-03-20T10:00:00Z",
|
||||
"createdAt": "2026-03-20T10:00:00Z",
|
||||
"updatedAt": "2026-03-20T10:00:00Z"
|
||||
}
|
||||
],
|
||||
"error": null
|
||||
}
|
||||
```
|
||||
|
||||
### 15.8 获取用户拥有的店铺
|
||||
|
||||
**请求**:
|
||||
- 方法:GET
|
||||
- 路径:/api/shops/user/:userId/shops
|
||||
- 认证:需要管理员权限或用户本人
|
||||
|
||||
**响应**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": [
|
||||
{
|
||||
"id": "member_1",
|
||||
"shopId": "shop_1",
|
||||
"userId": "user_1",
|
||||
"role": "admin",
|
||||
"permissions": ["product:read", "product:write"],
|
||||
"assignedAt": "2026-03-20T10:00:00Z"
|
||||
}
|
||||
],
|
||||
"error": null
|
||||
}
|
||||
```
|
||||
|
||||
### 15.9 添加店铺成员
|
||||
|
||||
**请求**:
|
||||
- 方法:POST
|
||||
- 路径:/api/shop-members
|
||||
- 认证:需要店铺拥有者权限
|
||||
- 内容类型:application/json
|
||||
- 请求体:
|
||||
|
||||
```json
|
||||
{
|
||||
"shopId": "shop_1",
|
||||
"userId": "user_2",
|
||||
"role": "operator",
|
||||
"permissions": ["product:read", "product:write", "order:read"],
|
||||
"assignedBy": "user_1"
|
||||
}
|
||||
```
|
||||
|
||||
**响应**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"id": "member_2",
|
||||
"shopId": "shop_1",
|
||||
"userId": "user_2",
|
||||
"role": "operator",
|
||||
"permissions": ["product:read", "product:write", "order:read"],
|
||||
"assignedBy": "user_1",
|
||||
"assignedAt": "2026-03-29T11:00:00Z",
|
||||
"createdAt": "2026-03-29T11:00:00Z"
|
||||
},
|
||||
"error": null
|
||||
}
|
||||
```
|
||||
|
||||
### 15.10 移除店铺成员
|
||||
|
||||
**请求**:
|
||||
- 方法:DELETE
|
||||
- 路径:/api/shop-members/:shopId/:userId
|
||||
- 认证:需要店铺拥有者权限
|
||||
|
||||
**响应**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": null,
|
||||
"error": null
|
||||
}
|
||||
```
|
||||
|
||||
### 15.11 更新成员角色和权限
|
||||
|
||||
**请求**:
|
||||
- 方法:PUT
|
||||
- 路径:/api/shop-members/:shopId/:userId
|
||||
- 认证:需要店铺拥有者权限
|
||||
- 内容类型:application/json
|
||||
- 请求体:
|
||||
|
||||
```json
|
||||
{
|
||||
"role": "admin",
|
||||
"permissions": ["product:read", "product:write", "product:delete", "order:read", "order:write"]
|
||||
}
|
||||
```
|
||||
|
||||
**响应**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"id": "member_1",
|
||||
"shopId": "shop_1",
|
||||
"userId": "user_1",
|
||||
"role": "admin",
|
||||
"permissions": ["product:read", "product:write", "product:delete", "order:read", "order:write"],
|
||||
"updatedAt": "2026-03-29T11:30:00Z"
|
||||
},
|
||||
"error": null
|
||||
}
|
||||
```
|
||||
|
||||
### 15.12 获取店铺统计信息
|
||||
|
||||
**请求**:
|
||||
- 方法:GET
|
||||
- 路径:/api/shops/stats
|
||||
- 认证:需要登录
|
||||
|
||||
**响应**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"total": 10,
|
||||
"active": 8,
|
||||
"inactive": 1,
|
||||
"expired": 1,
|
||||
"error": 0
|
||||
},
|
||||
"error": null
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 16. 集成与扩展接口
|
||||
|
||||
### 16.1 SSO集成
|
||||
|
||||
**请求**:
|
||||
- 方法:GET
|
||||
- 路径:/integrations/sso/login
|
||||
- 查询参数:
|
||||
- provider:身份提供商(google, microsoft, etc.)
|
||||
- redirect_uri:回调地址
|
||||
|
||||
**响应**:
|
||||
- 类型:重定向到身份提供商登录页面
|
||||
|
||||
### 16.2 LDAP/AD集成
|
||||
|
||||
**请求**:
|
||||
- 方法:POST
|
||||
- 路径:/integrations/ldap/test
|
||||
- 内容类型:application/json
|
||||
- 请求体:
|
||||
|
||||
```json
|
||||
{
|
||||
"url": "ldap://example.com",
|
||||
"bindDn": "cn=admin,dc=example,dc=com",
|
||||
"bindPassword": "password",
|
||||
"baseDn": "ou=users,dc=example,dc=com"
|
||||
}
|
||||
```
|
||||
|
||||
**响应**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"connected": true,
|
||||
"userCount": 100
|
||||
},
|
||||
"error": null
|
||||
}
|
||||
```
|
||||
|
||||
### 16.3 Webhook管理
|
||||
|
||||
**请求**:
|
||||
- 方法:POST
|
||||
- 路径:/webhooks
|
||||
- 内容类型:application/json
|
||||
- 请求体:
|
||||
|
||||
```json
|
||||
{
|
||||
"url": "https://example.com/webhook",
|
||||
"events": ["user.created", "user.updated", "tenant.created"],
|
||||
"secret": "secret_key"
|
||||
}
|
||||
```
|
||||
|
||||
**响应**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"webhookId": "1"
|
||||
},
|
||||
"error": null
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
本文档会定期更新,以反映系统的最新API接口。
|
||||
Reference in New Issue
Block a user