diff --git a/user-service/src/main/java/com/mh/user/netty/handle/ExceptionServerHandler.java b/user-service/src/main/java/com/mh/user/netty/handle/ExceptionServerHandler.java index b0a7447..ddfd2a4 100644 --- a/user-service/src/main/java/com/mh/user/netty/handle/ExceptionServerHandler.java +++ b/user-service/src/main/java/com/mh/user/netty/handle/ExceptionServerHandler.java @@ -39,7 +39,17 @@ public class ExceptionServerHandler extends ChannelInboundHandlerAdapter { //if (meterNum != null) { // meterInfoService.insertTestDetail(meterNum,"offline"); //} - ServerSession.closeSession(ctx); + ServerSession.closeSession(ctx);// 添加到日志表,下线了 + SysLog sysLog = new SysLog(); + sysLog.setOperation(ctx.channel().remoteAddress().toString() + "下线了"); + sysLog.setCreateBy("开发者"); + sysLog.setIp(ctx.channel().remoteAddress().toString()); + sysLog.setCreateTime(new Date()); + sysLog.setTime(0L); + sysLogService.insertLog(sysLog); + // 更新网关在线情况 + gatewayManageService.updateGatewayManageOnlineByHeartBeatCode(ctx.channel().remoteAddress().toString().substring(0, 8), 1); + ctx.close(); } @Override