feat: 添加环境变量管理工具和部署配置改版
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m33s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m33s
主要改动: - 新增交互式环境配置脚本 (scripts/setup-env.sh) - 新增本地启动快捷脚本 (scripts/run-local.sh) - 新增环境变量模板文件 (.env.example) - 部署模式改版:使用嵌入式配置 + 环境变量覆盖 - 添加对象存储功能支持 - 改进 IoT 卡片导入任务 - 优化 OpenAPI 文档生成 - 删除旧的配置文件,改用嵌入式默认配置
This commit is contained in:
@@ -148,6 +148,77 @@ components:
|
||||
description: 总卡数量
|
||||
type: integer
|
||||
type: object
|
||||
DtoAllocateStandaloneCardsRequest:
|
||||
properties:
|
||||
batch_no:
|
||||
description: 批次号(selection_type=filter时可选)
|
||||
maxLength: 100
|
||||
type: string
|
||||
carrier_id:
|
||||
description: 运营商ID(selection_type=filter时可选)
|
||||
minimum: 0
|
||||
nullable: true
|
||||
type: integer
|
||||
iccid_end:
|
||||
description: 结束ICCID(selection_type=range时必填)
|
||||
maxLength: 20
|
||||
type: string
|
||||
iccid_start:
|
||||
description: 起始ICCID(selection_type=range时必填)
|
||||
maxLength: 20
|
||||
type: string
|
||||
iccids:
|
||||
description: ICCID列表(selection_type=list时必填,最多1000个)
|
||||
items:
|
||||
type: string
|
||||
nullable: true
|
||||
type: array
|
||||
remark:
|
||||
description: 备注
|
||||
maxLength: 500
|
||||
type: string
|
||||
selection_type:
|
||||
description: 选卡方式 (list:ICCID列表, range:号段范围, filter:筛选条件)
|
||||
enum:
|
||||
- list
|
||||
- range
|
||||
- filter
|
||||
type: string
|
||||
status:
|
||||
description: 卡状态 (1:在库, 2:已分销)(selection_type=filter时可选)
|
||||
maximum: 4
|
||||
minimum: 1
|
||||
nullable: true
|
||||
type: integer
|
||||
to_shop_id:
|
||||
description: 目标店铺ID
|
||||
minimum: 1
|
||||
type: integer
|
||||
required:
|
||||
- to_shop_id
|
||||
- selection_type
|
||||
type: object
|
||||
DtoAllocateStandaloneCardsResponse:
|
||||
properties:
|
||||
allocation_no:
|
||||
description: 分配单号
|
||||
type: string
|
||||
fail_count:
|
||||
description: 失败数
|
||||
type: integer
|
||||
failed_items:
|
||||
description: 失败项列表
|
||||
items:
|
||||
$ref: '#/components/schemas/DtoAllocationFailedItem'
|
||||
nullable: true
|
||||
type: array
|
||||
success_count:
|
||||
description: 成功数
|
||||
type: integer
|
||||
total_count:
|
||||
description: 待分配总数
|
||||
type: integer
|
||||
type: object
|
||||
DtoAllocatedDevice:
|
||||
properties:
|
||||
card_count:
|
||||
@@ -167,6 +238,15 @@ components:
|
||||
nullable: true
|
||||
type: array
|
||||
type: object
|
||||
DtoAllocationFailedItem:
|
||||
properties:
|
||||
iccid:
|
||||
description: ICCID
|
||||
type: string
|
||||
reason:
|
||||
description: 失败原因
|
||||
type: string
|
||||
type: object
|
||||
DtoApproveWithdrawalReq:
|
||||
properties:
|
||||
account_name:
|
||||
@@ -198,6 +278,156 @@ components:
|
||||
required:
|
||||
- payment_type
|
||||
type: object
|
||||
DtoAssetAllocationRecordDetailResponse:
|
||||
properties:
|
||||
allocation_name:
|
||||
description: 分配类型名称
|
||||
type: string
|
||||
allocation_no:
|
||||
description: 分配单号
|
||||
type: string
|
||||
allocation_type:
|
||||
description: 分配类型 (allocate:分配, recall:回收)
|
||||
type: string
|
||||
asset_id:
|
||||
description: 资产ID
|
||||
minimum: 0
|
||||
type: integer
|
||||
asset_identifier:
|
||||
description: 资产标识符(ICCID或设备号)
|
||||
type: string
|
||||
asset_type:
|
||||
description: 资产类型 (iot_card:物联网卡, device:设备)
|
||||
type: string
|
||||
asset_type_name:
|
||||
description: 资产类型名称
|
||||
type: string
|
||||
created_at:
|
||||
description: 创建时间
|
||||
format: date-time
|
||||
type: string
|
||||
from_owner_id:
|
||||
description: 来源所有者ID
|
||||
minimum: 0
|
||||
nullable: true
|
||||
type: integer
|
||||
from_owner_name:
|
||||
description: 来源所有者名称
|
||||
type: string
|
||||
from_owner_type:
|
||||
description: 来源所有者类型
|
||||
type: string
|
||||
id:
|
||||
description: 记录ID
|
||||
minimum: 0
|
||||
type: integer
|
||||
operator_id:
|
||||
description: 操作人ID
|
||||
minimum: 0
|
||||
type: integer
|
||||
operator_name:
|
||||
description: 操作人名称
|
||||
type: string
|
||||
related_card_count:
|
||||
description: 关联卡数量
|
||||
type: integer
|
||||
related_card_ids:
|
||||
description: 关联卡ID列表
|
||||
items:
|
||||
minimum: 0
|
||||
type: integer
|
||||
type: array
|
||||
related_device_id:
|
||||
description: 关联设备ID
|
||||
minimum: 0
|
||||
nullable: true
|
||||
type: integer
|
||||
remark:
|
||||
description: 备注
|
||||
type: string
|
||||
to_owner_id:
|
||||
description: 目标所有者ID
|
||||
minimum: 0
|
||||
type: integer
|
||||
to_owner_name:
|
||||
description: 目标所有者名称
|
||||
type: string
|
||||
to_owner_type:
|
||||
description: 目标所有者类型
|
||||
type: string
|
||||
type: object
|
||||
DtoAssetAllocationRecordResponse:
|
||||
properties:
|
||||
allocation_name:
|
||||
description: 分配类型名称
|
||||
type: string
|
||||
allocation_no:
|
||||
description: 分配单号
|
||||
type: string
|
||||
allocation_type:
|
||||
description: 分配类型 (allocate:分配, recall:回收)
|
||||
type: string
|
||||
asset_id:
|
||||
description: 资产ID
|
||||
minimum: 0
|
||||
type: integer
|
||||
asset_identifier:
|
||||
description: 资产标识符(ICCID或设备号)
|
||||
type: string
|
||||
asset_type:
|
||||
description: 资产类型 (iot_card:物联网卡, device:设备)
|
||||
type: string
|
||||
asset_type_name:
|
||||
description: 资产类型名称
|
||||
type: string
|
||||
created_at:
|
||||
description: 创建时间
|
||||
format: date-time
|
||||
type: string
|
||||
from_owner_id:
|
||||
description: 来源所有者ID
|
||||
minimum: 0
|
||||
nullable: true
|
||||
type: integer
|
||||
from_owner_name:
|
||||
description: 来源所有者名称
|
||||
type: string
|
||||
from_owner_type:
|
||||
description: 来源所有者类型
|
||||
type: string
|
||||
id:
|
||||
description: 记录ID
|
||||
minimum: 0
|
||||
type: integer
|
||||
operator_id:
|
||||
description: 操作人ID
|
||||
minimum: 0
|
||||
type: integer
|
||||
operator_name:
|
||||
description: 操作人名称
|
||||
type: string
|
||||
related_card_count:
|
||||
description: 关联卡数量
|
||||
type: integer
|
||||
related_device_id:
|
||||
description: 关联设备ID
|
||||
minimum: 0
|
||||
nullable: true
|
||||
type: integer
|
||||
remark:
|
||||
description: 备注
|
||||
type: string
|
||||
to_owner_id:
|
||||
description: 目标所有者ID
|
||||
minimum: 0
|
||||
type: integer
|
||||
to_owner_name:
|
||||
description: 目标所有者名称
|
||||
type: string
|
||||
to_owner_type:
|
||||
description: 目标所有者类型
|
||||
type: string
|
||||
type: object
|
||||
DtoAssignPermissionsParams:
|
||||
properties:
|
||||
perm_ids:
|
||||
@@ -832,6 +1062,55 @@ components:
|
||||
description: 失败原因
|
||||
type: string
|
||||
type: object
|
||||
DtoGetUploadURLRequest:
|
||||
properties:
|
||||
content_type:
|
||||
description: 文件 MIME 类型(如:text/csv),留空则自动推断
|
||||
maxLength: 100
|
||||
type: string
|
||||
file_name:
|
||||
description: 文件名(如:cards.csv)
|
||||
maxLength: 255
|
||||
minLength: 1
|
||||
type: string
|
||||
purpose:
|
||||
description: 文件用途 (iot_import:ICCID导入, export:数据导出, attachment:附件)
|
||||
type: string
|
||||
required:
|
||||
- file_name
|
||||
- purpose
|
||||
type: object
|
||||
DtoGetUploadURLResponse:
|
||||
properties:
|
||||
expires_in:
|
||||
description: URL 有效期(秒)
|
||||
type: integer
|
||||
file_key:
|
||||
description: 文件路径标识,上传成功后用于调用业务接口
|
||||
type: string
|
||||
upload_url:
|
||||
description: 预签名上传 URL,使用 PUT 方法上传文件
|
||||
type: string
|
||||
type: object
|
||||
DtoImportIotCardRequest:
|
||||
properties:
|
||||
batch_no:
|
||||
description: 批次号
|
||||
maxLength: 100
|
||||
type: string
|
||||
carrier_id:
|
||||
description: 运营商ID
|
||||
minimum: 1
|
||||
type: integer
|
||||
file_key:
|
||||
description: 对象存储文件路径(通过 /storage/upload-url 获取)
|
||||
maxLength: 500
|
||||
minLength: 1
|
||||
type: string
|
||||
required:
|
||||
- carrier_id
|
||||
- file_key
|
||||
type: object
|
||||
DtoImportIotCardResponse:
|
||||
properties:
|
||||
message:
|
||||
@@ -853,6 +1132,9 @@ components:
|
||||
line:
|
||||
description: 行号
|
||||
type: integer
|
||||
msisdn:
|
||||
description: 接入号
|
||||
type: string
|
||||
reason:
|
||||
description: 原因
|
||||
type: string
|
||||
@@ -985,6 +1267,27 @@ components:
|
||||
description: 总数
|
||||
type: integer
|
||||
type: object
|
||||
DtoListAssetAllocationRecordResponse:
|
||||
properties:
|
||||
list:
|
||||
description: 分配记录列表
|
||||
items:
|
||||
$ref: '#/components/schemas/DtoAssetAllocationRecordResponse'
|
||||
nullable: true
|
||||
type: array
|
||||
page:
|
||||
description: 当前页码
|
||||
type: integer
|
||||
page_size:
|
||||
description: 每页数量
|
||||
type: integer
|
||||
total:
|
||||
description: 总数
|
||||
type: integer
|
||||
total_pages:
|
||||
description: 总页数
|
||||
type: integer
|
||||
type: object
|
||||
DtoListImportTaskResponse:
|
||||
properties:
|
||||
list:
|
||||
@@ -1261,6 +1564,71 @@ components:
|
||||
description: 成功数量
|
||||
type: integer
|
||||
type: object
|
||||
DtoRecallStandaloneCardsRequest:
|
||||
properties:
|
||||
batch_no:
|
||||
description: 批次号(selection_type=filter时可选)
|
||||
maxLength: 100
|
||||
type: string
|
||||
carrier_id:
|
||||
description: 运营商ID(selection_type=filter时可选)
|
||||
minimum: 0
|
||||
nullable: true
|
||||
type: integer
|
||||
from_shop_id:
|
||||
description: 来源店铺ID(被回收方)
|
||||
minimum: 1
|
||||
type: integer
|
||||
iccid_end:
|
||||
description: 结束ICCID(selection_type=range时必填)
|
||||
maxLength: 20
|
||||
type: string
|
||||
iccid_start:
|
||||
description: 起始ICCID(selection_type=range时必填)
|
||||
maxLength: 20
|
||||
type: string
|
||||
iccids:
|
||||
description: ICCID列表(selection_type=list时必填,最多1000个)
|
||||
items:
|
||||
type: string
|
||||
nullable: true
|
||||
type: array
|
||||
remark:
|
||||
description: 备注
|
||||
maxLength: 500
|
||||
type: string
|
||||
selection_type:
|
||||
description: 选卡方式 (list:ICCID列表, range:号段范围, filter:筛选条件)
|
||||
enum:
|
||||
- list
|
||||
- range
|
||||
- filter
|
||||
type: string
|
||||
required:
|
||||
- from_shop_id
|
||||
- selection_type
|
||||
type: object
|
||||
DtoRecallStandaloneCardsResponse:
|
||||
properties:
|
||||
allocation_no:
|
||||
description: 回收单号
|
||||
type: string
|
||||
fail_count:
|
||||
description: 失败数
|
||||
type: integer
|
||||
failed_items:
|
||||
description: 失败项列表
|
||||
items:
|
||||
$ref: '#/components/schemas/DtoAllocationFailedItem'
|
||||
nullable: true
|
||||
type: array
|
||||
success_count:
|
||||
description: 成功数
|
||||
type: integer
|
||||
total_count:
|
||||
description: 待回收总数
|
||||
type: integer
|
||||
type: object
|
||||
DtoRecalledDevice:
|
||||
properties:
|
||||
card_count:
|
||||
@@ -2297,19 +2665,6 @@ components:
|
||||
- message
|
||||
- timestamp
|
||||
type: object
|
||||
FormDataDtoImportIotCardRequest:
|
||||
properties:
|
||||
batch_no:
|
||||
description: 批次号
|
||||
maxLength: 100
|
||||
type: string
|
||||
carrier_id:
|
||||
description: 运营商ID
|
||||
minimum: 1
|
||||
type: integer
|
||||
required:
|
||||
- carrier_id
|
||||
type: object
|
||||
ModelPermission:
|
||||
properties:
|
||||
available_for_role_types:
|
||||
@@ -2779,6 +3134,179 @@ paths:
|
||||
summary: 分配角色
|
||||
tags:
|
||||
- 账号相关
|
||||
/api/admin/asset-allocation-records:
|
||||
get:
|
||||
parameters:
|
||||
- description: 页码
|
||||
in: query
|
||||
name: page
|
||||
schema:
|
||||
description: 页码
|
||||
minimum: 1
|
||||
type: integer
|
||||
- description: 每页数量
|
||||
in: query
|
||||
name: page_size
|
||||
schema:
|
||||
description: 每页数量
|
||||
maximum: 100
|
||||
minimum: 1
|
||||
type: integer
|
||||
- description: 分配类型 (allocate:分配, recall:回收)
|
||||
in: query
|
||||
name: allocation_type
|
||||
schema:
|
||||
description: 分配类型 (allocate:分配, recall:回收)
|
||||
enum:
|
||||
- allocate
|
||||
- recall
|
||||
type: string
|
||||
- description: 资产类型 (iot_card:物联网卡, device:设备)
|
||||
in: query
|
||||
name: asset_type
|
||||
schema:
|
||||
description: 资产类型 (iot_card:物联网卡, device:设备)
|
||||
enum:
|
||||
- iot_card
|
||||
- device
|
||||
type: string
|
||||
- description: 资产标识符(ICCID或设备号,模糊查询)
|
||||
in: query
|
||||
name: asset_identifier
|
||||
schema:
|
||||
description: 资产标识符(ICCID或设备号,模糊查询)
|
||||
maxLength: 50
|
||||
type: string
|
||||
- description: 分配单号(精确匹配)
|
||||
in: query
|
||||
name: allocation_no
|
||||
schema:
|
||||
description: 分配单号(精确匹配)
|
||||
maxLength: 50
|
||||
type: string
|
||||
- description: 来源店铺ID
|
||||
in: query
|
||||
name: from_shop_id
|
||||
schema:
|
||||
description: 来源店铺ID
|
||||
minimum: 0
|
||||
nullable: true
|
||||
type: integer
|
||||
- description: 目标店铺ID
|
||||
in: query
|
||||
name: to_shop_id
|
||||
schema:
|
||||
description: 目标店铺ID
|
||||
minimum: 0
|
||||
nullable: true
|
||||
type: integer
|
||||
- description: 操作人ID
|
||||
in: query
|
||||
name: operator_id
|
||||
schema:
|
||||
description: 操作人ID
|
||||
minimum: 0
|
||||
nullable: true
|
||||
type: integer
|
||||
- description: 创建时间起始
|
||||
in: query
|
||||
name: created_at_start
|
||||
schema:
|
||||
description: 创建时间起始
|
||||
format: date-time
|
||||
nullable: true
|
||||
type: string
|
||||
- description: 创建时间结束
|
||||
in: query
|
||||
name: created_at_end
|
||||
schema:
|
||||
description: 创建时间结束
|
||||
format: date-time
|
||||
nullable: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DtoListAssetAllocationRecordResponse'
|
||||
description: OK
|
||||
"400":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 请求参数错误
|
||||
"401":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 未认证或认证已过期
|
||||
"403":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 无权访问
|
||||
"500":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 服务器内部错误
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 分配记录列表
|
||||
tags:
|
||||
- 资产分配记录
|
||||
/api/admin/asset-allocation-records/{id}:
|
||||
get:
|
||||
parameters:
|
||||
- description: 记录ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
schema:
|
||||
description: 记录ID
|
||||
minimum: 1
|
||||
type: integer
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DtoAssetAllocationRecordDetailResponse'
|
||||
description: OK
|
||||
"400":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 请求参数错误
|
||||
"401":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 未认证或认证已过期
|
||||
"403":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 无权访问
|
||||
"500":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 服务器内部错误
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 分配记录详情
|
||||
tags:
|
||||
- 资产分配记录
|
||||
/api/admin/commission/withdrawal-requests:
|
||||
get:
|
||||
parameters:
|
||||
@@ -4006,27 +4534,37 @@ paths:
|
||||
- 企业客户管理
|
||||
/api/admin/iot-cards/import:
|
||||
post:
|
||||
parameters:
|
||||
- description: 运营商ID
|
||||
in: query
|
||||
name: carrier_id
|
||||
required: true
|
||||
schema:
|
||||
description: 运营商ID
|
||||
minimum: 1
|
||||
type: integer
|
||||
- description: 批次号
|
||||
in: query
|
||||
name: batch_no
|
||||
schema:
|
||||
description: 批次号
|
||||
maxLength: 100
|
||||
type: string
|
||||
description: |-
|
||||
## ⚠️ 接口变更说明(BREAKING CHANGE)
|
||||
|
||||
本接口已从 `multipart/form-data` 改为 `application/json`。
|
||||
|
||||
### 完整导入流程
|
||||
|
||||
1. **获取上传 URL**: 调用 `POST /api/admin/storage/upload-url`
|
||||
2. **上传 CSV 文件**: 使用预签名 URL 上传文件到对象存储
|
||||
3. **调用本接口**: 使用返回的 `file_key` 提交导入任务
|
||||
|
||||
### 请求示例
|
||||
|
||||
```json
|
||||
{
|
||||
"carrier_id": 1,
|
||||
"batch_no": "BATCH-2025-01",
|
||||
"file_key": "imports/2025/01/24/abc123.csv"
|
||||
}
|
||||
```
|
||||
|
||||
### CSV 文件格式
|
||||
|
||||
- 必须包含两列:`iccid`, `msisdn`
|
||||
- 首行为表头
|
||||
- 编码:UTF-8
|
||||
requestBody:
|
||||
content:
|
||||
application/x-www-form-urlencoded:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/FormDataDtoImportIotCardRequest'
|
||||
$ref: '#/components/schemas/DtoImportIotCardRequest'
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
@@ -4060,7 +4598,7 @@ paths:
|
||||
description: 服务器内部错误
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 批量导入ICCID
|
||||
summary: 批量导入IoT卡(ICCID+MSISDN)
|
||||
tags:
|
||||
- IoT卡管理
|
||||
/api/admin/iot-cards/import-tasks:
|
||||
@@ -4340,6 +4878,92 @@ paths:
|
||||
summary: 单卡列表(未绑定设备)
|
||||
tags:
|
||||
- IoT卡管理
|
||||
/api/admin/iot-cards/standalone/allocate:
|
||||
post:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DtoAllocateStandaloneCardsRequest'
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DtoAllocateStandaloneCardsResponse'
|
||||
description: OK
|
||||
"400":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 请求参数错误
|
||||
"401":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 未认证或认证已过期
|
||||
"403":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 无权访问
|
||||
"500":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 服务器内部错误
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 批量分配单卡
|
||||
tags:
|
||||
- IoT卡管理
|
||||
/api/admin/iot-cards/standalone/recall:
|
||||
post:
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DtoRecallStandaloneCardsRequest'
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DtoRecallStandaloneCardsResponse'
|
||||
description: OK
|
||||
"400":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 请求参数错误
|
||||
"401":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 未认证或认证已过期
|
||||
"403":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 无权访问
|
||||
"500":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 服务器内部错误
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 批量回收单卡
|
||||
tags:
|
||||
- IoT卡管理
|
||||
/api/admin/login:
|
||||
post:
|
||||
requestBody:
|
||||
@@ -6740,6 +7364,99 @@ paths:
|
||||
summary: 代理商佣金列表
|
||||
tags:
|
||||
- 代理商佣金管理
|
||||
/api/admin/storage/upload-url:
|
||||
post:
|
||||
description: |-
|
||||
## 文件上传流程
|
||||
|
||||
本接口用于获取对象存储的预签名上传 URL,实现前端直传文件到对象存储。
|
||||
|
||||
### 完整流程
|
||||
|
||||
1. **调用本接口** 获取预签名 URL 和 file_key
|
||||
2. **使用预签名 URL 上传文件** 发起 PUT 请求直接上传到对象存储
|
||||
3. **调用业务接口** 使用 file_key 调用相关业务接口(如 ICCID 导入)
|
||||
|
||||
### 前端上传示例
|
||||
|
||||
```javascript
|
||||
// 1. 获取预签名 URL
|
||||
const { data } = await api.post('/storage/upload-url', {
|
||||
file_name: 'cards.csv',
|
||||
content_type: 'text/csv',
|
||||
purpose: 'iot_import'
|
||||
});
|
||||
|
||||
// 2. 上传文件到对象存储
|
||||
await fetch(data.upload_url, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'text/csv' },
|
||||
body: file
|
||||
});
|
||||
|
||||
// 3. 调用业务接口
|
||||
await api.post('/iot-cards/import', {
|
||||
carrier_id: 1,
|
||||
batch_no: 'BATCH-2025-01',
|
||||
file_key: data.file_key
|
||||
});
|
||||
```
|
||||
|
||||
### purpose 可选值
|
||||
|
||||
| 值 | 说明 | 生成路径格式 |
|
||||
|---|------|-------------|
|
||||
| iot_import | ICCID 导入 | imports/YYYY/MM/DD/uuid.csv |
|
||||
| export | 数据导出 | exports/YYYY/MM/DD/uuid.xlsx |
|
||||
| attachment | 附件上传 | attachments/YYYY/MM/DD/uuid.ext |
|
||||
|
||||
### 注意事项
|
||||
|
||||
- 预签名 URL 有效期 **15 分钟**,请及时使用
|
||||
- 上传时 Content-Type 需与请求时一致
|
||||
- file_key 在上传成功后永久有效,用于后续业务接口调用
|
||||
- 上传失败时可重新调用本接口获取新的 URL
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DtoGetUploadURLRequest'
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DtoGetUploadURLResponse'
|
||||
description: OK
|
||||
"400":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 请求参数错误
|
||||
"401":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 未认证或认证已过期
|
||||
"403":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 无权访问
|
||||
"500":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
description: 服务器内部错误
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 获取文件上传预签名 URL
|
||||
tags:
|
||||
- 对象存储
|
||||
/api/admin/tasks/{id}:
|
||||
get:
|
||||
parameters:
|
||||
|
||||
Reference in New Issue
Block a user