baozhensong 6 years ago
parent
commit
f4a352d4b4
2 changed files with 3 additions and 4 deletions
  1. 1 2
      services/knowoapi/controllers/device.go
  2. 2 2
      services/knowoapi/services/device.go

+ 1 - 2
services/knowoapi/controllers/device.go

@@ -9,7 +9,6 @@ import (
 	"strconv"
 	"time"
 
-	"github.com/garyburd/redigo/redis"
 	"github.com/kataras/iris"
 )
 
@@ -87,7 +86,7 @@ func (a *DeviceController) GetDevicestatus() {
 		return
 	}
 
-	if int(onlinereply.HeartbeatInterval) > 0 && len(onlinereply.ClientIP) > 0 && err != redis.ErrNil {
+	if int(onlinereply.HeartbeatInterval) > 0 && len(onlinereply.ClientIP) > 0 {
 		status = 1
 	}
 

+ 2 - 2
services/knowoapi/services/device.go

@@ -63,7 +63,7 @@ func (a deviceservice) GetDevices(vendorid uint, proid, pi, ps int, deviceid str
 
 		devices.Device = device
 
-		if int(onlinereply.HeartbeatInterval) > 0 && len(onlinereply.ClientIP) > 0 && err.Error() != "redigo: nil returned" {
+		if int(onlinereply.HeartbeatInterval) > 0 && len(onlinereply.ClientIP) > 0 {
 			devices.Status = 1
 		}
 
@@ -109,7 +109,7 @@ func (a deviceservice) GetDevicesCountByVenderId(vendorid uint) (map[string]inte
 			return nil, err
 		}
 
-		if int(onlinereply.HeartbeatInterval) > 0 && len(onlinereply.ClientIP) > 0 && err.Error() != "redigo: nil returned" {
+		if int(onlinereply.HeartbeatInterval) > 0 && len(onlinereply.ClientIP) > 0 {
 			onlineCount += 1
 		} else {
 			offlineCount += 1