[优化]优化目录

This commit is contained in:
PandaX
2023-11-07 16:45:23 +08:00
parent 3a4cea5b26
commit 6bdc4b1dd6
37 changed files with 97 additions and 98 deletions

View File

@@ -11,7 +11,7 @@ import (
"pandax/iothub/hook_message_work"
"pandax/iothub/netbase"
"pandax/pkg/global"
"pandax/pkg/global_model"
"pandax/pkg/global/model"
"pandax/pkg/rule_engine/message"
"sync"
"time"
@@ -42,7 +42,7 @@ func InitHttpHook(addr string, hs *hook_message_work.HookService) {
case http.StateHijacked, http.StateClosed:
etoken, _ := activeConnections.Load(conn.RemoteAddr().String())
if etoken != nil {
data := netbase.CreateConnectionInfo(message.DisConnectMes, "http", conn.RemoteAddr().String(), conn.RemoteAddr().String(), etoken.(*global_model.DeviceAuth))
data := netbase.CreateConnectionInfo(message.DisConnectMes, "http", conn.RemoteAddr().String(), conn.RemoteAddr().String(), etoken.(*model.DeviceAuth))
activeConnections.Delete(conn.RemoteAddr().String())
service.HookService.MessageCh <- data
}
@@ -80,7 +80,7 @@ func (hhs *HookHttpService) hook(req *restful.Request, resp *restful.Response) {
resp.Write([]byte("解析上报参数失败"))
return
}
etoken := &global_model.DeviceAuth{}
etoken := &model.DeviceAuth{}
etoken.GetDeviceToken(token)
_, ok := activeConnections.Load(req.Request.RemoteAddr)
// 是否需要添加设备上线通知