Files
Web_AuthorityManagement_Mvc…/更新日志.md

218 lines
5.7 KiB
Markdown
Raw Permalink 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 |
**返回结果**
```json
{
"Status": 1, // 1成功0失败-1异常
"Message": "查询成功", // 操作结果描述
"Data": [
{
"ID": 1,
"HotelID": "123",
"RoomNumber": "101",
"EquipmentStatus": "正常",
"FaultDescription": null,
"UpdateDate": "2025-12-24 10:30:00",
"DevName": "灯光设备"
},
{
"ID": 2,
"HotelID": "123",
"RoomNumber": "101",
"EquipmentStatus": "故障",
"FaultDescription": "无法正常开关",
"UpdateDate": "2025-12-24 10:31:00",
"DevName": "空调设备"
}
]
}
```
**功能描述**
该接口用于查询房间设备访问日志根据酒店ID、房号和时间范围进行筛选。如果开始时间和结束时间为空则查询该房间的所有记录。
**使用示例**
```javascript
// 查询指定时间范围内的记录
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);
// 输出查询结果
});
// 查询所有记录
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);
// 输出查询结果
});
```
**开发人员**
系统开发团队
**备注**
该接口用于查询房间设备的访问和状态信息,支持按时间范围筛选,方便进行历史记录查询和分析。
#### 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 '设备在线状态';
```
**开发人员**
技术团队