修改:1、修改Emqx上报服务login内容 2、修改Emqx上报服务logout主题,Logout改成logout

This commit is contained in:
pengwang 2021-08-07 23:11:03 +08:00
parent 5bbe726acd
commit 146ccf906a
5 changed files with 18 additions and 29 deletions

View File

@ -137,7 +137,7 @@ func (r *ReportServiceParamEmqxTemplate) NodeLogIn(name []string) bool {
for _, d := range name {
for _, v := range r.NodeList {
if d == v.Name {
nodeMap = append(nodeMap, v.Name)
nodeMap = append(nodeMap, v.Param.ClientID)
MQTTEmqxNodeLoginIn(r.GWParam, nodeMap)
select {

View File

@ -35,7 +35,7 @@ func MQTTEmqxNodeLogOut(param ReportServiceGWParamEmqxTemplate, nodeMap []string
}
//批量注册
LogoutInTopic := "/sys/thing/event/Logout/post/" + param.Param.ClientID
LogoutInTopic := "/sys/thing/event/logout/post/" + param.Param.ClientID
sJson, _ := json.Marshal(nodeLogout)
if len(nodeLogout.Params) > 0 {
@ -61,7 +61,7 @@ func (r *ReportServiceParamEmqxTemplate) NodeLogOut(name []string) bool {
for _, d := range name {
for _, v := range r.NodeList {
if d == v.Name {
nodeMap = append(nodeMap, v.Name)
nodeMap = append(nodeMap, v.Param.ClientID)
MQTTEmqxNodeLogOut(r.GWParam, nodeMap)
select {

View File

@ -404,19 +404,19 @@ func (r *ReportServiceParamEmqxTemplate) ReportTimeFun() {
func (r *ReportServiceParamEmqxTemplate) ReportOfflineTimeFun() {
setting.Logger.Infof("service:%s CheckReportOffline", r.GWParam.ServiceName)
if r.GWParam.ReportErrCnt >= 3 {
r.GWParam.ReportStatus = "offLine"
r.GWParam.ReportErrCnt = 0
setting.Logger.Warningf("service:%s gw offline", r.GWParam.ServiceName)
}
for k, v := range r.NodeList {
if v.ReportErrCnt >= 3 {
r.NodeList[k].ReportStatus = "offLine"
r.NodeList[k].ReportErrCnt = 0
setting.Logger.Warningf("service:%s %s offline", v.ServiceName, v.Name)
}
}
//if r.GWParam.ReportErrCnt >= 3 {
// r.GWParam.ReportStatus = "offLine"
// r.GWParam.ReportErrCnt = 0
// setting.Logger.Warningf("service:%s gw offline", r.GWParam.ServiceName)
//}
//
//for k, v := range r.NodeList {
// if v.ReportErrCnt >= 3 {
// r.NodeList[k].ReportStatus = "offLine"
// r.NodeList[k].ReportErrCnt = 0
// setting.Logger.Warningf("service:%s %s offline", v.ServiceName, v.Name)
// }
//}
}
func ReportServiceEmqxPoll(r *ReportServiceParamEmqxTemplate) {

View File

@ -1,23 +1,12 @@
package setting
import (
"fmt"
"testing"
)
func TestNTPAddHost(t *testing.T){
func TestNTPAddHost(t *testing.T) {
//跳过本函数
//t.SkipNow()
NTPAddHost("ntp1.aliyun.com")
NTPAddHost("ntp2.aliyun.com")
NTPRemoveHost("ntp1.aliyun.com")
hostArray := NTPGetHost()
fmt.Printf("NTPAddr %+v\n",hostArray)
NTPGetTime()
}

View File

@ -46,7 +46,7 @@ var SystemState = SystemStateTemplate{
Name: "openGW",
SN: "22005260001",
HardVer: "openGW-V.A",
SoftVer: "V0.3.1",
SoftVer: "V0.3.2",
SystemRTC: "2020-05-26 12:00:00",
RunTime: "0",
DeviceOnline: "0",