Files
Web_AuthorityManagement_Mvc…/更新日志.md
2025-12-30 13:50:17 +08:00

285 lines
7.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 系统更新日志
## 2025-12-24
### 新增接口
#### 1. 房间设备访问日志写入接口
**接口地址**
`/Upgrade/WriteRoomVisitLog`
**请求方式**
`POST`
**请求参数**
| 参数名 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| HotelID | string | 是 | 酒店ID |
| RoomNumber | string | 是 | 房号 |
| EquipmentList | List<EquipmentInfo> | 是 | 设备信息列表 |
**EquipmentInfo 数据结构**
| 参数名 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| EquipmentStatus | string | 否 | 设备状态 |
| FaultDescription | string | 否 | 故障描述 |
| DevName | string | 否 | 设备名称 |
| EquipmentStatusType | string | 否 | 设备状态类型 |
| EquipmentOnlineStatus | string | 否 | 设备在线状态 |
**返回结果**
```json
{
"Status": 1, // 1成功0失败-1异常
"Message": "写入成功", // 操作结果描述
"Count": 3 // 写入记录数量
}
```
**功能描述**
该接口用于向数据库表 `tbl_roomvisitlogform` 写入房间设备访问日志,支持批量写入多个设备的信息。
**数据库表结构**
```sql
CREATE TABLE `tbl_roomvisitlogform` (
`ID` int NOT NULL AUTO_INCREMENT,
`HotelID` varchar(254) DEFAULT NULLCOMMENT '酒店id',
`RoomNumber` varchar(254)DEFAULT NULL COMMENT '房号',
`EquipmentStatus` varchar(254)DEFAULT NULL COMMENT '设备状态',
`FaultDescription` varchar(254)DEFAULT NULL COMMENT '故障描述',
`UpdateDate` varchar(254)DEFAULT NULL COMMENT '更新时间',
`DevName` varchar(254)DEFAULT NULL COMMENT '设备名称',
`EquipmentStatusType` varchar(254)DEFAULT NULL COMMENT '设备状态类型',
`EquipmentOnlineStatus` varchar(254)DEFAULT NULL COMMENT '设备在线状态',
PRIMARY KEY (`ID`),
KEY `idx_hotel_room` (`HotelID`,`RoomNumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3
```
**使用示例**
```javascript
// 请求示例
fetch('/Upgrade/WriteRoomVisitLog', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: JSON.stringify({
HotelID: '123',
RoomNumber: '101',
EquipmentList: [
{
EquipmentStatus: '正常',
DevName: '灯光设备'
},
{
EquipmentStatus: '故障',
FaultDescription: '无法正常开关',
DevName: '空调设备'
}
]
})
})
.then(response => response.json())
.then(data => {
console.log(data);
// 输出:{"Status":1,"Message":"写入成功","Count":2}
});
```
**开发人员**
系统开发团队
**备注**
该接口用于记录房间设备的访问和状态信息,方便后续查询和分析。
#### 2. 房间设备访问日志查询接口(故障记录查询)
**接口地址**
`/Upgrade/QueryRoomVisitLog`
**请求方式**
`POST`
**请求参数**
| 参数名 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| HotelID | string | 是 | 酒店ID |
| RoomNumber | string | 否 | 房号(为空时查询酒店所有故障记录) |
| StartTime | string | 否 | 开始时间格式yyyy-MM-dd HH:mm:ss |
| EndTime | string | 否 | 结束时间格式yyyy-MM-dd HH:mm:ss |
**功能描述**
该接口用于查询房间设备故障日志根据酒店ID进行筛选房号可选为空时查询酒店所有故障记录。支持按时间范围筛选。
**返回结果**
```json
{
"Status": 1, // 1成功0失败-1异常
"Message": "查询成功", // 操作结果描述
"Data": [
{
"ID": 1,
"HotelID": "123",
"RoomNumber": "101",
"EquipmentStatus": "故障",
"FaultDescription": "无法正常开关",
"UpdateDate": "2025-12-24 10:30:00",
"DevName": "空调设备",
"EquipmentStatusType": "温控器故障",
"EquipmentOnlineStatus": "在线"
}
]
}
```
**使用示例**
```javascript
// 查询酒店所有故障记录
fetch('/Upgrade/QueryRoomVisitLog', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: JSON.stringify({
HotelID: '123'
})
})
.then(response => response.json())
.then(data => {
console.log(data);
});
// 查询指定房间故障记录
fetch('/Upgrade/QueryRoomVisitLog', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: JSON.stringify({
HotelID: '123',
RoomNumber: '101'
})
})
.then(response => response.json())
.then(data => {
console.log(data);
});
// 查询指定时间范围内的故障记录
fetch('/Upgrade/QueryRoomVisitLog', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: JSON.stringify({
HotelID: '123',
RoomNumber: '101',
StartTime: '2025-12-24 00:00:00',
EndTime: '2025-12-24 23:59:59'
})
})
.then(response => response.json())
.then(data => {
console.log(data);
});
```
**开发人员**
系统开发团队
**备注**
该接口仅查询设备状态为"故障"的记录支持按酒店ID和房号筛选方便进行故障查询和分析。
#### 3. 设备状态类型和在线状态字段更新
**更新时间**2025-12-26
**更新内容**
`tbl_roomvisitlogform` 表新增两个字段,接口同步支持:
| 字段名|类型|描述|
|---|---|---|
|EquipmentStatusType|varchar(254)|设备状态类型|
|EquipmentOnlineStatus|varchar(254)|设备在线状态|
**修改文件**
`UI/Controllers/UpgradeController.cs`
**修改内容**
- `EquipmentInfo`类新增 `EquipmentStatusType``EquipmentOnlineStatus`属性
- `RoomVisitLogFormRow`类新增对应字段
- `WriteRoomVisitLog`接口支持写入新字段数据
- `QueryRoomVisitLog`接口查询结果包含新字段
**数据库更新**
```sql
ALTER TABLE `tbl_roomvisitlogform` ADD COLUMN `EquipmentStatusType` varchar(254) DEFAULT NULL COMMENT '设备状态类型';
ALTER TABLE `tbl_roomvisitlogform` ADD COLUMN `EquipmentOnlineStatus` varchar(254) DEFAULT NULL COMMENT '设备在线状态';
```
**开发人员**
技术团队
## 2025-12-30
### 新增接口
#### 房间设备访问日志修改接口
**接口地址**
`/Upgrade/UpdateRoomVisitLog`
**请求方式**
`POST`
**请求参数**
| 参数名 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| id | int | 是 | 日志ID必填参数必须大于0 |
| faultDescription | string | 是 | 故障情况描述 |
| equipmentStatusType | string | 是 | 故障类型 |
**返回结果**
```json
{
"Status": 1, // 1成功0失败-1异常
"Message": "更新成功", // 操作结果描述
"Count": 1 // 更新记录数量
}
```
**功能描述**
该接口用于修改 `tbl_roomvisitlogform` 表中的故障描述和故障类型信息根据传入的日志ID更新对应记录。
**使用示例**
```javascript
fetch('/Upgrade/UpdateRoomVisitLog', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: JSON.stringify({
id: 123,
faultDescription: "设备温度过高",
equipmentStatusType: "高温故障"
})
})
.then(response => response.json())
.then(data => {
console.log(data);
// 输出:{"Status":1,"Message":"更新成功","Count":1}
});
```
**开发人员**
系统开发团队
**备注**
- 该接口使用参数化查询防止SQL注入
- 包含完整的参数验证和异常处理机制
- 与现有的查询接口 `QueryRoomVisitLog` 配套使用,实现故障记录的修改功能