更新文件结构,统一文档格式

This commit is contained in:
ylweng
2025-09-01 03:32:45 +08:00
parent 950ef70173
commit 23041faa2a
39 changed files with 817 additions and 111 deletions

View File

@@ -80,7 +80,7 @@ Authorization: Bearer <token>
"gender": "male",
"birthday": "1990-01-01",
"phone": "13800138000",
"email": "test@example.com",
"email": "test@jiebanke.com",
"travelCount": 5,
"animalClaimCount": 2,
"createdAt": "2024-01-01T00:00:00.000Z",
@@ -504,12 +504,12 @@ Authorization: Bearer <token>
### 使用curl测试
```bash
# 微信用户登录
curl -X POST http://localhost:3000/api/v1/auth/wechat-login \
curl -X POST https://api.jiebanke.com/api/v1/auth/wechat-login \
-H "Content-Type: application/json" \
-d '{"code":"wxlogincode123","userInfo":{"nickName":"测试用户","avatarUrl":"https://avatar.url","gender":1}}'
# 获取旅行计划列表
curl -X GET http://localhost:3000/api/v1/travel/plans \
curl -X GET https://api.jiebanke.com/api/v1/travel/plans \
-H "Authorization: Bearer <token>"
```

View File

@@ -78,9 +78,9 @@ npm run dev
```
### 6. 验证部署
- 后端API: http://localhost:3000/api/v1/health
- 后台管理: http://localhost:3001
- 官方网站: http://localhost:3002
- 后端API: https://api.jiebanke.com/api/v1/health
- 后台管理: https://admin.jiebanke.com
- 官方网站: https://www.jiebanke.com
## 🧪 测试环境部署
@@ -228,7 +228,7 @@ server {
# 反向代理到后端API
location /api {
proxy_pass http://localhost:3000;
proxy_pass http://backend-service:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -315,8 +315,8 @@ vim /etc/mysql/mysql.conf.d/mysqld.cnf
# 创建应用专用用户
mysql -u root -p -e "
CREATE USER 'appuser'@'localhost' IDENTIFIED BY 'strongpassword';
GRANT SELECT, INSERT, UPDATE, DELETE ON jiebandata.* TO 'appuser'@'localhost';
CREATE USER 'appuser'@'%' IDENTIFIED BY 'strongpassword';
GRANT SELECT, INSERT, UPDATE, DELETE ON jiebandata.* TO 'appuser'@'%';
FLUSH PRIVILEGES;
"
```
@@ -434,8 +434,8 @@ tail -f /var/log/mysql/error.log
## 📞 支持与维护
### 紧急联系人
- **运维团队**: ops@company.com
- **开发团队**: dev@company.com
- **运维团队**: ops@jiebanke.com
- **开发团队**: dev@jiebanke.com
- **值班电话**: +86-138-0013-8000
### 维护窗口

View File

