From bd6656b537850cf1addae06f5cf83fe3b9aeab50 Mon Sep 17 00:00:00 2001 From: PandaX <18610165312@163.com> Date: Thu, 14 Dec 2023 10:38:11 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E4=BF=AE=E6=94=B9pg=20sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iothub/server/httpserver/hook.go | 12 +++++++++++- resource/pandax_iot_pg.sql | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/iothub/server/httpserver/hook.go b/iothub/server/httpserver/hook.go index d0d0fb4..40909d1 100644 --- a/iothub/server/httpserver/hook.go +++ b/iothub/server/httpserver/hook.go @@ -25,6 +25,11 @@ var ( activeConnections sync.Map ) +const ( + AEPTYPE = "AEP" + ONENETTYPE = "ONENET" +) + func InitHttpHook(addr string, hs *hook_message_work.HookService) { server := NewHttpServer(addr) service := &HookHttpService{ @@ -70,6 +75,7 @@ func basicAuthenticate(req *restful.Request, resp *restful.Response, chain *rest func (hhs *HookHttpService) hook(req *restful.Request, resp *restful.Response) { token := req.PathParameter("token") pathType := req.PathParameter("pathType") + platformType := req.QueryParameter("platformType") if token == "" || pathType == "" { resp.Write([]byte("路径未识别token,或上报类型")) return @@ -88,9 +94,13 @@ func (hhs *HookHttpService) hook(req *restful.Request, resp *restful.Response) { activeConnections.Store(req.Request.RemoteAddr, etoken) data := netbase.CreateConnectionInfo(message.ConnectMes, "http", req.Request.RemoteAddr, req.Request.RemoteAddr, etoken) go hhs.HookService.Queue.Queue(data) + } + var data *netbase.DeviceEventInfo + if platformType == AEPTYPE { + } marshal, _ := json.Marshal(upData) - data := &netbase.DeviceEventInfo{ + data = &netbase.DeviceEventInfo{ Datas: string(marshal), DeviceAuth: etoken, DeviceId: etoken.DeviceId, diff --git a/resource/pandax_iot_pg.sql b/resource/pandax_iot_pg.sql index 3b05a33..39ba215 100644 --- a/resource/pandax_iot_pg.sql +++ b/resource/pandax_iot_pg.sql @@ -513,7 +513,7 @@ CREATE TABLE "public"."device_groups" ( "path" varchar(255) COLLATE "pg_catalog"."default", "description" varchar(255) COLLATE "pg_catalog"."default", "sort" int4, - "ext" json COLLATE "pg_catalog"."default", + "ext" json, "status" varchar(1) COLLATE "pg_catalog"."default" ) ; @@ -552,7 +552,7 @@ CREATE TABLE "public"."devices" ( "description" varchar(255) COLLATE "pg_catalog"."default", "status" varchar(1) COLLATE "pg_catalog"."default", "ota_version" varchar(64) COLLATE "pg_catalog"."default", - "ext" json COLLATE "pg_catalog"."default", + "ext" json, "parent_id" varchar(64) COLLATE "pg_catalog"."default", "device_type" varchar(64) COLLATE "pg_catalog"."default", "link_status" varchar(10) COLLATE "pg_catalog"."default",