feat: 实现RCU固件升级服务核心功能
- 添加升级服务主逻辑,包括定时触发升级、状态查询和日志记录 - 实现数据库初始化脚本和日志表结构 - 添加PM2部署配置文件 - 实现环境变量配置系统 - 添加API客户端模块处理外部接口调用 - 实现升级状态轮询和超时处理机制 - 添加测试用例验证核心功能
This commit is contained in:
183
spec/rcu-upgrade-flow.yaml
Normal file
183
spec/rcu-upgrade-flow.yaml
Normal file
@@ -0,0 +1,183 @@
|
||||
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/WebChatUpgrade:
|
||||
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
|
||||
Data:
|
||||
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
|
||||
required:
|
||||
- roomtype_id
|
||||
- fileName
|
||||
Reference in New Issue
Block a user