@@ -2,7 +2,7 @@
## 基础信息
**Base URL**: `http://localhost:3100/api/v1`
**Base URL**: `https://www.jiebanke.com/api/v1`
**认证方式**: Bearer Token (JWT)
@@ -83,7 +83,7 @@
"id": 1,
"username": "testuser",
"nickname": "测试用户",
"email": "test@example.com",
"email": "test@jiebanke.com",
"phone": "13800138000",
"avatar": "",
"gender": "unknown",
@@ -122,7 +122,7 @@
"id": 1,
"username": "testuser",
"nickname": "测试用户",
"email": "test@example.com",
"email": "test@jiebanke.com",
"phone": "13800138000",
"avatar": "",
"gender": "unknown",
@@ -154,9 +154,9 @@
"id": 1,
"username": "testuser",
"nickname": "测试用户",
"email": "test@example.com",
"email": "test@jiebanke.com",
"phone": "13800138000",
"avatar": "https://example.com/avatar.jpg",
"avatar": "https://www.jiebanke.com/avatar.jpg",
"gender": "male",
"birthday": "1990-01-01",
"points": 1000,
@@ -203,7 +203,7 @@
"id": 1,
"username": "testuser",
"nickname": "新昵称",
"avatar": "https://example.com/new-avatar.jpg",
"avatar": "https://www.jiebanke.com/new-avatar.jpg",
"gender": "male",
"birthday": "1990-01-01",
"updated_at": "2025-01-01T00:00:00.000Z"
@@ -241,7 +241,7 @@
"id": 1,
"username": "testuser",
"nickname": "测试用户",
"avatar": "https://example.com/avatar.jpg",
"avatar": "https://www.jiebanke.com/avatar.jpg",
"gender": "male",
"points": 100,
"level": 2,
@@ -273,7 +273,7 @@
"nickname": "测试用户",
"email": "test@example.com",
"phone": "13800138000",
"avatar": "https://example.com/avatar.jpg",
"avatar": "https://www.jiebanke.com/avatar.jpg",
"gender": "male",
"birthday": "1990-01-01",
"points": 1000,
@@ -358,7 +358,7 @@
"nickname": "测试用户",
"email": "test@example.com",
"phone": "13800138000",
"avatar": "https://example.com/avatar.jpg",
"avatar": "https://www.jiebanke.com/avatar.jpg",
"gender": "male",
"points": 100,
"level": 2,
@@ -396,7 +396,7 @@
"nickname": "测试用户",
"email": "test@example.com",
"phone": "13800138000",
"avatar": "https://example.com/avatar.jpg",
"avatar": "https://www.jiebanke.com/avatar.jpg",
"gender": "male",
"birthday": "1990-01-01",
"points": 1000,
@@ -437,7 +437,7 @@
"admin": {
"id": 1,
"username": "admin",
"email": "admin@example.com",
"email": "admin@jiebanke.com",
"nickname": "超级管理员",
"avatar": "https://example.com/avatar.jpg",
"role": "super_admin",
@@ -566,17 +566,21 @@
}
```
### 9. 用户管理接口
### 9. 管理员后台接口
#### 9.1 获取用户列表
- **Endpoint**: GET /api/v1/users
#### 9.1 用户管理接口
##### 9.1.1 获取用户列表
- **Endpoint**: GET /api/v1/admin/users
- **认证要求**: Bearer Token需要user:manage权限
- **查询参数**:
- `page` (可选): 页码默认1
- `limit` (可选): 每页数量默认20
- `username` (可选): 用户名模糊搜索
- `user_type` (可选): 用户类型过滤
- `status` (可选): 状态过滤
- `user_type` (可选): 用户类型过滤normal/merchant/farmer/organizer
- `status` (可选): 状态过滤active/inactive/banned
- `start_date` (可选): 注册开始时间
- `end_date` (可选): 注册结束时间
- **响应**:
```json
{
@@ -591,14 +595,682 @@
"nickname": "测试用户",
"email": "test@example.com",
"phone": "13800138000",
"user_type": "farmer",
"user_type": "normal",
"status": "active",
"points": 100,
"level": 2,
"travel_count": 5,
"animal_adopt_count": 2,
"flower_order_count": 3,
"created_at": "2025-01-01T00:00:00.000Z",
"last_login_at": "2025-01-01T00:00:00.000Z"
}
],
"pagination": {
"total": 100,
"page": 1,
"limit": 20,
"pages": 5
},
"statistics": {
"total_users": 100,
"active_users": 80,
"new_users_today": 5,
"merchant_users": 15,
"farmer_users": 10
}
}
}
```
##### 9.1.2 获取用户详情
- **Endpoint**: GET /api/v1/admin/users/{id}
- **认证要求**: Bearer Token需要user:manage权限
- **响应**:
```json
{
"success": true,
"code": 200,
"message": "获取成功",
"data": {
"user": {
"id": 1,
"username": "testuser",
"nickname": "测试用户",
"email": "test@example.com",
"phone": "13800138000",
"avatar": "https://example.com/avatar.jpg",
"gender": "male",
"birthday": "1990-01-01",
"user_type": "normal",
"status": "active",
"points": 1000,
"level": 3,
"balance": 500.00,
"travel_count": 5,
"animal_adopt_count": 2,
"flower_order_count": 3,
"created_at": "2025-01-01T00:00:00.000Z",
"updated_at": "2025-01-01T00:00:00.000Z",
"last_login_at": "2025-01-01T00:00:00.000Z"
},
"activity_stats": {
"last_7_days_login_count": 5,
"total_travel_plans": 3,
"total_animal_claims": 2,
"total_flower_orders": 1
}
}
}
```
##### 9.1.3 更新用户状态
- **Endpoint**: PUT /api/v1/admin/users/{id}/status
- **认证要求**: Bearer Token需要user:manage权限
- **请求体**:
```json
{
"status": "banned",
"reason": "违反平台规则"
}
```
- **响应**:
```json
{
"success": true,
"code": 200,
"message": "用户状态更新成功"
}
```
##### 9.1.4 导出用户数据
- **Endpoint**: GET /api/v1/admin/users/export
- **认证要求**: Bearer Token需要user:manage权限
- **查询参数**:
- `format` (可选): 导出格式csv/excel默认csv
- `start_date` (可选): 注册开始时间
- `end_date` (可选): 注册结束时间
- `user_type` (可选): 用户类型过滤
- **响应**: 返回文件下载流
#### 9.2 商家审核接口
##### 9.2.1 获取待审核商家列表
- **Endpoint**: GET /api/v1/admin/merchants/pending
- **认证要求**: Bearer Token需要merchant:review权限
- **查询参数**:
- `page` (可选): 页码默认1
- `limit` (可选): 每页数量默认20
- `merchant_type` (可选): 商家类型flower_shop/farm/activity_organizer
- **响应**:
```json
{
"success": true,
"code": 200,
"message": "获取成功",
"data": {
"merchants": [
{
"id": 1,
"user_id": 2,
"shop_name": "鲜花小店",
"merchant_type": "flower_shop",
"contact_name": "张老板",
"contact_phone": "13800138001",
"business_license": "https://www.jiebanke.com/license.jpg",
"status": "pending",
"apply_reason": "希望加入平台提供鲜花服务",
"created_at": "2025-01-01T00:00:00.000Z",
"user_info": {
"username": "merchant1",
"nickname": "花店老板",
"email": "merchant@jiebanke.com"
}
}
],
"pagination": {
"total": 10,
"page": 1,
"limit": 20,
"pages": 1
}
}
}
```
##### 9.2.2 审核商家申请
- **Endpoint**: POST /api/v1/admin/merchants/{id}/review
- **认证要求**: Bearer Token需要merchant:review权限
- **请求体**:
```json
{
"action": "approve",
"review_notes": "资质齐全,符合要求",
"reject_reason": ""
}
```
或者
```json
{
"action": "reject",
"review_notes": "营业执照不清晰",
"reject_reason": "营业执照图片模糊,无法辨认"
}
```
- **响应**:
```json
{
"success": true,
"code": 200,
"message": "商家审核完成"
}
```
##### 9.2.3 获取商家列表
- **Endpoint**: GET /api/v1/admin/merchants
- **认证要求**: Bearer Token需要merchant:manage权限
- **查询参数**:
- `page` (可选): 页码默认1
- `limit` (可选): 每页数量默认20
- "shop_name" (可选): 店铺名称模糊搜索
- "merchant_type" (可选): 商家类型
- "status" (可选): 状态active/inactive/rejected
- **响应**:
```json
{
"success": true,
"code": 200,
"message": "获取成功",
"data": {
"merchants": [
{
"id": 1,
"user_id": 2,
"shop_name": "鲜花小店",
"merchant_type": "flower_shop",
"contact_name": "张老板",
"contact_phone": "13800138001",
"business_license": "https://www.jiebanke.com/license.jpg",
"status": "active",
"total_products": 15,
"total_orders": 120,
"total_revenue": 5000.00,
"avg_rating": 4.8,
"created_at": "2025-01-01T00:00:00.000Z",
"approved_at": "2025-01-02T00:00:00.000Z"
}
],
"pagination": {
"total": 50,
"page": 1,
"limit": 20,
"pages": 3
},
"statistics": {
"total_merchants": 50,
"active_merchants": 45,
"flower_shops": 20,
"farms": 15,
"organizers": 15,
"pending_reviews": 5
}
}
}
```
#### 9.3 内容审核接口
##### 9.3.1 获取待审核内容列表
- **Endpoint**: GET /api/v1/admin/content/pending
- **认证要求**: Bearer Token需要content:review权限
- **查询参数**:
- `page` (可选): 页码默认1
- `limit` (可选): 每页数量默认20
- `content_type` (可选): 内容类型travel_plan/dynamic/comment
- **响应**:
```json
{
"success": true,
"code": 200,
"message": "获取成功",
"data": {
"contents": [
{
"id": 1,
"type": "travel_plan",
"title": "云南大理之旅",
"content": "计划去大理游玩5天寻找同行伙伴...",
"author_id": 3,
"author_name": "旅行爱好者",
"status": "pending",
"created_at": "2025-01-01T00:00:00.000Z",
"review_count": 0
},
{
"id": 2,
"type": "dynamic",
"title": "",
"content": "今天认领了一只可爱的小羊!",
"images": ["https://www.jiebanke.com/sheep.jpg"],
"author_id": 4,
"author_name": "动物爱好者",
"status": "pending",
"created_at": "2025-01-01T00:00:00.000Z",
"review_count": 0
}
],
"pagination": {
"total": 25,
"page": 1,
"limit": 20,
"pages": 2
}
}
}
```
##### 9.3.2 审核内容
- **Endpoint**: POST /api/v1/admin/content/{id}/review
- **认证要求**: Bearer Token需要content:review权限
- **请求体**:
```json
{
"action": "approve",
"review_notes": "内容符合规范"
}
```
或者
```json
{
"action": "reject",
"review_notes": "包含不当内容",
"reject_reason": "包含联系方式"
}
```
- **响应**:
```json
{
"success": true,
"code": 200,
"message": "内容审核完成"
}
```
##### 9.3.3 获取内容统计
- **Endpoint**: GET /api/v1/admin/content/statistics
- **认证要求**: Bearer Token需要content:review权限
- **查询参数**:
- `days` (可选): 统计天数默认7
- **响应**:
```json
{
"success": true,
"code": 200,
"message": "获取成功",
"data": {
"total_contents": 1000,
"pending_review": 25,
"approved": 900,
"rejected": 75,
"daily_stats": [
{
"date": "2025-01-01",
"total": 50,
"approved": 45,
"rejected": 5
}
],
"by_type": {
"travel_plan": 300,
"dynamic": 500,
"comment": 200
}
}
}
```
#### 9.4 数据统计接口
##### 9.4.1 获取平台概览数据
- **Endpoint**: GET /api/v1/admin/dashboard/overview
- **认证要求**: Bearer Token需要data:view权限
- **查询参数**:
- `days` (可选): 统计天数默认30
- **响应**:
```json
{
"success": true,
"code": 200,
"message": "获取成功",
"data": {
"user_stats": {
"total_users": 10000,
"new_users_today": 50,
"new_users_7d": 300,
"new_users_30d": 1200,
"active_users_7d": 2000,
"active_users_30d": 6000
},
"order_stats": {
"total_orders": 5000,
"today_orders": 25,
"revenue_today": 1250.00,
"revenue_7d": 8500.00,
"revenue_30d": 35000.00,
"avg_order_value": 70.00
},
"content_stats": {
"total_travel_plans": 2000,
"total_animal_claims": 800,
"total_flower_orders": 1200,
"total_dynamics": 3000
},
"merchant_stats": {
"total_merchants": 150,
"active_merchants": 120,
"flower_shops": 60,
"farms": 50,
"organizers": 40
}
}
}
```
##### 9.4.2 获取用户增长图表
- **Endpoint**: GET /api/v1/admin/dashboard/user-growth
- **认证要求**: Bearer Token需要data:view权限
- **查询参数**:
- `days` (可选): 统计天数默认30
- `group_by` (可选): 分组方式day/week/month默认day
- **响应**:
```json
{
"success": true,
"code": 200,
"message": "获取成功",
"data": {
"chart_data": [
{
"date": "2025-01-01",
"new_users": 45,
"total_users": 10045
},
{
"date": "2025-01-02",
"new_users": 52,
"total_users": 10097
}
],
"summary": {
"total_new_users": 1200,
"growth_rate": 12.5,
"avg_daily_new_users": 40
}
}
}
```
##### 9.4.3 获取订单统计图表
- **Endpoint**: GET /api/v1/admin/dashboard/order-stats
- **认证要求**: Bearer Token需要data:view权限
- **查询参数**:
- `days` (可选): 统计天数默认30
- `order_type` (可选): 订单类型flower/animal/travel
- **响应**:
```json
{
"success": true,
"code": 200,
"message": "获取成功",
"data": {
"chart_data": [
{
"date": "2025-01-01",
"total_orders": 28,
"total_revenue": 1960.00,
"flower_orders": 15,
"animal_orders": 8,
"travel_orders": 5
}
],
"summary": {
"total_revenue": 35000.00,
"avg_daily_revenue": 1166.67,
"order_conversion_rate": 8.5
}
}
}
```
##### 9.4.4 导出数据报表
- **Endpoint**: GET /api/v1/admin/dashboard/export
- **认证要求**: Bearer Token需要data:export权限
- **查询参数**:
- `report_type` (必选): 报表类型users/orders/contents/merchants
- `format` (可选): 格式csv/excel默认csv
- `start_date` (可选): 开始时间
- `end_date` (可选): 结束时间
- **响应**: 返回文件下载流
#### 9.5 权限管理接口
##### 9.5.1 获取管理员列表
- **Endpoint**: GET /api/v1/admin/administrators
- **认证要求**: Bearer Token需要admin:manage权限
- **查询参数**:
- `page` (可选): 页码默认1
- `limit` (可选): 每页数量默认20
- `username` (可选): 用户名模糊搜索
- `role` (可选): 角色过滤
- **响应**:
```json
{
"success": true,
"code": 200,
"message": "获取成功",
"data": {
"admins": [
{
"id": 1,
"username": "admin",
"email": "admin@example.com",
"nickname": "超级管理员",
"avatar": "https://example.com/avatar.jpg",
"role": "super_admin",
"status": 1,
"last_login": "2025-01-15T10:30:00.000Z",
"created_at": "2025-01-01T00:00:00.000Z",
"permissions": ["user:manage", "content:review", "data:view", "data:export"]
}
],
"pagination": {
"total": 10,
"page": 1,
"limit": 20,
"pages": 1
}
}
}
```
##### 9.5.2 创建管理员账号
- **Endpoint**: POST /api/v1/admin/administrators
- **认证要求**: Bearer Token需要admin:manage权限
- **请求体**:
```json
{
"username": "newadmin",
"password": "password123",
"email": "newadmin@example.com",
"nickname": "新管理员",
"role": "content_admin",
"permissions": ["content:review", "content:publish"]
}
```
- **响应**:
```json
{
"success": true,
"code": 201,
"message": "管理员创建成功",
"data": {
"id": 2,
"username": "newadmin",
"email": "newadmin@example.com",
"nickname": "新管理员",
"role": "content_admin",
"status": 1,
"created_at": "2025-01-01T00:00:00.000Z"
}
}
```
##### 9.5.3 更新管理员权限
- **Endpoint**: PUT /api/v1/admin/administrators/{id}/permissions
- **认证要求**: Bearer Token需要admin:manage权限
- **请求体**:
```json
{
"permissions": ["content:review", "content:publish", "data:view"]
}
```
- **响应**:
```json
{
"success": true,
"code": 200,
"message": "权限更新成功"
}
```
##### 9.5.4 禁用/启用管理员账号
- **Endpoint**: PUT /api/v1/admin/administrators/{id}/status
- **认证要求**: Bearer Token需要admin:manage权限
- **请求体**:
```json
{
"status": 0
}
```
- **响应**:
```json
{
"success": true,
"code": 200,
"message": "管理员状态更新成功"
}
```
##### 9.5.5 获取权限列表
- **Endpoint**: GET /api/v1/admin/permissions
- **认证要求**: Bearer Token需要admin:manage权限
- **响应**:
```json
{
"success": true,
"code": 200,
"message": "获取成功",
"data": {
"permissions": [
{
"code": "user:manage",
"name": "用户管理",
"description": "管理用户账号和状态"
},
{
"code": "content:review",
"name": "内容审核",
"description": "审核用户发布的内容"
},
{
"code": "content:publish",
"name": "内容发布",
"description": "发布和管理平台内容"
},
{
"code": "data:view",
"name": "数据查看",
"description": "查看平台统计数据"
},
{
"code": "data:export",
"name": "数据导出",
"description": "导出数据报表"
},
{
"code": "merchant:review",
"name": "商家审核",
"description": "审核商家入驻申请"
},
{
"code": "merchant:manage",
"name": "商家管理",
"description": "管理商家账号和信息"
},
{
"code": "admin:manage",
"name": "管理员管理",
"description": "管理其他管理员账号"
}
]
}
}
```
#### 9.6 操作日志接口
##### 9.6.1 获取操作日志列表
- **Endpoint**: GET /api/v1/admin/operation-logs
- **认证要求**: Bearer Token需要admin:manage权限
- **查询参数**:
- `page` (可选): 页码默认1
- `limit` (可选): 每页数量默认20
- `admin_id` (可选): 操作管理员ID
- `action_type` (可选): 操作类型
- `start_date` (可选): 开始时间
- `end_date` (可选): 结束时间
- **响应**:
```json
{
"success": true,
"code": 200,
"message": "获取成功",
"data": {
"logs": [
{
"id": 1,
"admin_id": 1,
"admin_name": "超级管理员",
"action_type": "user_status_update",
"target_type": "user",
"target_id": 5,
"target_name": "testuser",
"old_value": "active",
"new_value": "banned",
"ip_address": "192.168.1.100",
"user_agent": "Mozilla/5.0...",
"created_at": "2025-01-01T10:30:00.000Z"
}
],
"pagination": {
"total": 1000,
"page": 1,
"limit": 20,
"pages": 50
}
}
}
```
##### 9.6.2 导出操作日志
- **Endpoint**: GET /api/v1/admin/operation-logs/export
- **认证要求**: Bearer Token需要admin:manage权限
- **查询参数**:
- `format` (可选): 格式csv/excel默认csv
- `start_date` (可选): 开始时间
- `end_date` (可选): 结束时间
- **响应**: 返回文件下载流
],
"pagination": {
"total": 100,
"page": 1,
@@ -716,7 +1388,7 @@
"name": "MySQL数据库",
"type": "database",
"status": "running",
"host": "localhost",
"host": "mysql.jiebanke.com",
"port": 3306,
"description": "主数据库服务",
"created_at": "2024-01-01T00:00:00.000Z",
@@ -864,7 +1536,7 @@
"username": "testuser",
"nickname": "测试用户"
},
"images": ["https://example.com/image1.jpg"],
"images": ["https://www.jiebanke.com/image1.jpg"],
"status": "pending",
"created_at": "2025-01-01T12:00:00.000Z",
"updated_at": "2025-01-01T12:00:00.000Z"
@@ -1797,7 +2469,7 @@
"vaccination_status": "vaccinated",
"sterilization_status": "sterilized",
"location": "北京市朝阳区",
"images": ["https://example.com/animal1.jpg"],
"images": ["https://www.jiebanke.com/animal1.jpg"],
"status": "available",
"shelter": {
"id": 1,
@@ -1882,7 +2554,7 @@
"original_price": 129.00,
"stock": 50,
"sales": 120,
"images": ["https://example.com/rose.jpg"],
"images": ["https://www.jiebanke.com/rose.jpg"],
"merchant": {
"id": 1,
"name": "花语花店",
@@ -1990,7 +2662,7 @@
"post": {
"id": 1,
"content": "今天去了西湖,风景真美!",
"images": ["https://example.com/westlake.jpg"],
"images": ["https://www.jiebanke.com/westlake.jpg"],
"visibility": "public",
"location": "杭州西湖",
"like_count": 0,
@@ -2177,7 +2849,7 @@
"id": 1,
"username": "user1",
"nickname": "用户1",
"email": "user1@example.com",
"email": "user1@jiebanke.com",
"phone": "13800138001",
"status": "active",
"level": 2,
@@ -2344,7 +3016,7 @@
"user": {
"id": 2,
"nickname": "旅行伙伴",
"avatar": "https://example.com/avatar2.jpg"
"avatar": "https://www.jiebanke.com/avatar2.jpg"
}
}
],
@@ -2398,7 +3070,7 @@
"description": "非常温顺的猫咪,寻找有爱心的主人",
"location": "北京市朝阳区",
"status": "available",
"images": ["https://example.com/cat1.jpg"],
"images": ["https://www.jiebanke.com/cat1.jpg"],
"creator_id": 1,
"created_at": "2025-01-01T00:00:00.000Z"
}
@@ -2482,7 +3154,7 @@
"name": "羊驼认领体验",
"description": "提供一个月的羊驼认领体验服务",
"price": 1000.00,
"image_url": "https://example.com/product.jpg",
"image_url": "https://www.jiebanke.com/product.jpg",
"category": "animal_claim",
"status": "available",
"created_at": "202极速版5-01-01T00:00:00.000Z"
@@ -2590,8 +3262,8 @@
"success": true,
"code": 200,
"data": {
"promotion_link": "https://example.com/promotion?ref=user123",
"qr_code": "https://example.com/qrcode.png"
"promotion_link": "https://www.jiebanke.com/promotion?ref=user123",
"qr_code": "https://www.jiebanke.com/qrcode.png"
}
}
```
@@ -2716,7 +3388,7 @@
"id": 1,
"title": "XX农场成功入驻案例",
"description": "XX农场通过平台实现了数字化转型",
"image_url": "https://example.com/case1.jpg",
"image_url": "https://www.jiebanke.com/case1.jpg",
"created_at": "2025-01-01T00:00:00.000Z"
}
],

