公开 API
公开访问的 API 路由,无需认证。返回公开配置数据。
基础路径
/public认证方式
无需认证。所有端点均公开访问,使用 publicCors 中间件支持跨域请求。
端点列表
GET /public/devices/bluetooth-filters
获取蓝牙设备名前缀过滤规则。从 hw_product_models 表读取状态为 active 的产品型号的蓝牙前缀配置。
请求参数
无。
响应格式
json
{
"success": true,
"filters": [
{
"namePrefix": "WN-",
"productModelId": "uuid",
"modelName": "设备型号名称",
"requiresInventoryCheck": false
}
]
}响应字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
filters[].namePrefix | string | 蓝牙设备名前缀 |
filters[].productModelId | string | 产品型号 ID |
filters[].modelName | string | 产品型号名称 |
filters[].requiresInventoryCheck | boolean | 是否需要库存校验 |
错误码
| HTTP 状态码 | 说明 |
|---|---|
| 500 | 获取蓝牙过滤规则失败 |
GET /public/payment/prices
获取产品价格列表。
请求参数
| 参数 | 位置 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|---|
currency | Query | string | 否 | CNY | 货币类型 |
响应格式
json
{
"success": true,
"data": [
{
"id": "uuid",
"productType": "subscription",
"productCode": "pro",
"name": "专业版",
"description": "描述文本",
"amount": 9900,
"currency": "CNY",
"credits": 100000,
"billingPeriod": "monthly",
"isFeatured": true
}
]
}响应字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
data[].id | string | 价格 ID |
data[].productType | string | 产品类型 |
data[].productCode | string | 产品代码 |
data[].name | string | 产品名称 |
data[].description | string | 产品描述 |
data[].amount | number | 价格金额(分) |
data[].currency | string | 货币类型 |
data[].credits | number | 包含积分数 |
data[].billingPeriod | string | 计费周期 |
data[].isFeatured | boolean | 是否推荐 |
错误码
| HTTP 状态码 | 说明 |
|---|---|
| 500 | 获取价格列表失败 |
GET /public/payment/methods
获取可用支付方式。
请求参数
| 参数 | 位置 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|---|
currency | Query | string | 否 | 无 | 按货币类型筛选支付方式 |
响应格式
json
{
"success": true,
"data": [
{
"id": "wechat_pay",
"name": "微信支付",
"currencies": ["CNY"]
}
]
}错误码
无特殊错误码。
源码
- 路由文件:
apps/backend/src/routes/public.ts