1. 在pm2.json中添加进程管理配置 2. 在YAML配置中增加upgrade_count字段控制升级次数 3. 修改升级逻辑支持N次升级后切换版本 4. 为API调用日志添加ISO时间戳 5. 更新项目文档说明可配置升级次数
188 lines
4.3 KiB
YAML
188 lines
4.3 KiB
YAML
openapi: 3.1.0
|
|
info:
|
|
title: RCU Upgrade Service Spec
|
|
version: 1.0.0
|
|
description: Specification for RCU Upgrade Service API interactions and data models.
|
|
|
|
paths:
|
|
/api/Upgrade_V2:
|
|
post:
|
|
summary: Trigger Upgrade
|
|
operationId: triggerUpgrade
|
|
requestBody:
|
|
content:
|
|
application/x-www-form-urlencoded:
|
|
schema:
|
|
$ref: '#/components/schemas/UpgradeRequest'
|
|
responses:
|
|
'200':
|
|
description: Successful response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/UpgradeResponse'
|
|
|
|
/api/QueryUpdateHostProgressBar:
|
|
post:
|
|
summary: Query Upgrade Status
|
|
operationId: queryUpgradeStatus
|
|
requestBody:
|
|
content:
|
|
application/x-www-form-urlencoded:
|
|
schema:
|
|
$ref: '#/components/schemas/QueryRequest'
|
|
responses:
|
|
'200':
|
|
description: Status response
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/QueryResponse'
|
|
|
|
components:
|
|
schemas:
|
|
UpgradeRequest:
|
|
type: object
|
|
properties:
|
|
roomtype_id:
|
|
type: integer
|
|
description: Room Type ID
|
|
host_list_str:
|
|
type: string
|
|
description: JSON string array of Host IDs (e.g., "[1,2,3]")
|
|
fileName:
|
|
type: string
|
|
description: Firmware filename
|
|
required:
|
|
- roomtype_id
|
|
- host_list_str
|
|
- fileName
|
|
|
|
UpgradeResponse:
|
|
type: object
|
|
properties:
|
|
IsSuccess:
|
|
type: boolean
|
|
Message:
|
|
type: string
|
|
required:
|
|
- IsSuccess
|
|
|
|
QueryRequest:
|
|
type: object
|
|
properties:
|
|
HostIDList:
|
|
type: string
|
|
description: JSON string array of Host IDs (e.g., "[1,2,3]")
|
|
required:
|
|
- HostIDList
|
|
|
|
QueryResponse:
|
|
type: object
|
|
properties:
|
|
IsSuccess:
|
|
type: boolean
|
|
Response:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/HostStatus'
|
|
required:
|
|
- IsSuccess
|
|
|
|
HostStatus:
|
|
type: object
|
|
properties:
|
|
HostID:
|
|
type: integer
|
|
Upgrade_status:
|
|
type: string
|
|
enum:
|
|
- 升级就绪
|
|
- 升级完成
|
|
- 升级失败
|
|
- 开始下载
|
|
- 下载中
|
|
- 下载完成
|
|
- 校验中
|
|
- 校验完成
|
|
- RCU升级中
|
|
- 超时失败
|
|
Upgrade_DateTime:
|
|
type: string
|
|
format: date-time
|
|
UpgradeFileType:
|
|
type: string
|
|
enum:
|
|
- 固件升级
|
|
- 配置升级
|
|
FileBlockTotalCount:
|
|
type: integer
|
|
FileCurrentNumber:
|
|
type: integer
|
|
BaiFenBi:
|
|
type: string
|
|
FileName:
|
|
type: string
|
|
Version:
|
|
type: string
|
|
ConfiguraVersion:
|
|
type: string
|
|
|
|
UpgradeLog:
|
|
type: object
|
|
description: Schema for database log entry
|
|
properties:
|
|
start_time:
|
|
type: string
|
|
format: date-time
|
|
roomtype_id:
|
|
type: integer
|
|
host_str:
|
|
type: string
|
|
filename:
|
|
type: string
|
|
status:
|
|
type: string
|
|
end_time:
|
|
type: string
|
|
format: date-time
|
|
file_type:
|
|
type: string
|
|
config_version:
|
|
type: string
|
|
firmware_version:
|
|
type: string
|
|
uuid:
|
|
type: string
|
|
format: uuid
|
|
UpgradeConfigGroup:
|
|
type: object
|
|
properties:
|
|
hosts:
|
|
type: array
|
|
items:
|
|
type: integer
|
|
roomtypes:
|
|
type: array
|
|
minItems: 2
|
|
maxItems: 2
|
|
items:
|
|
$ref: '#/components/schemas/UpgradeConfigRoomtype'
|
|
required:
|
|
- hosts
|
|
- roomtypes
|
|
UpgradeConfigRoomtype:
|
|
type: object
|
|
properties:
|
|
roomtype_id:
|
|
type: integer
|
|
fileName:
|
|
type: string
|
|
upgrade_count:
|
|
type: integer
|
|
description: Number of times to upgrade this file before switching
|
|
default: 2
|
|
required:
|
|
- roomtype_id
|
|
- fileName
|