View File

@@ -194,7 +194,7 @@ erDiagram
### 开发环境 (Development)
```env
DB_HOST=localhost
DB_HOST=mysql.jiebanke.com
DB_PORT=3306
DB_USER=root
DB_PASSWORD=rootpassword
@@ -280,7 +280,7 @@ NODE_ENV=production
"gender": "male",
"birthday": "1990-01-01",
"phone": "13800138000",
"email": "test@example.com",
"email": "test@jiebanke.com",
"travelCount": 5,
"animalClaimCount": 2,
"createdAt": "2024-01-01T00:00:00.000Z",

View File

@@ -324,7 +324,7 @@ erDiagram
### 3.1 接口统一格式
#### 请求格式
- **Base URL**: http://localhost:3100/api/v1
- **Base URL**: https://www.jiebanke.com/api/v1
- **认证**: Bearer Token (需要认证的接口)
- **Content-Type**: application/json
@@ -393,6 +393,40 @@ erDiagram
- **Endpoint**: PUT /admin/users/{id}/status
- **认证要求**: Bearer Token
### 2.13 管理员操作日志表 (admin_operation_logs)
| 字段名 | 类型 | 约束 | 描述 |
|--------|------|------|------|
| id | INT | PRIMARY KEY, AUTO_INCREMENT | 日志ID |
| admin_id | INT | FOREIGN KEY REFERENCES admins(id), NOT NULL | 操作管理员ID |
| admin_name | VARCHAR(50) | NOT NULL | 管理员名称 |
| action_type | VARCHAR(50) | NOT NULL | 操作类型 |
| target_type | VARCHAR(50) | | 目标类型 |
| target_id | INT | | 目标ID |
| target_name | VARCHAR(100) | | 目标名称 |
| old_value | TEXT | | 操作前值 |
| new_value | TEXT | | 操作后值 |
| ip_address | VARCHAR(45) | | 操作IP地址 |
| user_agent | VARCHAR(500) | | 用户代理信息 |
| created_at | DATETIME | NOT NULL | 创建时间 |
### 2.14 管理员权限表 (admin_permissions)
| 字段名 | 类型 | 约束 | 描述 |
|--------|------|------|------|
| id | INT | PRIMARY KEY, AUTO_INCREMENT | 权限ID |
| code | VARCHAR(50) | UNIQUE, NOT NULL | 权限代码 |
| name | VARCHAR(100) | NOT NULL | 权限名称 |
| description | VARCHAR(255) | | 权限描述 |
| created_at | DATETIME | NOT NULL | 创建时间 |
| updated_at | DATETIME | NOT NULL | 更新时间 |
### 2.15 管理员角色权限关联表 (admin_role_permissions)
| 字段名 | 类型 | 约束 | 描述 |
|--------|------|------|------|
| id | INT | PRIMARY KEY, AUTO_INCREMENT | 关联ID |
| admin_id | INT | FOREIGN KEY REFERENCES admins(id), NOT NULL | 管理员ID |
| permission_code | VARCHAR(50) | FOREIGN KEY REFERENCES admin_permissions(code), NOT NULL | 权限代码 |
| created_at | DATETIME | NOT NULL | 创建时间 |
### 3.5 商家管理接口
#### 3.5.1 获取商家列表
@@ -434,8 +468,8 @@ VALUES
```sql
INSERT INTO users (openid, nickname, gender, phone, email)
VALUES
('wx1234567890', '测试用户1', 'male', '13800138000', 'test1@example.com'),
('wx0987654321', '测试用户2', 'female', '13800138001', 'test2@example.com');
('wx1234567890', '测试用户1', 'male', '13800138000', 'test1@jiebanke.com'),
('wx0987654321', '测试用户2', 'female', '13800138001', 'test2@jiebanke.com');
```
### 4.3 创建测试商家

View File

@@ -496,7 +496,7 @@ erDiagram
"gender": "male",
"birthday": "1990-01-01",
"phone": "13800138000",
"email": "user@example.com"
"email": "user@jiebanke.com"
}
}
```
@@ -511,7 +511,7 @@ erDiagram
"gender": "female",
"birthday": "1995-01-01",
"phone": "13900139000",
"email": "new@example.com"
"email": "new@jiebanke.com"
}
```
- **响应**:
@@ -675,7 +675,7 @@ erDiagram
"user_id": 1,
"animal_id": 1,
"price_paid": 1000.00,
"agreement_url": "https://example.com/agreement.pdf",
"agreement_url": "https://www.jiebanke.com/agreement.pdf",
"status": "active",
"claimed_at": "2023-09-01T12:00:00Z"
}
@@ -722,7 +722,7 @@ erDiagram
{
"merchant_type": "farm_owner",
"business_name": "XX农场",
"business_license": "https://example.com/license.jpg",
"business_license": "https://www.jiebanke.com/license.jpg",
"contact_person": "张三",
"contact_phone": "13800138000",
"address": "北京市朝阳区XX路XX号",
@@ -759,7 +759,7 @@ erDiagram
"name": "羊驼认领体验",
"description": "提供一个月的羊驼认领体验服务",
"price": 1000.00,
"image_url": "https://example.com/product.jpg",
"image_url": "https://www.jiebanke.com/product.jpg",
"category": "animal_claim",
"status": "available"
}
@@ -775,7 +775,7 @@ erDiagram
"name": "羊驼认领体验",
"description": "提供一个月的羊驼认领体验服务",
"price": 1000.00,
"image_url": "https://example.com/product.jpg",
"image_url": "https://www.jiebanke.com/product.jpg",
"category": "animal_claim",
"status": "available",
"created_at": "2023-09-01T12:00:00Z"
@@ -822,7 +822,7 @@ erDiagram
"business_name": "XX农场",
"contact_person": "张三",
"contact_phone": "13800138000",
"email": "zhangsan@example.com",
"email": "zhangsan@jiebanke.com",
"description": "专业养殖羊驼的农场"
}
```
@@ -858,7 +858,7 @@ erDiagram
"id": 1,
"title": "XX农场成功入驻案例",
"description": "XX农场通过平台实现了数字化转型",
"image_url": "https://example.com/case1.jpg",
"image_url": "https://www.jiebanke.com/case1.jpg",
"created_at": "2023-09-01T12:00:00Z"
}
],