This commit is contained in:
@@ -66,8 +66,11 @@ func (c networkClient) ClientOfflineNotify() {
|
||||
continue
|
||||
}
|
||||
|
||||
online := time.Since(peer.LastHandshakeTime).Minutes() < 3
|
||||
log.Debugf("客户端[%v]在线状态: %v,离线时间: %v", clientName, online, time.Since(peer.LastHandshakeTime).Minutes())
|
||||
|
||||
// 如果存在,判断离线时间
|
||||
if time.Since(peer.LastHandshakeTime).Minutes() >= 3 {
|
||||
if !online {
|
||||
var ipAllocation string
|
||||
for _, iaip := range peer.AllowedIPs {
|
||||
ipAllocation += iaip.String() + ","
|
||||
@@ -78,11 +81,7 @@ func (c networkClient) ClientOfflineNotify() {
|
||||
}
|
||||
|
||||
// 已经离线,发送通知
|
||||
msg := fmt.Sprintf(`
|
||||
[离线通知]
|
||||
客户端名称 : %v
|
||||
客户端IP : %v
|
||||
最后在线时间 : %v
|
||||
msg := fmt.Sprintf(`[离线通知]\n客户端名称 : %v\n客户端IP : %v\n最后在线时间 : %v
|
||||
`, clientName, ipAllocation, peer.LastHandshakeTime.Format("2006-01-02 15:04:05"))
|
||||
err := utils.WechatNotify(code).SendTextMessage(msg)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user