GET /api/admin/auth/status
响应:
{
"configured": true
}POST /api/admin/auth/login
Content-Type: application/json
{
"password": "your-password",
"code": "123456"
}
响应:
{
"token": "eyJhbGciOiJIUzI1NiIs...",
"expires_in": 1800
}POST /api/admin/auth/change-password
Authorization: Bearer <jwt>
Content-Type: application/json
{
"current_password": "old-password",
"code": "123456",
"new_password": "new-password"
}
GET /buy?p=<product_slug>&s=<sku_alias>&d=<device_id>
重定向到爱发电支付页面。
POST /api/v1/:slug/activate
Content-Type: application/json
{
"device_id": "device-123",
"deviceInfo": {
"product": "MiBand8",
"osVersionName": "1.0.0"
}
}
响应:
{
"status": "success",
"license": {
"payload": { ... },
"signature": "base64..."
}
}POST /api/v1/:slug/config
Content-Type: application/json
{
"device_id": "device-123",
"product": "MiBand8",
"app_version_code": 120
}
响应:
{
"announcements": [],
"maintenance": {
"enabled": false,
"message": "",
"end_at": 0
},
"feature_toggles": {
"feature_a": true
},
"update": {
"force": false,
"latest_version_code": 120,
"update_url": "",
"changelog": ""
},
"extra_rules": []
}POST /api/v1/:slug/event
Content-Type: application/json
{
"device_id": "device-123",
"event_name": "app_launch",
"data": { ... }
}
POST /api/v1/:slug/feedback
Content-Type: application/json
{
"device_id": "device-123",
"content": "用户反馈内容"
}
POST /api/v1/webhook/afdian
Content-Type: application/json
{
"sign": "signature",
"data": {
"type": "order",
"order": { ... }
}
}
GET /api/admin/stats
Authorization: Bearer <jwt>
GET /api/admin/config/raw
Authorization: Bearer <jwt>
POST /api/admin/config/save
Authorization: Bearer <jwt>
Content-Type: application/json
{
"server": { ... },
"database": { ... },
"products": [ ... ]
}
GET /api/admin/data/:table?page=1&size=20&q=keyword&product_slug=&sort=created_at+desc
Authorization: Bearer <jwt>
支持表:devices, orders, events, feedbacks, audit_logs
查询参数:
page: 页码(默认 1)size: 每页条数(默认 20,最大 1000)q: 关键词搜索product_slug: 按产品过滤sort: 排序字段(created_at desc)activated:true/false(仅 devices)processed:true/false(仅 orders)
POST /api/admin/devices/save
Authorization: Bearer <jwt>
Content-Type: application/json
{
"device_id": "device-123",
"product_slug": "product-slug",
"expire_at": 1700000000,
"is_active": true
}
DELETE /api/admin/devices/:slug/:device_id
Authorization: Bearer <jwt>
POST /api/admin/orders/repair
Authorization: Bearer <jwt>
Content-Type: application/json
{
"out_trade_no": "20210101...",
"new_device_id": "device-123"
}
DELETE /api/admin/orders/:out_trade_no
Authorization: Bearer <jwt>
GET /api/admin/afdian/sync?plan_id=<plan_id>
Authorization: Bearer <jwt>
POST /api/admin/keys/gen
Authorization: Bearer <jwt>
响应:
{
"private_key": "-----BEGIN PRIVATE KEY-----\n...",
"public_key": "-----BEGIN PUBLIC KEY-----\n..."
}POST /api/admin/keys/extract
Authorization: Bearer <jwt>
Content-Type: application/json
{
"private_key": "-----BEGIN PRIVATE KEY-----\n..."
}
{
"message": "错误描述"
}HTTP 状态码:
400: 请求参数错误401: 未认证/认证失败404: 资源不存在429: 请求过于频繁(登录速率限制)500: 服务器内部错误503: 系统未配置