4.5 KiB
4.5 KiB
系统更新日志
2025-12-24
新增接口
1. 房间设备访问日志写入接口
接口地址:
/Upgrade/WriteRoomVisitLog
请求方式:
POST
请求参数:
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| HotelID | string | 是 | 酒店ID |
| RoomNumber | string | 是 | 房号 |
| EquipmentList | List | 是 | 设备信息列表 |
EquipmentInfo 数据结构:
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| EquipmentStatus | string | 否 | 设备状态 |
| FaultDescription | string | 否 | 故障描述 |
| DevName | string | 否 | 设备名称 |
返回结果:
{
"Status": 1, // 1成功,0失败,-1异常
"Message": "写入成功", // 操作结果描述
"Count": 3 // 写入记录数量
}
功能描述:
该接口用于向数据库表 tbl_roomvisitlogform 写入房间设备访问日志,支持批量写入多个设备的信息。
数据库表结构:
CREATE TABLE `tbl_roomvisitlogform` (
`ID` int NOT NULL AUTO_INCREMENT,
`HotelID` varchar(254) DEFAULT NULL COMMENT '酒店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 '设备名称',
PRIMARY KEY (`ID`),
KEY `idx_hotel_room` (`HotelID`,`RoomNumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3
使用示例:
// 请求示例
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) |
返回结果:
{
"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、房号和时间范围进行筛选。如果开始时间和结束时间为空,则查询该房间的所有记录。
使用示例:
// 查询指定时间范围内的记录
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);
// 输出查询结果
});
开发人员: 系统开发团队
备注: 该接口用于查询房间设备的访问和状态信息,支持按时间范围筛选,方便进行历史记录查询和分析。