|
@@ -48,14 +48,15 @@ func GetDeviceState(id string) (retTime time.Time, retState string) {
|
|
|
}()
|
|
|
retTime = time.Time{}
|
|
|
retState = "2"
|
|
|
- //redis中 0在线 1离线
|
|
|
+ //redis中 1在线 0离线
|
|
|
//todo 需要统一
|
|
|
list, err := Redis.HMGet(DeviceStateKey+id, TLast, ONLINE).Result()
|
|
|
+ //fmt.Printf("list = %v id=%v \n", list, id)
|
|
|
if err == nil && list[0] != nil || list[1] != nil {
|
|
|
t, err1 := common.MlParseTime(list[0].(string))
|
|
|
s, err0 := strconv.Atoi(list[1].(string))
|
|
|
if err0 == nil && err1 == nil {
|
|
|
- if s == 0 {
|
|
|
+ if s == 1 {
|
|
|
retState = "1"
|
|
|
}
|
|
|
retTime = t
|