1
This commit is contained in:
@@ -276,17 +276,20 @@ class MqttDispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
// 移除 device_status 更新逻辑
|
||||
// 如果需要在 pla_account 表中添加在线状态字段,可以在这里更新
|
||||
console.log(`[MQTT心跳] 设备 ${sn_code} 心跳已接收 - 登录: ${updateData.isLoggedIn || false}`);
|
||||
|
||||
// if (device) {
|
||||
// await device_status.update(updateData, { where: { sn_code } });
|
||||
// console.log(`[MQTT心跳] 设备 ${sn_code} 状态已更新 - 在线: true, 登录: ${updateData.isLoggedIn}`);
|
||||
// } else {
|
||||
// logProxy.error('[MQTT心跳] 设备 ${sn_code} 不存在', { sn_code });
|
||||
// return;
|
||||
// }
|
||||
// 更新 pla_account 表中的在线和登录状态
|
||||
try {
|
||||
const models = db.getModels();
|
||||
await models.pla_account.update(
|
||||
{
|
||||
is_online: 1,
|
||||
is_logged_in: updateData.isLoggedIn ? 1 : 0
|
||||
},
|
||||
{ where: { sn_code } }
|
||||
);
|
||||
console.log(`[MQTT心跳] 设备 ${sn_code} 状态已更新到数据库 - 在线: true, 登录: ${updateData.isLoggedIn || false}`);
|
||||
} catch (error) {
|
||||
console.error(`[MQTT心跳] 更新数据库状态失败:`, error);
|
||||
}
|
||||
|
||||
// 记录心跳到设备管理器(包含登录状态)
|
||||
const heartbeatPayload = {
|
||||
|
||||
Reference in New Issue
Block a user