修改:1、修改设备丢包率为0时的bug
This commit is contained in:
parent
50bad73285
commit
b08eb8a2cf
3
main.go
3
main.go
|
@ -4,7 +4,6 @@ import (
|
|||
"fmt"
|
||||
"goAdapter/device"
|
||||
"goAdapter/httpServer"
|
||||
"goAdapter/mqttClient"
|
||||
"goAdapter/setting"
|
||||
"log"
|
||||
"net/http"
|
||||
|
@ -79,7 +78,7 @@ func main() {
|
|||
cronGetNetStatus.Start()
|
||||
defer cronGetNetStatus.Stop()
|
||||
|
||||
mqttClient.MQTTClient_Init()
|
||||
//mqttClient.MQTTClient_Init()
|
||||
|
||||
/**************httpserver初始化****************/
|
||||
// 默认启动方式,包含 Logger、Recovery 中间件
|
||||
|
|
|
@ -116,7 +116,11 @@ func GetDevicePacketLossState(){
|
|||
deviceCommLossCnt += v.CommTotalCnt-v.CommSuccessCnt
|
||||
}
|
||||
}
|
||||
SystemState.DevicePacketLoss = fmt.Sprintf("%2.1f",float32(deviceCommLossCnt*100.0/deviceCommTotalCnt))
|
||||
if deviceCommLossCnt == 0{
|
||||
SystemState.DevicePacketLoss = "0"
|
||||
}else{
|
||||
SystemState.DevicePacketLoss = fmt.Sprintf("%2.1f",float32(deviceCommLossCnt*100.0/deviceCommTotalCnt))
|
||||
}
|
||||
}
|
||||
|
||||
func GetTimeStart(){
|
||||
|
|
Loading…
Reference in New Issue