mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-25 00:23:53 +08:00
fix
This commit is contained in:
+4
-2
@@ -59,6 +59,7 @@ public class DeviceServiceImpl extends BaseServiceImpl<DeviceDao, DeviceEntity>
|
|||||||
|
|
||||||
@Async
|
@Async
|
||||||
public void updateDeviceConnectionInfo(String agentId, String deviceId, String appVersion) {
|
public void updateDeviceConnectionInfo(String agentId, String deviceId, String appVersion) {
|
||||||
|
log.info("Attempting to update connection info for deviceId: {}", deviceId);
|
||||||
try {
|
try {
|
||||||
UpdateWrapper<DeviceEntity> updateWrapper = new UpdateWrapper<>();
|
UpdateWrapper<DeviceEntity> updateWrapper = new UpdateWrapper<>();
|
||||||
updateWrapper.eq("id", deviceId)
|
updateWrapper.eq("id", deviceId)
|
||||||
@@ -68,13 +69,14 @@ public class DeviceServiceImpl extends BaseServiceImpl<DeviceDao, DeviceEntity>
|
|||||||
if (StringUtils.isNotBlank(appVersion)) {
|
if (StringUtils.isNotBlank(appVersion)) {
|
||||||
updateWrapper.set("app_version", appVersion);
|
updateWrapper.set("app_version", appVersion);
|
||||||
}
|
}
|
||||||
deviceDao.update(null, updateWrapper);
|
int updatedRows = deviceDao.update(null, updateWrapper);
|
||||||
|
log.info("Update result for deviceId {}: {} rows affected.", deviceId, updatedRows);
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(agentId)) {
|
if (StringUtils.isNotBlank(agentId)) {
|
||||||
redisUtils.set(RedisKeys.getAgentDeviceLastConnectedAtById(agentId), new Date());
|
redisUtils.set(RedisKeys.getAgentDeviceLastConnectedAtById(agentId), new Date());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("异步更新设备连接信息失败", e);
|
log.error("Failed to update connection info for deviceId: {}", deviceId, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user