siked 1 rok pred
commit
4847386e2e
72 zmenil súbory, kde vykonal 6991 pridanie a 0 odobranie
  1. 8 0
      .idea/.gitignore
  2. 9 0
      .idea/AIOT-coer.iml
  3. 22 0
      .idea/deployment.xml
  4. 8 0
      .idea/modules.xml
  5. 7 0
      .idea/vcs.xml
  6. 366 0
      Handle/Handle.go
  7. 88 0
      Handle/Relay.go
  8. 70 0
      Plugin/Mode/Demo.go
  9. 338 0
      Plugin/Plugin.go
  10. 8 0
      Z_Build.bat
  11. 40 0
      conf/app.conf
  12. 89 0
      conf/config.go
  13. 523 0
      controllers/Device.go
  14. 256 0
      controllers/ProductMode.go
  15. 147 0
      controllers/ProductOTA.go
  16. 265 0
      controllers/ProductProt.go
  17. 198 0
      controllers/ProductType.go
  18. 24 0
      controllers/StatisticalData.go
  19. 42 0
      controllers/System.go
  20. 39 0
      controllers/UpFile.go
  21. 54 0
      controllers/Websocket.go
  22. 65 0
      go.mod
  23. 393 0
      go.sum
  24. 1 0
      lastupdate.tmp
  25. 61 0
      lib/Aes.go
  26. 44 0
      lib/DownloadSo.go
  27. 58 0
      lib/MinuteToDataTime.go
  28. 41 0
      lib/Qiniu.go
  29. 97 0
      lib/SubClinets.go
  30. 715 0
      lib/lib.go
  31. 0 0
      logs/Data/logx.2024-04-03.001.log
  32. 0 0
      logs/Data/logx.2024-04-04.001.log
  33. 0 0
      logs/Data/logx.2024-04-05.001.log
  34. 0 0
      logs/Data/logx.2024-04-06.001.log
  35. 0 0
      logs/Data/logx.log
  36. 95 0
      logs/LogPrintln.go
  37. 0 0
      logs/Mqtt/logx.log
  38. 0 0
      logs/Orm/logx.log
  39. 0 0
      logs/logx/logx.2024-04-01.001.log
  40. 557 0
      logs/logx/logx.2024-04-03.001.log
  41. 0 0
      logs/logx/logx.2024-04-04.001.log
  42. 0 0
      logs/logx/logx.2024-04-05.001.log
  43. 0 0
      logs/logx/logx.2024-04-06.001.log
  44. 0 0
      logs/logx/logx.log
  45. 0 0
      logs/logxE/logx.2024-04-01.001.log
  46. 10 0
      logs/logxE/logx.2024-04-03.001.log
  47. 0 0
      logs/logxE/logx.2024-04-04.001.log
  48. 0 0
      logs/logxE/logx.2024-04-05.001.log
  49. 0 0
      logs/logxE/logx.2024-04-06.001.log
  50. 0 0
      logs/logxE/logx.log
  51. 59 0
      main.go
  52. 79 0
      models/Account/Tokey.go
  53. 121 0
      models/Account/User.go
  54. 402 0
      models/Device/Device.go
  55. 278 0
      models/Device/DeviceData.go
  56. 70 0
      models/GTime.go
  57. 50 0
      models/Product/ProductLang.go
  58. 49 0
      models/Product/ProductMode.go
  59. 104 0
      models/Product/ProductOTA.go
  60. 183 0
      models/Product/ProductProt.go
  61. 210 0
      models/Product/ProductPush.go
  62. 25 0
      models/Product/ProductPushMode.go
  63. 310 0
      models/Product/ProductType.go
  64. 122 0
      models/StatisticalData/ProductTypeCount.go
  65. 33 0
      models/System/Logs.go
  66. 5 0
      plugin.sh
  67. 28 0
      routers/Device.go
  68. 42 0
      routers/Product.go
  69. 12 0
      tests/default_test.go
  70. 6 0
      views/index.tpl
  71. BIN
      核心通讯文档.docx
  72. 65 0
      说明.md

+ 8 - 0
.idea/.gitignore

@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/

+ 9 - 0
.idea/AIOT-coer.iml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="WEB_MODULE" version="4">
+  <component name="Go" enabled="true" />
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$" />
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 22 - 0
.idea/deployment.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="PublishConfigData" autoUpload="On explicit save action" autoUploadExternalChanges="true">
+    <serverData>
+      <paths name="Alot">
+        <serverdata>
+          <mappings>
+            <mapping deploy="/AIOT-coer" local="$PROJECT_DIR$" web="/" />
+          </mappings>
+        </serverdata>
+      </paths>
+      <paths name="huitong">
+        <serverdata>
+          <mappings>
+            <mapping local="$PROJECT_DIR$" web="/" />
+          </mappings>
+        </serverdata>
+      </paths>
+    </serverData>
+    <option name="myAutoUpload" value="ON_EXPLICIT_SAVE" />
+  </component>
+</project>

+ 8 - 0
.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/AIOT-coer.iml" filepath="$PROJECT_DIR$/.idea/AIOT-coer.iml" />
+    </modules>
+  </component>
+</project>

+ 7 - 0
.idea/vcs.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+    <mapping directory="$PROJECT_DIR$/SDK" vcs="Git" />
+  </component>
+</project>

+ 366 - 0
Handle/Handle.go

@@ -0,0 +1,366 @@
+package Handle
+
+import (
+	"AIOTCOER/conf"
+	"AIOTCOER/lib"
+	"AIOTCOER/logs"
+	"AIOTCOER/models/Device"
+	"AIOTCOER/models/Product"
+	"AIOTCOER/models/StatisticalData"
+	"encoding/hex"
+	"encoding/json"
+	"errors"
+	"fmt"
+	"go.mongodb.org/mongo-driver/bson"
+	"plugin"
+	"reflect"
+	"sync"
+	"time"
+)
+
+var Mu_PullHandle sync.Mutex // Mutex for synchronizing access to the map
+
+// var Mu_PushHandle sync.Mutex // Mutex for synchronizing access to the map
+// 设备->平台
+func PullHandle(Device_r *Device.Device, topicName string, message []byte) error {
+
+	Msid := fmt.Sprintf("Msid:%d", uint8(time.Now().UnixNano())) // 通讯处理 唯一ID
+	//Msidstart := time.Now()
+	defer lib.PullHandleTime.TimeCost(time.Now())
+
+
+	//流量统计
+	go func(num int64) {
+		Mu_PullHandle.Lock()
+		sd, sdis := StatisticalData.FlowCountMap[Device_r.T_ProductID]
+		if !sdis {
+			sd = &StatisticalData.FlowCount_T{}
+			StatisticalData.FlowCountMap[Device_r.T_ProductID] = sd
+		}
+		sd.T_send += num
+		Mu_PullHandle.Unlock()
+	}(int64(len(message)))
+
+
+	DeviceRealLogR_ := []string{}
+
+	//  加入设备日志  类型
+	Data_log := ""
+	if message[0] == '{' {
+		Data_log = "<-接收[" + topicName + "]" + time.Now().Format("15:04:05") + "\\r\\n" + string(message)
+	} else {
+		Data_log = "<-接收[" + topicName + "]" + time.Now().Format("15:04:05") + "\\r\\n" + hex.EncodeToString(message) //  加入设备日志
+	}
+	//  加入设备日志
+	DeviceRealLogR_ = append(DeviceRealLogR_, Data_log) //  加入设备日志
+	logs.PrintlnData(Data_log)
+
+	messagejson := string(message)
+	// 是否加载转换协议
+	if Device_r.T_ProductJson.T_prot != 0 {
+		// 设备协议
+		ProductProt_r := Product.ProductProt{Id: Device_r.T_ProductJson.T_prot}
+		if !ProductProt_r.Read() {
+			logs.Println(Msid, "MqttServer", Device_r.T_sn+"|"+Device_r.T_ProductID+"-"+fmt.Sprintf("%d", Device_r.T_ProductJson.T_prot)+" 设备协议找不到!")
+			return errors.New("T_prot E!")
+		}
+		// 加载 SO 文件
+		p, err := plugin.Open(conf.Analysis_Dir + ProductProt_r.T_analysis + ".so")
+		if err != nil {
+			logs.PrintlnError(Msid, "打开 SO 失败:", err)
+			return errors.New("T_analysis E!")
+		}
+		//logs.Println("Plugin 地址:", &p)
+
+		// 查找库导出信息
+		s, err := p.Lookup("T")
+		if err != nil {
+			logs.PrintlnError(Msid, "Plugin:", err)
+			return errors.New("Plugin E!")
+		}
+		// 类型转换
+		messagejson = s.(func(t string, b []byte) string)(topicName, message)
+		// 开始处理
+		//logs.Println("协议后:", messagejson)
+
+		DeviceRealLogR_ = append(DeviceRealLogR_, "<-转换["+topicName+"]\\r\\n"+time.Now().Format("15:04:05")+"\\r\\n"+messagejson) //  加入设备日志
+	}
+
+	//logs.Println("首字符:", string(f[0]))
+	if messagejson[0] != '{' {
+		logs.Println(Msid, "data jsonE {}!")
+		return errors.New("data jsonE {}!")
+	}
+
+	//结构体
+	var json_r map[string]interface{}
+	err := json.Unmarshal([]byte(messagejson), &json_r)
+	if err != nil {
+		logs.Println(Msid, "data jsonE !")
+		return errors.New("data jsonE!")
+	}
+
+	// 数据 SSE 实时推送
+	go lib.SseSubscribeSendAll(Device_r.T_sn, json_r)
+
+	// 数据 SSELog 实时推送
+	go lib.SseLogSubscribeSendAll(Device_r.T_sn, DeviceRealLogR_)
+
+	// 数据 Websocket 实时推送
+	go lib.WebsocketSubscribeSendAll(Device_r.T_sn, json_r)
+
+
+	// 详细处理
+	json_r = AnalysisMap(Msid, Device_r, json_r, "")
+	logs.Println("json_r:", json_r)
+
+	// 合并json
+	Device_r.Read_Tidy() // 提前最新的
+	//logs.Println(Msid,"Device_r.T_dataJson:", Device_r.T_dataJson)
+	//logs.Println(Msid,"json_r:", json_r)
+	//var json_x map[string]interface{}
+	if Device_r.T_dataJson != nil {
+		// 托管平台 参数
+		for _, field := range Device_r.T_ProductJson.T_renew {
+			value := lib.JsonGetField(Device_r.T_dataJson, field)
+			if value != nil {
+				//logs.Println(Msid,"JsonSetField:", field,value)
+				lib.JsonSetField(json_r, field, value)
+
+			}
+		}
+		//logs.Println(Msid,"json_r:", json_r)
+		// 合并
+		json_str, _ := json.Marshal(json_r)
+		//logs.Println(Msid,"json_x_b:", json_str)
+		json.Unmarshal(json_str, &Device_r.T_dataJson)
+		//json_r = json_x
+
+	} else {
+		Device_r.T_dataJson = json_r
+	}
+	logs.Println(Msid, "Device_r.T_dataJson_New:", Device_r.T_dataJson)
+	//logs.Println(Msid,"Device_r.T_data 更新:", json_r)
+	//Device_r.T_dataJson = json_r
+	Device_r.Update("T_data")
+
+	//logs.Println("DeviceRealLogR_:",DeviceRealLogR_)
+	// 更新设备记录日志
+	//v, is := logs.DeviceRealLogMap[Device_r.T_sn]
+	//if is {
+	//	v.Data = append(v.Data, DeviceRealLogR_...)
+	//	logs.DeviceRealLogMap[Device_r.T_sn] = v
+	//}
+
+
+
+	return nil
+}
+
+// 平台->设备
+func PushHandle(Device_r *Device.Device, topicName string, message string) error {
+	Msid := fmt.Sprintf("Msid:%d", uint8(time.Now().UnixNano())) // 通讯处理 唯一ID
+	//Msidstart := time.Now()
+
+	// 流量统计
+	Mu_PullHandle.Lock()
+	sd, sdis := StatisticalData.FlowCountMap[Device_r.T_ProductID]
+	if !sdis {
+		sd = &StatisticalData.FlowCount_T{}
+		StatisticalData.FlowCountMap[Device_r.T_ProductID] = sd
+	}
+	sd.T_receive += int64(len(message))
+	Mu_PullHandle.Unlock()
+
+	//  加入设备日志
+	DeviceRealLogR_ := []string{}
+	logs.Println(Msid, "PushHandle ", topicName, message) //  加入设备日志
+
+	// 设备协议
+	ProductProt_r := Product.ProductProt{Id: Device_r.T_ProductJson.T_prot}
+	if Device_r.T_ProductJson.T_prot != 0 {
+		if !ProductProt_r.Read() {
+			logs.Println(Msid, "PushHandle", Device_r.T_sn+"|"+Device_r.T_ProductID+"-"+fmt.Sprintf("%d", Device_r.T_ProductJson.T_prot)+" 设备协议找不到!")
+			return errors.New("设备协议找不到")
+		}
+	}
+
+	var byte_r []byte
+	byte_r = []byte(message)
+	var topicName_r = topicName
+	// 是否加载转换协议
+	if ProductProt_r.T_lang != 0 && len(ProductProt_r.T_analysis) != 0 {
+		// 根据库的存放路径加载库
+		p, err := plugin.Open(conf.Analysis_Dir + ProductProt_r.T_analysis + ".so")
+		if err != nil {
+			logs.PrintlnError(Msid, "PushHandle:", err)
+			return err
+		}
+
+		// 查找库导出信息
+		s, err := p.Lookup("R")
+		if err != nil {
+			logs.PrintlnError(Msid, "PushHandle:", err)
+			return err
+		}
+		DeviceRealLogR_ = append(DeviceRealLogR_, "->转换["+topicName+"]"+time.Now().Format("15:04:05")+"\\r\\n"+message) //  加入设备日志
+		// 类型转换
+		topicName_r, byte_r = s.(func(sn string, b string) (string, []byte))(topicName, message)
+		// 开始处理
+		//logs.Println(Msid,"协议后:", byte_r)
+
+	} else {
+		topicName_r = "/" + topicName_r
+	}
+
+	// 无效消息,不用推送
+	if len(topicName_r) == 0 || len(byte_r) == 0 {
+		logs.Println(Msid, "无效消息,不用推送!", len(topicName_r), len(byte_r))
+		return errors.New("无效消息,不用推送")
+	}
+
+	// 长连接 网关
+	//logs.Println("ProductProt_r.T_mode:", ProductProt_r.T_mode)
+
+	ProductMode_r, is := Product.ProductModeMap[Device_r.T_ProductJson.T_mode]
+	if !is {
+		logs.Println(Msid, "没有找到网关!", Device_r.T_ProductJson.T_mode)
+		return errors.New("没有找到网关!")
+	}
+
+	//初始化插件
+	FunPushHandle_r, err := ProductMode_r.T_Plugin.Lookup("FunPushHandle")
+	if err != nil {
+		logs.PrintlnError(Msid, "网关 错误!", Device_r.T_ProductJson.T_mode, err)
+		return errors.New("网关 错误!")
+	}
+
+	// 初始化插件
+	err = FunPushHandle_r.(func(T_topic string, T_data []byte) error)(topicName_r, byte_r)
+	if err != nil {
+		logs.PrintlnError(Msid, "网关 推送失败!", Device_r.T_ProductJson.T_mode, err)
+		return errors.New("网关 推送失败!")
+	}
+
+	//  加入设备日志  类型
+	Data_log := ""
+	if byte_r[0] == '{' {
+		Data_log = "->推送[" + topicName_r + "]" + time.Now().Format("15:04:05") + "\\r\\n" + string(byte_r) //  加入设备日志
+	} else {
+		Data_log = "->推送[" + topicName_r + "]" + time.Now().Format("15:04:05") + "\\r\\n" + hex.EncodeToString(byte_r) //  加入设备日志
+	}
+	//  加入设备日志
+	DeviceRealLogR_ = append(DeviceRealLogR_, Data_log) //  加入设备日志
+	logs.PrintlnData(Data_log)
+
+	//// 更新设备记录日志
+	//v, is := logs.DeviceRealLogMap[Device_r.T_sn]
+	//if is {
+	//	v.Data = append(v.Data, DeviceRealLogR_...)
+	//	logs.DeviceRealLogMap[Device_r.T_sn] = v
+	//}
+
+	// 数据 SSELog 实时推送
+	go lib.SseLogSubscribeSendAll(Device_r.T_sn, DeviceRealLogR_)
+
+	// 托管平台 参数
+	if len(Device_r.T_ProductJson.T_renew) == 0 {
+		return nil // 没有 托管平台
+	}
+	logs.Println(Msid, "托管平台:", len(Device_r.T_ProductJson.T_renew), Device_r.T_ProductJson.T_renew)
+
+	var articleSlide map[string]interface{}
+	err = json.Unmarshal([]byte(message), &articleSlide)
+	if err != nil {
+		logs.Println(Msid, "参数 托管平台 json 解析错误!", err.Error())
+	}
+
+	Device_r.Read_Tidy() // 提前最新的
+	for _, field := range Device_r.T_ProductJson.T_renew {
+		value := lib.JsonGetField(articleSlide, field)
+		if value != nil {
+			lib.JsonSetField(Device_r.T_dataJson, field, value)
+		}
+	}
+
+	logs.Println(Msid, "Device_r.T_data 更新:", Device_r.T_dataJson)
+	Device_r.Update("T_data")
+
+	return nil
+
+}
+
+// 处理数据
+func AnalysisMap(Msid string, Device_r *Device.Device, ArticleSlide map[string]interface{}, JointTab string) (json_r map[string]interface{}) {
+	//JointTab += "."
+	//T_r := make(map[string]interface{})
+	json_r = make(map[string]interface{})
+	for key, value := range ArticleSlide {
+		//fmt.Println(reflect.TypeOf(value).String())
+		switch reflect.TypeOf(value).String() {
+		case "map[string]interface {}":
+			json_r[key] = AnalysisMap(Msid, Device_r, value.(map[string]interface{}), JointTab+key+".")
+			//return json_r
+			break
+		case "[]interface {}":
+			for _, valuex := range value.([]interface{}) {
+				if reflect.TypeOf(valuex).String() == "map[string]interface {}" {
+					json_r[key] = AnalysisMap(Msid, Device_r, valuex.(map[string]interface{}), JointTab+key+".")
+				}
+			}
+			//return json_r
+			break
+		default:
+			json_r[key] = value
+			// 根 TAB
+			if len(JointTab) == 0 {
+				//logs.Println("TAB.:",key)
+				bson_r := bson.M{key: value}
+
+				// 数据存储
+				//T_filter := Device_r.T_ProductJson.T_filter[key]
+				if lib.StringExistsInSlice(key, Device_r.T_ProductJson.T_filter) {
+					T_filter_v := lib.GetMapRecursion(key, Device_r.T_dataJson)
+					//logs.Println("T_filter:",key,value,T_filter_v)
+					if value != T_filter_v {
+						logs.Println(Msid, "T_filter 不同:", key)
+						Device.Data_Add(Device_r.T_sn+"_"+key, &bson_r)
+					}
+				} else {
+					Device.Data_Add(Device_r.T_sn+"_"+key, &bson_r)
+				}
+				// 消息转发
+				Relay(Msid, Device_r, JointTab, &bson_r)
+			}
+
+			break
+		}
+	}
+	if len(JointTab) == 0 {
+		return
+	}
+	// 多级 TAB
+	JointTab = JointTab[:len(JointTab)-1]
+	//logs.Println("TAB-:",JointTab)
+	bson_r := bson.M{}
+	for key, value := range json_r {
+		//fmt.Println(key, "->:", value)
+		bson_r[key] = value
+	}
+
+	// 数据存储
+	if lib.StringExistsInSlice(JointTab, Device_r.T_ProductJson.T_filter) {
+		T_filter_v := lib.GetMapRecursion(JointTab, Device_r.T_dataJson)
+		//logs.Println("T_filter:",JointTab,json_r,T_filter_v)
+		if !reflect.DeepEqual(json_r, T_filter_v) {
+			//logs.Println("T_filter 不同",JointTab)
+			Device.Data_Add(Device_r.T_sn+"_"+JointTab, &bson_r)
+		}
+	} else {
+		Device.Data_Add(Device_r.T_sn+"_"+JointTab, &bson_r)
+	}
+
+	// 消息转发
+	Relay(Msid, Device_r, JointTab, &bson_r)
+	return json_r
+}

+ 88 - 0
Handle/Relay.go

@@ -0,0 +1,88 @@
+package Handle
+
+import (
+	"AIOTCOER/lib"
+	"AIOTCOER/logs"
+	"AIOTCOER/models/Device"
+	"encoding/json"
+	"go.mongodb.org/mongo-driver/bson"
+	"io/ioutil"
+	"net/http"
+	"strings"
+	"time"
+)
+
+
+// 转发 匹配TAB
+func Relay(Msid string, Device_r *Device.Device, JointTab string, ArticleSlide *bson.M) {
+	// 将bson.M转换为map[string]interface{}
+	// fmt.Println("Relay:",JointTab,*ArticleSlide)
+	jsonData, err := json.Marshal(*ArticleSlide)
+	if err != nil {
+		logs.Println(Msid, "Relay json.Marshal!")
+		return
+	}
+	//fmt.Println("Relay-:",JointTab,*ArticleSlide)
+	for _, value := range Device_r.T_RelayDataJson {
+		//value = {
+		//	"T_tabs": "AAAA.AAAA",
+		//	"T_name": "推送报警",
+		//	"T_pushid": 0,
+		//	"T_pub": "/aaa/{$sn}/AAAA"
+		//},
+		if value["T_tabs"] == JointTab || value["T_tabs"] == "*" {
+
+			//  替换发布号变量
+			T_pub := strings.Replace(lib.To_string(value["T_pub"]), "{$sn}", Device_r.T_sn, -1) //  {$sn} :代表当前数据设备编号SN
+			if len(T_pub) == 0 {
+				logs.Println(Msid, "订阅号错误!")
+				return
+			}
+
+			// 推送 数据
+			go HTTPPush(T_pub, jsonData)
+
+			//// 流量统计
+			//sd, sdis := StatisticalData.FlowCountMap[Device_r.T_ProductID]
+			//if sdis {
+			//	sd = &StatisticalData.FlowCount_T{}
+			//	StatisticalData.FlowCountMap[Device_r.T_ProductID] = sd
+			//}
+			//sd.T_relay += 1
+
+		}
+
+	}
+
+}
+
+// 推送
+func HTTPPush(url string, data []byte) {
+	payload := strings.NewReader(string(data))
+
+	client := &http.Client{
+		Timeout: 3 * time.Second, // 设置超时时间为5秒
+	}
+	req, err := http.NewRequest("POST", url, payload)
+	if err != nil {
+		logs.Println("Relay -> API!!!:", url, any(err))
+		return
+	}
+	req.Header.Add("Content-Type", "application/json")
+
+	res, err := client.Do(req)
+	if err != nil {
+		logs.Println("Relay -> API!!!:", url, any(err))
+		return
+	}
+	defer res.Body.Close()
+
+	body, err := ioutil.ReadAll(res.Body)
+	if err != nil {
+		logs.Println("Relay -> API!!!:", url, any(err))
+		return
+	}
+	logs.Println("Relay -> API Body:", string(body))
+
+	return
+}

+ 70 - 0
Plugin/Mode/Demo.go

@@ -0,0 +1,70 @@
+package main
+
+// 协议基础信息
+var ProductMode = map[string]string{
+	"Id":         "0",                          // 此行不能乱改,需要联系管理员 分配ID
+	"T_name":     "http",                       // 协议名称
+	"T_connect":  "bj-3-mqtt.iot-api.com:1883", // 连接地址
+	"T_describe": "描述内容",                       // 协议描述
+	"T_state":    "0",                          // 连接状态  0停用  1启用
+}
+
+// 参数配置模版
+var ProductModeConfig = map[string]map[string]string{
+	"port": {
+		"T_name":     "端口号",     // 名称  用于参数显示与数据获取标识
+		"T_describe": "填写连接端口号", // 描述
+		"T_value":    "1883",    // 默认值
+	},
+}
+
+// 设备上下线状态推送  T_State:(0 验证  1 在线  2 离线 3 添加 )  T_Reason:备注内容
+var FunStateHandle func(T_sn, T_password string, T_State int, T_Reason string) error
+
+// 设备->平台
+var FunPullHandle func(T_sn, T_password, T_topic string, T_data []byte) error
+
+// 平台->设备
+func FunPushHandle(T_topic string, T_data []byte) error {
+
+	return nil
+}
+
+// 初始化服务
+func GoInit(FunPluginStateHandle func(T_sn, T_password string, T_State int, T_Reason string) error, FunPluginPullHandle func(T_sn, T_password, T_topic string, T_data []byte) error) {
+	FunStateHandle = FunPluginStateHandle // 设备上下线状态推送  方法指针
+	FunPullHandle = FunPluginPullHandle   // 设备->平台  方法指针
+}
+
+// 开启服务
+func GoRun(TConfig_map map[string]string) (map[string]string, error) {
+	println(ProductMode["T_name"])
+	// TConfig_map["port"]    // 获取配置参数
+
+	ProductMode["T_state"] = "1"
+	return ProductMode, nil
+}
+
+// 通知服务
+func GoStop() (map[string]string, error) {
+	// 关闭服务
+	println(ProductMode["T_name"], " 关闭服务!!")
+
+	ProductMode["T_state"] = "0"
+	return ProductMode, nil
+}
+
+//打包 SO 文件时,一定要注释 main主函数
+//func main() {
+//
+//
+//	GoRun(map[string]string{
+//		"port":"8080",
+//	})
+//
+//	//GoStop()
+//
+//	// 等待信号或其他事件来退出程序
+//	select {}
+//}
+//

+ 338 - 0
Plugin/Plugin.go

@@ -0,0 +1,338 @@
+package Plugin
+
+import (
+	"AIOTCOER/Handle"
+	"AIOTCOER/lib"
+	"AIOTCOER/logs"
+	"AIOTCOER/models/Device"
+	"AIOTCOER/models/Product"
+	"errors"
+	"fmt"
+	"io/ioutil"
+	"os"
+	"plugin"
+
+	"strings"
+	"time"
+)
+
+func init() {
+
+}
+
+// 设备状态  T_State:(0 验证  1 在线  2 离线  3 添加 )  T_Reason:备注内容
+func PluginStateHandle(T_sn, T_password string, T_State int, T_Reason string) error {
+	switch {
+	case T_State == 0: // 0 验证
+		Device_r := Device.Device{T_sn: T_sn}
+		if !Device_r.Read_Tidy() {
+			return errors.New("T_sn 错误!")
+		}
+
+		if Device_r.T_password != T_password {
+			return errors.New("T_password 错误!")
+		}
+
+		break
+	case T_State == 1 || T_State == 2: // 1 在线  2 离线
+
+		Device_r := Device.Device{T_sn: T_sn}
+		if !Device_r.Read_Tidy() {
+			return errors.New("T_sn 错误!")
+		}
+
+		if Device_r.T_password != T_password {
+			return errors.New("T_password 错误!")
+		}
+
+		Device_r.T_online = T_State
+		// 同步参数
+		Device_r.Update("T_online")
+
+		var Device_online_r map[string]interface{}
+		Device_online_r = make(map[string]interface{})
+		Device_online_r["online"] = Device_r.T_online
+		Device_online_r["msg"] = T_Reason
+		Device_online_r["time"] = time.Now().Format("2006-01-02 15:04:05")
+
+		Handle.AnalysisMap(fmt.Sprintf("Msid:%d", uint8(time.Now().UnixNano())), &Device_r, map[string]interface{}{"online": Device_online_r}, "")
+		// 数据 Websocket 实时推送
+		Device_online_r["T_sn"] = Device_r.T_sn
+		go lib.WebsocketSubscribeSendAll(Device_r.T_sn, Device_online_r)
+
+
+		break
+	case T_State == 3: // 3 验证添加  (deviceList[0]["deviceSn"], deviceList[0]["deviceId"], 3, T_ProductID)
+		ProductTyper := Product.ProductType{T_ProductID: T_Reason}
+		if !ProductTyper.Read() {
+			return errors.New("产品ID 错误!")
+		}
+
+		Device_r := Device.Device{T_sn: T_sn}
+		if Device_r.Read_Tidy() {
+			return errors.New("T_sn 重复!")
+		}
+
+		CreateDevice_r := Device.Device{T_ProductID: ProductTyper.T_ProductID, T_sn: T_sn, T_password: T_password}
+		// 单个
+		if !CreateDevice_r.CreateSn(1) {
+			return errors.New("CreateSn 失败!")
+		}
+
+		break
+	}
+
+	// 转换
+	return nil
+
+}
+
+// 设备->平台  T_topic:订阅号   T_data:数据       返回:200 成功  201 失败,描述
+func PluginPullHandle(T_sn, T_password, T_topic string, T_data []byte) error {
+
+	Device_r := Device.Device{T_sn: T_sn}
+	if !Device_r.Read_Tidy() {
+		return errors.New("T_sn 错误!")
+	}
+
+	if Device_r.T_password != T_password {
+		return errors.New("T_password 错误!")
+	}
+	if len(T_data) == 0 {
+		return errors.New("T_data 错误!")
+	}
+
+	// 转换
+	return Handle.PullHandle(&Device_r, T_topic, T_data)
+
+}
+
+// 平台->设备  T_topic:订阅号   T_data:数据
+func PluginPushHandle(ProductModeId int, T_topic string, T_data []byte) error {
+	v, is := Product.ProductModeMap[ProductModeId]
+	if !is {
+		return errors.New("ProductModeId E!")
+	}
+
+	//查找标识符
+	lookup, err := v.T_Plugin.Lookup("PushHandle")
+	if err != nil {
+		return errors.New("ProductModeId PushHandle E!")
+	}
+
+	// 推送
+	return lookup.(func(T_topic string, T_data []byte) error)(T_topic, T_data)
+
+}
+
+// 修改配置信息与启停服务
+func PluginProductModeConfigPu(ProductModeMap_v *Product.ProductMode) error {
+
+	Product.ProductModeMap[ProductModeMap_v.Id] = ProductModeMap_v // 更新参数
+
+	// 导出配置map到文件
+	filePath_json := strings.Replace(strings.Replace(ProductModeMap_v.T_file, ".SO", ".json", -1), ".so", ".json", -1)
+	lib.MapToFile(ProductModeMap_v.T_Config_map, filePath_json)
+
+	return nil
+}
+
+// 开启服务
+func PluginGoRun(ProductModeMap_v *Product.ProductMode) error {
+	logs.Println("PluginGoRun:", ProductModeMap_v.Id)
+	ProductModeMap_v.T_log = "--Start--" + "\n"
+	//查找标识符
+	GoRun_r, err := ProductModeMap_v.T_Plugin.Lookup("GoRun")
+	if err != nil {
+		logs.PrintlnError("T_Plugin.Lookup:", err)
+		ProductModeMap_v.T_log += err.Error() + "\n"
+		Product.ProductModeMap[ProductModeMap_v.Id] = ProductModeMap_v // 更新参数
+		return errors.New("GoRun E!")
+	}
+
+	// 转换配置文件
+	var TConfig_map map[string]string
+	TConfig_map = make(map[string]string)
+	for k, v := range ProductModeMap_v.T_Config_map {
+		TConfig_map[k] = v["T_value"]
+	}
+
+	// 运行插件
+	ProductModeMap, err := GoRun_r.(func(TConfig_map map[string]string) (map[string]string, error))(TConfig_map)
+	if err != nil {
+		ProductModeMap_v.T_log += err.Error() + "\n"
+		Product.ProductModeMap[ProductModeMap_v.Id] = ProductModeMap_v // 更新参数
+		logs.PrintlnError("GoRun E!:", err)
+		return errors.New("GoRun E!")
+	}
+
+	if v, is := ProductModeMap["T_state"]; is {
+		ProductModeMap_v.T_state = lib.To_int(v)
+	}
+	if v, is := ProductModeMap["T_connect"]; is {
+		ProductModeMap_v.T_connect = lib.To_string(v)
+	}
+
+	Product.ProductModeMap[ProductModeMap_v.Id] = ProductModeMap_v // 更新参数
+
+	return nil
+}
+
+// 关闭服务
+func PluginGoStop(ProductModeMap_v *Product.ProductMode) error {
+	logs.Println("PluginGoStop:", ProductModeMap_v.Id)
+	//  关闭服务
+	ProductModeMap_v.T_log = "--Stop--" + "\n"
+	//查找标识符
+	GoStop_r, err := ProductModeMap_v.T_Plugin.Lookup("GoStop")
+	if err != nil {
+		ProductModeMap_v.T_log += err.Error() + "\n"
+		Product.ProductModeMap[ProductModeMap_v.Id] = ProductModeMap_v // 更新参数
+		return errors.New("GoStop E!")
+	}
+
+	// 转换配置文件
+	var TConfig_map map[string]string
+	TConfig_map = make(map[string]string)
+	for k, v := range ProductModeMap_v.T_Config_map {
+		TConfig_map[k] = v["T_value"]
+	}
+
+	// 运行插件
+	ProductModeMap, err := GoStop_r.(func() (map[string]string, error))()
+	if err != nil {
+		ProductModeMap_v.T_log += err.Error() + "\n"
+		logs.PrintlnError("GoStop_r.:", err)
+	}
+
+	if v, is := ProductModeMap["T_state"]; is {
+		ProductModeMap_v.T_state = lib.To_int(v)
+	}
+
+	Product.ProductModeMap[ProductModeMap_v.Id] = ProductModeMap_v // 更新参数
+
+	return nil
+}
+
+// 插件初始化
+func Plugininit(open *plugin.Plugin, file_r string) {
+	// 协议基础信息
+	ProductMode, err := open.Lookup("ProductMode")
+	if err != nil {
+		logs.PrintlnError("ProductMode", err)
+		return
+	}
+	ProductModeMap := *ProductMode.(*map[string]string)
+
+	// 参数配置模版
+	ProductModeConfig, err := open.Lookup("ProductModeConfig")
+	if err != nil {
+		logs.PrintlnError("ProductModeConfig", err)
+		return
+	}
+	ProductModeConfigMap := *ProductModeConfig.(*map[string]map[string]string)
+
+	// 参数配置 保存文件
+	filePath_json := strings.Replace(strings.Replace(file_r, ".SO", ".json", -1), ".so", ".json", -1)
+	// 从文件中导入map数据
+	for k, v := range lib.MapFromFile(filePath_json) {
+		logs.Println("加载配置:", k, v)
+		ProductModeConfigMap[k] = v
+	}
+
+	// 获取旧的
+	Id_v, is := ProductModeMap["Id"]
+	if !is {
+		return
+	}
+
+	Id_int := lib.To_int(Id_v)
+
+	t, is := Product.ProductModeMap[Id_int]
+	if !is {
+		t = &Product.ProductMode{}
+	}
+
+	if v, is := ProductModeMap["T_name"]; is {
+		t.T_name = lib.To_string(v)
+	}
+	if v, is := ProductModeMap["T_connect"]; is {
+		t.T_connect = lib.To_string(v)
+	}
+	if v, is := ProductModeMap["T_describe"]; is {
+		t.T_describe = lib.To_string(v)
+	}
+
+	t.Id = Id_int
+	t.T_file = file_r
+	t.T_Plugin = open
+	t.T_Config_map = ProductModeConfigMap
+
+	//初始化插件
+	GoInit_r, err := open.Lookup("GoInit")
+	if err != nil {
+		logs.PrintlnError("open.Lookup(\"GoInit\"):", err)
+		return
+	}
+	// 初始化插件
+	GoInit_r.(func(FunPluginStateHandle func(T_sn, T_password string, T_State int, T_Reason string) error, FunPluginPullHandle func(T_sn, T_password, T_topic string, T_data []byte) error))(PluginStateHandle, PluginPullHandle)
+	if err != nil {
+		logs.PrintlnError("GoInit_r.", err)
+	}
+	logs.Println("Id_int:", Id_int)
+	Product.ProductModeMap[Id_int] = t // 更新参数
+
+	PluginGoRun(t) // 开启服务
+
+	// 导出配置map到文件
+	lib.MapToFile(ProductModeConfigMap, filePath_json)
+
+}
+
+func PluginInit() {
+	time.Sleep(time.Second * 2)
+	dir, err := os.Getwd()
+	if err != nil {
+		logs.PrintlnError("PluginInit:", err)
+		return
+	}
+	logs.Println("dir:", dir)
+
+	logs.Println("---PluginInit Mode----")
+	files, err := ioutil.ReadDir(dir + "/Plugin/Mode")
+	if err == nil {
+		for _, file := range files {
+			if strings.HasSuffix(file.Name(), ".so") {
+				file_r := dir + "/Plugin/Mode/" + file.Name()
+				logs.Println("PluginInit Mode 导入:" + file_r)
+				//打开加载插件,参数是插件的存储位置,可以是相对路径
+				open, err := plugin.Open(file_r)
+				if err != nil {
+					logs.PrintlnError("插件加载失败!", err)
+					continue
+				}
+				println("---")
+				Plugininit(open, file_r) //  插件初始化
+
+			}
+		}
+	}
+
+	logs.Println("---PluginInit Resource----")
+	files, err = ioutil.ReadDir(dir + "/Plugin/Resource")
+	if err == nil {
+		for _, file := range files {
+			if strings.HasSuffix(file.Name(), ".so") {
+				logs.Println("PluginInit Resource 导入:" + file.Name())
+
+				//打开加载插件,参数是插件的存储位置,可以是相对路径
+				//file_r := dir + "/Plugin/Mode/" + file.Name()
+				//open, err := plugin.Open(file_r)
+				//if err != nil {
+				//	panic(any(err))
+				//}
+				//Plugininit(open, file_r) //  插件初始化
+			}
+		}
+	}
+}

+ 8 - 0
Z_Build.bat

@@ -0,0 +1,8 @@
+cd %~dp0
+set GOARCH=amd64
+set GOOS=linux
+set GOPATH=C:\Users\SIKED\go
+set GO111MODULE=auto
+set CGO_ENABLED=1
+
+go build -o yunaiot main.go

+ 40 - 0
conf/app.conf

@@ -0,0 +1,40 @@
+appname = AIOT_coer
+httpport = 6804
+runmode = dev
+autorender = false
+
+# Nats   内核服务 127.0.0.1:6503
+
+# Mysql
+MysqlServer_UrlPort = "127.0.0.1:3305"
+MysqlServer_Database = "aiot_coer"
+MysqlServer_Username = "AIOT_coer"
+MysqlServer_Password = "iysxr7Axy46wCPC3"
+MysqlServer_MaxIdleConnections = 10
+MysqlServer_MaxOpenConnections = 200
+
+# Mongodb
+Mongodb_Url = "mongodb://127.0.0.1:27016"
+Mongodb_DB = "aiotcoer"
+Mongodb_Username = "AIOTcoer"
+Mongodb_Password = "2eEbsE4eD4D4t253"
+
+# Redis
+Redis_address = "127.0.0.1:6378"
+Redis_password = ""
+Redis_dbNum = "8"
+
+# 静态资源
+Qiniu_AccessKey = "-8ezB_d-8-eUFTMvhOGbGzgeQRPeKQnaQ3DBcUxo"
+Qiniu_SecretKey = "KFhkYxTAJ2ZPN3ZS3euTsfWk8-C92rKgkhAMkDRN"
+Qiniu_BUCKET = "aiotyun"
+Qiniu_URL = "https://aiot.baozhida.cn"
+
+
+
+
+# 添加 产品类型  true 可以添加    false  禁止添加
+Config_AddProductType = true
+
+# 不填写,每次启动后会随机生成 打印到控制台
+Config_AdminTokey = "12345678"

+ 89 - 0
conf/config.go

@@ -0,0 +1,89 @@
+package conf
+
+import (
+	"AIOTCOER/logs"
+	"fmt"
+	beego "github.com/beego/beego/v2/server/web"
+	"math/rand"
+	"os"
+	"strings"
+	"time"
+)
+
+func init() {
+	dir, err := os.Getwd()
+	if err != nil {
+		dir = "/tmp"
+	}
+	Analysis_Dir = dir + "/Plugin/Prot/"
+
+	logs.Println("Analysis_Dir:", Analysis_Dir)
+
+	Config_AdminTokey, err = beego.AppConfig.String("Config_AdminTokey")
+	//fmt.Println("AdminTokey:",Config_AdminTokey,err)
+	if err != nil || len(Config_AdminTokey) == 0{
+		Config_AdminTokey = GetRandstring(32, "", 1)
+		fmt.Println("AdminTokey:",Config_AdminTokey)
+	}
+
+}
+
+
+var HTTPPort, _ = beego.AppConfig.Int("httpport")
+var AppName, _ = beego.AppConfig.String("appname")
+
+// Redis
+var Redis_address, _ = beego.AppConfig.String("Redis_address")
+var Redis_password, _ = beego.AppConfig.String("Redis_password")
+var Redis_dbNum, _ = beego.AppConfig.String("Redis_dbNum")
+
+// Mysql
+var MysqlServer_UrlPort, _ = beego.AppConfig.String("MysqlServer_UrlPort")
+var MysqlServer_Database, _ = beego.AppConfig.String("MysqlServer_Database")
+var MysqlServer_Username, _ = beego.AppConfig.String("MysqlServer_Username")
+var MysqlServer_Password, _ = beego.AppConfig.String("MysqlServer_Password")
+var MysqlServer_MaxIdleConnections, _ = beego.AppConfig.Int("MysqlServer_MaxIdleConnections")
+var MysqlServer_MaxOpenConnections, _ = beego.AppConfig.Int("MysqlServer_MaxOpenConnections")
+
+// Mongodb
+var Mongodb_Url, _ = beego.AppConfig.String("Mongodb_Url")
+var Mongodb_DB, _ = beego.AppConfig.String("Mongodb_DB")
+var Mongodb_Username, _ = beego.AppConfig.String("Mongodb_Username")
+var Mongodb_Password, _ = beego.AppConfig.String("Mongodb_Password")
+
+// 数据解析加载目录
+var Analysis_Dir string
+
+// 管理
+var Config_AddProductType, _ = beego.AppConfig.Bool("Config_AddProductType")   // 是否可以添加产品
+var Config_AdminTokey string     // 管理员秘钥
+
+
+// Qiniu
+var Qiniu_AccessKey, _ = beego.AppConfig.String("Qiniu_AccessKey")
+var Qiniu_SecretKey, _ = beego.AppConfig.String("Qiniu_SecretKey")
+var Qiniu_BUCKET, _ = beego.AppConfig.String("Qiniu_BUCKET")
+var Qiniu_Url, _ = beego.AppConfig.String("Qiniu_Url")
+
+
+// #取得随机字符串:通过打乱slice来操作
+func GetRandstring(length int, char string, rand_x int64) string {
+	if length < 1 {
+		return ""
+	}
+
+	if len(char) <= 6 || len(char) <= length {
+		char = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+	}
+
+	charArr := strings.Split(char, "")
+	ran := rand.New(rand.NewSource(time.Now().Unix() + rand_x))
+
+	l := len(charArr)
+	for i := l - 1; i > 0; i-- {
+		r := ran.Intn(i)
+		charArr[r], charArr[i] = charArr[i], charArr[r]
+	}
+	rchar := charArr[:length]
+	return strings.Join(rchar, "")
+}

+ 523 - 0
controllers/Device.go

@@ -0,0 +1,523 @@
+package controllers
+
+import (
+	"AIOTCOER/Handle"
+	"AIOTCOER/lib"
+	"AIOTCOER/logs"
+	"AIOTCOER/models/Device"
+	"AIOTCOER/models/Product"
+	"encoding/json"
+	"fmt"
+	beego "github.com/beego/beego/v2/server/web"
+	"github.com/beego/beego/v2/server/web/context"
+	"github.com/gorilla/websocket"
+	"net/http"
+	"strings"
+	"time"
+)
+
+type DeviceController struct {
+	beego.Controller
+}
+
+
+func (c *DeviceController) WS() {
+	ws, err := upgrader.Upgrade(c.Ctx.ResponseWriter, c.Ctx.Request, nil)
+	if err != nil {
+		logs.Println("MySocketController:", err)
+	}
+	// 退出
+	defer func() {
+		lib.ClearSubscription(ws) // 清楚订阅
+		ws.CloseHandler()
+	}()
+
+	// 这里是我用户的结构体,你可以按自己需要定义
+
+	logs.Println("ws上线:", fmt.Sprintf("%p", ws))
+	for {
+		var msg RecvWs
+		err := ws.ReadJSON(&msg)
+		if err != nil {
+			logs.Println("ReadJSON err:", err)
+			if strings.Contains(err.Error(), "websocket: close 1005") {
+				ws.Close()
+				return
+			}
+			lib.WebsocketWriteJSON(ws, lib.JSONR{Code: lib.Error, Msg: "数据异常!"})
+			continue
+		}
+
+		Device_r_ := Device.Device{T_sn: msg.Sn}
+		if !Device_r_.Read_Tidy() {
+			lib.WebsocketWriteJSON(ws, lib.JSONR{Code: lib.Error, Msg: "验证失败!"})
+			continue
+		}
+
+		if len(Device_r_.T_ckey) != 0 {
+			if Device_r_.T_ckey != msg.Password {
+				lib.WebsocketWriteJSON(ws, lib.JSONR{Code: lib.Error, Msg: "验证失败 !"})
+				continue
+			}
+		}
+		//  1 订阅SN数据   2 解绑SN数据   3 项设备发送数据
+		switch msg.Type {
+		case 0: //  0 心跳
+			lib.WebsocketWriteJSON(ws, lib.JSONR{Code: lib.Success, Msg: "ok!"})
+			break
+		case 1: //  1 订阅SN数据
+			SubConn := []*websocket.Conn{}
+			// 从map中读取数据
+			val, ok := lib.WsSubClinets.Load(msg.Sn)
+			if ok {
+				SubConn = val.([]*websocket.Conn)
+			}
+
+			SubConn_is := true // 重复订阅  标签
+			for _, v := range SubConn {
+				if v == ws {
+					fmt.Println("重复订阅:", fmt.Sprintf("%p", v), msg.Sn)
+					SubConn_is = false
+					lib.WebsocketWriteJSON(ws, lib.JSONR{Code: lib.Error, Msg: "重复订阅!"})
+					break
+				}
+			}
+			if SubConn_is { // 防止重复订阅
+				SubConn = append(SubConn, ws)
+				// 写入map
+				lib.WsSubClinets.Store(msg.Sn, SubConn)
+			}
+			lib.WebsocketWriteJSON(ws, lib.JSONR{Code: lib.Success, Msg: "ok!"})
+		case 2: //  2 解绑SN数据
+
+			// 从map中读取数据
+			val, ok := lib.WsSubClinets.Load(msg.Sn)
+			if ok {
+				SubConn := val.([]*websocket.Conn)
+				for i, v := range SubConn {
+					if v == ws {
+						fmt.Println("删除订阅:", fmt.Sprintf("%p", v), msg.Sn)
+						SubConn = append(SubConn[:i], SubConn[i+1:]...)
+						lib.WsSubClinets.Store(msg.Sn, SubConn)
+						break
+					}
+				}
+			}
+			lib.WebsocketWriteJSON(ws, lib.JSONR{Code: lib.Success, Msg: "ok!"})
+		case 3: //  3 项设备发送数据
+
+			json_str, _ := json.Marshal(msg.Json)
+			err = Handle.PushHandle(&Device_r_, Device_r_.T_sn, string(json_str))
+			if err != nil {
+				lib.WebsocketWriteJSON(ws, lib.JSONR{Code: lib.Error, Msg: "e!", Data: err.Error()})
+				break
+			}
+		default:
+			lib.WebsocketWriteJSON(ws, lib.JSONR{Code: lib.Error, Msg: "Type 错误!"})
+			break
+		}
+
+	}
+}
+
+func (c *DeviceController) SSE() {
+
+	T_sn := c.GetString("T_sn")
+	T_ckey := c.GetString("T_ckey")
+	if len(T_sn) == 0 {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_sn!"}
+		c.ServeJSON()
+		return
+	}
+
+	Device_r := Device.Device{T_sn: T_sn}
+	if !Device_r.Read_Tidy() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "验证失败!"}
+		c.ServeJSON()
+		return
+	}
+
+	if len(Device_r.T_ckey) != 0 {
+		if Device_r.T_ckey != T_ckey {
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "验证失败 !"}
+			c.ServeJSON()
+			return
+		}
+	}
+
+
+	c.Ctx.ResponseWriter.Header().Set("Content-Type", "text/event-stream")
+	c.Ctx.ResponseWriter.Header().Set("Cache-Control", "no-cache")
+	c.Ctx.ResponseWriter.Header().Set("Connection", "keep-alive")
+
+	//
+	SubConn := []*context.Response{}
+
+	// 从map中读取数据
+	val, ok := lib.SseSubClinets.Load(Device_r.T_sn)
+	if ok {
+		SubConn = val.([]*context.Response)
+	}
+
+	SubConn = append(SubConn, c.Ctx.ResponseWriter)
+	// 写入map
+	lib.SseSubClinets.Store(Device_r.T_sn, SubConn)
+
+	// 退出  删除订阅
+	defer func() {
+		// 从map中读取数据
+		val, ok = lib.SseSubClinets.Load(Device_r.T_sn)
+		if ok {
+			SubConn = val.([]*context.Response)
+			for i, v := range SubConn {
+				if v == c.Ctx.ResponseWriter {
+					fmt.Println("删除订阅:", fmt.Sprintf("%p", v), Device_r.T_sn)
+					SubConn = append(SubConn[:i], SubConn[i+1:]...)
+					lib.SseSubClinets.Store(Device_r.T_sn, SubConn)
+					break
+				}
+			}
+		}
+	}()
+
+	//data, _ := json.Marshal(Device_r.T_dataJson)
+	//fmt.Println(string(data))
+
+	lib.SseWriteJSON(c.Ctx.ResponseWriter,[]byte(Device_r.T_data))
+
+	for true {
+		// Sleep for 1 second before sending the next update
+		time.Sleep(1 * time.Second)
+	}
+
+
+	// Close the connection
+	c.Ctx.ResponseWriter.WriteHeader(http.StatusOK)
+}
+
+
+func (c *DeviceController) List() {
+	PageIndex, _ := c.GetInt("PageIndex", 0)
+	PageSize, _ := c.GetInt("PageSize", 10)
+
+	Devicer := Device.Device{}
+	c.ParseForm(&Devicer)
+
+	ProductTyper := Product.ProductType{T_ProductID: Devicer.T_ProductID}
+	if !ProductTyper.Read() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "ProductID E!"}
+		c.ServeJSON()
+		return
+	}
+	T_uuid := c.GetString("T_uuid")
+	if T_uuid != ProductTyper.T_uuid {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+		c.ServeJSON()
+		return
+	}
+
+	Device_r, Total := Devicer.Lists(PageIndex, PageSize)
+
+	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: lib.C_Page(Device_r, PageIndex, PageSize, Total)}
+	c.ServeJSON()
+	return
+}
+
+func (c *DeviceController) Add() {
+	// 验证秘钥
+
+	ProductType_r := Product.ProductType{}
+	c.ParseForm(&ProductType_r)
+	ProductKey := ProductType_r.T_ProductKey
+	fmt.Println(ProductType_r)
+	fmt.Println("T_ProductID:",c.Ctx.Input.Query("T_ProductID"))
+	if len(ProductType_r.T_ProductID) != 8 {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_ProductID!"}
+		c.ServeJSON()
+		return
+	}
+	if !ProductType_r.Read() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_ProductID !"}
+		c.ServeJSON()
+		return
+	}
+	if ProductType_r.T_ProductKey != ProductKey {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_ProductKey!"}
+		c.ServeJSON()
+		return
+	}
+
+	// 创建sn
+	T_sn := c.GetString("T_sn")
+	Device_r := Device.Device{T_ProductID: ProductType_r.T_ProductID, T_sn: T_sn}
+
+	//
+	CreateNum, _ := c.GetInt("T_CreateNum", 1)
+	if CreateNum == 1 || len(Device_r.T_sn) >= 2 {
+		// 单个
+		if !Device_r.CreateSn(1) {
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_sn 重复!"}
+			c.ServeJSON()
+			return
+		}
+
+		c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: map[string]string{"T_sn": Device_r.T_sn, "T_password": Device_r.T_password}}
+		c.ServeJSON()
+		return
+
+	} else {
+		// 多个
+		var Device_List []map[string]string
+		for i := 1; i <= CreateNum; i++ {
+			Device_rr := Device_r
+			Device_rr.CreateSn(i)
+
+			Device_List = append(Device_List, map[string]string{"T_sn": Device_rr.T_sn, "T_password": Device_rr.T_password})
+		}
+
+		c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: Device_List}
+		c.ServeJSON()
+		return
+	}
+
+}
+
+func (c *DeviceController) Update() {
+	Devicer := Device.Device{T_sn: c.GetString("T_sn")}
+
+	if !Devicer.Read_Tidy() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "SN E!"}
+		c.ServeJSON()
+		return
+	}
+
+
+	if len(Devicer.T_ckey) != 0 {
+		if Devicer.T_ckey != c.GetString("T_ckey") {
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_ckey E!"}
+			c.ServeJSON()
+			return
+		}
+	}
+	if len(Devicer.T_ckey) != 0 {
+		Devicer.T_RelayData = c.GetString("T_RelayData")
+
+		if !Devicer.Update("T_RelayData") {
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "E!"}
+			c.ServeJSON()
+			return
+		}
+	}
+
+
+	println("T_ckey:",Devicer.T_ckey)
+	if len(Devicer.T_ckey) == 0 && len(c.GetString("T_ckey")) != 0{
+		Devicer.T_ckey = c.GetString("T_ckey")
+		Devicer.Update("T_ckey")
+
+	}
+
+	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!"}
+	c.ServeJSON()
+	return
+}
+
+//func (c *DeviceController) Activation() {
+//
+//	if len(c.GetString("T_sn")) == 0 {
+//		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "SN E!"}
+//		c.ServeJSON()
+//		return
+//	}
+//
+//	Devicer := Device.Device{T_sn: c.GetString("T_sn")}
+//
+//	if !Devicer.Read_Tidy() {
+//		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "SN E!"}
+//		c.ServeJSON()
+//		return
+//	}
+//
+//	fmt.Println("T_ckey:",len(Devicer.T_ckey))
+//	if len(Devicer.T_ckey) != 0 {
+//		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "设备已激活!"}
+//		c.ServeJSON()
+//		return
+//	}
+//
+//	fmt.Println(Devicer)
+//	Devicer.T_ckey = lib.GetRandstring(32, "", 1)
+//
+//	if !Devicer.Update("T_ckey") {
+//		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "E!"}
+//		c.ServeJSON()
+//		return
+//	}
+//
+//	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!",Data: Devicer.T_ckey}
+//	c.ServeJSON()
+//	return
+//}
+
+func (c *DeviceController) Get() {
+	Devicer := Device.Device{}
+	c.ParseForm(&Devicer)
+
+	if !Devicer.Read_Tidy() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "SN E!"}
+		c.ServeJSON()
+		return
+	}
+
+	if len(Devicer.T_ckey) != 0 {
+		if Devicer.T_ckey != c.GetString("T_ckey") {
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_ckey E!"}
+			c.ServeJSON()
+			return
+		}
+	}
+
+	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: Devicer}
+	c.ServeJSON()
+	return
+}
+
+func (c *DeviceController) Push() {
+	Devicer := Device.Device{}
+	c.ParseForm(&Devicer)
+	T_data := c.GetString("T_data")
+	if len(T_data) == 0 {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_data E!"}
+		c.ServeJSON()
+		return
+	}
+	if !Devicer.Read_Tidy() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "SN E!"}
+		c.ServeJSON()
+		return
+	}
+
+	if len(Devicer.T_ckey) != 0 {
+		if Devicer.T_ckey != c.GetString("T_ckey") {
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_ckey E!"}
+			c.ServeJSON()
+			return
+		}
+	}
+
+	err := Handle.PushHandle(&Devicer, Devicer.T_sn, T_data)
+	if err != nil {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "e!", Data: err.Error()}
+		c.ServeJSON()
+		return
+	}
+	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!"}
+	c.ServeJSON()
+	return
+}
+
+func (c *DeviceController) DataList() {
+	Devicer := Device.Device{T_sn: c.GetString("T_sn")}
+	if !Devicer.Read_Tidy() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "SN E!"}
+		c.ServeJSON()
+		return
+	}
+
+	if len(Devicer.T_ckey) != 0 {
+		if Devicer.T_ckey != c.GetString("T_ckey") {
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_ckey E!"}
+			c.ServeJSON()
+			return
+		}
+	}
+
+	DeviceData_Form := Device.DeviceData_Form{}
+	c.ParseForm(&DeviceData_Form)
+
+	if len(DeviceData_Form.T_jointTab) < 1 {
+		c.Data["json"] = lib.JSONS{Code: lib.Error, Msg: "T_jointTab !"}
+		c.ServeJSON()
+		return
+	}
+
+	JSONR_r := Device.Data_List(DeviceData_Form.T_sn+"_"+DeviceData_Form.T_jointTab, DeviceData_Form.T_jsonFind, DeviceData_Form.T_jsonSort, DeviceData_Form.PageIndex, DeviceData_Form.PageSize)
+
+	c.Data["json"] = JSONR_r
+	c.ServeJSON()
+	return
+}
+
+func (c *DeviceController) SSELog() {
+
+	T_sn := c.GetString("T_sn")
+	if len(T_sn) == 0 {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_sn!"}
+		c.ServeJSON()
+		return
+	}
+
+	Device_r := Device.Device{T_sn: T_sn}
+	if !Device_r.Read_Tidy() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "验证失败!"}
+		c.ServeJSON()
+		return
+	}
+
+	if len(Device_r.T_ckey) != 0 {
+		if Device_r.T_ckey != c.GetString("T_ckey") {
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "验证失败 !"}
+			c.ServeJSON()
+			return
+		}
+	}
+
+
+	c.Ctx.ResponseWriter.Header().Set("Content-Type", "text/event-stream")
+	c.Ctx.ResponseWriter.Header().Set("Cache-Control", "no-cache")
+	c.Ctx.ResponseWriter.Header().Set("Connection", "keep-alive")
+
+	//
+	SubConn := []*context.Response{}
+
+	// 从map中读取数据
+	val, ok := lib.SseLogSubClinets.Load(Device_r.T_sn)
+	if ok {
+		SubConn = val.([]*context.Response)
+	}
+
+	SubConn = append(SubConn, c.Ctx.ResponseWriter)
+	// 写入map
+	lib.SseLogSubClinets.Store(Device_r.T_sn, SubConn)
+
+	// 退出  删除订阅
+	defer func() {
+		// 从map中读取数据
+		val, ok = lib.SseLogSubClinets.Load(Device_r.T_sn)
+		if ok {
+			SubConn = val.([]*context.Response)
+			for i, v := range SubConn {
+				if v == c.Ctx.ResponseWriter {
+					fmt.Println("删除订阅:", fmt.Sprintf("%p", v), Device_r.T_sn)
+					SubConn = append(SubConn[:i], SubConn[i+1:]...)
+					lib.SseLogSubClinets.Store(Device_r.T_sn, SubConn)
+					break
+				}
+			}
+		}
+	}()
+
+	//data, _ := json.Marshal(Device_r.T_dataJson)
+	//fmt.Println(string(data))
+
+	lib.SseWriteJSON(c.Ctx.ResponseWriter,[]byte("OK"))
+
+	for true {
+		// Sleep for 1 second before sending the next update
+		time.Sleep(1 * time.Second)
+	}
+
+
+	// Close the connection
+	c.Ctx.ResponseWriter.WriteHeader(http.StatusOK)
+}

+ 256 - 0
controllers/ProductMode.go

@@ -0,0 +1,256 @@
+package controllers
+
+import (
+	"AIOTCOER/Plugin"
+	"AIOTCOER/conf"
+	"AIOTCOER/lib"
+	"AIOTCOER/logs"
+	"AIOTCOER/models/Product"
+	"encoding/json"
+	beego "github.com/beego/beego/v2/server/web"
+	"io"
+	"net/http"
+	"net/url"
+	"os"
+	"path"
+	"plugin"
+	"time"
+)
+
+type ProductModeController struct {
+	beego.Controller
+}
+
+func (c *ProductModeController) ProductModeLists() {
+	ProductProt_r, _ := Product.ProductModeLists()
+	//
+	//if c.GetString("AdminTokey") != conf.Config_AdminTokey {
+	//	c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "ok!", Data: "AdminTokey E!" }
+	//	c.ServeJSON()
+	//	return
+	//}
+
+	// 网关
+	type ProductMode struct {
+		Id         int    `json:"Id"`
+		T_name     string `json:"T_name"`     // 协议名称  Mqtt
+	}
+	var maplist  []ProductMode
+	for _,v := range ProductProt_r{
+		maplist = append(maplist, ProductMode{Id:  v.Id, T_name: v.T_name} )
+
+	}
+
+	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: maplist }
+	c.ServeJSON()
+	return
+
+}
+
+func (c *ProductModeController) Updata() {
+	if c.GetString("AdminTokey") != conf.Config_AdminTokey {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "AdminTokey E!"}
+		c.ServeJSON()
+		return
+	}
+	Id, _ := c.GetInt("Id", 0)
+
+	if Id <= 0 {
+		// 添加设备
+		//ProductProt_r := Product.ProductMode{}
+		//c.ParseForm(&ProductProt_r)
+		//ProductProt_r.Id = 0
+		//ProductProt_r.Add()
+
+		c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: ""}
+		c.ServeJSON()
+		return
+
+	}
+	ProductModeMap_r, is := Product.ProductModeMap[Id]
+	if !is {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "Id E!"}
+		c.ServeJSON()
+		return
+	}
+
+	T_Config_map := c.GetString("T_Config_map")
+	if len(T_Config_map) > 0 {
+		logs.Println("修改配置参数:", T_Config_map)
+		var articleSlide map[string]map[string]string
+		err := json.Unmarshal([]byte(T_Config_map), &articleSlide)
+		if err != nil {
+			c.Data["json"] = lib.JSONS{Code: lib.Error, Msg: "Data err!"}
+			c.ServeJSON()
+			return
+		}
+		ProductModeMap_r.T_Config_map = articleSlide
+		Product.ProductModeMap[Id] = ProductModeMap_r
+		Plugin.PluginProductModeConfigPu(ProductModeMap_r)
+
+		if ProductModeMap_r.T_state == 1 {
+			Plugin.PluginGoStop(ProductModeMap_r)
+			time.Sleep(time.Second * 2)
+			Plugin.PluginGoRun(ProductModeMap_r)
+		}
+	}
+
+	T_state, err := c.GetInt("T_state")
+	if err == nil {
+		logs.Println("T_state:", T_state)
+		if T_state == 1 {
+			time.Sleep(time.Second * 1)
+			Plugin.PluginGoRun(ProductModeMap_r)
+		} else {
+			Plugin.PluginGoStop(ProductModeMap_r)
+		}
+	}
+
+	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!"}
+	c.ServeJSON()
+	return
+}
+func (c *ProductModeController) Import() {
+	if c.GetString("AdminTokey") != conf.Config_AdminTokey {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "AdminTokey E!"}
+		c.ServeJSON()
+		return
+	}
+	// 验证 TOKEY
+	if len(c.GetString("T_uuid")) == 0 {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+		c.ServeJSON()
+		return
+	}
+	dir, err := os.Getwd()
+	if err != nil {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "Getwd E!"}
+		c.ServeJSON()
+		return
+	}
+
+	// 获取上传的zip文件
+	zipFile, FileHeader, err := c.GetFile("so")
+	if err == nil {
+		defer zipFile.Close()
+
+		file_r := dir + "/Plugin/Mode/" + FileHeader.Filename
+		logs.Println("file_r:", file_r)
+		// 检查文件是否存在
+		if _, err := os.Stat(file_r); !os.IsNotExist(err) {
+			logs.Println("os.Stat:", err)
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "文件已存在!"}
+			c.ServeJSON()
+			return
+		}
+
+		// 创建一个临时文件来保存上传的zip文件
+		tempFile, err := os.Create(file_r)
+		if err != nil {
+			logs.Println("Error creating temp file:", err)
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "os.Create!"}
+			c.ServeJSON()
+			return
+		}
+		// 将上传的zip文件内容复制到临时文件中
+		_, err = io.Copy(tempFile, zipFile)
+		if err != nil {
+			logs.Println("Error copying zip file to temp file:", err)
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "Copy!"}
+			c.ServeJSON()
+			return
+		}
+		tempFile.Close()
+
+		time.Sleep(time.Second * 1)
+		//
+		logs.Println("PluginInit Mode 导入:" + file_r)
+		//打开加载插件,参数是插件的存储位置,可以是相对路径
+		open, err := plugin.Open(file_r)
+		if err != nil {
+			logs.PrintlnError("插件加载失败!", err)
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "插件加载失败!"}
+			c.ServeJSON()
+			return
+		}
+
+		Plugin.Plugininit(open, file_r) //  插件初始化
+
+		c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!"}
+		c.ServeJSON()
+		return
+	}
+	fileUrl := c.GetString("urlso")
+	if len(fileUrl) > 0 {
+		// 下载文件的URL
+
+		parsedURL, err := url.Parse(fileUrl)
+		if err != nil {
+			logs.Println("Error parsing URL:", err)
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "urlso E!"}
+			c.ServeJSON()
+			return
+		}
+
+		fileName := path.Base(parsedURL.Path)
+		logs.Println("远程文件的文件名:", fileName)
+
+		file_r := dir + "/Plugin/Mode/" + fileName
+		logs.Println("file_r:", file_r)
+
+		// 检查文件是否存在
+		if _, err := os.Stat(file_r); !os.IsNotExist(err) {
+			logs.Println("os.Stat:", err)
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "文件已存在!"}
+			c.ServeJSON()
+			return
+		}
+
+		// 创建输出文件
+		output, err := os.Create(file_r)
+		if err != nil {
+			logs.Println("Error while creating", "-", err)
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "os.Create E!"}
+			c.ServeJSON()
+			return
+		}
+
+		// 发送HTTP GET请求
+		response, err := http.Get(fileUrl)
+		if err != nil {
+			logs.Println("Error while downloading", fileUrl, "-", err)
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "http.Get E!"}
+			c.ServeJSON()
+			return
+		}
+		defer response.Body.Close()
+
+		// 将响应体写入输出文件
+		_, err = io.Copy(output, response.Body)
+		if err != nil {
+			logs.Println("Error while downloading", fileUrl, "-", err)
+			return
+		}
+		output.Close()
+		logs.Println("文件下载完成")
+
+		time.Sleep(time.Second * 1)
+		//
+		logs.Println("PluginInit Mode 导入:" + file_r)
+		//打开加载插件,参数是插件的存储位置,可以是相对路径
+		open, err := plugin.Open(file_r)
+		if err != nil {
+			logs.PrintlnError("插件加载失败!", err)
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "插件加载失败!"}
+			c.ServeJSON()
+			return
+		}
+
+		Plugin.Plugininit(open, file_r) //  插件初始化
+
+		c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!"}
+		c.ServeJSON()
+		return
+	}
+
+}

+ 147 - 0
controllers/ProductOTA.go

@@ -0,0 +1,147 @@
+package controllers
+
+import (
+	"AIOTCOER/Handle"
+	"AIOTCOER/lib"
+	"AIOTCOER/logs"
+	"AIOTCOER/models/Device"
+	"AIOTCOER/models/Product"
+	"encoding/json"
+	beego "github.com/beego/beego/v2/server/web"
+)
+
+type ProductOTAController struct {
+	beego.Controller
+}
+
+func (c *ProductOTAController) List() {
+	PageIndex, _ := c.GetInt("PageIndex", 0)
+	PageSize, _ := c.GetInt("PageSize", 10)
+
+
+	ProductTyper := Product.ProductType{
+		T_ProductID:c.GetString("T_ProductID"),
+	}
+
+
+	if !ProductTyper.Read() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "ProductID E!"}
+		c.ServeJSON()
+		return
+	}
+
+	// 验证 T_uuid
+	T_uuid := lib.Take_one(c.Ctx.GetCookie("T_uuid"), c.GetString("T_uuid"))
+
+	if ProductTyper.T_uuid != T_uuid {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+		c.ServeJSON()
+		return
+	}
+
+	ProductOTAr := Product.ProductOTA{
+		T_ProductID: ProductTyper.T_ProductID,
+	}
+
+
+	ProductOTA_r, Total := ProductOTAr.Lists(PageIndex, PageSize)
+
+	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: lib.C_Page(ProductOTA_r, PageIndex, PageSize, Total)}
+	c.ServeJSON()
+	return
+}
+
+
+func (c *ProductOTAController) Add() {
+	ProductTyper := Product.ProductType{
+		T_ProductID:c.GetString("T_ProductID"),
+	}
+	if !ProductTyper.Read() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "ProductID E!"}
+		c.ServeJSON()
+		return
+	}
+
+	// 验证 T_uuid
+	T_uuid := lib.Take_one(c.Ctx.GetCookie("T_uuid"), c.GetString("T_uuid"))
+
+	if ProductTyper.T_uuid != T_uuid {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+		c.ServeJSON()
+		return
+	}
+
+
+	ProductOTA_r := Product.ProductOTA{}
+	c.ParseForm(&ProductOTA_r)
+
+	go func() {
+		device := Device.Device{T_ProductID: ProductOTA_r.T_ProductID}
+		Device_list := device.Lists_All()
+
+		var T_datajson map[string]interface{}
+		T_datajson = make(map[string]interface{})
+		T_datajson["name"] = ProductOTA_r.T_name
+		T_datajson["version"] = ProductOTA_r.T_version
+		T_datajson["file"] = ProductOTA_r.T_file
+		T_datajson["md5"] = ProductOTA_r.T_file
+		T_datajson["size"] = ProductOTA_r.T_file
+		T_datajson["publish"] = ProductOTA_r.T_publish
+		T_datajson["describe"] = ProductOTA_r.T_describe
+
+		b, _ := json.Marshal(map[string]interface{}{"upgrade": T_datajson})
+
+		for _, v := range Device_list {
+			logs.Println("全量发布:", v.T_sn, string(b))
+			Handle.PushHandle(&v, v.T_sn, string(b))
+		}
+
+	}()
+
+	ProductOTA_r.Id = 0
+	ProductOTA_r.Add()
+
+	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: ProductOTA_r}
+	c.ServeJSON()
+	return
+}
+
+func (c *ProductOTAController) Delete() {
+	ProductOTAr := Product.ProductOTA{}
+
+	c.ParseForm(&ProductOTAr)
+	if !ProductOTAr.Read() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "ID E!"}
+		c.ServeJSON()
+		return
+	}
+
+	ProductTyper := Product.ProductType{
+		T_ProductID:ProductOTAr.T_ProductID,
+	}
+	if !ProductTyper.Read() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "ProductID E!"}
+		c.ServeJSON()
+		return
+	}
+
+	// 验证 T_uuid
+	T_uuid := lib.Take_one(c.Ctx.GetCookie("T_uuid"), c.GetString("T_uuid"))
+
+	if ProductTyper.T_uuid != T_uuid {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+		c.ServeJSON()
+		return
+	}
+
+
+	if !ProductOTAr.Delete() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "E!"}
+		c.ServeJSON()
+		return
+	}
+
+	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!"}
+	c.ServeJSON()
+	return
+}

+ 265 - 0
controllers/ProductProt.go

@@ -0,0 +1,265 @@
+package controllers
+
+import (
+	"AIOTCOER/lib"
+	"AIOTCOER/models/Product"
+	beego "github.com/beego/beego/v2/server/web"
+)
+
+type ProductProtController struct {
+	beego.Controller
+}
+
+func (c *ProductProtController) ProductLangList() {
+
+	ProductProt_r, Total := Product.ProductLangLists()
+
+	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: lib.C_Page(ProductProt_r, 0, 0, Total)}
+	c.ServeJSON()
+	return
+}
+
+func (c *ProductProtController) Update() {
+	T_uuid := lib.Take_one(c.Ctx.GetCookie("T_uuid"), c.GetString("T_uuid"))
+
+	ProductProtr := Product.ProductProt{}
+	c.ParseForm(&ProductProtr)
+
+	if ProductProtr.Id == 0 {
+		ProductProtr.Id,_ = ProductProtr.Add()
+	}
+
+	if !ProductProtr.Read() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_ProductID E!"}
+		c.ServeJSON()
+		return
+	}
+
+	// 验证 TOKEY
+	if ProductProtr.T_uuid != T_uuid {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+		c.ServeJSON()
+		return
+	}
+	c.ParseForm(&ProductProtr)
+	if !ProductProtr.Update("T_lang", "T_analysis", "T_text", "T_describe") {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "E!"}
+		c.ServeJSON()
+		return
+	}
+
+	lib.DownloadSo(ProductProtr.T_analysis) // 下载SO 文件
+
+	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!",Data: ProductProtr}
+	c.ServeJSON()
+	return
+}
+
+
+
+func (c *ProductProtController) Get() {
+	ProductProt := Product.ProductProt{}
+	c.ParseForm(&ProductProt)
+	T_uuid := lib.Take_one(c.Ctx.GetCookie("T_uuid"), c.GetString("T_uuid"))
+
+	if !ProductProt.Read() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "ID E!"}
+		c.ServeJSON()
+		return
+	}
+
+	// 验证 TOKEY
+	if ProductProt.T_uuid != T_uuid {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+		c.ServeJSON()
+		return
+	}
+
+	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: ProductProt}
+	c.ServeJSON()
+	return
+}
+
+//func (c *ProductProtController) List() {
+//	PageIndex, _ := c.GetInt("PageIndex", 0)
+//	PageSize, _ := c.GetInt("PageSize", 10)
+//
+//	ProductProtr := Product.ProductProt{}
+//	c.ParseForm(&ProductProtr)
+//
+//	// 验证 TOKEY
+//	if c.Ctx.Input.Host() != "127.0.0.1" {
+//		if len(ProductProtr.T_uuid) != 8 {
+//			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+//			c.ServeJSON()
+//			return
+//		}
+//	}
+//
+//	ProductProt_r, Total := ProductProtr.Lists(PageIndex, PageSize)
+//
+//	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: lib.C_Page(ProductProt_r, PageIndex, PageSize, Total)}
+//	c.ServeJSON()
+//	return
+//}
+//
+//func (c *ProductProtController) Import() {
+//	// 验证 TOKEY
+//	T_uuid := lib.Take_one(c.Ctx.GetCookie("T_uuid"), c.GetString("T_uuid"))
+//
+//	if len(T_uuid) == 0 {
+//		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+//		c.ServeJSON()
+//		return
+//	}
+//
+//	ProductProt_r := Product.ProductProt{}
+//	c.ParseForm(&ProductProt_r)
+//
+//	if len(ProductProt_r.T_uuid) != 8 {
+//		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+//		c.ServeJSON()
+//		return
+//	}
+//
+//	// 获取上传的zip文件
+//	zipFile, _, err := c.GetFile("sozip")
+//	if err != nil {
+//		logs.Println("Error getting zip file:", err)
+//		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "没有找到 sozip !"}
+//		c.ServeJSON()
+//		return
+//	}
+//	defer zipFile.Close()
+//
+//	// 创建一个临时文件来保存上传的zip文件
+//	tempFile, err := os.Create(conf.Analysis_Dir + "temp.zip")
+//	if err != nil {
+//		logs.Println("Error creating temp file:", err)
+//		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "临时文件 无法创建 !"}
+//		c.ServeJSON()
+//		return
+//	}
+//
+//	// 将上传的zip文件内容复制到临时文件中
+//	_, err = io.Copy(tempFile, zipFile)
+//	if err != nil {
+//		logs.Println("Error copying zip file to temp file:", err)
+//		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "Copy!"}
+//		c.ServeJSON()
+//		return
+//	}
+//	tempFile.Close()
+//
+//	// 打开临时文件x
+//	zipReader, err := zip.OpenReader(conf.Analysis_Dir + "temp.zip")
+//	if err != nil {
+//		logs.Println("Error opening temp file:", err)
+//		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: err.Error()}
+//		c.ServeJSON()
+//		return
+//	}
+//	defer zipReader.Close()
+//
+//	// 解压文件
+//	for _, file := range zipReader.File {
+//		logs.Println("file.Name:", file.Name)
+//
+//		if file.Name == "ProductProt.json" {
+//			// 打开文件
+//			rc, err := file.Open()
+//			if err != nil {
+//				c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "file.Open!"}
+//				c.ServeJSON()
+//				return
+//			}
+//
+//			defer rc.Close()
+//			var contents strings.Builder
+//			_, err = io.Copy(&contents, rc)
+//			if err != nil {
+//				c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "file.Open!"}
+//				c.ServeJSON()
+//				return
+//			}
+//			logs.Println("contents:", contents.String())
+//
+//			// 处理JSON文件
+//			err = json.Unmarshal([]byte(contents.String()), &ProductProt_r)
+//
+//			// 处理jsonData,例如打印到控制台
+//			logs.Println("jsonData:", ProductProt_r)
+//		} else {
+//			// 检查文件是否存在
+//			if _, err := os.Stat(conf.Analysis_Dir + file.Name); !os.IsNotExist(err) {
+//				logs.Println("文件已经存在:", conf.Analysis_Dir+file.Name)
+//				continue
+//			}
+//			// 打开zip文件中的文件
+//			zippedFile, err := file.Open()
+//			if err != nil {
+//				logs.Println("Error opening zipped file:", err)
+//				c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "opening zipped file!"}
+//				c.ServeJSON()
+//				return
+//			}
+//			defer zippedFile.Close()
+//
+//			// 创建一个新文件来保存解压后的文件
+//			newFile, err := os.Create(conf.Analysis_Dir + file.Name)
+//			if err != nil {
+//				logs.Println("Error creating new file:", err)
+//				c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "Error creating new file!"}
+//				c.ServeJSON()
+//				return
+//			}
+//			defer newFile.Close()
+//
+//			// 将解压后的文件内容复制到新文件中
+//			_, err = io.Copy(newFile, zippedFile)
+//			if err != nil {
+//				logs.Println("Error copying zipped file to new file:", err)
+//				c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "io.Copy!"}
+//				c.ServeJSON()
+//				return
+//			}
+//		}
+//
+//	}
+//
+//	ProductProt_r.Id = 0
+//	ProductProt_r.T_uuid = T_uuid
+//	ProductProt_r.Add()
+//
+//	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: ProductProt_r}
+//	c.ServeJSON()
+//	return
+//}
+//
+//func (c *ProductProtController) Delete() {
+//	ProductProtr := Product.ProductProt{}
+//	T_uuid := lib.Take_one(c.Ctx.GetCookie("T_uuid"), c.GetString("T_uuid"))
+//
+//	c.ParseForm(&ProductProtr)
+//	if !ProductProtr.Read() {
+//		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "ID E!"}
+//		c.ServeJSON()
+//		return
+//	}
+//
+//	// 验证 TOKEY
+//	if ProductProtr.T_uuid != T_uuid {
+//		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+//		c.ServeJSON()
+//		return
+//	}
+//	if !ProductProtr.Delete() {
+//		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "E!"}
+//		c.ServeJSON()
+//		return
+//	}
+//
+//	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!"}
+//	c.ServeJSON()
+//	return
+//}

+ 198 - 0
controllers/ProductType.go

@@ -0,0 +1,198 @@
+package controllers
+
+import (
+	"AIOTCOER/conf"
+	"AIOTCOER/lib"
+	"AIOTCOER/models/Device"
+	"AIOTCOER/models/Product"
+	beego "github.com/beego/beego/v2/server/web"
+)
+
+type ProductTypeController struct {
+	beego.Controller
+}
+
+// *T_uuid  T_name
+func (c *ProductTypeController) List() {
+
+	PageIndex, _ := c.GetInt("PageIndex", 0)
+	PageSize, _ := c.GetInt("PageSize", 10)
+
+	ProductTyper := Product.ProductType{}
+	c.ParseForm(&ProductTyper)
+	ProductTyper.T_uuid = lib.Take_one(c.Ctx.GetCookie("T_uuid"), c.GetString("T_uuid"))
+
+	//// 验证 TOKEY
+	//if c.Ctx.Input.Host() != "127.0.0.1" {
+	if len(ProductTyper.T_uuid) == 0 {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+		c.ServeJSON()
+		return
+	}
+	//}
+
+	ProductType_r, Total := ProductTyper.Lists(PageIndex, PageSize)
+
+	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: lib.C_Page(ProductType_r, PageIndex, PageSize, Total)}
+	c.ServeJSON()
+	return
+}
+
+func (c *ProductTypeController) Get() {
+	ProductTyper := Product.ProductType{}
+	c.ParseForm(&ProductTyper)
+
+	if !ProductTyper.Read() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "ProductID E!"}
+		c.ServeJSON()
+		return
+	}
+
+	// 验证 T_uuid
+	T_uuid := lib.Take_one(c.Ctx.GetCookie("T_uuid"), c.GetString("T_uuid"))
+	if len(T_uuid) != 0 {
+
+		if ProductTyper.T_uuid != T_uuid {
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+			c.ServeJSON()
+			return
+		}
+		c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: ProductTyper}
+		c.ServeJSON()
+		return
+	}
+
+	ProductTyper_r := Product.ProductType_R{
+		T_name: ProductTyper.T_name,
+		T_panel: ProductTyper.T_panel,
+		T_TabDataJson: ProductTyper.T_TabDataJson,
+		CreateTime: ProductTyper.CreateTime,
+		UpdateTime: ProductTyper.UpdateTime,
+	}
+
+
+	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: ProductTyper_r}
+	c.ServeJSON()
+	return
+}
+
+//func (c *ProductTypeController) Add() {
+//	ProductType_r := Product.ProductType{}
+//	c.ParseForm(&ProductType_r)
+//
+//	if len(ProductType_r.T_uuid) != 8 {
+//		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+//		c.ServeJSON()
+//		return
+//	}
+//
+//	ProductType_r.T_ProductID = lib.GetRandstring(8, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 0)
+//	ProductType_r.T_akey = lib.GetRandstring(32, "", 0)
+//
+//	ProductType_r.Add()
+//
+//	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: ProductType_r}
+//	c.ServeJSON()
+//	return
+//}
+
+func (c *ProductTypeController) Update() {
+
+	T_ProductID := c.GetString("T_ProductID")
+
+	T_uuid := lib.Take_one(c.Ctx.GetCookie("T_uuid"), c.GetString("T_uuid"))
+	//logs.Println("T_uuid:",T_uuid)
+	// 验证 TOKEY
+	if len(T_uuid) == 0 {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+		c.ServeJSON()
+		return
+	}
+
+	if len(T_ProductID) == 0 {
+
+		if !conf.Config_AddProductType {
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "此服务节点负载过大,禁止添加新的产品,请选择其他节点添加!"}
+			c.ServeJSON()
+			return
+		}
+
+		ProductType_r := Product.ProductType{}
+		c.ParseForm(&ProductType_r)
+
+		ProductType_r.T_uuid = T_uuid
+		ProductType_r.T_ProductID = lib.GetRandstring(8, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 0)
+		ProductType_r.T_ProductKey = lib.GetRandstring(32, "", 0)
+		ProductType_r.T_state = 1
+
+		if len(ProductType_r.T_uuid) == 0 {
+			c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+			c.ServeJSON()
+			return
+		}
+
+		ProductType_r.Add()
+
+		c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: ProductType_r}
+		c.ServeJSON()
+		return
+	}
+
+	ProductTyper := Product.ProductType{T_ProductID: c.GetString("T_ProductID")}
+	if !ProductTyper.Read() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_ProductID E!"}
+		c.ServeJSON()
+		return
+	}
+
+	// 验证 TOKEY
+	if ProductTyper.T_uuid != T_uuid {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid !"}
+		c.ServeJSON()
+		return
+	}
+
+	c.ParseForm(&ProductTyper)
+
+	if !ProductTyper.Update("T_name","T_prot", "T_mode", "T_TabData") {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "E!"}
+		c.ServeJSON()
+		return
+	}
+
+	Device.Device_CacheDelK_All(ProductTyper.T_ProductID) // 删除 关联设备缓存
+	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!"}
+	c.ServeJSON()
+	return
+}
+
+func (c *ProductTypeController) Delete() {
+	ProductTyper := Product.ProductType{}
+	c.ParseForm(&ProductTyper)
+	T_uuid := lib.Take_one(c.Ctx.GetCookie("T_uuid"), c.GetString("T_uuid"))
+
+	if !ProductTyper.Read() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_ProductID E!"}
+		c.ServeJSON()
+		return
+	}
+
+	// 验证 TOKEY
+	if ProductTyper.T_uuid != T_uuid {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+		c.ServeJSON()
+		return
+	}
+
+	ProductTyper.T_state = 0
+	if !ProductTyper.Update("T_state") {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "E!"}
+		c.ServeJSON()
+		return
+	}
+
+	//Device.Device_CacheDelK_All(ProductTyper.T_ProductID) // 删除 关联设备缓存
+	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!"}
+	c.ServeJSON()
+	return
+}

+ 24 - 0
controllers/StatisticalData.go

@@ -0,0 +1,24 @@
+package controllers
+
+import (
+	"AIOTCOER/lib"
+	"AIOTCOER/models/StatisticalData"
+	beego "github.com/beego/beego/v2/server/web"
+)
+
+type StatisticalDataController struct {
+	beego.Controller
+}
+
+func (c *StatisticalDataController) FlowCountList() {
+	PageSize, err := c.GetInt("PageSize")
+	if err != nil {
+		PageSize = 1
+	}
+
+	StatisticalData_r := StatisticalData.FlowCountLists(c.GetString("T_ProductID"), PageSize)
+
+	c.Data["json"] = lib.JSONR{Code: lib.Success, Msg: "ok!", Data: StatisticalData_r}
+	c.ServeJSON()
+	return
+}

+ 42 - 0
controllers/System.go

@@ -0,0 +1,42 @@
+package controllers
+
+import (
+	"AIOTCOER/conf"
+	"AIOTCOER/lib"
+	"AIOTCOER/logs"
+	beego "github.com/beego/beego/v2/server/web"
+)
+
+type SystemController struct {
+	beego.Controller
+}
+
+// 列表 -
+func (c *SystemController) RunTime() {
+	lib.PullHandleTime.Mu.RLock()
+	c.Data["json"] = lib.JSONR{Code: 200, Msg: "ok!", Data: lib.PullHandleTime.Num}
+	lib.PullHandleTime.Mu.RUnlock()
+	c.ServeJSON()
+	return
+}
+// 列表 -
+func (c *SystemController) SystemConfig() {
+
+	if c.GetString("AdminTokey") != conf.Config_AdminTokey {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "AdminTokey E!"}
+		c.ServeJSON()
+		return
+	}
+
+	AddProduct, err := c.GetBool("AddProduct")
+	if err == nil {
+		conf.Config_AddProductType = AddProduct
+		logs.Println("Config_AddProductType",AddProduct)
+
+	}
+
+
+	c.Data["json"] = lib.JSONR{Code: 200, Msg: "ok!", Data: lib.PullHandleTime.Num}
+	c.ServeJSON()
+	return
+}

+ 39 - 0
controllers/UpFile.go

@@ -0,0 +1,39 @@
+package controllers
+
+import (
+	"AIOTCOER/lib"
+	"AIOTCOER/models/Product"
+	beego "github.com/beego/beego/v2/server/web"
+)
+
+type UpFileController struct {
+	beego.Controller
+}
+
+// 列表 -
+func (c *UpFileController) UpFileToken() {
+	ProductTyper := Product.ProductType{
+		T_ProductID:c.GetString("T_ProductID"),
+	}
+
+
+	if !ProductTyper.Read() {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "ProductID E!"}
+		c.ServeJSON()
+		return
+	}
+
+	// 验证 T_uuid
+	T_uuid := lib.Take_one(c.Ctx.GetCookie("T_uuid"), c.GetString("T_uuid"))
+
+	if ProductTyper.T_uuid != T_uuid {
+		c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
+		c.ServeJSON()
+		return
+	}
+
+
+	c.Data["json"] = lib.JSONR{Code: 200, Msg: "ok!", Data: lib.UploadToken(c.GetString("T_suffix"))}
+	c.ServeJSON()
+	return
+}

+ 54 - 0
controllers/Websocket.go

@@ -0,0 +1,54 @@
+package controllers
+
+import (
+	beego "github.com/beego/beego/v2/server/web"
+	"github.com/gorilla/websocket"
+	"time"
+)
+
+type MySocketController struct {
+	beego.Controller
+}
+
+var upgrader = websocket.Upgrader{
+	ReadBufferSize:   1024,
+	WriteBufferSize:  1024,
+	HandshakeTimeout: 10 * time.Second,
+}
+
+type RecvWs struct {
+	Type     int                    `json:"T_type"` // 必填  1 订阅SN数据   2 解绑SN数据   3 项设备发送数据
+	Sn       string                 `json:"T_sn"`   // 必填
+	Password string                 `json:"T_ckey"` // 必填
+	Json     map[string]interface{} `json:"T_json"` // Type == 3 时 必填
+}
+
+// NGINX 超时配置
+// proxy_connect_timeout 4s;
+// proxy_read_timeout 120s;
+// proxy_send_timeout 120s;
+func init() {
+	//go SubClinetsClear()
+}
+
+//循环清理
+//func SubClinetsClear() {
+//	for true {
+//		SubClinetsClearMap := make(map[*websocket.Conn]bool)
+//		time.Sleep(time.Second * 10)
+//		lib.SubClinets.Range(func(key, value interface{}) bool {
+//			ConnList := value.([]*websocket.Conn)
+//			Sn := key.(string)
+//			logs.Println("SubClinets|", Sn, len(ConnList))
+//			for _, v := range ConnList {
+//				if _,ok :=SubClinetsClearMap[v];!ok{
+//					logs.Println("Websocket 心跳|", fmt.Sprintf("%p", v))
+//					lib.WebsocketWriteJSON(v,"")
+//				}
+//			}
+//
+//			return true
+//		})
+//
+//	}
+//}

+ 65 - 0
go.mod

@@ -0,0 +1,65 @@
+module AIOTCOER
+
+go 1.19
+
+require (
+	github.com/astaxie/beego v1.12.3
+	github.com/beego/beego/v2 v2.0.1
+	github.com/go-sql-driver/mysql v1.6.0
+	github.com/gorilla/websocket v1.5.1
+	github.com/json-iterator/go v1.1.10
+	github.com/nats-io/nats-server/v2 v2.8.4
+	github.com/nats-io/nats.go v1.16.0
+	github.com/qiniu/go-sdk/v7 v7.18.2
+	github.com/robfig/cron/v3 v3.0.1
+	github.com/satori/go.uuid v1.2.0
+	github.com/thinkeridea/go-extend v1.3.2
+	github.com/vmihailenco/msgpack/v5 v5.4.0
+	github.com/yosssi/gmq v0.0.1
+	go.mongodb.org/mongo-driver v1.12.0
+	gogs.baozhida.cn/bzdadmin/YunIot_SDK v0.0.0-20231124090009-5e9cbcff9641
+	golang.org/x/text v0.13.0
+)
+
+require (
+	github.com/golang/protobuf v1.5.0 // indirect
+	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
+	github.com/modern-go/reflect2 v1.0.1 // indirect
+)
+
+require (
+	github.com/beorn7/perks v1.0.1 // indirect
+	github.com/cespare/xxhash/v2 v2.1.1 // indirect
+	github.com/golang/snappy v0.0.1 // indirect
+	github.com/gomodule/redigo v2.0.0+incompatible // indirect
+	github.com/hashicorp/golang-lru v0.5.4 // indirect
+	github.com/klauspost/compress v1.14.4 // indirect
+	github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
+	github.com/minio/highwayhash v1.0.2 // indirect
+	github.com/mitchellh/mapstructure v1.3.3 // indirect
+	github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
+	github.com/nats-io/jwt/v2 v2.2.1-0.20220330180145-442af02fd36a // indirect
+	github.com/nats-io/nkeys v0.3.0 // indirect
+	github.com/nats-io/nuid v1.0.1 // indirect
+	github.com/pkg/errors v0.9.1 // indirect
+	github.com/prometheus/client_golang v1.7.0 // indirect
+	github.com/prometheus/client_model v0.2.0 // indirect
+	github.com/prometheus/common v0.10.0 // indirect
+	github.com/prometheus/procfs v0.1.3 // indirect; indirectS
+	github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect
+	github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
+	github.com/xdg-go/pbkdf2 v1.0.0 // indirect
+	github.com/xdg-go/scram v1.1.2 // indirect
+	github.com/xdg-go/stringprep v1.0.4 // indirect
+	github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
+	golang.org/x/crypto v0.14.0 // indirect
+	golang.org/x/mod v0.8.0 // indirect
+	golang.org/x/net v0.17.0 // indirect
+	golang.org/x/sync v0.1.0 // indirect
+	golang.org/x/sys v0.13.0 // indirect
+	golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
+	golang.org/x/tools v0.6.0 // indirect
+	google.golang.org/protobuf v1.31.0 // indirect
+	gopkg.in/yaml.v2 v2.2.8 // indirect
+	gopkg.in/yaml.v3 v3.0.1 // indirect
+)

+ 393 - 0
go.sum

@@ -0,0 +1,393 @@
+cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
+github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
+github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
+github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
+github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
+github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
+github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk=
+github.com/astaxie/beego v1.12.3 h1:SAQkdD2ePye+v8Gn1r4X6IKZM1wd28EyUOVQ3PDSOOQ=
+github.com/astaxie/beego v1.12.3/go.mod h1:p3qIm0Ryx7zeBHLljmd7omloyca1s4yu1a8kM1FkpIA=
+github.com/beego/beego/v2 v2.0.1 h1:07a7Z0Ok5vbqyqh+q53sDPl9LdhKh0ZDy3gbyGrhFnE=
+github.com/beego/beego/v2 v2.0.1/go.mod h1:8zyHi1FnWO1mZLwTn62aKRIZF/aIKvkCBB2JYs+eqQI=
+github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ=
+github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU=
+github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
+github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
+github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
+github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
+github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60=
+github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE=
+github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
+github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
+github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
+github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
+github.com/coreos/etcd v3.3.25+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
+github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
+github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
+github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
+github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U=
+github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c=
+github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
+github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
+github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
+github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI=
+github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk=
+github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
+github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
+github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
+github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
+github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw=
+github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
+github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
+github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
+github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
+github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
+github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
+github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
+github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
+github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
+github.com/go-playground/validator/v10 v10.8.0/go.mod h1:9JhgTzTaE31GZDpH/HSvHiRJrJ3iKAgqqH0Bl/Ocjdk=
+github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
+github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg=
+github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
+github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
+github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
+github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
+github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
+github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
+github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
+github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
+github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
+github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
+github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
+github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
+github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
+github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0=
+github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
+github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
+github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
+github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
+github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
+github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
+github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
+github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
+github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
+github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
+github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
+github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
+github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
+github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
+github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
+github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
+github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
+github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
+github.com/klauspost/compress v1.14.4 h1:eijASRJcobkVtSt81Olfh7JX43osYLwy5krOJo6YEu4=
+github.com/klauspost/compress v1.14.4/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
+github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
+github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
+github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
+github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
+github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6/go.mod h1:n931TsDuKuq+uX4v1fulaMbA/7ZLLhjc85h7chZGBCQ=
+github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
+github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A=
+github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U=
+github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
+github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
+github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
+github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g=
+github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY=
+github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8=
+github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
+github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
+github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0=
+github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
+github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
+github.com/nats-io/jwt/v2 v2.2.1-0.20220330180145-442af02fd36a h1:lem6QCvxR0Y28gth9P+wV2K/zYUUAkJ+55U8cpS0p5I=
+github.com/nats-io/jwt/v2 v2.2.1-0.20220330180145-442af02fd36a/go.mod h1:0tqz9Hlu6bCBFLWAASKhE5vUA4c24L9KPUUgvwumE/k=
+github.com/nats-io/nats-server/v2 v2.8.4 h1:0jQzze1T9mECg8YZEl8+WYUXb9JKluJfCBriPUtluB4=
+github.com/nats-io/nats-server/v2 v2.8.4/go.mod h1:8zZa+Al3WsESfmgSs98Fi06dRWLH5Bnq90m5bKD/eT4=
+github.com/nats-io/nats.go v1.16.0 h1:zvLE7fGBQYW6MWaFaRdsgm9qT39PJDQoju+DS8KsO1g=
+github.com/nats-io/nats.go v1.16.0/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w=
+github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8=
+github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4=
+github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
+github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
+github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
+github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
+github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
+github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
+github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
+github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
+github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
+github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
+github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
+github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
+github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
+github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
+github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
+github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
+github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
+github.com/prometheus/client_golang v1.7.0 h1:wCi7urQOGBsYcQROHqpUUX4ct84xp40t9R9JX0FuA/U=
+github.com/prometheus/client_golang v1.7.0/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
+github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
+github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
+github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
+github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc=
+github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
+github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
+github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
+github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8=
+github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
+github.com/qiniu/dyn v1.3.0/go.mod h1:E8oERcm8TtwJiZvkQPbcAh0RL8jO1G0VXJMW3FAWdkk=
+github.com/qiniu/go-sdk/v7 v7.18.2 h1:vk9eo5OO7aqgAOPF0Ytik/gt7CMKuNgzC/IPkhda6rk=
+github.com/qiniu/go-sdk/v7 v7.18.2/go.mod h1:nqoYCNo53ZlGA521RvRethvxUDvXKt4gtYXOwye868w=
+github.com/qiniu/x v1.10.5/go.mod h1:03Ni9tj+N2h2aKnAz+6N0Xfl8FwMEDRC2PAlxekASDs=
+github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
+github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
+github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
+github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
+github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
+github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
+github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
+github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
+github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo=
+github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
+github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
+github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s=
+github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA=
+github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
+github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
+github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
+github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
+github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
+github.com/thinkeridea/go-extend v1.3.2 h1:0ZImRXpJc+wBNIrNEMbTuKwIvJ6eFoeuNAewvzONrI0=
+github.com/thinkeridea/go-extend v1.3.2/go.mod h1:xqN1e3y1PdVSij1VZp6iPKlO8I4jLbS8CUuTySj981g=
+github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
+github.com/vmihailenco/msgpack/v5 v5.4.0 h1:hRM0digJwyR6vll33NNAwCFguy5JuBD6jxDmQP3l608=
+github.com/vmihailenco/msgpack/v5 v5.4.0/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
+github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
+github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
+github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
+github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
+github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
+github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
+github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
+github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8=
+github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
+github.com/yosssi/gmq v0.0.1 h1:GhlDVaAQoi3Mvjul/qJXXGfL4JBeE0GQwbWp3eIsja8=
+github.com/yosssi/gmq v0.0.1/go.mod h1:mReykazh0U1JabvuWh1PEbzzJftqOQWsjr0Lwg5jL1Y=
+github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA=
+github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
+github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
+github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
+github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU=
+go.etcd.io/etcd v3.3.25+incompatible/go.mod h1:yaeTdrJi5lOmYerz05bd8+V7KubZs8YSFZfzsF9A6aI=
+go.mongodb.org/mongo-driver v1.12.0 h1:aPx33jmn/rQuJXPQLZQ8NtfPQG8CaqgLThFtqRb0PiE=
+go.mongodb.org/mongo-driver v1.12.0/go.mod h1:AZkxhPnFJUoH7kZlFkVKucV20K387miPfm7oimrSmK0=
+go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
+go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
+go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
+go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
+gogs.baozhida.cn/bzdadmin/YunIot_SDK v0.0.0-20231124090009-5e9cbcff9641 h1:iCxW1s8Vne1rAmMd0CEnD6FJnBsDpiYJHWdqFnkhb3U=
+gogs.baozhida.cn/bzdadmin/YunIot_SDK v0.0.0-20231124090009-5e9cbcff9641/go.mod h1:fo7CpR6Wuck5EQyj6EBaVoh3Ht+JIE4QjaR6ii+IUcM=
+golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
+golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
+golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
+golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
+golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
+golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
+golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
+golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
+golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
+golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
+golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
+golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
+golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
+golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
+golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
+golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
+golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
+golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
+golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
+golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
+golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
+golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
+golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
+golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
+golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
+golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
+golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
+golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
+golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 h1:GZokNIeuVkl3aZHJchRrr13WCsols02MLUcz1U9is6M=
+golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
+golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20201211185031-d93e913c1a58/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
+golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
+golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
+golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
+google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
+google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
+google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
+google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
+google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
+google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
+google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
+google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
+google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
+gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
+gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
+gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
+gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
+gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
+gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
+gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
+honnef.co/go/tools v0.0.1-2020.1.5/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=

+ 1 - 0
lastupdate.tmp

@@ -0,0 +1 @@
+{"C:\\BZD\\PaaS\\Alot\\AIOT-coer\\controllers":1712047425792512100}

+ 61 - 0
lib/Aes.go

@@ -0,0 +1,61 @@
+package lib
+
+import (
+	"bytes"
+	"crypto/aes"
+	"crypto/cipher"
+	"encoding/base64"
+)
+
+func AesEncryptCBC(orig string, key string) string {
+	// 转成字节数组
+	origData := []byte(orig)
+	k := []byte(key)
+	// 分组秘钥
+	// NewCipher该函数限制了输入k的长度必须为16, 24或者32
+	block, _ := aes.NewCipher(k)
+	// 获取秘钥块的长度
+	blockSize := block.BlockSize()
+	// 补全码
+	origData = PKCS7Padding(origData, blockSize)
+	// 加密模式
+	blockMode := cipher.NewCBCEncrypter(block, k[:blockSize])
+	// 创建数组
+	cryted := make([]byte, len(origData))
+	// 加密
+	blockMode.CryptBlocks(cryted, origData)
+	return base64.StdEncoding.EncodeToString(cryted)
+}
+func AesDecryptCBC(cryted string, key string) string {
+	// 转成字节数组
+	crytedByte, _ := base64.StdEncoding.DecodeString(cryted)
+	k := []byte(key)
+	// 分组秘钥
+	block, _ := aes.NewCipher(k)
+	// 获取秘钥块的长度
+	blockSize := block.BlockSize()
+	// 加密模式
+	blockMode := cipher.NewCBCDecrypter(block, k[:blockSize])
+	// 创建数组
+	orig := make([]byte, len(crytedByte))
+	// 解密
+	blockMode.CryptBlocks(orig, crytedByte)
+	// 去补全码
+	orig = PKCS7UnPadding(orig)
+	return string(orig)
+}
+
+// 补码
+// AES加密数据块分组长度必须为128bit(byte[16]),密钥长度可以是128bit(byte[16])、192bit(byte[24])、256bit(byte[32])中的任意一个。
+func PKCS7Padding(ciphertext []byte, blocksize int) []byte {
+	padding := blocksize - len(ciphertext)%blocksize
+	padtext := bytes.Repeat([]byte{byte(padding)}, padding)
+	return append(ciphertext, padtext...)
+}
+
+// 去码
+func PKCS7UnPadding(origData []byte) []byte {
+	length := len(origData)
+	unpadding := int(origData[length-1])
+	return origData[:(length - unpadding)]
+}

+ 44 - 0
lib/DownloadSo.go

@@ -0,0 +1,44 @@
+package lib
+
+import (
+	"AIOTCOER/conf"
+	"AIOTCOER/logs"
+	"io"
+	"net/http"
+	"os"
+)
+
+var url = "https://yunlot.baozhida.cn/API/RunCode/Download?T_describe="
+
+func DownloadSo(T_analysis string) {
+	//url := "http://example.com/file.txt"
+
+	// 检查文件是否存在
+	if _, err := os.Stat(conf.Analysis_Dir + T_analysis + ".so"); os.IsNotExist(err) {
+		logs.PrintlnError("File does not exist.")
+	} else {
+		return
+	}
+
+	resp, err := http.Get(url + T_analysis)
+	if err != nil {
+		logs.PrintlnError("Error downloading file:", err)
+		return
+	}
+	defer resp.Body.Close()
+
+	out, err := os.Create(conf.Analysis_Dir + T_analysis + ".so")
+	if err != nil {
+		logs.PrintlnError("Error creating file:", err)
+		return
+	}
+	defer out.Close()
+
+	_, err = io.Copy(out, resp.Body)
+	if err != nil {
+		logs.PrintlnError("Error downloading file:", err)
+		return
+	}
+
+	logs.Println("File downloaded successfully.")
+}

+ 58 - 0
lib/MinuteToDataTime.go

@@ -0,0 +1,58 @@
+package lib
+
+import (
+	"strconv"
+)
+
+/*
+时间常量
+*/
+const (
+	//定义每分钟的秒数
+	SecondsPerMinute = 60
+	//定义每小时的秒数
+	SecondsPerHour = SecondsPerMinute * 60
+	//定义每天的秒数
+	SecondsPerDay = SecondsPerHour * 24
+)
+
+/*
+时间转换函数
+*/
+func resolveTime(seconds int) (day int, hour int, minute int, second int) {
+	//秒
+	second = seconds % 60
+
+	//天
+	day = seconds / SecondsPerDay
+	seconds -= day * SecondsPerDay
+
+	//时
+	hour = seconds / SecondsPerHour
+	seconds -= hour * SecondsPerHour
+
+	//分
+	minute = seconds / SecondsPerMinute
+	seconds -= minute * SecondsPerHour
+
+	return
+}
+
+func MinuteToDataTime(t int) string {
+	str := ""
+	day, hour, minute, second := resolveTime(t)
+	if day > 0 {
+		str += strconv.Itoa(day) + "天 "
+	}
+	if hour > 0 {
+		str += strconv.Itoa(hour) + "小时 "
+	}
+	if minute > 0 {
+		str += strconv.Itoa(minute) + "分钟 "
+	}
+	if second > 0 {
+		str += strconv.Itoa(second) + "秒"
+	}
+
+	return str
+}

+ 41 - 0
lib/Qiniu.go

@@ -0,0 +1,41 @@
+package lib
+
+// 存储相关功能的引入包只有这两个,后面不再赘述
+
+// 存储相关功能的引入包只有这两个,后面不再赘述
+import (
+	"AIOTCOER/conf"
+	"github.com/qiniu/go-sdk/v7/auth/qbox"
+	"github.com/qiniu/go-sdk/v7/storage"
+	uuid "github.com/satori/go.uuid"
+	"strconv"
+	"time"
+)
+
+var Qiniu *qbox.Mac
+
+func init() {
+	Qiniu = qbox.NewMac(conf.Qiniu_AccessKey, conf.Qiniu_SecretKey)
+}
+
+func UploadToken(T_suffix string) string {
+	Tokey := strconv.FormatInt(time.Now().Unix(), 10) + uuid.NewV4().String()
+	if len(T_suffix) == 0 {
+		T_suffix = "png"
+	}
+	putPolicy := storage.PutPolicy{
+		Scope:      conf.Qiniu_BUCKET,
+		InsertOnly: 1,    // 仅能以新增模式上传文件。
+		Expires:    7200, //示例2小时有效期
+		ReturnBody: `{"key":"` + conf.Qiniu_Url + `/$(key)","hash":"$(etag)","fsize":$(fsize),"bucket":"$(bucket)"}`,
+		//{"key":"github-x.png","hash":"FqKXVdTvIx_mPjOYdjDyUSy_H1jr","fsize":6091,"bucket":"if-pbl","name":"github logo"}
+		//{"key":"` + conf.Oss + `/$(key)","hash":"$(etag)","fsize":$(fsize),"bucket":"$(bucket)","name":"$(x:name)"}
+		ForceSaveKey: true,
+		SaveKey:      "UpOTA/" + Tokey + "." + T_suffix,
+		//FsizeLimit:   1024 * 1024 * 1,
+		//MimeLimit: "image/*;application/*;",
+	}
+
+	upToken := putPolicy.UploadToken(Qiniu)
+	return upToken
+}

+ 97 - 0
lib/SubClinets.go

@@ -0,0 +1,97 @@
+package lib
+
+import (
+	"AIOTCOER/logs"
+	"encoding/json"
+	"fmt"
+	"github.com/beego/beego/v2/server/web/context"
+	"github.com/gorilla/websocket"
+
+	"sync"
+
+)
+
+var WsSubClinets sync.Map // 订阅Map
+var SseSubClinets sync.Map // 订阅Map
+var SseLogSubClinets sync.Map // 订阅Map
+
+// 清楚订阅
+func ClearSubscription(client *websocket.Conn) {
+	logs.Println("清楚订阅:", fmt.Sprintf("%p", client))
+	// 编列所有订阅号
+	WsSubClinets.Range(func(key, value interface{}) bool {
+		ConnList := value.([]*websocket.Conn)
+		Sn := key.(string)
+		logs.Println("SubClinets_数量|", Sn, len(ConnList))
+		for i, v := range ConnList {
+			if v == client {
+				fmt.Println("删除订阅:", fmt.Sprintf("%p", v), Sn)
+				ConnList = append(ConnList[:i], ConnList[i+1:]...)
+				WsSubClinets.Store(Sn, ConnList)
+				break
+			}
+		}
+
+		return true
+	})
+}
+
+// 发送 数据
+func WebsocketWriteJSON(client *websocket.Conn, msg interface{}) error {
+	err := client.WriteJSON(msg)
+	if err != nil {
+		ClearSubscription(client) // 清楚订阅
+		client.Close()
+	}
+	return nil
+}
+
+func WebsocketSubscribeSendAll(Sn string, json_r map[string]interface{}) {
+
+	val, ok := WsSubClinets.Load(Sn)
+	if ok {
+		json_r_ws := CopyMap(json_r)
+		json_r_ws["T_sn"] = Sn
+		SubConn := val.([]*websocket.Conn)
+		for _, v := range SubConn {
+			WebsocketWriteJSON(v, json_r_ws)
+		}
+	}
+}
+
+
+
+// 发送 数据
+func SseWriteJSON(client *context.Response, msg []byte) error {
+
+	// Send data to the client
+	client.Write(append(append([]byte("data: "), msg...), []byte("\n\n")...))
+	//client.Write([]byte("\n"))
+
+	// Flush the response writer to send the data immediately
+	client.Flush()
+
+	return nil
+}
+func SseSubscribeSendAll(Sn string, json_r map[string]interface{}) {
+	val, ok := SseSubClinets.Load(Sn)
+	if ok {
+		json_r_ws_data, _ := json.Marshal(json_r)
+		SubConn := val.([]*context.Response)
+		for _, v := range SubConn {
+			SseWriteJSON(v, json_r_ws_data)
+		}
+	}
+}
+
+func SseLogSubscribeSendAll(Sn string, json_r []string) {
+	val, ok := SseLogSubClinets.Load(Sn)
+	if ok {
+		json_r_ws_data, _ := json.Marshal(json_r)
+		SubConn := val.([]*context.Response)
+		for _, v := range SubConn {
+			SseWriteJSON(v, json_r_ws_data)
+		}
+	}
+}
+

+ 715 - 0
lib/lib.go

@@ -0,0 +1,715 @@
+package lib
+
+import (
+	"AIOTCOER/logs"
+	"bytes"
+	"crypto/sha256"
+	"encoding/hex"
+	"encoding/json"
+	"fmt"
+	"github.com/nats-io/nats.go"
+	"github.com/thinkeridea/go-extend/exunicode/exutf8"
+	"go.mongodb.org/mongo-driver/bson"
+	"golang.org/x/text/encoding/simplifiedchinese"
+	"golang.org/x/text/transform"
+	"io/ioutil"
+	"math/rand"
+	"reflect"
+	"runtime"
+	"strconv"
+	"strings"
+	"sync"
+	"time"
+	"unicode/utf8"
+)
+
+var Nats *nats.Conn
+
+type SingleMutex struct {
+	Mu sync.RWMutex
+	Num int64
+}
+
+var PullHandleTime SingleMutex
+//耗时统计函数
+func (c *SingleMutex) TimeCost(start time.Time){
+	c.Mu.Lock()
+	c.Num = time.Since(start).Milliseconds()
+	c.Mu.Unlock()
+}
+
+func init() {
+
+}
+
+const Success = 200
+const Error = 201
+
+type JSONR struct {
+	//必须的大写开头
+	Code int16
+	Msg  string
+	Data interface{} // 泛型
+}
+type JSONS struct {
+	//必须的大写开头
+	Code      int16
+	Msg       string
+	List      interface{}
+	Total     int16
+	PageIndex int
+	PageSize  int
+}
+
+func C_Page(list interface{}, PageIndex, PageSize int, Total int64) (Jsons JSONS) {
+	Jsons.List = list
+	Jsons.Total = int16(Total)
+	Jsons.PageIndex = PageIndex
+	Jsons.PageSize = PageSize
+	//Jsons.PageSize = int16(math.Ceil(float64(Total) / float64(PageSize)))
+	return Jsons
+}
+
+func Strval(value interface{}) string {
+	var key string
+	if value == nil {
+		return key
+	}
+
+	switch value.(type) {
+	case float64:
+		ft := value.(float64)
+		key = strconv.FormatFloat(ft, 'f', -1, 64)
+	case float32:
+		ft := value.(float32)
+		key = strconv.FormatFloat(float64(ft), 'f', -1, 64)
+	case int:
+		it := value.(int)
+		key = strconv.Itoa(it)
+	case uint:
+		it := value.(uint)
+		key = strconv.Itoa(int(it))
+	case int8:
+		it := value.(int8)
+		key = strconv.Itoa(int(it))
+	case uint8:
+		it := value.(uint8)
+		key = strconv.Itoa(int(it))
+	case int16:
+		it := value.(int16)
+		key = strconv.Itoa(int(it))
+	case uint16:
+		it := value.(uint16)
+		key = strconv.Itoa(int(it))
+	case int32:
+		it := value.(int32)
+		key = strconv.Itoa(int(it))
+	case uint32:
+		it := value.(uint32)
+		key = strconv.Itoa(int(it))
+	case int64:
+		it := value.(int64)
+		key = strconv.FormatInt(it, 10)
+	case uint64:
+		it := value.(uint64)
+		key = strconv.FormatUint(it, 10)
+	case string:
+		key = value.(string)
+	case []byte:
+		key = string(value.([]byte))
+	default:
+		newValue, _ := json.Marshal(value)
+		key = string(newValue)
+	}
+
+	return key
+}
+
+// 取一个
+func Take_one(a, b string) string {
+	if len(a) == 0 {
+		return b
+	}
+	return a
+}
+
+func To_int(value interface{}) int {
+	var key int
+	if value == nil {
+		return key
+	}
+	switch value.(type) {
+	case float64:
+		key = int(value.(float64))
+	case float32:
+		key = int(value.(float32))
+	case int:
+		key = int(value.(int))
+	case uint:
+		key = int(value.(uint))
+	case int8:
+		key = int(value.(int8))
+	case uint8:
+		key = int(value.(uint8))
+	case int16:
+		key = int(value.(int16))
+	case uint16:
+		key = int(value.(uint16))
+	case int32:
+		key = int(value.(int32))
+	case uint32:
+		key = int(value.(uint32))
+	case int64:
+		key = int(value.(int64))
+	case uint64:
+		key = int(value.(uint64))
+	case string:
+		key, _ = strconv.Atoi(value.(string))
+	case []byte:
+		key, _ = strconv.Atoi(string(value.([]byte)))
+	default:
+		newValue, _ := json.Marshal(value)
+		key, _ = strconv.Atoi(string(newValue))
+	}
+	return key
+}
+func To_int64(value interface{}) int64 {
+	var key int64
+	if value == nil {
+		return key
+	}
+	switch value.(type) {
+	case float64:
+		key = int64(value.(float64))
+	case float32:
+		key = int64(value.(float32))
+	case int:
+		key = int64(value.(int))
+	case uint:
+		key = int64(value.(uint))
+	case int8:
+		key = int64(value.(int8))
+	case uint8:
+		key = int64(value.(uint8))
+	case int16:
+		key = int64(value.(int16))
+	case uint16:
+		key = int64(value.(uint16))
+	case int32:
+		key = int64(value.(int32))
+	case uint32:
+		key = int64(value.(uint32))
+	case int64:
+		key = int64(value.(int64))
+	case uint64:
+		key = int64(value.(uint64))
+	case string:
+		key, _ = strconv.ParseInt(value.(string), 10, 64)
+	case []byte:
+		key, _ = strconv.ParseInt(string(value.([]byte)), 10, 64)
+	default:
+		newValue, _ := json.Marshal(value)
+		key, _ = strconv.ParseInt(string(newValue), 10, 64)
+	}
+	return key
+}
+
+func To_float32(value interface{}) float32 {
+	var key float32
+	if value == nil {
+		return key
+	}
+
+	switch value.(type) {
+	case float64:
+		key = float32(value.(float64))
+	case float32:
+		key = float32(value.(float32))
+	case int:
+		key = float32(value.(int))
+	case uint:
+		key = float32(value.(uint))
+	case int8:
+		key = float32(value.(int8))
+	case uint8:
+		key = float32(value.(uint8))
+	case int16:
+		key = float32(value.(int16))
+	case uint16:
+		key = float32(value.(uint16))
+	case int32:
+		key = float32(value.(int32))
+	case uint32:
+		key = float32(value.(uint32))
+	case int64:
+		key = float32(value.(int64))
+	case uint64:
+		key = float32(value.(uint64))
+	case string:
+		key_float64, _ := strconv.ParseFloat(value.(string), 32/64)
+		key = float32(key_float64)
+	case []byte:
+		key_float64, _ := strconv.ParseFloat(string(value.([]byte)), 32/64)
+		key = float32(key_float64)
+	default:
+		newValue, _ := json.Marshal(value)
+		key_float64, _ := strconv.ParseFloat(string(newValue), 32/64)
+		key = float32(key_float64)
+	}
+
+	key_float64, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", key), 32/64)
+	key = float32(key_float64)
+
+	return key
+}
+
+func To_string(value interface{}) string {
+	var key string
+	if value == nil {
+		return key
+	}
+
+	switch value.(type) {
+	case float64:
+		ft := value.(float64)
+		key = strconv.FormatFloat(ft, 'f', -1, 64)
+	case float32:
+		ft := value.(float32)
+		key = strconv.FormatFloat(float64(ft), 'f', -1, 64)
+	case int:
+		it := value.(int)
+		key = strconv.Itoa(it)
+	case uint:
+		it := value.(uint)
+		key = strconv.Itoa(int(it))
+	case int8:
+		it := value.(int8)
+		key = strconv.Itoa(int(it))
+	case uint8:
+		it := value.(uint8)
+		key = strconv.Itoa(int(it))
+	case int16:
+		it := value.(int16)
+		key = strconv.Itoa(int(it))
+	case uint16:
+		it := value.(uint16)
+		key = strconv.Itoa(int(it))
+	case int32:
+		it := value.(int32)
+		key = strconv.Itoa(int(it))
+	case uint32:
+		it := value.(uint32)
+		key = strconv.Itoa(int(it))
+	case int64:
+		it := value.(int64)
+		key = strconv.FormatInt(it, 10)
+	case uint64:
+		it := value.(uint64)
+		key = strconv.FormatUint(it, 10)
+	case string:
+		key = value.(string)
+	case []byte:
+		key = string(value.([]byte))
+	default:
+		newValue, _ := json.Marshal(value)
+		key = string(newValue)
+	}
+	return key
+}
+
+func Random(min, max int) int {
+	rand.Seed(time.Now().Unix()) //Seed生成的随机数
+	return rand.Intn(max-min) + min
+}
+
+// 取文本(字符串)中间
+func GetBetweenStr(str, start, end string) string {
+	n := strings.Index(str, start)
+	if n == -1 {
+		n = 0
+	} else {
+		n = n + len(start) // 增加了else,不加的会把start带上
+	}
+	str = string([]byte(str)[n:])
+	m := strings.Index(str, end)
+	if m == -1 {
+		m = len(str)
+	}
+	str = string([]byte(str)[:m])
+	return str
+}
+
+// getYearMonthToDay 查询指定年份指定月份有多少天
+// @params year int 指定年份
+// @params month int 指定月份
+func GetYearMonthToDay(year int, month int) int {
+	// 有31天的月份
+	day31 := map[int]bool{
+		1:  true,
+		3:  true,
+		5:  true,
+		7:  true,
+		8:  true,
+		10: true,
+		12: true,
+	}
+	if day31[month] == true {
+		return 31
+	}
+	// 有30天的月份
+	day30 := map[int]bool{
+		4:  true,
+		6:  true,
+		9:  true,
+		11: true,
+	}
+	if day30[month] == true {
+		return 30
+	}
+	// 计算是平年还是闰年
+	if (year%4 == 0 && year%100 != 0) || year%400 == 0 {
+		// 得出2月的天数
+		return 29
+	}
+	// 得出2月的天数
+	return 28
+}
+
+func Decimal(value float64) float64 {
+	value, _ = strconv.ParseFloat(fmt.Sprintf("%.1f", value), 64)
+	return value
+}
+
+func Strconv_Atoi(string string) int {
+	int, _ := strconv.Atoi(string)
+	return int
+}
+
+// 获取正在运行的函数名
+func FuncName() string {
+	pc := make([]uintptr, 1)
+	runtime.Callers(2, pc)
+	f := runtime.FuncForPC(pc[0])
+	return f.Name()
+}
+
+func Limit_len(str string, lenx int) string {
+	if utf8.RuneCountInString(str) > lenx {
+		return exutf8.RuneSubString(str, 0, lenx-3) + "..."
+	}
+	return exutf8.RuneSubString(str, 0, lenx)
+}
+
+func Utf8ToGbk(s []byte) ([]byte, error) {
+	reader := transform.NewReader(bytes.NewReader(s), simplifiedchinese.GBK.NewEncoder())
+	d, e := ioutil.ReadAll(reader)
+	if e != nil {
+		return nil, e
+	}
+	return d, nil
+}
+
+// #取得随机字符串:通过打乱slice来操作
+func GetRandstring(length int, char string, rand_x int64) string {
+	if length < 1 {
+		return ""
+	}
+
+	if len(char) <= 6 || len(char) <= length {
+		char = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+	}
+
+	charArr := strings.Split(char, "")
+	ran := rand.New(rand.NewSource(time.Now().Unix() + rand_x))
+
+	l := len(charArr)
+	for i := l - 1; i > 0; i-- {
+		r := ran.Intn(i)
+		charArr[r], charArr[i] = charArr[i], charArr[r]
+	}
+	rchar := charArr[:length]
+	return strings.Join(rchar, "")
+}
+
+// Sha256加密
+func Sha256(src string) string {
+	m := sha256.New()
+	m.Write([]byte(src))
+	res := hex.EncodeToString(m.Sum(nil))
+	return res
+}
+
+// 判断时间是当年的第几周
+func WeekByDate() string {
+	t := time.Now()
+	yearDay := t.YearDay()
+	yearFirstDay := t.AddDate(0, 0, -yearDay+1)
+	firstDayInWeek := int(yearFirstDay.Weekday())
+
+	//今年第一周有几天
+	firstWeekDays := 1
+	if firstDayInWeek != 0 {
+		firstWeekDays = 7 - firstDayInWeek + 1
+	}
+	var week int
+	if yearDay <= firstWeekDays {
+		week = 1
+	} else {
+		week = (yearDay-firstWeekDays)/7 + 2
+	}
+	return fmt.Sprintf("%d%02d", t.Year(), week) // 202253
+}
+
+// 获取json指定参数   [AAAA BBBB],0,JSON    !!!如果失败,返回已找到的全部json
+func Json_key(topicNameList []string, topicNameI int, articleSlide map[string]interface{}) interface{} {
+	if len(topicNameList) > topicNameI {
+		a, is := articleSlide[topicNameList[topicNameI]]
+		if !is {
+			return articleSlide
+		}
+		if reflect.TypeOf(a).String() == "map[string]interface {}" {
+			return Json_key(topicNameList, topicNameI+1, a.(map[string]interface{}))
+		}
+	}
+
+	if len(topicNameList) == topicNameI {
+		return articleSlide
+	}
+
+	return articleSlide[topicNameList[topicNameI]]
+}
+
+// 导出map到文件
+func MapToFile(data map[string]map[string]string, filePath string) error {
+	jsonData, err := json.Marshal(data)
+	if err != nil {
+		return err
+	}
+	err = ioutil.WriteFile(filePath, jsonData, 0644)
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+// 从文件中导入map数据
+func MapFromFile(filePath string) map[string]map[string]string {
+	jsonData, err := ioutil.ReadFile(filePath)
+	if err != nil {
+		return nil
+	}
+	var importedMap map[string]map[string]string
+	err = json.Unmarshal(jsonData, &importedMap)
+	if err != nil {
+		logs.PrintlnError("Error unmarshalling JSON:", err)
+		return nil
+	}
+	return importedMap
+}
+
+func Hande_Tab_Tfilter(ArticleSlide []map[string]interface{}, JointTab string, t_map *[]string) {
+
+	for _, value := range ArticleSlide {
+		// 存在下一级
+		if len(JointTab) == 0 || len(value["children"].([]interface{})) != 0 {
+			key := JointTab + value["T_tab"].(string)
+			if value["T_filter"] == nil {
+				continue
+			}
+			if reflect.TypeOf(value["T_filter"]).String() != "bool" {
+				continue
+			}
+			key_v := value["T_filter"].(bool)
+			if key_v {
+				//(*t_map)[key] = key_v
+				(*t_map) = append((*t_map), key)
+			}
+			if len(value["children"].([]interface{})) != 0 {
+				var valuex_map []map[string]interface{}
+				for _, valuex := range value["children"].([]interface{}) {
+					if reflect.TypeOf(valuex).String() == "map[string]interface {}" {
+						valuex_map = append(valuex_map, valuex.(map[string]interface{}))
+					}
+				}
+				Hande_Tab_Tfilter(valuex_map, key+".", t_map)
+			}
+		}
+	}
+}
+
+func Hande_Tab_Trenew(ArticleSlide []map[string]interface{}, JointTab string, t_map *[]string) {
+
+	for _, value := range ArticleSlide {
+		// 存在下一级
+
+		key := JointTab + value["T_tab"].(string)
+		if len(value["children"].([]interface{})) != 0 {
+			var valuex_map []map[string]interface{}
+			for _, valuex := range value["children"].([]interface{}) {
+				if reflect.TypeOf(valuex).String() == "map[string]interface {}" {
+					valuex_map = append(valuex_map, valuex.(map[string]interface{}))
+				}
+			}
+			Hande_Tab_Trenew(valuex_map, key+".", t_map)
+		}
+		if value["T_renew"] == nil {
+			continue
+		}
+		if reflect.TypeOf(value["T_renew"]).String() != "bool" {
+			continue
+		}
+		key_v := value["T_renew"].(bool)
+		if key_v {
+			//(*t_map)[key] = key_v
+			(*t_map) = append((*t_map), key)
+		}
+
+	}
+}
+func Hande_Tab_Tsave(ArticleSlide []map[string]interface{}, JointTab string, t_map *map[string]int) {
+
+	for _, value := range ArticleSlide {
+		// 存在下一级
+		if len(JointTab) == 0 || len(value["children"].([]interface{})) != 0 {
+			key := JointTab + value["T_tab"].(string)
+			if value["T_save"] == nil {
+				continue
+			}
+			key_v := To_int(value["T_save"])
+			if key_v > 0 {
+				(*t_map)[key] = key_v
+			}
+			if len(value["children"].([]interface{})) != 0 {
+				var valuex_map []map[string]interface{}
+				for _, valuex := range value["children"].([]interface{}) {
+					if reflect.TypeOf(valuex).String() == "map[string]interface {}" {
+						valuex_map = append(valuex_map, valuex.(map[string]interface{}))
+					}
+				}
+				Hande_Tab_Tsave(valuex_map, key+".", t_map)
+			}
+		}
+	}
+}
+
+// 通过 "aa.bb.cc"  获取map指定参数
+func GetMapRecursion(str string, nestedMap map[string]interface{}) interface{} {
+	keys := strings.Split(str, ".")
+	result := nestedMap
+	for _, key := range keys {
+		if value, ok := result[key]; ok {
+			switch reflect.TypeOf(value).String() {
+			case "map[string]interface {}":
+				result = value.(map[string]interface{})
+				break
+			default:
+				return value
+			}
+
+		} else {
+			logs.Println("Key not found")
+			return nil
+		}
+	}
+	return result
+}
+
+// 将 时间格式为 bson.M 时间格式
+func MongdbJsonHtime(ArticleSlide bson.M) bson.M {
+	bson_M := bson.M{}
+	for key, value := range ArticleSlide {
+		//logs.Println(reflect.TypeOf(value).String())
+		switch reflect.TypeOf(value).String() {
+		case "map[string]interface {}":
+			jsonFind_M := bson.M{}
+			data, _ := json.Marshal(value.(map[string]interface{}))
+			err := json.Unmarshal(data, &jsonFind_M)
+			if err == nil {
+				bson_M[key] = MongdbJsonHtime(jsonFind_M)
+			}
+
+			break
+		case "[]interface {}":
+			bson_M_list := []bson.M{}
+			for _, valuex := range value.([]interface{}) {
+				if reflect.TypeOf(valuex).String() == "map[string]interface {}" {
+					jsonFind_M := bson.M{}
+					data, _ := json.Marshal(valuex.(map[string]interface{}))
+					err := json.Unmarshal(data, &jsonFind_M)
+					if err == nil {
+						bson_M_list = append(bson_M_list, MongdbJsonHtime(jsonFind_M))
+					}
+				}
+			}
+			bson_M[key] = bson_M_list
+			//return json_r
+			break
+		default:
+			t1, err := time.ParseInLocation("2006-01-02 15:04:05", value.(string), time.Local) // +8  时差
+			if err == nil {
+				bson_M[key] = t1
+			} else {
+				bson_M[key] = value
+			}
+
+			break
+		}
+	}
+
+	return bson_M
+}
+
+// 判断字符串是否在数组中
+func StringExistsInSlice(str string, slice []string) bool {
+	for _, s := range slice {
+		if s == str {
+			return true
+		}
+	}
+	return false
+}
+
+// 获取 JSON 指定位置  field : "AAA.BBB.d_name"
+func JsonGetField(data map[string]interface{}, field string) interface{} {
+	fields := strings.Split(field, ".")
+	result := data
+	for _, f := range fields {
+		if val, ok := result[f]; ok {
+			switch val.(type) {
+			case map[string]interface{}:
+				result = val.(map[string]interface{})
+			default:
+				return val
+			}
+		} else {
+			return nil
+		}
+	}
+	return result
+}
+
+// 获取 JSON 指定位置 data:修改的field必须存在  field : "AAA.BBB.d_name"   value: 123
+func JsonSetField(data map[string]interface{}, field string, value interface{}) {
+	fields := strings.Split(field, ".")
+	current := data
+	for i, fieldv := range fields {
+		if i == len(fields)-1 {
+			current[fieldv] = value
+		} else {
+			next, ok := current[fieldv].(map[string]interface{})
+			if !ok {
+				return
+			}
+			current = next
+		}
+	}
+}
+
+// 复制一份 Map
+func CopyMap(inputMap map[string]interface{}) map[string]interface{} {
+	copiedMap := make(map[string]interface{})
+	for key, value := range inputMap {
+		copiedMap[key] = value
+	}
+	return copiedMap
+}

+ 0 - 0
logs/Data/logx.2024-04-03.001.log


+ 0 - 0
logs/Data/logx.2024-04-04.001.log


+ 0 - 0
logs/Data/logx.2024-04-05.001.log


+ 0 - 0
logs/Data/logx.2024-04-06.001.log


+ 0 - 0
logs/Data/logx.log


+ 95 - 0
logs/LogPrintln.go

@@ -0,0 +1,95 @@
+package logs
+
+import (
+	"fmt"
+	"github.com/astaxie/beego/logs"
+	orm2 "github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+// var Test = true
+var logx *logs.BeeLogger
+var logxE *logs.BeeLogger
+var logxData *logs.BeeLogger
+
+//var DeviceRealLogMap map[string]DeviceRealLogR // 设备实时日志
+
+type DeviceRealLogR struct {
+	Time time.Time //
+	Data []string  // 泛型数组
+}
+
+func init() {
+	//
+	//DeviceRealLogMap = make(map[string]DeviceRealLogR)
+	//go func() {
+	//	for true {
+	//		for key, value := range DeviceRealLogMap {
+	//			subM := time.Now().Sub(value.Time)
+	//			println(key+"日志-", subM.Minutes(), "分钟")
+	//			if subM.Minutes() > 3 {
+	//				delete(DeviceRealLogMap, key) // 删除日志
+	//			}
+	//		}
+	//
+	//		time.Sleep(time.Minute * 1)
+	//	}
+	//
+	//}()
+
+	logx = logs.NewLogger()
+	logx.SetLogger(logs.AdapterFile, `{"filename":"logs/logx/logx.log","perm":"0666"}`)
+
+	logxE = logs.NewLogger()
+	logxE.SetLogger(logs.AdapterFile, `{"filename":"logs/logxE/logx.log","perm":"0666"}`)
+
+	logxData = logs.NewLogger()
+	logxData.SetLogger(logs.AdapterFile, `{"filename":"logs/Data/logx.log","perm":"0666"}`)
+
+	orm2.DebugLog = orm2.NewLog(logx)
+
+	// 测试 日志分割
+	//go func() {
+	//	t := 1
+	//	orm2.DebugLog.Println("==========DebugLog=========")
+	//	for true {
+	//		t +=1
+	//		orm2.DebugLog.Println("DebugLog:",t)
+	//		time.Sleep(time.Second * 1)
+	//	}
+	//}()
+	//go TimeTask.OrmLog_MonitorScanStatus()
+}
+
+func Println(format string, v ...interface{}) {
+	fmt.Println(format, v)
+	logx.Info(format, v)
+
+}
+
+func PrintlnError(format string, v ...interface{}) {
+
+	logxE.Error(format, v)
+	logx.Info(format, v)
+}
+
+func PrintlnData(str string) {
+
+	logxData.Info(str)
+}
+
+//func Println(a ...interface{}) {
+//	if test {
+//		fmt.Printf("=>", a)
+//	}
+//	logx.Info(">", a)
+//}
+
+// 日志
+// logs.Println(time.Now().Format("2006-01-02 15:04:05"), "=>", a)
+
+// 重要
+// logs.Println("MqttServer", " 存在报警 跳过:", string(msg))
+
+// 严重
+// logs.Println("MqttServer", " 存在报警 跳过:", string(msg))

+ 0 - 0
logs/Mqtt/logx.log


+ 0 - 0
logs/Orm/logx.log


+ 0 - 0
logs/logx/logx.2024-04-01.001.log


+ 557 - 0
logs/logx/logx.2024-04-03.001.log

@@ -0,0 +1,557 @@
+2024/04/01 15:19:19.063 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 15:19:19.108 [I]  {"key":"redis_DeviceData","conn":"127.0.0.1:6378","dbNum":"8","password":""}%!(EXTRA []interface {}=[])
+2024/04/01 15:19:19.116 [I]  MysqlServer:AIOT_coer:iysxr7Axy46wCPC3@tcp(127.0.0.1:3305)/aiot_coer?charset=utf8mb4&loc=Local&parseTime=True%!(EXTRA []interface {}=[])
+2024/04/01 15:19:19.223 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 15:19:19.223 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 15:19:19.223 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 15:19:19.261 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 15:19:21.227 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 15:19:21.227 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 15:19:21.228 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 15:19:23.313 [I]  T_uuid:%!(EXTRA []interface {}=[12345678])
+2024/04/01 15:19:24.989 [I]  T_uuid:%!(EXTRA []interface {}=[12345678])
+2024/04/01 15:19:49.234  [ORM]2024/04/01 15:19:49  -[Queries/default] - [  OK /    db.Query /    13.4ms] - [SELECT T0.`t__product_i_d`, T0.`t__product_key`, T0.`t_uuid`, T0.`t_name`, T0.`t_mode`, T0.`t_prot`, T0.`t_panel`, T0.`t__tab_data`, T0.`t_state`, T0.`create_time`, T0.`update_time` FROM `ProductType` T0 WHERE T0.`t_state` = ? AND T0.`t_uuid` = ? ORDER BY T0.`create_time` DESC LIMIT 10] - `1`, `12345678`
+2024/04/01 15:19:49.243  [ORM]2024/04/01 15:19:49  -[Queries/default] - [  OK / db.QueryRow /     8.3ms] - [SELECT COUNT(*) FROM `ProductType` T0 WHERE T0.`t_state` = ? AND T0.`t_uuid` = ? ] - `1`, `12345678`
+2024/04/01 15:20:17.948  [ORM]2024/04/01 15:20:17  -[Queries/default] - [  OK / db.QueryRow /    15.9ms] - [SELECT `t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time` FROM `ProductType` WHERE `t__product_i_d` = ? ] - `vAnzuGpV`
+2024/04/01 15:20:17.948 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 15:48:25.702 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 15:48:25.737 [I]  {"key":"redis_DeviceData","conn":"127.0.0.1:6378","dbNum":"8","password":""}%!(EXTRA []interface {}=[])
+2024/04/01 15:48:25.745 [I]  MysqlServer:AIOT_coer:iysxr7Axy46wCPC3@tcp(127.0.0.1:3305)/aiot_coer?charset=utf8mb4&loc=Local&parseTime=True%!(EXTRA []interface {}=[])
+2024/04/01 15:48:25.850 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 15:48:25.851 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 15:48:25.851 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 15:48:25.884 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 15:48:27.859 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 15:48:27.859 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 15:48:27.859 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 15:48:45.294 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 15:48:45.355 [I]  {"key":"redis_DeviceData","conn":"127.0.0.1:6378","dbNum":"8","password":""}%!(EXTRA []interface {}=[])
+2024/04/01 15:48:45.363 [I]  MysqlServer:AIOT_coer:iysxr7Axy46wCPC3@tcp(127.0.0.1:3305)/aiot_coer?charset=utf8mb4&loc=Local&parseTime=True%!(EXTRA []interface {}=[])
+2024/04/01 15:48:45.519 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 15:48:45.519 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 15:48:45.519 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 15:48:45.582 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 15:48:47.519 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 15:48:47.519 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 15:48:47.519 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 15:51:24.252 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 15:51:24.286 [I]  {"key":"redis_DeviceData","conn":"127.0.0.1:6378","dbNum":"8","password":""}%!(EXTRA []interface {}=[])
+2024/04/01 15:51:24.294 [I]  MysqlServer:AIOT_coer:iysxr7Axy46wCPC3@tcp(127.0.0.1:3305)/aiot_coer?charset=utf8mb4&loc=Local&parseTime=True%!(EXTRA []interface {}=[])
+2024/04/01 15:51:24.399 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 15:51:24.400 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 15:51:24.400 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 15:51:24.438 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 15:51:26.410 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 15:51:26.410 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 15:51:26.410 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 15:52:25.332 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 15:52:25.391 [I]  {"key":"redis_DeviceData","conn":"127.0.0.1:6378","dbNum":"8","password":""}%!(EXTRA []interface {}=[])
+2024/04/01 15:52:25.398 [I]  MysqlServer:AIOT_coer:iysxr7Axy46wCPC3@tcp(127.0.0.1:3305)/aiot_coer?charset=utf8mb4&loc=Local&parseTime=True%!(EXTRA []interface {}=[])
+2024/04/01 15:52:25.503 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 15:52:25.503 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 15:52:25.503 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 15:52:25.548 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 15:52:27.508 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 15:52:27.508 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 15:52:27.508 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 15:53:12.528 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 15:53:12.586 [I]  {"key":"redis_DeviceData","conn":"127.0.0.1:6378","dbNum":"8","password":""}%!(EXTRA []interface {}=[])
+2024/04/01 15:53:12.594 [I]  MysqlServer:AIOT_coer:iysxr7Axy46wCPC3@tcp(127.0.0.1:3305)/aiot_coer?charset=utf8mb4&loc=Local&parseTime=True%!(EXTRA []interface {}=[])
+2024/04/01 15:53:12.699 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 15:53:12.700 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 15:53:12.700 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 15:53:12.743 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 15:53:14.707 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 15:53:14.707 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 15:53:14.707 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 15:56:12.377 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 15:56:12.430 [I]  {"key":"redis_DeviceData","conn":"127.0.0.1:6378","dbNum":"8","password":""}%!(EXTRA []interface {}=[])
+2024/04/01 15:56:12.438 [I]  MysqlServer:AIOT_coer:iysxr7Axy46wCPC3@tcp(127.0.0.1:3305)/aiot_coer?charset=utf8mb4&loc=Local&parseTime=True%!(EXTRA []interface {}=[])
+2024/04/01 15:56:12.570 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 15:56:12.570 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 15:56:12.570 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 15:56:12.607 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 15:56:14.576 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 15:56:14.576 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 15:56:14.576 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 15:56:36.264 [I]  T_uuid:%!(EXTRA []interface {}=[12345678])
+2024/04/01 15:57:28.837 [I]  T_uuid:%!(EXTRA []interface {}=[12345678])
+2024/04/01 15:57:28.852  [ORM]2024/04/01 15:57:28  -[Queries/default] - [  OK /     db.Exec /    15.0ms] - [INSERT INTO `ProductType` (`t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] - `EHtoMTJs`, `Coxe0M7lHtUVp4qDI1gTFNnwYv3cPGyf`, `12345678`, `默认产品类型http`, `1`, `0`, ``, `[{"T_name":"温度","T_tab":"Tt","T_type":1,"T_attr":{"unit":"C","dvalue":0,"accuracy":1,"min":2,"max":8},"T_text":"温度温度温度","T_read":true,"children":[{"T_name":"采样率","T_tab":"Tt_speed","T_type":1,"T_attr":{"unit":"s","dvalue":15,"accuracy":1,"min":0,"max":30},"T_text":"数据采集速度","T_read":false,"children":[]}]}]`, `1`, `2024-04-01 15:57:28.8374604 +0800 CST`, `2024-04-01 15:57:28.8374604 +0800 CST`
+2024/04/01 15:57:28.852 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 15:57:31.734 [I]  T_uuid:%!(EXTRA []interface {}=[12345678])
+2024/04/01 15:57:31.749  [ORM]2024/04/01 15:57:31  -[Queries/default] - [  OK /     db.Exec /    14.8ms] - [INSERT INTO `ProductType` (`t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] - `iflbdGjq`, `uWaDvdhfjXYSnBQ8UPHCLqcENJyz0s5m`, `12345678`, `默认产品类型http`, `1`, `0`, ``, `[{"T_name":"温度","T_tab":"Tt","T_type":1,"T_attr":{"unit":"C","dvalue":0,"accuracy":1,"min":2,"max":8},"T_text":"温度温度温度","T_read":true,"children":[{"T_name":"采样率","T_tab":"Tt_speed","T_type":1,"T_attr":{"unit":"s","dvalue":15,"accuracy":1,"min":0,"max":30},"T_text":"数据采集速度","T_read":false,"children":[]}]}]`, `1`, `2024-04-01 15:57:31.7345652 +0800 CST`, `2024-04-01 15:57:31.7345652 +0800 CST`
+2024/04/01 15:57:31.749 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 15:57:32.772 [I]  T_uuid:%!(EXTRA []interface {}=[12345678])
+2024/04/01 15:57:32.809  [ORM]2024/04/01 15:57:32  -[Queries/default] - [  OK /     db.Exec /    37.3ms] - [INSERT INTO `ProductType` (`t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] - `GMeOwaDd`, `h7CwX23vqzcU16Aks4MgVmIdZaGiFEpt`, `12345678`, `默认产品类型http`, `1`, `0`, ``, `[{"T_name":"温度","T_tab":"Tt","T_type":1,"T_attr":{"unit":"C","dvalue":0,"accuracy":1,"min":2,"max":8},"T_text":"温度温度温度","T_read":true,"children":[{"T_name":"采样率","T_tab":"Tt_speed","T_type":1,"T_attr":{"unit":"s","dvalue":15,"accuracy":1,"min":0,"max":30},"T_text":"数据采集速度","T_read":false,"children":[]}]}]`, `1`, `2024-04-01 15:57:32.7725337 +0800 CST`, `2024-04-01 15:57:32.7725337 +0800 CST`
+2024/04/01 15:57:32.809 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 15:57:33.719 [I]  T_uuid:%!(EXTRA []interface {}=[12345678])
+2024/04/01 15:57:34.519  [ORM]2024/04/01 15:57:34  -[Queries/default] - [  OK /     db.Exec /   800.7ms] - [INSERT INTO `ProductType` (`t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] - `TUaGlDno`, `6dmSK4GARgzZMEbONLUc0XPlnyj5stBQ`, `12345678`, `默认产品类型http`, `1`, `0`, ``, `[{"T_name":"温度","T_tab":"Tt","T_type":1,"T_attr":{"unit":"C","dvalue":0,"accuracy":1,"min":2,"max":8},"T_text":"温度温度温度","T_read":true,"children":[{"T_name":"采样率","T_tab":"Tt_speed","T_type":1,"T_attr":{"unit":"s","dvalue":15,"accuracy":1,"min":0,"max":30},"T_text":"数据采集速度","T_read":false,"children":[]}]}]`, `1`, `2024-04-01 15:57:33.7190302 +0800 CST`, `2024-04-01 15:57:33.7190302 +0800 CST`
+2024/04/01 15:57:34.519 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 15:57:35.678 [I]  T_uuid:%!(EXTRA []interface {}=[12345678])
+2024/04/01 15:57:35.905  [ORM]2024/04/01 15:57:35  -[Queries/default] - [  OK /     db.Exec /   226.8ms] - [INSERT INTO `ProductType` (`t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] - `ziuXtCFR`, `9BiKR2JQX3zYxOv5FmgPIn8U7hNSt04s`, `12345678`, `默认产品类型http`, `1`, `0`, ``, `[{"T_name":"温度","T_tab":"Tt","T_type":1,"T_attr":{"unit":"C","dvalue":0,"accuracy":1,"min":2,"max":8},"T_text":"温度温度温度","T_read":true,"children":[{"T_name":"采样率","T_tab":"Tt_speed","T_type":1,"T_attr":{"unit":"s","dvalue":15,"accuracy":1,"min":0,"max":30},"T_text":"数据采集速度","T_read":false,"children":[]}]}]`, `1`, `2024-04-01 15:57:35.6786767 +0800 CST`, `2024-04-01 15:57:35.6786767 +0800 CST`
+2024/04/01 15:57:35.905 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 15:57:36.960 [I]  T_uuid:%!(EXTRA []interface {}=[12345678])
+2024/04/01 15:57:36.976  [ORM]2024/04/01 15:57:36  -[Queries/default] - [  OK /     db.Exec /    15.1ms] - [INSERT INTO `ProductType` (`t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] - `ASWRtKhC`, `2WX9n71ZLsaM3Ojxvt6NgGRTrcy8fiQd`, `12345678`, `默认产品类型http`, `1`, `0`, ``, `[{"T_name":"温度","T_tab":"Tt","T_type":1,"T_attr":{"unit":"C","dvalue":0,"accuracy":1,"min":2,"max":8},"T_text":"温度温度温度","T_read":true,"children":[{"T_name":"采样率","T_tab":"Tt_speed","T_type":1,"T_attr":{"unit":"s","dvalue":15,"accuracy":1,"min":0,"max":30},"T_text":"数据采集速度","T_read":false,"children":[]}]}]`, `1`, `2024-04-01 15:57:36.9608848 +0800 CST`, `2024-04-01 15:57:36.9608848 +0800 CST`
+2024/04/01 15:57:36.976 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 15:57:38.029 [I]  T_uuid:%!(EXTRA []interface {}=[12345678])
+2024/04/01 15:57:38.202  [ORM]2024/04/01 15:57:38  -[Queries/default] - [  OK /     db.Exec /   173.1ms] - [INSERT INTO `ProductType` (`t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] - `duANMmTg`, `dT69qZFOyAo2giuX8bKStHsGJYRWnNcV`, `12345678`, `默认产品类型http`, `1`, `0`, ``, `[{"T_name":"温度","T_tab":"Tt","T_type":1,"T_attr":{"unit":"C","dvalue":0,"accuracy":1,"min":2,"max":8},"T_text":"温度温度温度","T_read":true,"children":[{"T_name":"采样率","T_tab":"Tt_speed","T_type":1,"T_attr":{"unit":"s","dvalue":15,"accuracy":1,"min":0,"max":30},"T_text":"数据采集速度","T_read":false,"children":[]}]}]`, `1`, `2024-04-01 15:57:38.0291293 +0800 CST`, `2024-04-01 15:57:38.0291293 +0800 CST`
+2024/04/01 15:57:38.202 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 15:57:43.388 [I]  T_uuid:%!(EXTRA []interface {}=[12345678])
+2024/04/01 15:57:43.408  [ORM]2024/04/01 15:57:43  -[Queries/default] - [  OK /     db.Exec /    20.3ms] - [INSERT INTO `ProductType` (`t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] - `bEBmWsRP`, `pQ4N9q5ncB3fRLhDzg0EA8ekasUK6PjI`, `12345678`, `默认产品类型http`, `3`, `0`, ``, `[{"T_name":"温度","T_tab":"Tt","T_type":1,"T_attr":{"unit":"C","dvalue":0,"accuracy":1,"min":2,"max":8},"T_text":"温度温度温度","T_read":true,"children":[{"T_name":"采样率","T_tab":"Tt_speed","T_type":1,"T_attr":{"unit":"s","dvalue":15,"accuracy":1,"min":0,"max":30},"T_text":"数据采集速度","T_read":false,"children":[]}]}]`, `1`, `2024-04-01 15:57:43.3883567 +0800 CST`, `2024-04-01 15:57:43.3883567 +0800 CST`
+2024/04/01 15:57:43.408 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 15:57:45.066 [I]  T_uuid:%!(EXTRA []interface {}=[12345678])
+2024/04/01 15:57:45.083  [ORM]2024/04/01 15:57:45  -[Queries/default] - [  OK /     db.Exec /    16.8ms] - [INSERT INTO `ProductType` (`t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] - `wAMJpuUy`, `qfYpQP82C3HmZrUoyIjlX0dMR4bvSA5J`, `12345678`, `默认产品类型http`, `3`, `0`, ``, `[{"T_name":"温度","T_tab":"Tt","T_type":1,"T_attr":{"unit":"C","dvalue":0,"accuracy":1,"min":2,"max":8},"T_text":"温度温度温度","T_read":true,"children":[{"T_name":"采样率","T_tab":"Tt_speed","T_type":1,"T_attr":{"unit":"s","dvalue":15,"accuracy":1,"min":0,"max":30},"T_text":"数据采集速度","T_read":false,"children":[]}]}]`, `1`, `2024-04-01 15:57:45.0667183 +0800 CST`, `2024-04-01 15:57:45.0667183 +0800 CST`
+2024/04/01 15:57:45.083 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 15:58:07.628 [I]  T_uuid:%!(EXTRA []interface {}=[12345678])
+2024/04/01 15:58:07.809  [ORM]2024/04/01 15:58:07  -[Queries/default] - [  OK /     db.Exec /   181.5ms] - [INSERT INTO `ProductType` (`t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] - `dqSYObzJ`, `fqAvyQDkYw51M8Ng0WTV4pGmR2UIJF3Z`, `12345678`, `核心 mQTT 测试`, `3`, `0`, ``, `[{"T_name":"温度","T_tab":"Tt","T_type":1,"T_attr":{"unit":"C","dvalue":0,"accuracy":1,"min":2,"max":8},"T_text":"温度温度温度","T_read":true,"children":[{"T_name":"采样率","T_tab":"Tt_speed","T_type":1,"T_attr":{"unit":"s","dvalue":15,"accuracy":1,"min":0,"max":30},"T_text":"数据采集速度","T_read":false,"children":[]}]}]`, `1`, `2024-04-01 15:58:07.6283654 +0800 CST`, `2024-04-01 15:58:07.6283654 +0800 CST`
+2024/04/01 15:58:07.809 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 15:58:21.015 [I]  T_uuid:%!(EXTRA []interface {}=[12345678])
+2024/04/01 16:00:14.540 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 16:00:14.605 [I]  {"key":"redis_DeviceData","conn":"127.0.0.1:6378","dbNum":"8","password":""}%!(EXTRA []interface {}=[])
+2024/04/01 16:00:14.613 [I]  MysqlServer:AIOT_coer:iysxr7Axy46wCPC3@tcp(127.0.0.1:3305)/aiot_coer?charset=utf8mb4&loc=Local&parseTime=True%!(EXTRA []interface {}=[])
+2024/04/01 16:00:14.722 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 16:00:14.723 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 16:00:14.723 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 16:00:14.767 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 16:00:16.729 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 16:00:16.729 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 16:00:16.730 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 16:00:36.223  [ORM]2024/04/01 16:00:36  -[Queries/default] - [  OK / db.QueryRow /     8.9ms] - [SELECT `t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time` FROM `ProductType` WHERE `t__product_i_d` = ? ] - `dqSYObzJ`
+2024/04/01 16:00:36.224 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 16:00:36.244  [ORM]2024/04/01 16:00:36  -[Queries/default] - [  OK /     db.Exec /    16.5ms] - [UPDATE `ProductType` SET `t_name` = ?, `t_prot` = ?, `t_mode` = ?, `t__tab_data` = ?, `update_time` = ? WHERE `t__product_i_d` = ?] - `核心 mQTT 测试`, `0`, `3`, `[{"T_name":"温度","T_tab":"Tt","T_type":1,"T_attr":{"unit":"C","dvalue":0,"accuracy":1,"min":2,"max":8},"T_text":"温度温度温度","T_read":true,"children":[{"T_name":"采样率","T_tab":"Tt_speed","T_type":1,"T_attr":{"unit":"s","dvalue":15,"accuracy":1,"min":0,"max":30},"T_text":"数据采集速度","T_read":false,"children":[]}]}]`, `2024-04-01 16:00:36.2277064 +0800 CST m=+21.714105401`, `dqSYObzJ`
+2024/04/01 16:00:36.244 [I]  Number of records updated in database:%!(EXTRA []interface {}=[1])
+2024/04/01 16:00:36.244 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 16:00:36.257  [ORM]2024/04/01 16:00:36  -[Queries/default] - [  OK /    db.Query /     8.5ms] - [SELECT T0.`t_sn`, T0.`t_password`, T0.`t_ckey`, T0.`t_online`, T0.`t__product_i_d`, T0.`t_data`, T0.`t__relay_data`, T0.`create_time`, T0.`update_time` FROM `Device` T0 WHERE T0.`t__product_i_d` = ? ] - `dqSYObzJ`
+2024/04/01 16:00:51.063  [ORM]2024/04/01 16:00:51  -[Queries/default] - [  OK /     db.Exec /    19.0ms] - [UPDATE `ProductType` SET `t_name` = ?, `t_prot` = ?, `t_mode` = ?, `t__tab_data` = ?, `update_time` = ? WHERE `t__product_i_d` = ?] - `核心 mQTT 测试1`, `0`, `3`, `[{"T_name":"温度","T_tab":"Tt","T_type":1,"T_attr":{"unit":"C","dvalue":0,"accuracy":1,"min":2,"max":8},"T_text":"温度温度温度","T_read":true,"children":[{"T_name":"采样率","T_tab":"Tt_speed","T_type":1,"T_attr":{"unit":"s","dvalue":15,"accuracy":1,"min":0,"max":30},"T_text":"数据采集速度","T_read":false,"children":[]}]}]`, `2024-04-01 16:00:51.044343 +0800 CST m=+36.530555301`, `dqSYObzJ`
+2024/04/01 16:00:51.063 [I]  Number of records updated in database:%!(EXTRA []interface {}=[1])
+2024/04/01 16:00:51.063 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 16:00:51.075  [ORM]2024/04/01 16:00:51  -[Queries/default] - [  OK /    db.Query /     8.0ms] - [SELECT T0.`t_sn`, T0.`t_password`, T0.`t_ckey`, T0.`t_online`, T0.`t__product_i_d`, T0.`t_data`, T0.`t__relay_data`, T0.`create_time`, T0.`update_time` FROM `Device` T0 WHERE T0.`t__product_i_d` = ? ] - `dqSYObzJ`
+2024/04/01 16:01:12.875  [ORM]2024/04/01 16:01:12  -[Queries/default] - [  OK /     db.Exec /    16.6ms] - [UPDATE `ProductType` SET `t_name` = ?, `t_prot` = ?, `t_mode` = ?, `t__tab_data` = ?, `update_time` = ? WHERE `t__product_i_d` = ?] - `核心 mQTT 测试1`, `0`, `3`, `[{"T_name":"温度","T_tab":"Tt","T_type":1,"T_attr":{"unit":"C","dvalue":0,"accuracy":1,"min":2,"max":8},"T_text":"温度温度温度","T_read":true,"children":[{"T_name":"采样率","T_tab":"Tt_speed","T_type":1,"T_attr":{"unit":"s","dvalue":15,"accuracy":1,"min":0,"max":30},"T_text":"数据采集速度","T_read":false,"children":[]}]}]`, `2024-04-01 16:01:12.8591211 +0800 CST m=+58.345058501`, `dqSYObzJ`
+2024/04/01 16:01:12.875 [I]  Number of records updated in database:%!(EXTRA []interface {}=[1])
+2024/04/01 16:01:12.875 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 16:01:12.889  [ORM]2024/04/01 16:01:12  -[Queries/default] - [  OK /    db.Query /     8.8ms] - [SELECT T0.`t_sn`, T0.`t_password`, T0.`t_ckey`, T0.`t_online`, T0.`t__product_i_d`, T0.`t_data`, T0.`t__relay_data`, T0.`create_time`, T0.`update_time` FROM `Device` T0 WHERE T0.`t__product_i_d` = ? ] - `dqSYObzJ`
+2024/04/01 16:01:16.960  [ORM]2024/04/01 16:01:16  -[Queries/default] - [  OK /     db.Exec /    19.1ms] - [INSERT INTO `ProductType` (`t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] - `OjIvBVUC`, `yUEfYu27LQ5FV6zJO0KBglpRdhiD8xS9`, `12345678`, `核心 mQTT 测试1`, `3`, `0`, ``, `[{"T_name":"温度","T_tab":"Tt","T_type":1,"T_attr":{"unit":"C","dvalue":0,"accuracy":1,"min":2,"max":8},"T_text":"温度温度温度","T_read":true,"children":[{"T_name":"采样率","T_tab":"Tt_speed","T_type":1,"T_attr":{"unit":"s","dvalue":15,"accuracy":1,"min":0,"max":30},"T_text":"数据采集速度","T_read":false,"children":[]}]}]`, `1`, `2024-04-01 16:01:16.9417524 +0800 CST`, `2024-04-01 16:01:16.9417524 +0800 CST`
+2024/04/01 16:01:16.960 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 16:01:37.135  [ORM]2024/04/01 16:01:37  -[Queries/default] - [  OK /     db.Exec /    15.8ms] - [UPDATE `ProductType` SET `t_state` = ?, `update_time` = ? WHERE `t__product_i_d` = ?] - `2`, `2024-04-01 16:01:37.1199498 +0800 CST m=+82.605581501`, `dqSYObzJ`
+2024/04/01 16:01:37.135 [I]  Number of records updated in database:%!(EXTRA []interface {}=[1])
+2024/04/01 16:01:37.135 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 16:01:37.148  [ORM]2024/04/01 16:01:37  -[Queries/default] - [  OK /    db.Query /     8.2ms] - [SELECT T0.`t_sn`, T0.`t_password`, T0.`t_ckey`, T0.`t_online`, T0.`t__product_i_d`, T0.`t_data`, T0.`t__relay_data`, T0.`create_time`, T0.`update_time` FROM `Device` T0 WHERE T0.`t__product_i_d` = ? ] - `dqSYObzJ`
+2024/04/01 16:01:43.019  [ORM]2024/04/01 16:01:43  -[Queries/default] - [  OK /     db.Exec /    15.1ms] - [UPDATE `ProductType` SET `t_state` = ?, `update_time` = ? WHERE `t__product_i_d` = ?] - `2`, `2024-04-01 16:01:43.0039628 +0800 CST m=+88.489520401`, `dqSYObzJ`
+2024/04/01 16:01:43.019 [I]  Number of records updated in database:%!(EXTRA []interface {}=[1])
+2024/04/01 16:01:43.019 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 16:01:43.032  [ORM]2024/04/01 16:01:43  -[Queries/default] - [  OK /    db.Query /     8.6ms] - [SELECT T0.`t_sn`, T0.`t_password`, T0.`t_ckey`, T0.`t_online`, T0.`t__product_i_d`, T0.`t_data`, T0.`t__relay_data`, T0.`create_time`, T0.`update_time` FROM `Device` T0 WHERE T0.`t__product_i_d` = ? ] - `dqSYObzJ`
+2024/04/01 16:01:44.534  [ORM]2024/04/01 16:01:44  -[Queries/default] - [  OK /     db.Exec /    16.0ms] - [UPDATE `ProductType` SET `t_state` = ?, `update_time` = ? WHERE `t__product_i_d` = ?] - `2`, `2024-04-01 16:01:44.5183765 +0800 CST m=+90.003915001`, `dqSYObzJ`
+2024/04/01 16:01:44.534 [I]  Number of records updated in database:%!(EXTRA []interface {}=[1])
+2024/04/01 16:01:44.534 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 16:01:44.546  [ORM]2024/04/01 16:01:44  -[Queries/default] - [  OK /    db.Query /     8.1ms] - [SELECT T0.`t_sn`, T0.`t_password`, T0.`t_ckey`, T0.`t_online`, T0.`t__product_i_d`, T0.`t_data`, T0.`t__relay_data`, T0.`create_time`, T0.`update_time` FROM `Device` T0 WHERE T0.`t__product_i_d` = ? ] - `dqSYObzJ`
+2024/04/01 16:01:45.568  [ORM]2024/04/01 16:01:45  -[Queries/default] - [  OK /     db.Exec /    15.7ms] - [UPDATE `ProductType` SET `t_state` = ?, `update_time` = ? WHERE `t__product_i_d` = ?] - `2`, `2024-04-01 16:01:45.55249 +0800 CST m=+91.038015501`, `dqSYObzJ`
+2024/04/01 16:01:45.568 [I]  Number of records updated in database:%!(EXTRA []interface {}=[1])
+2024/04/01 16:01:45.568 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 16:01:45.580  [ORM]2024/04/01 16:01:45  -[Queries/default] - [  OK /    db.Query /     8.0ms] - [SELECT T0.`t_sn`, T0.`t_password`, T0.`t_ckey`, T0.`t_online`, T0.`t__product_i_d`, T0.`t_data`, T0.`t__relay_data`, T0.`create_time`, T0.`update_time` FROM `Device` T0 WHERE T0.`t__product_i_d` = ? ] - `dqSYObzJ`
+2024/04/01 16:02:07.236  [ORM]2024/04/01 16:02:07  -[Queries/default] - [  OK /     db.Exec /    16.5ms] - [UPDATE `ProductType` SET `t_state` = ?, `update_time` = ? WHERE `t__product_i_d` = ?] - `2`, `2024-04-01 16:02:07.2196907 +0800 CST m=+112.704943201`, `dqSYObzJ`
+2024/04/01 16:02:07.236 [I]  Number of records updated in database:%!(EXTRA []interface {}=[1])
+2024/04/01 16:02:07.236 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 16:02:07.250  [ORM]2024/04/01 16:02:07  -[Queries/default] - [  OK /    db.Query /     9.6ms] - [SELECT T0.`t_sn`, T0.`t_password`, T0.`t_ckey`, T0.`t_online`, T0.`t__product_i_d`, T0.`t_data`, T0.`t__relay_data`, T0.`create_time`, T0.`update_time` FROM `Device` T0 WHERE T0.`t__product_i_d` = ? ] - `dqSYObzJ`
+2024/04/01 16:02:09.943  [ORM]2024/04/01 16:02:09  -[Queries/default] - [  OK /     db.Exec /    16.6ms] - [UPDATE `ProductType` SET `t_state` = ?, `update_time` = ? WHERE `t__product_i_d` = ?] - `2`, `2024-04-01 16:02:09.9266022 +0800 CST m=+115.411820501`, `dqSYObzJ`
+2024/04/01 16:02:09.943 [I]  Number of records updated in database:%!(EXTRA []interface {}=[1])
+2024/04/01 16:02:09.943 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 16:02:09.955  [ORM]2024/04/01 16:02:09  -[Queries/default] - [  OK /    db.Query /     8.2ms] - [SELECT T0.`t_sn`, T0.`t_password`, T0.`t_ckey`, T0.`t_online`, T0.`t__product_i_d`, T0.`t_data`, T0.`t__relay_data`, T0.`create_time`, T0.`update_time` FROM `Device` T0 WHERE T0.`t__product_i_d` = ? ] - `dqSYObzJ`
+2024/04/01 16:03:07.511 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 16:03:07.568 [I]  {"key":"redis_DeviceData","conn":"127.0.0.1:6378","dbNum":"8","password":""}%!(EXTRA []interface {}=[])
+2024/04/01 16:03:07.575 [I]  MysqlServer:AIOT_coer:iysxr7Axy46wCPC3@tcp(127.0.0.1:3305)/aiot_coer?charset=utf8mb4&loc=Local&parseTime=True%!(EXTRA []interface {}=[])
+2024/04/01 16:03:07.678 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 16:03:07.679 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 16:03:07.679 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 16:03:07.711 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 16:03:09.680 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 16:03:09.680 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 16:03:09.680 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 16:20:35.401  [ORM]2024/04/01 16:20:35  -[Queries/default] - [  OK /     db.Exec /   280.9ms] - [UPDATE `ProductType` SET `t_state` = ?, `update_time` = ? WHERE `t__product_i_d` = ?] - `0`, `2024-04-01 16:20:35.1207905 +0800 CST m=+1047.614453501`, `dqSYObzJ`
+2024/04/01 16:20:35.401 [I]  Number of records updated in database:%!(EXTRA []interface {}=[1])
+2024/04/01 16:20:35.401 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/01 16:20:35.415  [ORM]2024/04/01 16:20:35  -[Queries/default] - [  OK /    db.Query /     8.4ms] - [SELECT T0.`t_sn`, T0.`t_password`, T0.`t_ckey`, T0.`t_online`, T0.`t__product_i_d`, T0.`t_data`, T0.`t__relay_data`, T0.`create_time`, T0.`update_time` FROM `Device` T0 WHERE T0.`t__product_i_d` = ? ] - `dqSYObzJ`
+2024/04/01 16:22:29.875 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 16:22:29.910 [I]  {"key":"redis_DeviceData","conn":"127.0.0.1:6378","dbNum":"8","password":""}%!(EXTRA []interface {}=[])
+2024/04/01 16:22:29.917 [I]  MysqlServer:AIOT_coer:iysxr7Axy46wCPC3@tcp(127.0.0.1:3305)/aiot_coer?charset=utf8mb4&loc=Local&parseTime=True%!(EXTRA []interface {}=[])
+2024/04/01 16:22:30.028 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 16:22:30.028 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 16:22:30.028 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 16:22:30.077 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 16:22:32.032 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 16:22:32.032 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 16:22:32.032 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 16:23:24.892 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 16:23:24.926 [I]  {"key":"redis_DeviceData","conn":"127.0.0.1:6378","dbNum":"8","password":""}%!(EXTRA []interface {}=[])
+2024/04/01 16:23:24.934 [I]  MysqlServer:AIOT_coer:iysxr7Axy46wCPC3@tcp(127.0.0.1:3305)/aiot_coer?charset=utf8mb4&loc=Local&parseTime=True%!(EXTRA []interface {}=[])
+2024/04/01 16:23:25.039 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 16:23:25.040 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 16:23:25.040 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 16:23:25.075 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 16:23:27.050 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 16:23:27.050 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 16:23:27.050 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 16:23:31.970  [ORM]2024/04/01 16:23:31  -[Queries/default] - [  OK /    db.Query /    12.4ms] - [SELECT T0.`t__product_i_d`, T0.`t__product_key`, T0.`t_uuid`, T0.`t_name`, T0.`t_mode`, T0.`t_prot`, T0.`t_panel`, T0.`t__tab_data`, T0.`t_state`, T0.`create_time`, T0.`update_time` FROM `ProductType` T0 WHERE T0.`t_state` = ? AND T0.`t_uuid` = ? ORDER BY T0.`create_time` DESC LIMIT 10] - `1`, `12345678`
+2024/04/01 16:23:31.978  [ORM]2024/04/01 16:23:31  -[Queries/default] - [  OK / db.QueryRow /     7.5ms] - [SELECT COUNT(*) FROM `ProductType` T0 WHERE T0.`t_state` = ? AND T0.`t_uuid` = ? ] - `1`, `12345678`
+2024/04/01 16:47:40.927 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 16:47:40.961 [I]  {"key":"redis_DeviceData","conn":"127.0.0.1:6378","dbNum":"8","password":""}%!(EXTRA []interface {}=[])
+2024/04/01 16:47:40.969 [I]  MysqlServer:AIOT_coer:iysxr7Axy46wCPC3@tcp(127.0.0.1:3305)/aiot_coer?charset=utf8mb4&loc=Local&parseTime=True%!(EXTRA []interface {}=[])
+2024/04/01 16:47:41.072 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 16:47:41.073 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 16:47:41.073 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 16:47:41.110 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 16:47:43.080 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 16:47:43.080 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 16:47:43.080 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 16:50:27.144 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 16:50:27.195 [I]  {"key":"redis_DeviceData","conn":"127.0.0.1:6378","dbNum":"8","password":""}%!(EXTRA []interface {}=[])
+2024/04/01 16:50:27.202 [I]  MysqlServer:AIOT_coer:iysxr7Axy46wCPC3@tcp(127.0.0.1:3305)/aiot_coer?charset=utf8mb4&loc=Local&parseTime=True%!(EXTRA []interface {}=[])
+2024/04/01 16:50:27.310 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 16:50:27.310 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 16:50:27.310 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 16:50:27.352 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 16:50:29.320 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 16:50:29.320 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 16:50:29.320 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 16:52:33.283 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 16:52:33.445 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 16:52:33.446 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 16:52:33.446 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 16:52:33.485 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 16:52:35.454 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 16:52:35.454 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 16:52:35.454 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 16:55:32.018 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 16:57:38.553 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 16:57:38.730 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 16:57:38.731 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 16:57:38.731 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 16:57:38.776 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 16:57:40.737 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 16:57:40.737 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 16:57:40.737 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 16:58:07.038 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 16:58:07.187 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 16:58:07.188 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 16:58:07.188 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 16:58:07.224 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 16:58:09.200 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 16:58:09.200 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 16:58:09.200 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 16:59:33.057 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 16:59:33.238 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 16:59:33.238 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 16:59:33.238 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 16:59:33.290 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 16:59:35.248 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 16:59:35.248 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 16:59:35.248 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 17:00:19.252 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 17:00:19.414 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 17:00:19.415 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 17:00:19.415 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 17:00:19.455 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 17:00:21.420 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 17:00:21.420 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 17:00:21.420 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 17:06:37.244 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 17:06:37.401 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 17:06:37.401 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 17:06:37.401 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 17:06:37.439 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 17:06:39.411 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 17:06:39.411 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 17:06:39.411 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 17:07:10.069 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 17:07:10.238 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 17:07:10.238 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 17:07:10.238 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 17:07:10.280 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 17:07:12.246 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 17:07:12.246 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 17:07:12.246 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 17:07:47.020 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 17:07:47.168 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 17:07:47.169 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 17:07:47.169 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 17:07:47.207 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 17:07:49.174 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 17:07:49.174 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 17:07:49.174 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 17:11:57.221 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 17:11:57.398 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 17:11:57.399 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 17:11:57.399 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 17:11:57.460 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 17:11:59.402 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 17:11:59.402 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 17:11:59.402 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 17:22:22.702 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 17:22:22.851 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 17:22:22.851 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 17:22:22.851 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 17:22:22.889 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 17:22:24.858 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 17:22:24.858 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 17:22:24.858 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 17:30:47.030 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 17:30:47.184 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 17:30:47.184 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 17:30:47.184 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 17:30:47.235 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 17:30:49.190 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 17:30:49.190 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 17:30:49.190 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 17:31:10.383 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 17:31:10.569 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 17:31:10.570 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 17:31:10.570 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 17:31:10.628 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 17:31:12.583 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 17:31:12.583 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 17:31:12.583 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 17:33:06.904 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 17:33:07.078 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 17:33:07.078 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 17:33:07.078 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 17:33:07.117 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 17:33:09.084 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 17:33:09.084 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 17:33:09.084 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 17:33:17.134 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 17:33:17.295 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 17:33:17.295 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 17:33:17.295 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 17:33:17.339 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 17:33:19.304 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 17:33:19.304 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 17:33:19.304 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 17:34:00.522 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 17:34:00.684 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 17:34:00.685 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 17:34:00.685 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 17:34:00.739 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 17:34:02.690 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 17:34:02.690 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 17:34:02.690 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 17:34:23.449 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 17:34:23.826 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 17:34:23.826 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 17:34:23.826 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 17:34:23.866 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 17:34:25.836 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 17:34:25.836 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 17:34:25.836 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 17:34:46.414 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 17:34:46.562 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 17:34:46.563 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 17:34:46.563 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 17:34:46.615 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 17:34:48.568 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 17:34:48.568 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 17:34:48.568 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 17:35:05.720 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 17:35:05.867 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 17:35:05.867 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 17:35:05.867 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 17:35:05.904 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 17:35:07.869 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 17:35:07.869 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 17:35:07.869 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 17:35:14.433 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 17:35:14.579 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 17:35:14.579 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 17:35:14.579 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 17:35:14.612 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 17:35:16.590 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 17:35:16.590 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 17:35:16.590 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 17:35:29.240 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 17:35:29.419 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 17:35:29.419 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 17:35:29.419 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 17:35:29.456 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 17:35:31.423 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 17:35:31.423 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 17:35:31.423 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/01 17:35:41.723 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/01 17:35:41.901 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/01 17:35:41.901 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/01 17:35:41.901 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/01 17:35:41.944 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/01 17:35:43.910 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/01 17:35:43.910 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/01 17:35:43.910 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/02 09:26:43.285 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/02 09:26:48.858 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/02 09:26:48.858 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/02 09:26:48.858 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/02 09:26:49.131 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/02 09:26:50.862 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/02 09:26:50.862 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/02 09:26:50.862 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/02 09:26:54.360  [ORM]2024/04/02 09:26:54  -[Queries/default] - [  OK / db.QueryRow /   226.5ms] - [SELECT `t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time` FROM `ProductType` WHERE `t__product_i_d` = ? ] - `GSOyMqYA`
+2024/04/02 09:27:41.127  [ORM]2024/04/02 09:27:41  -[Queries/default] - [  OK /     db.Exec /    16.2ms] - [INSERT INTO `ProductType` (`t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] - `eyWaRQiu`, `kzeZSx9IaoqKH7TPuj1OfrD0pFdG6Ucv`, `12345678`, `核心 mQTT 测试1`, `3`, `0`, ``, `[{"T_name":"温度","T_tab":"Tt","T_type":1,"T_attr":{"unit":"C","dvalue":0,"accuracy":1,"min":2,"max":8},"T_text":"温度温度温度","T_read":true,"children":[{"T_name":"采样率","T_tab":"Tt_speed","T_type":1,"T_attr":{"unit":"s","dvalue":15,"accuracy":1,"min":0,"max":30},"T_text":"数据采集速度","T_read":false,"children":[]}]}]`, `1`, `2024-04-02 09:27:41.1113997 +0800 CST`, `2024-04-02 09:27:41.1113997 +0800 CST`
+2024/04/02 09:27:41.127 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/02 09:27:55.246  [ORM]2024/04/02 09:27:55  -[Queries/default] - [  OK /     db.Exec /    24.5ms] - [INSERT INTO `ProductOTA` (`t__product_i_d`, `t_name`, `t_version`, `t_file`, `t_hash`, `t_size`, `t_describe`, `t_publish`, `create_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)] - `eyWaRQiu`, `app1`, `0.1.6`, `htpp://xxxxxxxxxxx.bin`, `FnKpeXZwNi3pNDQqZmLCwfrFzx7_`, `1363713`, `代码内容`, `false`, `2024-04-02 09:27:55.2216585 +0800 CST`
+2024/04/02 09:27:55.260  [ORM]2024/04/02 09:27:55  -[Queries/default] - [  OK /    db.Query /    38.2ms] - [SELECT T0.`t_sn`, T0.`t_password`, T0.`t_ckey`, T0.`t_online`, T0.`t__product_i_d`, T0.`t_data`, T0.`t__relay_data`, T0.`create_time`, T0.`update_time` FROM `Device` T0 WHERE T0.`t__product_i_d` = ? ] - `eyWaRQiu`
+2024/04/02 09:28:34.992  [ORM]2024/04/02 09:28:34  -[Queries/default] - [  OK /    db.Query /     4.7ms] - [SELECT T0.`ID`, T0.`t__product_i_d`, T0.`t_name`, T0.`t_version`, T0.`t_file`, T0.`t_hash`, T0.`t_size`, T0.`t_describe`, T0.`t_publish`, T0.`create_time` FROM `ProductOTA` T0 LIMIT 10]
+2024/04/02 09:28:34.997  [ORM]2024/04/02 09:28:34  -[Queries/default] - [  OK / db.QueryRow /     4.6ms] - [SELECT COUNT(*) FROM `ProductOTA` T0 ]
+2024/04/02 09:28:39.056  [ORM]2024/04/02 09:28:39  -[Queries/default] - [  OK /    db.Query /    10.7ms] - [SELECT T0.`t_sn`, T0.`t_password`, T0.`t_ckey`, T0.`t_online`, T0.`t__product_i_d`, T0.`t_data`, T0.`t__relay_data`, T0.`create_time`, T0.`update_time` FROM `Device` T0 WHERE T0.`t__product_i_d` = ? ] - `eyWaRQiu`
+2024/04/02 09:28:39.068  [ORM]2024/04/02 09:28:39  -[Queries/default] - [  OK /     db.Exec /    21.9ms] - [INSERT INTO `ProductOTA` (`t__product_i_d`, `t_name`, `t_version`, `t_file`, `t_hash`, `t_size`, `t_describe`, `t_publish`, `create_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)] - `eyWaRQiu`, `app1`, `0.1.6`, `htpp://xxxxxxxxxxx.bin`, `FnKpeXZwNi3pNDQqZmLCwfrFzx7_`, `1363713`, `代码内容`, `false`, `2024-04-02 09:28:39.0461016 +0800 CST`
+2024/04/02 09:28:40.743  [ORM]2024/04/02 09:28:40  -[Queries/default] - [  OK /    db.Query /     5.6ms] - [SELECT T0.`ID`, T0.`t__product_i_d`, T0.`t_name`, T0.`t_version`, T0.`t_file`, T0.`t_hash`, T0.`t_size`, T0.`t_describe`, T0.`t_publish`, T0.`create_time` FROM `ProductOTA` T0 LIMIT 10]
+2024/04/02 09:28:40.753  [ORM]2024/04/02 09:28:40  -[Queries/default] - [  OK / db.QueryRow /    10.1ms] - [SELECT COUNT(*) FROM `ProductOTA` T0 ]
+2024/04/02 09:29:17.533 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/02 09:29:17.721 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/02 09:29:17.723 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/02 09:29:17.723 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/02 09:29:17.784 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/02 09:29:19.731 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/02 09:29:19.731 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/02 09:29:19.731 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/02 09:29:23.846  [ORM]2024/04/02 09:29:23  -[Queries/default] - [  OK /    db.Query /     5.0ms] - [SELECT T0.`ID`, T0.`t__product_i_d`, T0.`t_name`, T0.`t_version`, T0.`t_file`, T0.`t_hash`, T0.`t_size`, T0.`t_describe`, T0.`t_publish`, T0.`create_time` FROM `ProductOTA` T0 ORDER BY T0.`create_time` DESC LIMIT 10]
+2024/04/02 09:29:23.850  [ORM]2024/04/02 09:29:23  -[Queries/default] - [  OK / db.QueryRow /     4.2ms] - [SELECT COUNT(*) FROM `ProductOTA` T0 ]
+2024/04/02 09:29:44.561  [ORM]2024/04/02 09:29:44  -[Queries/default] - [  OK / db.QueryRow /     9.3ms] - [SELECT `ID`, `t__product_i_d`, `t_name`, `t_version`, `t_file`, `t_hash`, `t_size`, `t_describe`, `t_publish`, `create_time` FROM `ProductOTA` WHERE `ID` = ? ] - `1`
+2024/04/02 09:29:44.639  [ORM]2024/04/02 09:29:44  -[Queries/default] - [  OK /     db.Exec /    68.8ms] - [DELETE FROM `ProductOTA` WHERE `ID` = ?] - `1`
+2024/04/02 09:29:44.639 [I]  Number of records deleted in database:%!(EXTRA []interface {}=[1])
+2024/04/02 09:29:48.514  [ORM]2024/04/02 09:29:48  -[Queries/default] - [  OK /    db.Query /     4.8ms] - [SELECT T0.`ID`, T0.`t__product_i_d`, T0.`t_name`, T0.`t_version`, T0.`t_file`, T0.`t_hash`, T0.`t_size`, T0.`t_describe`, T0.`t_publish`, T0.`create_time` FROM `ProductOTA` T0 ORDER BY T0.`create_time` DESC LIMIT 10]
+2024/04/02 09:29:48.518  [ORM]2024/04/02 09:29:48  -[Queries/default] - [  OK / db.QueryRow /     4.7ms] - [SELECT COUNT(*) FROM `ProductOTA` T0 ]
+2024/04/02 09:30:32.072 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/02 09:30:45.311 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/02 09:30:45.311 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/02 09:30:45.311 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/02 09:30:45.378 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/02 09:30:47.318 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/02 09:30:47.318 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/02 09:30:47.319 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/02 09:31:29.537  [ORM]2024/04/02 09:31:29  -[Queries/default] - [  OK / db.QueryRow /  3152.8ms] - [SELECT `t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time` FROM `ProductType` WHERE `t__product_i_d` = ? ] - `vAnzuGpV`
+2024/04/02 09:31:29.537 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/02 09:31:35.066  [ORM]2024/04/02 09:31:35  -[Queries/default] - [  OK / db.QueryRow /     9.0ms] - [SELECT `t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time` FROM `ProductType` WHERE `t__product_i_d` = ? ] - `vAnzuGpV2`
+2024/04/02 09:35:40.012 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/02 09:35:40.394 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/02 09:35:40.395 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/02 09:35:40.395 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/02 09:35:40.958 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/02 09:35:42.395 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/02 09:35:42.395 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/02 09:35:42.395 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/02 09:51:19.666 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/02 09:51:19.832 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/02 09:51:19.832 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/02 09:51:19.832 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/02 09:51:19.888 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/02 09:51:21.835 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/02 09:51:21.835 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/02 09:51:21.836 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/02 09:59:10.912  [ORM]2024/04/02 09:59:10  -[Queries/default] - [  OK /     db.Exec /   147.3ms] - [INSERT INTO `ProductProt` (`t_uuid`, `t_lang`, `t_analysis`, `t_text`, `t_describe`) VALUES (?, ?, ?, ?, ?)] - `12345678`, `1`, `1700186538268`, `代码内容1`, `描述内容1`
+2024/04/02 09:59:11.494  [ORM]2024/04/02 09:59:11  -[Queries/default] - [  OK /     db.Exec /   556.3ms] - [UPDATE `ProductProt` SET `t_lang` = ?, `t_analysis` = ?, `t_text` = ?, `t_describe` = ? WHERE `ID` = ?] - `1`, `1700186538268`, `代码内容1`, `描述内容1`, `1`
+2024/04/02 09:59:11.494 [I]  Number of records updated in database:%!(EXTRA []interface {}=[0])
+2024/04/02 09:59:11.498 [I]  File does not exist.%!(EXTRA []interface {}=[])
+2024/04/02 09:59:14.737 [I]  Error creating file:%!(EXTRA []interface {}=[open C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/1700186538268.so: The system cannot find the path specified.])
+2024/04/02 10:00:00.068  [ORM]2024/04/02 10:00:00  -[Queries/default] - [  OK /     db.Exec /    33.3ms] - [UPDATE `ProductProt` SET `t_lang` = ?, `t_analysis` = ?, `t_text` = ?, `t_describe` = ? WHERE `ID` = ?] - `1`, `1700186538268`, `代码内容1`, `描述内容1`, `1`
+2024/04/02 10:00:00.068 [I]  Number of records updated in database:%!(EXTRA []interface {}=[0])
+2024/04/02 10:00:00.073 [I]  File does not exist.%!(EXTRA []interface {}=[])
+2024/04/02 10:00:00.083 [I]  Error creating file:%!(EXTRA []interface {}=[open C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/1700186538268.so: The system cannot find the path specified.])
+2024/04/02 10:00:08.980  [ORM]2024/04/02 10:00:08  -[Queries/default] - [  OK /     db.Exec /    18.1ms] - [UPDATE `ProductProt` SET `t_lang` = ?, `t_analysis` = ?, `t_text` = ?, `t_describe` = ? WHERE `ID` = ?] - `1`, `1700186538268`, `代码内容1`, `描述内容1`, `1`
+2024/04/02 10:00:08.980 [I]  Number of records updated in database:%!(EXTRA []interface {}=[0])
+2024/04/02 10:00:08.995 [I]  File does not exist.%!(EXTRA []interface {}=[])
+2024/04/02 10:00:09.007 [I]  Error creating file:%!(EXTRA []interface {}=[open C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/1700186538268.so: The system cannot find the path specified.])
+2024/04/02 10:00:10.332  [ORM]2024/04/02 10:00:10  -[Queries/default] - [  OK /     db.Exec /    16.5ms] - [UPDATE `ProductProt` SET `t_lang` = ?, `t_analysis` = ?, `t_text` = ?, `t_describe` = ? WHERE `ID` = ?] - `1`, `1700186538268`, `代码内容1`, `描述内容1`, `1`
+2024/04/02 10:00:10.332 [I]  Number of records updated in database:%!(EXTRA []interface {}=[0])
+2024/04/02 10:00:10.337 [I]  File does not exist.%!(EXTRA []interface {}=[])
+2024/04/02 10:00:10.347 [I]  Error creating file:%!(EXTRA []interface {}=[open C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/1700186538268.so: The system cannot find the path specified.])
+2024/04/02 10:01:12.936 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/02 10:01:13.091 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/02 10:01:13.091 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/02 10:01:13.092 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/02 10:01:13.145 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/02 10:01:15.105 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/02 10:01:15.105 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/02 10:01:15.105 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/02 10:02:12.132  [ORM]2024/04/02 10:02:12  -[Queries/default] - [  OK /     db.Exec /    22.0ms] - [UPDATE `ProductProt` SET `t_lang` = ?, `t_analysis` = ?, `t_text` = ?, `t_describe` = ? WHERE `ID` = ?] - `2`, `1700186538268`, `代码内容2`, `描述内容2`, `1`
+2024/04/02 10:02:12.132 [I]  Number of records updated in database:%!(EXTRA []interface {}=[1])
+2024/04/02 10:02:12.137 [I]  File does not exist.%!(EXTRA []interface {}=[])
+2024/04/02 10:02:17.141 [I]  Error downloading file:%!(EXTRA []interface {}=[Get "https://yunlot.baozhida.cn/API/RunCode/Download?T_describe=1700186538268": read tcp 127.0.0.1:8562->127.0.0.1:7890: wsarecv: An existing connection was forcibly closed by the remote host.])
+2024/04/02 10:16:52.216  [ORM]2024/04/02 10:16:52  -[Queries/default] - [  OK / db.QueryRow /     8.6ms] - [SELECT `t_sn`, `t_password`, `t_ckey`, `t_online`, `t__product_i_d`, `t_data`, `t__relay_data`, `create_time`, `update_time` FROM `Device` WHERE `t_sn` = ? ] - `2024135610836597`
+2024/04/02 10:16:52.241  [ORM]2024/04/02 10:16:52  -[Queries/default] - [  OK / db.QueryRow /     8.4ms] - [SELECT `t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time` FROM `ProductType` WHERE `t__product_i_d` = ? ] - `jXdKOYaV`
+2024/04/02 10:16:52.242 [I]  T_renew:%!(EXTRA []interface {}=[[]])
+2024/04/02 10:37:21.351 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/02 10:37:21.534 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/02 10:37:21.534 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/02 10:37:21.534 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/02 10:37:21.590 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/02 10:37:23.540 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/02 10:37:23.540 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/02 10:37:23.541 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/02 10:37:33.764  [ORM]2024/04/02 10:37:33  -[Queries/default] - [  OK / db.QueryRow /     8.9ms] - [SELECT `t_sn`, `t_password`, `t_ckey`, `t_online`, `t__product_i_d`, `t_data`, `t__relay_data`, `create_time`, `update_time` FROM `Device` WHERE `t_sn` = ? ] - `2024141571847625`
+2024/04/02 10:37:33.780  [ORM]2024/04/02 10:37:33  -[Queries/default] - [  OK /     db.Exec /    16.6ms] - [INSERT INTO `Device` (`t_sn`, `t_password`, `t_ckey`, `t_online`, `t__product_i_d`, `t_data`, `t__relay_data`, `create_time`, `update_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)] - `2024141571847625`, `E8nyHRIN435oUwZl`, ``, `0`, `jXdKOYaV`, ``, ``, `2024-04-02 10:37:33.7642993 +0800 CST`, `2024-04-02 10:37:33.7642993 +0800 CST`
+2024/04/02 10:39:24.022 [I]  Msid:172%!(EXTRA []interface {}=[PushHandle  2024141571847625 {"Tt":{"Tt_speed":123}}])
+2024/04/02 10:39:24.022 [I]  Msid:172%!(EXTRA []interface {}=[没有找到网关! 1])
+2024/04/02 10:42:04.940 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/02 10:42:05.194 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/02 10:42:05.195 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/02 10:42:05.195 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/02 10:42:05.260 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/02 10:42:07.197 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/02 10:42:07.197 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/02 10:42:07.197 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/02 10:50:41.291 [I]  Msid:44%!(EXTRA []interface {}=[PushHandle  2024141571847625 {"Tt":{"Tt_speed":123}}])
+2024/04/02 10:50:41.291 [I]  Msid:44%!(EXTRA []interface {}=[没有找到网关! 1])
+2024/04/02 13:54:55.353 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/02 13:54:55.541 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/02 13:54:55.541 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/02 13:54:55.541 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/02 13:54:55.581 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/02 13:54:57.544 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/02 13:54:57.544 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/02 13:54:57.544 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/02 13:56:34.910 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/02 13:56:35.108 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/02 13:56:35.109 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/02 13:56:35.109 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/02 13:56:35.151 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/02 13:56:37.113 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/02 13:56:37.113 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/02 13:56:37.113 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/02 13:56:40.916  [ORM]2024/04/02 13:56:40  -[Queries/default] - [  OK /    db.Query /    10.8ms] - [SELECT T0.`t_sn`, T0.`t_password`, T0.`t_ckey`, T0.`t_online`, T0.`t__product_i_d`, T0.`t_data`, T0.`t__relay_data`, T0.`create_time`, T0.`update_time` FROM `Device` T0 WHERE T0.`t__product_i_d` = ? ORDER BY T0.`create_time` DESC LIMIT 10] - `jXdKOYaV`
+2024/04/02 13:56:40.927  [ORM]2024/04/02 13:56:40  -[Queries/default] - [  OK / db.QueryRow /     9.8ms] - [SELECT COUNT(*) FROM `Device` T0 WHERE T0.`t__product_i_d` = ? ] - `jXdKOYaV`
+2024/04/02 13:58:52.573  [ORM]2024/04/02 13:58:52  -[Queries/default] - [  OK /    db.Query /    15.5ms] - [SELECT T0.`t__product_i_d`, T0.`t__product_key`, T0.`t_uuid`, T0.`t_name`, T0.`t_mode`, T0.`t_prot`, T0.`t_panel`, T0.`t__tab_data`, T0.`t_state`, T0.`create_time`, T0.`update_time` FROM `ProductType` T0 WHERE T0.`t_state` = ? AND T0.`t_uuid` = ? ORDER BY T0.`create_time` DESC LIMIT 10] - `1`, `12345678`
+2024/04/02 13:58:52.584  [ORM]2024/04/02 13:58:52  -[Queries/default] - [  OK / db.QueryRow /    10.7ms] - [SELECT COUNT(*) FROM `ProductType` T0 WHERE T0.`t_state` = ? AND T0.`t_uuid` = ? ] - `1`, `12345678`
+2024/04/02 16:24:05.533 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/02 16:24:06.818 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/02 16:24:06.819 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/02 16:24:06.819 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/02 16:24:07.054 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/02 16:24:08.820 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/02 16:24:08.820 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/02 16:24:08.820 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/02 16:41:05.453 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/02 16:41:05.648 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/02 16:41:05.649 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/02 16:41:05.649 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/02 16:41:05.703 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/02 16:41:07.649 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/02 16:41:07.649 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/02 16:41:07.649 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/02 16:42:20.245 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/02 16:42:20.450 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/02 16:42:20.450 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/02 16:42:20.450 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/02 16:42:20.496 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/02 16:42:22.462 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/02 16:42:22.462 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/02 16:42:22.462 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/02 16:43:53.038 [I]  Analysis_Dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/])
+2024/04/02 16:43:53.239 [I]  MqttServer%!(EXTRA []interface {}=[ ======= 项目启动 ========])
+2024/04/02 16:43:53.239 [I]  Mongodb OK!%!(EXTRA []interface {}=[mongodb://127.0.0.1:27016])
+2024/04/02 16:43:53.239 [I]  Mongodb 测试连接!%!(EXTRA []interface {}=[])
+2024/04/02 16:43:53.290 [I]  Mongodb 测试连接 OK!%!(EXTRA []interface {}=[])
+2024/04/02 16:43:55.250 [I]  dir:%!(EXTRA []interface {}=[C:\BZD\PaaS\Alot\AIOT-coer])
+2024/04/02 16:43:55.250 [I]  ---PluginInit Mode----%!(EXTRA []interface {}=[])
+2024/04/02 16:43:55.250 [I]  ---PluginInit Resource----%!(EXTRA []interface {}=[])
+2024/04/02 16:44:12.043 [I]  Config_AddProductType%!(EXTRA []interface {}=[false])
+2024/04/02 16:44:27.311  [ORM]2024/04/02 16:44:27  -[Queries/default] - [  OK /     db.Exec /    18.4ms] - [UPDATE `ProductType` SET `t_name` = ?, `t_prot` = ?, `t_mode` = ?, `t__tab_data` = ?, `update_time` = ? WHERE `t__product_i_d` = ?] - `核心 mQTT 测试1`, `0`, `3`, `[{"T_name":"温度","T_tab":"Tt","T_type":1,"T_attr":{"unit":"C","dvalue":0,"accuracy":1,"min":2,"max":8},"T_text":"温度温度温度","T_read":true,"children":[{"T_name":"采样率","T_tab":"Tt_speed","T_type":1,"T_attr":{"unit":"s","dvalue":15,"accuracy":1,"min":0,"max":30},"T_text":"数据采集速度","T_read":false,"children":[]}]}]`, `2024-04-02 16:44:27.2929781 +0800 CST m=+34.276129301`, `jXdKOYaV`
+2024/04/02 16:44:27.311 [I]  Number of records updated in database:%!(EXTRA []interface {}=[1])
+2024/04/02 16:44:27.328  [ORM]2024/04/02 16:44:27  -[Queries/default] - [  OK /    db.Query /    11.6ms] - [SELECT T0.`t_sn`, T0.`t_password`, T0.`t_ckey`, T0.`t_online`, T0.`t__product_i_d`, T0.`t_data`, T0.`t__relay_data`, T0.`create_time`, T0.`update_time` FROM `Device` T0 WHERE T0.`t__product_i_d` = ? ] - `jXdKOYaV`
+2024/04/02 16:45:48.955 [I]  Config_AddProductType%!(EXTRA []interface {}=[true])
+2024/04/02 16:45:53.412  [ORM]2024/04/02 16:45:53  -[Queries/default] - [  OK /     db.Exec /    20.9ms] - [INSERT INTO `ProductType` (`t__product_i_d`, `t__product_key`, `t_uuid`, `t_name`, `t_mode`, `t_prot`, `t_panel`, `t__tab_data`, `t_state`, `create_time`, `update_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] - `DonVdZuY`, `B3F9PH8sZegfL1qkWvaVtSc7z5MyG0l4`, `12345678`, `核心 mQTT 测试1`, `3`, `0`, ``, `[{"T_name":"温度","T_tab":"Tt","T_type":1,"T_attr":{"unit":"C","dvalue":0,"accuracy":1,"min":2,"max":8},"T_text":"温度温度温度","T_read":true,"children":[{"T_name":"采样率","T_tab":"Tt_speed","T_type":1,"T_attr":{"unit":"s","dvalue":15,"accuracy":1,"min":0,"max":30},"T_text":"数据采集速度","T_read":false,"children":[]}]}]`, `1`, `2024-04-02 16:45:53.3916673 +0800 CST`, `2024-04-02 16:45:53.3916673 +0800 CST`
+2024/04/02 16:45:53.412 [I]  T_renew:%!(EXTRA []interface {}=[[]])

+ 0 - 0
logs/logx/logx.2024-04-04.001.log


+ 0 - 0
logs/logx/logx.2024-04-05.001.log


+ 0 - 0
logs/logx/logx.2024-04-06.001.log


+ 0 - 0
logs/logx/logx.log


+ 0 - 0
logs/logxE/logx.2024-04-01.001.log


+ 10 - 0
logs/logxE/logx.2024-04-03.001.log

@@ -0,0 +1,10 @@
+2024/04/02 09:59:11.498 [E]  File does not exist.%!(EXTRA []interface {}=[])
+2024/04/02 09:59:14.737 [E]  Error creating file:%!(EXTRA []interface {}=[open C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/1700186538268.so: The system cannot find the path specified.])
+2024/04/02 10:00:00.073 [E]  File does not exist.%!(EXTRA []interface {}=[])
+2024/04/02 10:00:00.083 [E]  Error creating file:%!(EXTRA []interface {}=[open C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/1700186538268.so: The system cannot find the path specified.])
+2024/04/02 10:00:08.995 [E]  File does not exist.%!(EXTRA []interface {}=[])
+2024/04/02 10:00:09.007 [E]  Error creating file:%!(EXTRA []interface {}=[open C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/1700186538268.so: The system cannot find the path specified.])
+2024/04/02 10:00:10.337 [E]  File does not exist.%!(EXTRA []interface {}=[])
+2024/04/02 10:00:10.347 [E]  Error creating file:%!(EXTRA []interface {}=[open C:\BZD\PaaS\Alot\AIOT-coer/Plugin/Prot/1700186538268.so: The system cannot find the path specified.])
+2024/04/02 10:02:12.137 [E]  File does not exist.%!(EXTRA []interface {}=[])
+2024/04/02 10:02:17.141 [E]  Error downloading file:%!(EXTRA []interface {}=[Get "https://yunlot.baozhida.cn/API/RunCode/Download?T_describe=1700186538268": read tcp 127.0.0.1:8562->127.0.0.1:7890: wsarecv: An existing connection was forcibly closed by the remote host.])

+ 0 - 0
logs/logxE/logx.2024-04-04.001.log


+ 0 - 0
logs/logxE/logx.2024-04-05.001.log


+ 0 - 0
logs/logxE/logx.2024-04-06.001.log


+ 0 - 0
logs/logxE/logx.log


+ 59 - 0
main.go

@@ -0,0 +1,59 @@
+package main
+
+import (
+	"AIOTCOER/Plugin"
+	"AIOTCOER/conf"
+	"AIOTCOER/logs"
+	"AIOTCOER/models/Device"
+	_ "AIOTCOER/routers"
+	"github.com/beego/beego/v2/adapter/orm"
+	orm2 "github.com/beego/beego/v2/client/orm"
+	beego "github.com/beego/beego/v2/server/web"
+	"github.com/beego/beego/v2/server/web/filter/cors"
+	_ "github.com/go-sql-driver/mysql"
+	"runtime"
+	"strconv"
+)
+
+func init() {
+	runtime.GOMAXPROCS(runtime.NumCPU())
+
+	//logs.Println("MysqlServer:" + conf.MysqlServer_Username + ":" + conf.MysqlServer_Password + "@tcp(" + conf.MysqlServer_UrlPort + ")/" + conf.MysqlServer_Database + "?charset=utf8mb4&loc=Local&parseTime=True")
+
+	orm.RegisterDriver("mysql", orm.DRMySQL)
+	orm.RegisterDataBase("default", "mysql",
+		conf.MysqlServer_Username+":"+conf.MysqlServer_Password+"@tcp("+conf.MysqlServer_UrlPort+")/"+conf.MysqlServer_Database+"?charset=utf8mb4&loc=Local&parseTime=True",
+		conf.MysqlServer_MaxIdleConnections, conf.MysqlServer_MaxOpenConnections)
+	orm.RunSyncdb("default", false, true) // 创建数据库
+
+}
+
+func main() {
+
+	beego.BConfig.AppName = conf.AppName + "_" + strconv.Itoa(conf.HTTPPort)    // 项目名
+	beego.BConfig.ServerName = conf.AppName + "_" + strconv.Itoa(conf.HTTPPort) //server  名称
+	beego.BConfig.RunMode = "dev"                                               //  应用的运行模式
+	beego.BConfig.Listen.HTTPPort = conf.HTTPPort                               //监听端口  本地:8518  线上:8528
+
+	beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
+		// 允许访问所有源
+		AllowAllOrigins: true,
+		// 可选参数"GET", "POST", "PUT", "DELETE", "OPTIONS" (*为所有)
+		AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
+		// 指的是允许的Header的种类
+		AllowHeaders: []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
+		// 公开的HTTP标头列表
+		ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
+		// 如果设置,则允许共享身份验证凭据,例如cookie
+		AllowCredentials: true,
+	}))
+
+	orm2.Debug = true
+	logs.Println("MqttServer", " ======= 项目启动 ========")
+	go Device.ConnectMongodb() // 连接 Mongodb
+	go Plugin.PluginInit()     // Plugin 初始化
+
+
+	beego.Run()
+
+}

+ 79 - 0
models/Account/Tokey.go

@@ -0,0 +1,79 @@
+package Account
+
+import (
+	"AIOTCOER/conf"
+	"AIOTCOER/logs"
+	"fmt"
+	"github.com/astaxie/beego/cache"
+	_ "github.com/astaxie/beego/cache/redis"
+	uuid "github.com/satori/go.uuid"
+	"time"
+)
+
+var redis_Tokey cache.Cache
+
+func init() {
+
+	config := fmt.Sprintf(`{"key":"%s","conn":"%s","dbNum":"%s","password":"%s"}`,
+		"redis_Tokey", conf.Redis_address, conf.Redis_dbNum, conf.Redis_password)
+	var err error
+	redis_Tokey, err = cache.NewCache("redis", config)
+	if err != nil || redis_Tokey == nil {
+		logs.PrintlnError(config, err)
+		panic(any(err))
+	}
+}
+
+// ---------------- Redis -------------------
+// Redis_Set(m.T_sn,m) // Redis 更新缓存
+func Redis_Tokey_Set(key string, r string) (err error) {
+	err = redis_Tokey.Put(key, r, 24*time.Hour)
+	if err != nil {
+		logs.Println("set key:", key, ",value:", r, err)
+	}
+	return
+}
+
+// if r,is :=Redis_Get(T_sn);is{
+// return r,nil
+// }
+func Redis_Tokey_Get(key string) (r string, is bool) {
+	if redis_Tokey.IsExist(key) {
+		//println("找到key:",key)
+		v := redis_Tokey.Get(key)
+		value := string(v.([]byte))
+		Redis_Tokey_Set(key, value)
+		return value, true
+	}
+	//println("没有 找到key:",key)
+	return "", false
+}
+
+func Redis_DelK(key string) (err error) {
+	err = redis_Tokey.Delete(key)
+	return
+}
+
+// ---------------- 方法 -------------------
+
+// 验证 TOKEY
+func Read_Tokey(User_tokey string) (string, bool) {
+
+	return Redis_Tokey_Get(User_tokey)
+}
+
+// 添加 Tokey
+func Add_Tokey(User_uuid string) (Tokey string) {
+
+	for true {
+		Tokey = uuid.NewV4().String()
+		_, is := Redis_Tokey_Get(Tokey)
+		if !is {
+			break
+		}
+		fmt.Print("申请 TOKEY 重复!重新生成。", Tokey)
+	}
+	Redis_Tokey_Set(Tokey, User_uuid)
+
+	return Tokey
+}

+ 121 - 0
models/Account/User.go

@@ -0,0 +1,121 @@
+package Account
+
+import (
+	"AIOTCOER/conf"
+	"AIOTCOER/logs"
+	"AIOTCOER/models"
+	"encoding/json"
+	"fmt"
+	"github.com/astaxie/beego/cache"
+	_ "github.com/astaxie/beego/cache/redis"
+	"github.com/beego/beego/v2/adapter/orm"
+	_ "github.com/go-sql-driver/mysql"
+	"time"
+)
+
+type User struct {
+	T_uuid string `orm:"size(100);pk"`
+	T_user string `orm:"size(256);null"` // 用户名
+	T_pass string `orm:"size(256);null"` // 密码
+	T_hash string `orm:"size(256);null"` // hash
+
+	T_State    int         `orm:"size(200);1"`                                           //  1 正常   2 删除\禁用
+	CreateTime models.Time `orm:"column(create_time);type(timestamp);null;auto_now_add"` //auto_now 每次 model 保存时都会对时间自动更新
+	UpdateTime models.Time `orm:"column(update_time);type(timestamp);null;auto_now"`     //auto_now_add 第一次保存时才设置时间
+}
+type VCode struct {
+	T_Code string
+}
+
+func (t *User) TableName() string {
+	return "User" // 数据库名称   // ************** 替换 FormulaList **************
+}
+
+var redis_User cache.Cache
+
+func init() {
+	//注册模型
+	orm.RegisterModel(new(User))
+	config := fmt.Sprintf(`{"key":"%s","conn":"%s","dbNum":"%s","password":"%s"}`,
+		"redis_User", conf.Redis_address, conf.Redis_dbNum, conf.Redis_password)
+	var err error
+	redis_User, err = cache.NewCache("redis", config)
+	if err != nil || redis_User == nil {
+		logs.PrintlnError(config, err)
+		panic(any(err))
+	}
+}
+
+// ---------------- Redis -------------------
+func (t *User) redis_Set() (err error) {
+	//json序列化
+	str, err := json.Marshal(t)
+	if err != nil {
+		logs.PrintlnError("Redis_Set", err)
+		return
+	}
+
+	err = redis_User.Put(t.T_uuid, str, 24*time.Hour)
+	if err != nil {
+		logs.Println("set key:", t.T_uuid, ",value:", str, err)
+	}
+	return
+}
+func (t *User) redis_Get(key string) (is bool) {
+	if redis_User.IsExist(key) {
+		//println("找到key:",key)
+		v := redis_User.Get(key)
+		if v == nil {
+			return false
+		}
+		json.Unmarshal(v.([]byte), t)
+		return true
+	}
+	//println("没有 找到key:",key)
+	return false
+}
+func (t *User) redis_DelK() (err error) {
+	err = redis_User.Delete(t.T_uuid)
+	return
+}
+
+// ---------------- 方法 -------------------
+
+// 获取 ById
+func (t *User) Read(T_uuid string) (r User, is bool) {
+	if r.redis_Get(T_uuid) {
+		return r, true
+	}
+	o := orm.NewOrm()
+	r = User{T_uuid: T_uuid}
+	err := o.Read(&r, "T_uuid") // o.Read(&r,"Tokey") 如果不是 主键 就得指定字段名
+	if err != nil {
+		return r, false
+	}
+	r.redis_Set() // Redis 更新缓存
+	return r, true
+}
+
+// 添加
+func (t *User) Add() (id int64, is bool) {
+	o := orm.NewOrm()
+
+	id, err := o.Insert(t)
+	if err != nil {
+		return 0, false
+	}
+
+	t.redis_Set()
+	return id, true
+}
+
+// 修改
+func (t *User) Update(cols ...string) bool {
+	o := orm.NewOrm()
+	if num, err := o.Update(&t, cols...); err == nil {
+		logs.Println("Number of records updated in database:", num)
+		t.redis_Set() // Redis 更新缓存
+		return true
+	}
+	return false
+}

+ 402 - 0
models/Device/Device.go

@@ -0,0 +1,402 @@
+package Device
+
+import (
+	"AIOTCOER/conf"
+	"AIOTCOER/lib"
+	"AIOTCOER/logs"
+	"AIOTCOER/models"
+	"AIOTCOER/models/Product"
+	"encoding/json"
+	"fmt"
+	"github.com/astaxie/beego/cache"
+	_ "github.com/astaxie/beego/cache/redis"
+	"github.com/beego/beego/v2/adapter/orm"
+	orm2 "github.com/beego/beego/v2/client/orm"
+	_ "github.com/go-sql-driver/mysql"
+	"github.com/vmihailenco/msgpack/v5"
+	"time"
+)
+
+// 设备
+type Device struct {
+	T_sn          string                 `orm:"size(64);pk" json:"T_sn" msgpack:"T_sn" form:"T_sn"`                          // Sn
+	T_password    string                 `orm:"size(128);" json:"T_password" msgpack:"T_password" form:"T_password"`         // 设备密钥
+	T_ckey        string                 `orm:"size(32);" json:"-"  msgpack:"T_ckey" form:"T_ckey" `                         // 控制密钥 (业务系统自动生成 < 64位)
+	T_online      int                    `orm:"size(1);index;default(3)" json:"T_online" msgpack:"T_online" form:"T_online"` // 在线状态  1 在线  2 离线   3 未激活
+	T_ProductID   string                 `orm:"size(32);index" json:"T_ProductID" msgpack:"T_ProductID" form:"T_ProductID"`  // 产品类型
+	T_ProductJson Product.ProductType    `orm:"-" json:"T_ProductJson" msgpack:"T_ProductJson"`                              // 产品类型 json
+	T_data        string                 `orm:"column(t_data);type(text);default('')" json:"T_data" msgpack:"T_data" `       // 设备数据
+	T_dataJson    map[string]interface{} `orm:"-" json:"T_dataJson" msgpack:"T_dataJson"`                                    // 设备数据
+
+	T_RelayData     string                   `orm:"type(text);default('[]')" json:"T_RelayData" msgpack:"T_RelayData" form:"T_RelayData"` // 消息转发
+	T_RelayDataJson []map[string]interface{} `orm:"-" json:"T_RelayDataJson" msgpack:"T_RelayDataJson"`                                   // 消息转发 json
+
+	CreateTime models.Time `orm:"column(create_time);type(timestamp);auto_now_add" json:"CreateTime" msgpack:"CreateTime"`
+	UpdateTime models.Time `orm:"column(update_time);type(timestamp);auto_now" json:"UpdateTime" msgpack:"UpdateTime"`
+}
+
+/*
+	消息转发  T_RelayData \ T_RelayDataJson
+
+[
+
+	{
+		"T_tabs": "AAAA.AAAA",
+		"T_name": "推送报警",
+		"T_pushid": 0,
+		"T_pub": "/aaa/{$sn}/AAAA"
+	},
+	{
+		"T_tabs": "AAAA.BBBB",
+		"T_name": "推送报警",
+		"T_pushid": 0,
+		"T_pub": "/aaa/{$sn}/BBBB"
+	}, {
+		"T_tabs": "AAAA.CCCC",
+		"T_name": "推送报警",
+		"T_pushid": 0,
+		"T_pub": "/aaa/{$sn}/CCCC"
+	}
+
+]
+
+-----------------
+//  {KEY}   监听 TAB 标识 拼接:AAAA.BBBB   对象后面加点
+//  	T_name   名称
+//  	T_mode   推送服务 0:Nats  1:API  2:MQTT
+//  	T_pub   发布号 /aaa/{$sn}/bbb
+*/
+
+// 设备 - 列表
+type Device_List struct {
+	T_sn        string      `orm:"size(64);pk" json:"T_sn" form:"T_sn"`                      // Sn
+	T_online    int         `orm:"size(1);index;default(3)" json:"T_online" form:"T_online"` // 在线状态  1 在线  2 离线   3 未激活
+	CreateTime  models.Time `orm:"column(create_time);type(timestamp);auto_now_add" json:"CreateTime"`
+	UpdateTime  models.Time `orm:"column(update_time);type(timestamp);auto_now" json:"UpdateTime"`
+}
+
+func (t *Device) TableName() string {
+	return "Device" // 数据库名称   // ************** 替换 FormulaList **************
+}
+
+var redis_Device cache.Cache
+
+func init() {
+	//注册模型
+	orm.RegisterModel(new(Device))
+
+	config := fmt.Sprintf(`{"key":"%s","conn":"%s","dbNum":"%s","password":"%s"}`,
+		"redis_Device", conf.Redis_address, conf.Redis_dbNum, conf.Redis_password)
+	var err error
+	redis_Device, err = cache.NewCache("redis", config)
+	if err != nil || redis_Device == nil {
+		logs.PrintlnError(config, err)
+		panic(any(err))
+	}
+}
+
+// ---------------- Redis -------------------
+func (t *Device) Redis_Set() (err error) {
+	if len(t.T_data) > 5 {
+		var T_datajson map[string]interface{}
+		json.Unmarshal([]byte(t.T_data), &T_datajson)
+		t.T_dataJson = T_datajson
+	}
+	if len(t.T_ProductID) > 0 {
+		t.T_ProductJson.T_ProductID = t.T_ProductID
+		t.T_ProductJson.Read()
+	}
+	if len(t.T_RelayData) > 0 {
+		var T_datajson []map[string]interface{}
+		json.Unmarshal([]byte(t.T_RelayData), &T_datajson)
+		t.T_RelayDataJson = T_datajson
+	}
+	//json序列化
+	str, err := msgpack.Marshal(t)
+	if err != nil {
+		logs.PrintlnError("Redis_Set", err)
+		return
+	}
+
+	err = redis_Device.Put(t.T_sn, str, 24*time.Hour)
+	if err != nil {
+		logs.Println("set key:", t.T_sn, ",value:", str, err)
+	}
+	return
+}
+func (t *Device) Redis_Get(key string) (is bool) {
+	if redis_Device.IsExist(key) {
+		//println("找到key:",key)
+		v := redis_Device.Get(key)
+		if v == nil {
+			return false
+		}
+
+		msgpack.Unmarshal(v.([]byte), t)
+
+		return true
+	}
+	//println("没有 找到key:",key)
+	return false
+}
+func (t *Device) Redis_DelK() (err error) {
+	err = redis_Device.Delete(t.T_sn)
+	return
+}
+
+// ---------------- 方法 -------------------
+
+// 获取(不带缓存查询)
+func (t *Device) Read() (is bool) {
+	o := orm.NewOrm()
+	err := o.Read(t) // o.Read(&r,"Tokey") 如果不是 主键 就得指定字段名
+	if err != nil {
+		return false
+	}
+	return true
+}
+
+// 获取-高效的
+func (t *Device) Read_Tidy() (bool bool) {
+	if t.Redis_Get(t.T_sn) {
+		return true
+	}
+	o := orm.NewOrm()
+	err := o.Read(t) // o.Read(&r,"Tokey") 如果不是 主键 就得指定字段名
+	if err != nil {
+		return false
+	}
+	t.Redis_Set() // Redis 更新缓存
+
+	return true
+}
+
+func (Device_r *Device) CreateSn(GetRandstringI int) bool {
+
+	GetRandstringI += GetRandstringI * 100
+	if len(Device_r.T_sn) < 10 {
+		for true {
+			Device_r.T_sn = lib.WeekByDate() + lib.GetRandstring(10, "0123456789123456789", int64(GetRandstringI))
+			Device_is := Device{T_sn: Device_r.T_sn}
+			if !Device_is.Read() {
+				break
+			}
+			GetRandstringI += 1
+		}
+
+	} else {
+		Device_is := Device{T_sn: Device_r.T_sn}
+		if Device_is.Read() {
+
+			return false
+		}
+		Device_r.Add()
+	}
+
+	GetRandstringI += 1
+	// mysql 秘钥
+	if len(Device_r.T_password) == 0 {
+		Device_r.T_password = lib.GetRandstring(16, "", int64(GetRandstringI))
+	}
+	//println(Device_r.T_password)
+	//Device_r.T_password = lib.Sha256(Device_r.T_password)
+
+	Device_r.Add()
+	return true
+}
+
+// 添加
+func (t *Device) Add() (is bool) {
+	o := orm.NewOrm()
+
+	id, err := o.Insert(t)
+	if err != nil {
+		return false
+	}
+	println(id)
+	t.Redis_Set()
+	return true
+}
+
+// 修改
+func (t *Device) Update(cols ...string) bool {
+	data, _ := json.Marshal(t.T_dataJson)
+	t.T_data = string(data)
+
+	// 更新时间
+	t.UpdateTime.NowDbTime()
+	cols = append(cols, "UpdateTime")
+
+	o := orm.NewOrm()
+	if num, err := o.Update(t, cols...); err == nil {
+		logs.Println("Number of records updated in database:", num)
+		t.Redis_Set() // Redis 更新缓存
+		return true
+	}
+	return false
+}
+
+// 删除
+func (t *Device) Delete() bool {
+	o := orm.NewOrm()
+	if num, err := o.Delete(t); err == nil {
+		logs.Println("Number of records deleted in database:", num)
+	} else {
+		return false
+	}
+
+	t.Redis_DelK()
+	return true
+}
+
+// 获取列表
+func (t *Device) Lists(PageIndex int, PageSize int) ([]Device_List, int64) {
+
+	o := orm.NewOrm()
+
+	// 也可以直接使用 Model 结构体作为表名
+	qs := o.QueryTable(new(Device))
+	var offset int64
+	if PageIndex <= 1 {
+		offset = 0
+	} else {
+		offset = int64((PageIndex - 1) * PageSize)
+	}
+
+	// 筛选参数
+	cond := orm.NewCondition().And("T_ProductID", t.T_ProductID)
+	if len(t.T_sn) > 0 {
+		cond = cond.And("T_sn__icontains", t.T_sn) // .AndNot("status__in", 1).Or("profile__age__gt", 2000)
+	}
+	if t.T_online > 0 {
+		cond = cond.And("T_online", t.T_online) // .AndNot("status__in", 1).Or("profile__age__gt", 2000)
+	}
+
+	var r []Device
+	// 执行
+	qs.Limit(PageSize, offset).SetCond((*orm2.Condition)(cond)).OrderBy("-CreateTime").All(&r)
+	Total, _ := qs.SetCond((*orm2.Condition)(cond)).Count()
+
+	var Device_List_r []Device_List
+	for _, v := range r {
+		Device_List_r = append(Device_List_r, Device_List{
+			T_sn:        v.T_sn,
+			T_online:    v.T_online,
+			CreateTime:  v.CreateTime,
+			UpdateTime:  v.UpdateTime,
+		})
+	}
+	//	if len(r[i].T_ProductID) > 0 {
+	//		r[i].T_ProductJson.T_ProductID = r[i].T_ProductID
+	//		r[i].T_ProductJson.Read()
+	//	}
+	//	if len(r[i].T_data) > 5 {
+	//		var T_datajson map[string]interface{}
+	//		json.Unmarshal([]byte(r[i].T_data), &T_datajson)
+	//		r[i].T_dataJson = T_datajson
+	//	}
+	//	if len(r[i].T_RelayData) > 0 {
+	//		var T_datajson []map[string]interface{}
+	//		json.Unmarshal([]byte(r[i].T_RelayData), &T_datajson)
+	//		r[i].T_RelayDataJson = T_datajson
+	//		//logs.Println("T_RelayData", r[i].T_RelayDataJson)
+	//	}
+	//}
+
+	return Device_List_r, Total
+}
+
+//// 获取列表
+//func (t *Device) Lists(PageIndex int, PageSize int) (r []Device, Total int64) {
+//
+//	o := orm.NewOrm()
+//
+//	// 也可以直接使用 Model 结构体作为表名
+//	qs := o.QueryTable(new(Device))
+//	var offset int64
+//	if PageIndex <= 1 {
+//		offset = 0
+//	} else {
+//		offset = int64((PageIndex - 1) * PageSize)
+//	}
+//
+//	// 筛选参数
+//	cond := orm.NewCondition()
+//	if len(t.T_ProductID) > 0 {
+//		cond = cond.And("T_ProductID", t.T_ProductID) // .AndNot("status__in", 1).Or("profile__age__gt", 2000)
+//	}
+//	if len(t.T_sn) > 0 {
+//		cond = cond.And("T_sn__icontains", t.T_sn) // .AndNot("status__in", 1).Or("profile__age__gt", 2000)
+//	}
+//	if t.T_online > 0 {
+//		cond = cond.And("T_online", t.T_online) // .AndNot("status__in", 1).Or("profile__age__gt", 2000)
+//	}
+//
+//	// 执行
+//	qs.Limit(PageSize, offset).SetCond((*orm2.Condition)(cond)).OrderBy("-UpdateTime").All(&r)
+//	Total, _ = qs.SetCond((*orm2.Condition)(cond)).Count()
+//	for i, _ := range r {
+//		if len(r[i].T_ProductID) > 0 {
+//			r[i].T_ProductJson.T_ProductID = r[i].T_ProductID
+//			r[i].T_ProductJson.Read()
+//		}
+//		if len(t.T_data) > 5 {
+//			var T_datajson map[string]interface{}
+//			json.Unmarshal([]byte(t.T_data), &T_datajson)
+//			t.T_dataJson = T_datajson
+//		}
+//	}
+//	return r, Total
+//}
+
+// 获取列表
+func (t *Device) Lists_All() (r []Device) {
+
+	o := orm.NewOrm()
+
+	// 也可以直接使用 Model 结构体作为表名
+	qs := o.QueryTable(new(Device))
+
+	// 筛选参数
+	cond := orm.NewCondition()
+	if len(t.T_ProductID) > 0 {
+		cond = cond.And("T_ProductID", t.T_ProductID) // .AndNot("status__in", 1).Or("profile__age__gt", 2000)
+	}
+
+	// 执行
+	qs.SetCond((*orm2.Condition)(cond)).All(&r)
+
+	for i, _ := range r {
+		if len(r[i].T_ProductID) > 0 {
+			r[i].T_ProductJson.T_ProductID = r[i].T_ProductID
+			r[i].T_ProductJson.Read()
+		}
+		if len(t.T_data) > 5 {
+			var T_datajson map[string]interface{}
+			json.Unmarshal([]byte(t.T_data), &T_datajson)
+			t.T_dataJson = T_datajson
+		}
+	}
+	return r
+}
+
+// 删除 关联设备缓存
+func Device_CacheDelK_All(T_ProductID string) {
+
+	o := orm.NewOrm()
+
+	// 也可以直接使用 Model 结构体作为表名
+	qs := o.QueryTable(new(Device))
+
+	// 筛选参数
+	cond := orm.NewCondition()
+	cond = cond.And("T_ProductID", T_ProductID) // .AndNot("status__in", 1).Or("profile__age__gt", 2000)
+
+	// 执行
+	var r []Device
+	qs.SetCond((*orm2.Condition)(cond)).All(&r)
+	for _, v := range r {
+		v.Redis_DelK()
+	}
+	return
+}

+ 278 - 0
models/Device/DeviceData.go

@@ -0,0 +1,278 @@
+package Device
+
+import (
+	"AIOTCOER/conf"
+	"AIOTCOER/lib"
+	"AIOTCOER/logs"
+	"AIOTCOER/models"
+	"context"
+	"encoding/json"
+	"fmt"
+	"github.com/astaxie/beego/cache"
+	_ "github.com/astaxie/beego/cache/redis"
+	_ "github.com/go-sql-driver/mysql"
+	"go.mongodb.org/mongo-driver/bson"
+	"go.mongodb.org/mongo-driver/bson/primitive"
+	"go.mongodb.org/mongo-driver/mongo"
+	"go.mongodb.org/mongo-driver/mongo/options"
+	"strconv"
+	"time"
+)
+
+// 模板
+type DeviceData_R struct {
+	T_tab      string      `orm:"size(256);index" json:"T_Rtab"`                         //转发 TAB 标识 拼接:AAAA.BBBB.   对象后面加点
+	T_type     int         `orm:"size(200);default(4)"`                                  // 数据类型  (1,'bool'),(2,'int'),(3,'float'),(4,'str'),(5,'time'),(7,'u8'[模式图片]);
+	T_bool     bool        `orm:"type(text);size(200);"`                                 // 值
+	T_int      int         `orm:"type(text);size(200);null"`                             // 值
+	T_float    float64     `orm:"type(text);size(200);null"`                             // 值
+	T_time     models.Time `orm:"type(timestamp);null;"`                                 // 采集时间
+	CreateTime models.Time `orm:"column(create_time);type(timestamp);null;auto_now_add"` //auto_now_add 第一次保存时才设置时间
+}
+
+// 表单
+type Device_Form struct {
+	T_ProductID string `json:"T_ProductID" form:"T_ProductID"` // Sn
+	T_sn        string `json:"T_sn" form:"T_sn"`               // 标签路径
+	T_online    int    `json:"T_online" form:"T_online"`       // 当前页码
+	PageIndex   int    `json:"PageIndex" form:"PageIndex"`     // 当前页码
+	PageSize    int    `json:"PageSize" form:"PageSize"`       // 每页文档数量
+}
+
+// 表单
+type DeviceData_Form struct {
+	T_sn       string `json:"T_sn" form:"T_sn"`             // Sn
+	T_jointTab string `json:"T_jointTab" form:"T_jointTab"` // 标签路径
+	T_jsonFind string `json:"T_jsonFind" form:"T_jsonFind"` // 条件
+	T_jsonSort string `json:"T_jsonSort" form:"T_jsonSort"` // 排序
+	PageIndex  int    `json:"PageIndex" form:"PageIndex"`   // 当前页码
+	PageSize   int    `json:"PageSize" form:"PageSize"`     // 每页文档数量
+}
+
+var redis_DeviceData cache.Cache
+var Mongodb_client *mongo.Client
+var Mongodb_DB *mongo.Database
+
+func init() {
+	var err error
+	config := fmt.Sprintf(`{"key":"%s","conn":"%s","dbNum":"%s","password":"%s"}`,
+		"redis_DeviceData", conf.Redis_address, conf.Redis_dbNum, conf.Redis_password)
+	//logs.Println(config)
+
+	redis_DeviceData, err = cache.NewCache("redis", config)
+	if err != nil || redis_DeviceData == nil {
+		logs.PrintlnError(config, err)
+		panic(any(err))
+	}
+
+}
+
+// 连接 Mongodb
+func ConnectMongodb() {
+	credential := options.Credential{
+		//AuthSource: conf.Mongodb_DB,
+		Username:   conf.Mongodb_Username,
+		Password:   conf.Mongodb_Password,
+		AuthSource: conf.Mongodb_DB,
+	}
+	ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
+	defer cancel()
+	var err error
+	Mongodb_client, err = mongo.Connect(ctx, options.Client().ApplyURI(conf.Mongodb_Url).SetAuth(credential).SetMaxPoolSize(200))
+	if err != nil {
+		logs.PrintlnError("Mongodb 连接错误!", err)
+		panic(any(err))
+	} else {
+		logs.Println("Mongodb OK!", conf.Mongodb_Url)
+	}
+	Mongodb_DB = Mongodb_client.Database(conf.Mongodb_DB)
+
+	//测试连接
+	logs.Println("Mongodb 测试连接!")
+	collection := Mongodb_DB.Collection("yuniot")
+
+	_, err = collection.InsertOne(context.TODO(), bson.D{{"time", time.Now()}})
+	if err != nil {
+		logs.Println("Mongodb:", conf.Mongodb_Url, conf.Mongodb_Username, conf.Mongodb_Password, conf.Mongodb_DB)
+		logs.PrintlnError("Mongodb 连接测试错误!", err)
+		panic(any(err))
+	} else {
+		logs.Println("Mongodb 测试连接 OK!")
+	}
+
+}
+
+// ---------------- Redis -------------------
+// Redis_Set(m.T_sn,m) // Redis 更新缓存
+func RedisDeviceData_Set(T_sn string, T_id int, r DeviceData_R) (err error) {
+	key := T_sn + "|" + strconv.Itoa(T_id)
+
+	if redis_DeviceData.IsExist(key) {
+		var t DeviceData_R
+		v := redis_DeviceData.Get(key)
+		json.Unmarshal(v.([]byte), &t)
+		// 防止时间溢出
+		if time.Now().Unix() <= r.T_time.Unix() {
+			r.T_time.NowDbTime()
+		}
+		// 提前最新数据
+		if t.T_time.Unix() > r.T_time.Unix() {
+			// 储存的 是最新数据
+			return
+		}
+	}
+
+	//json序列化
+	str, err := json.Marshal(r)
+	if err != nil {
+		logs.PrintlnError("RedisDeviceData_Set", err)
+		return
+	}
+	err = redis_DeviceData.Put(key, str, 1*time.Hour)
+	if err != nil {
+		logs.Println("set key:", key, ",value:", str, err)
+	}
+	return
+}
+
+func RedisDeviceData_Get(key string) (r DeviceData_R, is bool) {
+	if redis_DeviceData.IsExist(key) {
+		v := redis_DeviceData.Get(key)
+		json.Unmarshal(v.([]byte), &r)
+		return r, true
+	}
+	return DeviceData_R{}, false
+}
+
+// ----------------
+func Data_Add(JointTab string, bson_r *bson.M) {
+
+	//dd, _ := time.ParseDuration("8h")
+	//(*bson_r)["CreateTime"] = time.Now().Add(dd)  // 插入默认时间
+	(*bson_r)["CreateTime"] = time.Now() // 插入默认时间
+
+	logs.Println("JointTab:", JointTab, *bson_r)
+	collection := Mongodb_DB.Collection(JointTab)
+
+	_, err := collection.InsertOne(context.TODO(), bson_r)
+	if err != nil {
+		logs.PrintlnError("Data_Add:", err.Error())
+	}
+
+}
+
+// db.getCollection("2023445039284316_params_varData").find({ $and : [{"name" : "TempSet"}, {"value" : "26"}] }).limit(1000).skip(0)
+// ----------------
+func Data_Read(JointTab string, bson_r *bson.M) {
+
+	logs.Println("JointTab:", JointTab, *bson_r)
+	collection := Mongodb_DB.Collection(JointTab)
+
+	_, err := collection.InsertOne(context.TODO(), bson_r)
+	if err != nil {
+		logs.PrintlnError("Data_Read:", err.Error())
+	}
+
+}
+
+/*
+----------------
+// 数据列表
+JointTab:2023445039284316_params.varData
+// 条件 jsonFind := `{"$or":[{"name":"TempSet"},{"value":"26"}]}`
+// 排序 jsonSort := `{"value": 1}`
+// 当前页码 page := 2
+// 每页文档数量 pageSize := 2
+*/
+func Data_List(JointTab, jsonFind, jsonSort string, page, pageSize int) lib.JSONS {
+	var err error
+	// 初始化 Mongodb_DB
+	collection := Mongodb_DB.Collection(JointTab)
+	if page < 1 {
+		page = 1
+	}
+	// 限制 过小、过大
+	if pageSize < 1 || pageSize > 9999 {
+		page = 10
+	}
+	// 分页
+	options := options.Find().SetSkip(int64((page - 1) * pageSize)).SetLimit(int64(pageSize))
+	// 排序
+	if len(jsonSort) != 0 {
+		// 解码JSON
+		var jsonSortMap map[string]interface{}
+		err = json.Unmarshal([]byte(jsonSort), &jsonSortMap)
+		if err != nil {
+			logs.PrintlnError("解码JSON 错误", err)
+			return lib.JSONS{Code: lib.Error, Msg: "排序 解码JSON 错误!"}
+		}
+
+		options = options.SetSort(bson.M(jsonSortMap))
+	}
+	// 条件
+	jsonFind_M := bson.M{}
+	if len(jsonFind) != 0 {
+		// 解码JSON
+		//var jsonFindMap map[string]interface{}
+		err = json.Unmarshal([]byte(jsonFind), &jsonFind_M)
+		if err != nil {
+			logs.PrintlnError("解码JSON 错误", err)
+			return lib.JSONS{Code: lib.Error, Msg: "条件 解码JSON 错误!"}
+		}
+		//jsonFind_M = jsonFindMap
+
+		jsonFind_M = lib.MongdbJsonHtime(jsonFind_M)
+		logs.Println("jsonFind_M:", jsonFind_M)
+
+	}
+
+	cursor, err := collection.Find(context.Background(), jsonFind_M, options)
+	if err != nil {
+		logs.PrintlnError("Find 错误", err)
+		return lib.JSONS{Code: lib.Error, Msg: "Find 错误!"}
+	}
+	defer cursor.Close(context.Background())
+
+	var results []bson.M
+	if err = cursor.All(context.Background(), &results); err != nil {
+		logs.PrintlnError("cursor.All 错误", err)
+		return lib.JSONS{Code: lib.Error, Msg: "cursor.All 错误!"}
+	}
+
+	// 时间转换
+	for _, v := range results {
+		v["CreateTime"] = v["CreateTime"].(primitive.DateTime).Time().Format("2006-01-02 15:04:05")
+	}
+
+	//
+	//// 遍历查询结果并格式化时间
+	//for cursor.Next(context.Background()) {
+	//	var event Event
+	//	if err := cursor.Decode(&event); err != nil {
+	//		log.Fatal(err)
+	//	}
+	//	startTimeFormatted := event.StartTime.Format("2006-01-02 15:04:05")
+	//	endTimeFormatted := event.EndTime.Format("2006-01-02 15:04:05")
+	//	fmt.Printf("Event: %s\nStart Time: %s\nEnd Time: %s\n", event.Name, startTimeFormatted, endTimeFormatted)
+	//}
+	//if err := cursor.Err(); err != nil {
+	//	log.Fatal(err)
+	//}
+	//
+
+	// 执行计数操作
+	count, err := collection.CountDocuments(context.Background(), jsonFind_M)
+	if err != nil {
+		logs.PrintlnError("Count 错误", err)
+		return lib.JSONS{Code: lib.Error, Msg: "Count 错误!"}
+	}
+
+	return lib.JSONS{
+		Code:      lib.Success,
+		Msg:       "ok!",
+		List:      results,
+		Total:     int16(count),
+		PageIndex: page,
+		PageSize:  pageSize,
+	}
+}

+ 70 - 0
models/GTime.go

@@ -0,0 +1,70 @@
+package models
+
+import (
+	"encoding/json"
+	"fmt"
+	orm2 "github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type Time struct {
+	time.Time
+}
+
+// MarshalJSON 序列化为JSON
+func (t Time) MarshalJSON() ([]byte, error) {
+	if t.IsZero() {
+		return []byte("\"\""), nil
+	}
+	stamp := fmt.Sprintf("\"%s\"", t.Format("2006-01-02 15:04:05"))
+	return []byte(stamp), nil
+}
+
+// UnmarshalJSON 反序列化为JSON
+func (t *Time) UnmarshalJSON(data []byte) error {
+	var err error
+	t.Time, err = time.Parse("2006-01-02 15:04:05", string(data)[1:20])
+	return err
+}
+
+func (t *Time) String() string {
+	data, _ := json.Marshal(t)
+	return string(data)
+}
+
+func (t *Time) FieldType() int {
+	return orm2.TypeDateTimeField
+}
+
+func (t *Time) SetRaw(value interface{}) error {
+	switch value.(type) {
+	case time.Time:
+		t.Time = value.(time.Time)
+	}
+	return nil
+}
+
+func (t *Time) RawValue() interface{} {
+	str := t.Format("2006-01-02 15:04:05")
+	if str == "0001-01-01 00:00:00" {
+		return nil
+	}
+	return str
+}
+
+func (t *Time) NowDbTime() Time {
+	dbTime := Time{}
+	dbTime.Time = time.Now()
+	return dbTime
+}
+func (t *Time) AddDates(years int, months int, days int) Time {
+	dbTime := Time{}
+	dbTime.Time = t.Time.AddDate(years, months, days)
+	return dbTime
+}
+func TimeParse(value string) (Time, error) {
+	dbTime := Time{}
+	times, err := time.Parse("2006-01-02 15:04:05", value)
+	dbTime.Time = times
+	return dbTime, err
+}

+ 50 - 0
models/Product/ProductLang.go

@@ -0,0 +1,50 @@
+package Product
+
+// 产品语言
+type ProductLang struct {
+	Id     int    `json:"Id"`
+	T_name string `json:"T_name"` // 协议语言
+	T_code string `json:"T_code"` // 协议语言
+}
+
+var ProductLangList = []ProductLang{}
+
+// ---------------- 方法 -------------------
+func init() {
+	ProductLangAdd(ProductLang{
+		Id:     0,
+		T_name: "无解析",
+		T_code: "",
+	})
+	ProductLangAdd(ProductLang{
+		Id:     1,
+		T_name: "Goland",
+		T_code: "import (\n\t\"encoding/hex\"\n\t\"fmt\"\n\t\"strings\"\n)\n/*\n设备->平台\n*/\nfunc T(t string, b []byte) string {\n\treturn string(b)\n}\n/*\n平台->设备\n*/\nfunc R(sn string, b string) (string, []byte) {\n\tt := sn\n\treturn t, []byte(b)\n}",
+	})
+	ProductLangAdd(ProductLang{
+		Id:     2,
+		T_name: "C",
+		T_code: "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#define LEN 1024\n\n// 设备->平台\nvoid T(const char *t, const char *b, char **r_b) {\n    size_t len1 = strlen(t);\n    size_t len2 = strlen(b);\n    *r_b = (char *)malloc(len1 + len2 + 1);\n    strcpy(*r_b, t);\n    strcat(*r_b, b);\n}\n// 平台->设备\nvoid R(const char *t,  const char *b, char **r_t, char **r_b) {\n    size_t len1 = strlen(t);\n    size_t len2 = strlen(b);\n    *r_t = (char *)malloc(len1 + 1);\n    *r_b = (char *)malloc(len2 + 1);\n    strcpy(*r_t, t);\n    strcpy(*r_b, b);\n}",
+	})
+	//Add(ProductLang{
+	//	Id:     3,
+	//	T_name: "Python",
+	//})
+	//Add(ProductLang{
+	//	Id:     4,
+	//	T_name: "JavaScript",
+	//})
+
+}
+
+// 添加
+func ProductLangAdd(t ProductLang) {
+	ProductLangList = append(ProductLangList, t)
+
+}
+
+// 获取列表
+func ProductLangLists() (r []ProductLang, Total int64) {
+
+	return ProductLangList, int64(len(ProductLangList))
+}

+ 49 - 0
models/Product/ProductMode.go

@@ -0,0 +1,49 @@
+package Product
+
+import (
+	"plugin"
+	"sort"
+)
+
+// 网关
+type ProductMode struct {
+	Id         int    `json:"Id"`
+	T_name     string `json:"T_name"`     // 协议名称  Mqtt
+	T_connect  string `json:"T_connect"`  //接入地址    bj-3-mqtt.iot-api.com:1883
+	T_describe string `json:"T_describe"` // 描述内容
+	T_state    int    `json:"T_state"`    //状态  0停用  1 开启
+	T_file     string `json:"-"`          //文件地址
+	T_log      string `json:"T_log"`      //文件地址
+
+	T_Config_map map[string]map[string]string `json:"T_Config_map"` //接入端口   8888
+	T_Plugin     *plugin.Plugin               `json:"-"`            //状态
+}
+
+var ProductModeMap map[int]*ProductMode
+
+func init() {
+	ProductModeMap = make(map[int]*ProductMode)
+}
+
+// 获取列表
+func ProductModeLists() (r []ProductMode, Total int64) {
+	var ProductModeList = []ProductMode{}
+
+	for _, v := range ProductModeMap {
+		ProductModeList = append(ProductModeList, ProductMode{Id: v.Id, T_name: v.T_name, T_connect: v.T_connect, T_describe: v.T_describe, T_state: v.T_state, T_Config_map: v.T_Config_map, T_log: v.T_log})
+	}
+	// 对切片进行排序
+	sort.Slice(ProductModeList, func(i, j int) bool {
+		return ProductModeList[i].Id < ProductModeList[j].Id
+	})
+	return ProductModeList, int64(len(ProductModeList))
+}
+
+/*
+
+1:HTTP
+2:TCP
+3:MQTT
+10:CtwingHTTP
+
+*/

+ 104 - 0
models/Product/ProductOTA.go

@@ -0,0 +1,104 @@
+package Product
+
+import (
+	"AIOTCOER/logs"
+	"AIOTCOER/models"
+	"github.com/astaxie/beego/cache"
+	_ "github.com/astaxie/beego/cache/redis"
+	"github.com/beego/beego/v2/adapter/orm"
+	orm2 "github.com/beego/beego/v2/client/orm"
+	_ "github.com/go-sql-driver/mysql"
+)
+
+// OTA
+type ProductOTA struct {
+	Id          int    `orm:"column(ID);size(11);auto;pk" json:"Id" form:"Id"`
+	T_ProductID string `orm:"size(8);index" json:"T_ProductID" form:"T_ProductID"`        // 产品型号 随机生成(8位)
+	T_name      string `orm:"size(256);" json:"T_name" form:"T_name"`                     // 固件名称
+	T_version   string `orm:"size(200);" json:"T_version" form:"T_version"`               // 版本
+	T_file      string `orm:"type(text);default('')" json:"T_file" form:"T_file"`         // 文件
+	T_hash      string `orm:"type(text);default('')" json:"T_hash" form:"T_hash"`         // 文件 MD5
+	T_size      int    `orm:"size(256);" json:"T_size" form:"T_size"`                     // 文件大小  字节
+	T_describe  string `orm:"type(text);default('')" json:"T_describe" form:"T_describe"` // 描述
+	T_publish   bool   `orm:"" json:"T_publish" form:"T_publish"`                         // 全量发布(类型所有设备 全部更新)默认:不发布 \ 全量发布
+
+	CreateTime models.Time `orm:"column(create_time);type(timestamp);auto_now_add" json:"CreateTime"`
+}
+
+func (t *ProductOTA) TableName() string {
+	return "ProductOTA" // 数据库名称   // ************** 替换 FormulaList **************
+}
+
+var redis_ProductOTA cache.Cache
+
+func init() {
+	//注册模型
+	orm.RegisterModel(new(ProductOTA))
+
+}
+
+// 添加
+func (t *ProductOTA) Add() (is bool) {
+	o := orm.NewOrm()
+
+	id, err := o.Insert(t)
+	if err != nil {
+		return false
+	}
+
+	println(id)
+	return true
+}
+
+// 获取
+func (t *ProductOTA) Read() (bool bool) {
+	o := orm.NewOrm()
+	err := o.Read(t) // o.Read(&r,"Tokey") 如果不是 主键 就得指定字段名
+	if err != nil {
+		return false
+	}
+
+	return true
+}
+
+// 删除
+func (t *ProductOTA) Delete() bool {
+	o := orm.NewOrm()
+	if num, err := o.Delete(t); err == nil {
+		logs.Println("Number of records deleted in database:", num)
+	} else {
+		return false
+	}
+
+	return true
+}
+
+// 获取列表
+func (t *ProductOTA) Lists(PageIndex int, PageSize int) (r []ProductOTA, Total int64) {
+
+	o := orm.NewOrm()
+
+	// 也可以直接使用 Model 结构体作为表名
+	qs := o.QueryTable(new(ProductOTA))
+	var offset int64
+	if PageIndex <= 1 {
+		offset = 0
+	} else {
+		offset = int64((PageIndex - 1) * PageSize)
+	}
+
+	// 筛选参数
+	cond := orm.NewCondition()
+	if len(t.T_name) > 0 {
+		cond = cond.And("T_name__icontains", t.T_name) // .AndNot("status__in", 1).Or("profile__age__gt", 2000)
+	}
+	if len(t.T_version) > 0 {
+		cond = cond.And("T_version__icontains", t.T_version) // .AndNot("status__in", 1).Or("profile__age__gt", 2000)
+	}
+
+	// 执行
+	qs.Limit(PageSize, offset).SetCond((*orm2.Condition)(cond)).OrderBy("-CreateTime").All(&r)
+	Total, _ = qs.SetCond((*orm2.Condition)(cond)).Count()
+
+	return r, Total
+}

+ 183 - 0
models/Product/ProductProt.go

@@ -0,0 +1,183 @@
+package Product
+
+import (
+	"AIOTCOER/conf"
+	"AIOTCOER/logs"
+	"encoding/json"
+	"fmt"
+	"github.com/astaxie/beego/cache"
+	_ "github.com/astaxie/beego/cache/redis"
+	"github.com/beego/beego/v2/adapter/orm"
+	orm2 "github.com/beego/beego/v2/client/orm"
+	_ "github.com/go-sql-driver/mysql"
+	"time"
+)
+
+// 产品协议
+type ProductProt struct {
+	Id         int    `orm:"column(ID);size(11);auto;pk" json:"Id" form:"Id"`
+	T_uuid     string `orm:"size(8);" json:"T_uuid" form:"T_uuid"`                  // 用户识别码(8位) ,管理员可以为空
+
+	T_lang     int    `orm:"size(1);default(1)" json:"T_lang" form:"T_lang"`             //编程语言 0: 无解析 1: go   2: C
+	T_analysis string `orm:"size(100);default('')" json:"T_analysis" form:"T_analysis"`  // 插件 SO 文件名
+	T_text     string `orm:"type(text);default('')" json:"T_text" form:"T_text"`         // 代码内容
+	T_describe string `orm:"type(text);default('')" json:"T_describe" form:"T_describe"` // 描述内容
+}
+
+func (t *ProductProt) TableName() string {
+	return "ProductProt" // 数据库名称   // ************** 替换 FormulaList **************
+}
+
+var redis_ProductProt cache.Cache
+
+func init() {
+	//注册模型
+	orm.RegisterModel(new(ProductProt))
+
+	config := fmt.Sprintf(`{"key":"%s","conn":"%s","dbNum":"%s","password":"%s"}`,
+		"ProductProt", conf.Redis_address, conf.Redis_dbNum, conf.Redis_password)
+	var err error
+	redis_ProductProt, err = cache.NewCache("redis", config)
+	if err != nil || redis_ProductProt == nil {
+		logs.PrintlnError(config, err)
+		panic(any(err))
+	}
+}
+
+// ---------------- Redis -------------------
+func (t *ProductProt) redis_Set() (err error) {
+	//json序列化
+	str, err := json.Marshal(t)
+	if err != nil {
+		logs.PrintlnError("Redis_Set", err)
+		return
+	}
+
+	err = redis_ProductProt.Put(fmt.Sprintf("%d", t.Id), str, 24*time.Hour)
+	if err != nil {
+		logs.Println("set key:", t.Id, ",value:", str, err)
+	}
+	return
+}
+func (t *ProductProt) redis_Get(key string) (is bool) {
+	if redis_ProductProt.IsExist(key) {
+		//println("找到key:",key)
+		v := redis_ProductProt.Get(key)
+		if v == nil {
+			return false
+		}
+		json.Unmarshal(v.([]byte), t)
+		return true
+	}
+	//println("没有 找到key:",key)
+	return false
+}
+func (t *ProductProt) redis_DelK() (err error) {
+	err = redis_ProductProt.Delete(fmt.Sprintf("%d", t.Id))
+	return
+}
+
+// ---------------- 方法 -------------------
+
+// 添加
+func (t *ProductProt) Add() ( int, bool) {
+	o := orm.NewOrm()
+
+	id, err := o.Insert(t)
+	if err != nil {
+		return 0,false
+	}
+	println(id)
+	t.redis_Set()
+	return int(id),true
+}
+
+// 获取
+func (t *ProductProt) Read() (bool bool) {
+	if t.redis_Get(fmt.Sprintf("%d", t.Id)) {
+		return true
+	}
+
+	if !(t.Id > 0) {
+		logs.Println("ProductProt.Id:", t.Id)
+		return false
+	}
+	o := orm.NewOrm()
+	err := o.Read(t) // o.Read(&r,"Tokey") 如果不是 主键 就得指定字段名
+	if err != nil {
+		return false
+	}
+	t.redis_Set() // Redis 更新缓存
+	return true
+}
+
+// 修改
+func (t *ProductProt) Update(cols ...string) bool {
+	o := orm.NewOrm()
+	if num, err := o.Update(t, cols...); err == nil {
+		logs.Println("Number of records updated in database:", num)
+		t.redis_Set() // Redis 更新缓存
+		return true
+	}
+	return false
+}
+
+// 删除
+func (t *ProductProt) Delete() bool {
+	o := orm.NewOrm()
+	if num, err := o.Delete(t); err == nil {
+		logs.Println("Number of records deleted in database:", num)
+	} else {
+		return false
+	}
+
+	t.redis_DelK()
+	return true
+}
+
+// 获取列表
+func (t *ProductProt) Lists(PageIndex int, PageSize int) (r []ProductProt, Total int64) {
+
+	o := orm.NewOrm()
+
+	// 也可以直接使用 Model 结构体作为表名
+	qs := o.QueryTable(new(ProductProt))
+	var offset int64
+	if PageIndex <= 1 {
+		offset = 0
+	} else {
+		offset = int64((PageIndex - 1) * PageSize)
+	}
+
+	// 筛选参数
+	cond := orm.NewCondition()
+	if len(t.T_uuid) == 8 {
+		cond = cond.And("T_uuid", t.T_uuid) // 用户识别码
+	}
+
+	// 执行
+	qs.Limit(PageSize, offset).SetCond((*orm2.Condition)(cond)).All(&r)
+	Total, _ = qs.SetCond((*orm2.Condition)(cond)).Count()
+
+	return r, Total
+}
+
+// 获取列表
+func (t *ProductProt) Lists_All() (r []ProductProt) {
+
+	o := orm.NewOrm()
+
+	// 也可以直接使用 Model 结构体作为表名
+	qs := o.QueryTable(new(ProductProt))
+
+	// 筛选参数
+	cond := orm.NewCondition()
+
+	if len(t.T_uuid) == 8 {
+		cond = cond.And("T_uuid", t.T_uuid) // 用户识别码
+	}
+	// 执行
+	qs.SetCond((*orm2.Condition)(cond)).All(&r)
+
+	return r
+}

+ 210 - 0
models/Product/ProductPush.go

@@ -0,0 +1,210 @@
+package Product
+
+import (
+	"AIOTCOER/conf"
+	"AIOTCOER/logs"
+	"encoding/json"
+	"fmt"
+	"github.com/astaxie/beego/cache"
+	_ "github.com/astaxie/beego/cache/redis"
+	"github.com/beego/beego/v2/adapter/orm"
+	orm2 "github.com/beego/beego/v2/client/orm"
+	_ "github.com/go-sql-driver/mysql"
+	"time"
+)
+
+// 网关
+type ProductPush struct {
+	Id           int                    `json:"Id"`
+	T_uuid       string                 `orm:"size(8);index" json:"T_uuid" form:"T_uuid"`                // 用户识别码(8位) ,管理员可以为空
+	T_name       string                 `json:"T_name"`                                                  // 协议名称  Mqtt
+	T_PushModeId int                    `json:"T_PushModeId"`                                            //推送模式ID
+	T_Config     string                 `orm:"type(text);default('{}')" json:"T_Config" form:"T_Config"` // 产品模型
+	T_ConfigJson map[string]interface{} `orm:"-" json:"T_ConfigJson"`                                    // 产品模型 json
+	T_log        string                 `orm:"type(text);default('')" json:"T_log" form:"T_log"`         //启动日志
+
+	T_state int `orm:"default(0)" json:"T_state"` //状态  0停用  1 开启
+
+}
+
+func (t *ProductPush) TableName() string {
+	return "ProductPush" // 数据库名称   // ************** 替换 FormulaList **************
+}
+
+var redis_ProductPush cache.Cache
+
+func init() {
+	//注册模型
+	orm.RegisterModel(new(ProductPush))
+
+	config := fmt.Sprintf(`{"key":"%s","conn":"%s","dbNum":"%s","password":"%s"}`,
+		"ProductPush", conf.Redis_address, conf.Redis_dbNum, conf.Redis_password)
+	var err error
+	redis_ProductPush, err = cache.NewCache("redis", config)
+	if err != nil || redis_ProductPush == nil {
+		logs.PrintlnError(config, err)
+		panic(any(err))
+	}
+}
+
+// ---------------- Redis -------------------
+func (t *ProductPush) redis_Set() (err error) {
+	// T_ConfigJson 格式化
+	var T_datajson map[string]interface{}
+	json.Unmarshal([]byte(t.T_Config), &T_datajson)
+	t.T_ConfigJson = T_datajson
+
+	//json序列化
+	str, err := json.Marshal(t)
+	if err != nil {
+		logs.PrintlnError("Redis_Set", err)
+		return
+	}
+
+	err = redis_ProductPush.Put(fmt.Sprintf("%d", t.Id), str, 24*time.Hour)
+	if err != nil {
+		logs.Println("set key:", t.Id, ",value:", str, err)
+	}
+	return
+}
+func (t *ProductPush) redis_Get(key string) (is bool) {
+	if redis_ProductPush.IsExist(key) {
+		//println("找到key:",key)
+		v := redis_ProductPush.Get(key)
+		if v == nil {
+			return false
+		}
+		json.Unmarshal(v.([]byte), t)
+		return true
+	}
+	//println("没有 找到key:",key)
+	return false
+}
+func (t *ProductPush) redis_DelK() (err error) {
+	err = redis_ProductPush.Delete(fmt.Sprintf("%d", t.Id))
+	return
+}
+
+// ---------------- 方法 -------------------
+
+// 添加
+func (t *ProductPush) Add() (is bool) {
+	o := orm.NewOrm()
+
+	id, err := o.Insert(t)
+	if err != nil {
+		return false
+	}
+	println(id)
+	t.redis_Set()
+	return true
+}
+
+// 获取
+func (t *ProductPush) Read() (bool bool) {
+	if t.redis_Get(fmt.Sprintf("%d", t.Id)) {
+		return true
+	}
+
+	if !(t.Id > 0) {
+		logs.Println("ProductPush.Id:", t.Id)
+		return false
+	}
+	o := orm.NewOrm()
+	err := o.Read(t) // o.Read(&r,"Tokey") 如果不是 主键 就得指定字段名
+	if err != nil {
+		return false
+	}
+	t.redis_Set() // Redis 更新缓存
+	return true
+}
+
+// 修改
+func (t *ProductPush) Update(cols ...string) bool {
+	o := orm.NewOrm()
+	if num, err := o.Update(t, cols...); err == nil {
+		logs.Println("Number of records updated in database:", num)
+		t.redis_Set() // Redis 更新缓存
+		return true
+	}
+	return false
+}
+
+// 删除
+func (t *ProductPush) Delete() bool {
+	o := orm.NewOrm()
+	if num, err := o.Delete(t); err == nil {
+		logs.Println("Number of records deleted in database:", num)
+	} else {
+		return false
+	}
+
+	t.redis_DelK()
+	return true
+}
+
+// 获取列表
+func (t *ProductPush) Lists(PageIndex int, PageSize int) (r []ProductPush, Total int64) {
+
+	o := orm.NewOrm()
+
+	// 也可以直接使用 Model 结构体作为表名
+	qs := o.QueryTable(new(ProductPush))
+	var offset int64
+	if PageIndex <= 1 {
+		offset = 0
+	} else {
+		offset = int64((PageIndex - 1) * PageSize)
+	}
+
+	// 筛选参数
+	cond := orm.NewCondition()
+	//if t.T_mode > 0 {
+	//	cond = cond.And("T_mode", t.T_mode) // .AndNot("status__in", 1).Or("profile__age__gt", 2000)
+	//}
+	//if len(t.T_name) > 0 {
+	//	cond = cond.And("T_name__icontains", t.T_name) // .AndNot("status__in", 1).Or("profile__age__gt", 2000)
+	//}
+	if len(t.T_uuid) == 8 {
+		cond = cond.And("T_uuid", t.T_uuid) // 用户识别码
+	}
+
+	// 执行
+	qs.Limit(PageSize, offset).SetCond((*orm2.Condition)(cond)).All(&r)
+	Total, _ = qs.SetCond((*orm2.Condition)(cond)).Count()
+
+	for i, _ := range r {
+		if len(r[i].T_Config) > 0 {
+			var T_datajson map[string]interface{}
+			json.Unmarshal([]byte(r[i].T_Config), &T_datajson)
+			r[i].T_ConfigJson = T_datajson
+		}
+
+	}
+	return r, Total
+}
+
+// 获取列表
+func ProductPushListALL() (r []ProductPush) {
+	o := orm.NewOrm()
+
+	// 也可以直接使用 Model 结构体作为表名
+	qs := o.QueryTable(new(ProductPush))
+
+	// 筛选参数
+	cond := orm.NewCondition()
+	cond = cond.And("T_state", 1) // 用户识别码
+
+	// 执行
+	qs.SetCond((*orm2.Condition)(cond)).All(&r)
+
+	for i, _ := range r {
+		if len(r[i].T_Config) > 0 {
+			var T_datajson map[string]interface{}
+			json.Unmarshal([]byte(r[i].T_Config), &T_datajson)
+			r[i].T_ConfigJson = T_datajson
+		}
+
+	}
+	return r
+}

+ 25 - 0
models/Product/ProductPushMode.go

@@ -0,0 +1,25 @@
+package Product
+
+// 网关
+type ProductPushMode struct {
+	Id     int    `json:"Id"`
+	T_name string `json:"T_name"` // 协议名称  Mqtt
+}
+
+var ProductPushModeList []ProductPushMode
+
+func init() {
+	ProductPushModeList = append(ProductPushModeList, ProductPushMode{Id: 1, T_name: "HTTP"})
+	ProductPushModeList = append(ProductPushModeList, ProductPushMode{Id: 2, T_name: "NATS"})
+	ProductPushModeList = append(ProductPushModeList, ProductPushMode{Id: 3, T_name: "MQTT"})
+
+}
+
+/*
+1:HTTP
+2:NATS
+3:MQTT
+
+
+
+*/

+ 310 - 0
models/Product/ProductType.go

@@ -0,0 +1,310 @@
+package Product
+
+import (
+	"AIOTCOER/conf"
+	"AIOTCOER/lib"
+	"AIOTCOER/logs"
+	"AIOTCOER/models"
+	"encoding/json"
+	"fmt"
+	"github.com/astaxie/beego/cache"
+	_ "github.com/astaxie/beego/cache/redis"
+	"github.com/beego/beego/v2/adapter/orm"
+	orm2 "github.com/beego/beego/v2/client/orm"
+	_ "github.com/go-sql-driver/mysql"
+	"github.com/vmihailenco/msgpack/v5"
+	"time"
+)
+
+// 产品类型
+type ProductType struct {
+	T_ProductID  string `orm:"size(8);pk" json:"T_ProductID" msgpack:"T_ProductID" form:"T_ProductID"` // 产品型号 随机生成(8位)
+	T_ProductKey string `orm:"size(56);" json:"T_ProductKey" msgpack:"T_ProductKey" `                  // 授权密钥
+	T_uuid       string `orm:"size(64);index" json:"-" msgpack:"T_uuid" form:"-"`                      // 用户识别码( < 64位) ,管理员可以为空
+
+	T_name string `orm:"size(256);" json:"T_name" msgpack:"T_name" form:"T_name"` // 产品名称
+	//T_img   string `orm:"size(256);" json:"T_img" form:"T_img"`            // 产品图片
+	T_mode  int    `orm:"size(3);default(0)" json:"T_mode" msgpack:"T_mode" form:"T_mode"`  //接入网关ID
+	T_prot  int    `orm:"size(11);default(0)" json:"T_prot" msgpack:"T_prot" form:"T_prot"` //接入协议ID  0:统一协议  ProductProt ID
+	T_panel string `orm:"size(32);" json:"T_panel" msgpack:"T_panel" form:"T_panel"`        // 产品面板ID
+
+	// 功能模型
+	T_TabData     string                   `orm:"type(text);default('[]')" json:"T_TabData" msgpack:"T_TabData" form:"T_TabData"` // 产品模型
+	T_TabDataJson []map[string]interface{} `orm:"-" json:"T_TabDataJson" msgpack:"T_TabDataJson"`                                 // 产品模型 json
+	T_save        map[string]int           `orm:"-" json:"T_save" msgpack:"T_save"`                                               // 保存天数  数据保存天数,默认为30天, 0为永久保存
+	T_filter      []string                 `orm:"-" json:"T_filter" msgpack:"T_filter"`                                           // 数据过滤 上传值与最新的值一样将会被忽略, 不会保存到数据库
+	T_renew       []string                 `orm:"-" json:"T_renew" msgpack:"T_renew"`                                             // 平台托管   平台->设备 时将参数强制更新此参数,用于 参数托管给平台记录
+
+	T_state    int         `orm:"size(1);default(1);index" json:"-"  msgpack:"-" form:"-"` //  1 正常  0 禁用\删除  (管理员)
+	CreateTime models.Time `orm:"column(create_time);type(timestamp);auto_now_add" json:"CreateTime" msgpack:"CreateTime"`
+	UpdateTime models.Time `orm:"column(update_time);type(timestamp);auto_now" json:"UpdateTime" msgpack:"UpdateTime"`
+}
+
+/*  产品模型  T_TabData \ T_TabDataJson
+[
+	{
+		"T_name": "温度",
+		"T_tab": "Tt",
+		"T_type": 1,
+		"T_attr": {
+					"unit": "C",
+					"dvalue": 0,
+					"accuracy": 1,
+					"min": 2,
+					"max": 8,
+					},
+		"T_text": "温度温度温度",
+		"T_read": true,
+		"children":[{
+			"T_name": "采样率",
+			"T_tab": "Tt_speed",
+			"T_type": 1,
+			"T_attr": {
+						"unit": "s",
+						"dvalue": 15,
+						"accuracy": 1,
+						"min": 0,
+						"max": 30,
+						},
+			"T_text": "数据采集速度",
+			"T_read": false,
+			"children":[]
+		}]
+	}
+
+]
+
+// T_attr属性  定义
+
+	1 数值
+		unit 单位
+		dvalue 默认值
+		accuracy 精度
+		min 最小值
+		max 最大值
+
+	2 文本
+		dvalue 默认值
+
+	3 枚举
+		map [] 枚举
+			value 值
+			text 描述
+*/
+
+// 产品类型 - 列表
+type ProductType_List struct {
+	T_ProductID string `orm:"size(8);pk" json:"T_ProductID" form:"T_ProductID"` // 产品型号 随机生成(8位)
+
+	T_name string `orm:"size(256);" json:"T_name" form:"T_name"` // 产品名称
+	//T_img  string `orm:"size(256);" json:"T_img" form:"T_img"`            // 产品图片
+	T_prot int `orm:"size(10);default(0)" json:"T_prot" form:"T_prot"` //接入协议ID  0:统一协议
+	T_mode int `orm:"size(10);default(0)" json:"T_mode" form:"T_mode"` //接入网关ID
+
+	CreateTime models.Time `orm:"column(create_time);type(timestamp);auto_now_add" json:"CreateTime"`
+	UpdateTime models.Time `orm:"column(update_time);type(timestamp);auto_now" json:"UpdateTime"`
+}
+
+// 产品类型
+type ProductType_R struct {
+	T_name string `orm:"size(256);" json:"T_name" msgpack:"T_name" form:"T_name"` // 产品名称
+
+	T_panel string `orm:"size(32);" json:"T_panel" msgpack:"T_panel" form:"T_panel"` // 产品面板ID
+
+	// 功能模型
+	T_TabDataJson []map[string]interface{} `orm:"-" json:"T_TabDataJson" msgpack:"T_TabDataJson"`                                 // 产品模型 json
+
+	CreateTime models.Time `orm:"column(create_time);type(timestamp);auto_now_add" json:"CreateTime" msgpack:"CreateTime"`
+	UpdateTime models.Time `orm:"column(update_time);type(timestamp);auto_now" json:"UpdateTime" msgpack:"UpdateTime"`
+}
+
+func (t *ProductType) TableName() string {
+	return "ProductType" // 数据库名称   // ************** 替换 FormulaList **************
+}
+
+var redis_ProductType cache.Cache
+
+func init() {
+	//注册模型
+	orm.RegisterModel(new(ProductType))
+
+	config := fmt.Sprintf(`{"key":"%s","conn":"%s","dbNum":"%s","password":"%s"}`,
+		"redis_ProductType", conf.Redis_address, conf.Redis_dbNum, conf.Redis_password)
+	var err error
+	redis_ProductType, err = cache.NewCache("redis", config)
+	if err != nil || redis_ProductType == nil {
+		logs.PrintlnError(config, err)
+		panic(any(err))
+	}
+}
+
+// ---------------- Redis -------------------
+func (t *ProductType) redis_Set() (err error) {
+
+	if len(t.T_TabData) > 0 {
+		var T_datajson []map[string]interface{}
+		json.Unmarshal([]byte(t.T_TabData), &T_datajson)
+		t.T_TabDataJson = T_datajson
+	}
+
+	// 汇总 数据过滤
+	t.T_filter = []string{}
+	lib.Hande_Tab_Tfilter(t.T_TabDataJson, "", &t.T_filter)
+
+	// 汇总 平台托管
+	//t.T_renew = make(map[string]bool)
+	t.T_renew = []string{}
+	lib.Hande_Tab_Trenew(t.T_TabDataJson, "", &t.T_renew)
+	logs.Println("T_renew:", t.T_renew)
+
+	// 汇总 保存天数
+	t.T_save = make(map[string]int)
+	lib.Hande_Tab_Tsave(t.T_TabDataJson, "", &t.T_save)
+
+	//json序列化
+	str, err := msgpack.Marshal(t)
+	if err != nil {
+		logs.PrintlnError("Redis_Set", err)
+		return
+	}
+
+	err = redis_ProductType.Put(t.T_ProductID, str, 24*time.Hour)
+	if err != nil {
+		logs.Println("set key:", t.T_ProductID, ",value:", str, err)
+	}
+	return
+}
+func (t *ProductType) redis_Get(key string) (is bool) {
+	if redis_ProductType.IsExist(key) {
+		//println("找到key:",key)
+		v := redis_ProductType.Get(key)
+		if v == nil {
+			return false
+		}
+		msgpack.Unmarshal(v.([]byte), t)
+		return true
+	}
+	//println("没有 找到key:",key)
+	return false
+}
+func (t *ProductType) Redis_DelK() (err error) {
+	err = redis_ProductType.Delete(t.T_ProductID)
+	return
+}
+
+// ---------------- 方法 -------------------
+
+// 添加
+func (t *ProductType) Add() (is bool) {
+	o := orm.NewOrm()
+
+	id, err := o.Insert(t)
+	if err != nil {
+		return false
+	}
+	println(id)
+	t.redis_Set()
+	return true
+}
+
+// 获取
+func (t *ProductType) Read() (bool bool) {
+	if t.redis_Get(t.T_ProductID) {
+		return true
+	}
+	o := orm.NewOrm()
+	err := o.Read(t) // o.Read(&r,"Tokey") 如果不是 主键 就得指定字段名
+	if err != nil {
+		return false
+	}
+	t.redis_Set() // Redis 更新缓存
+	return true
+}
+
+// 修改
+func (t *ProductType) Update(cols ...string) bool {
+	o := orm.NewOrm()
+	num, err := o.Update(t, cols...)
+	if err == nil {
+		logs.Println("Number of records updated in database:", num)
+		t.Redis_DelK() // Redis 更新缓存
+
+		return true
+	}
+	logs.PrintlnError("ProductType Update", err)
+	return false
+}
+
+// 获取列表
+func (t *ProductType) Lists(PageIndex int, PageSize int) (r_ []ProductType_List, Total int64) {
+
+	o := orm.NewOrm()
+
+	// 也可以直接使用 Model 结构体作为表名
+	qs := o.QueryTable(new(ProductType))
+	var offset int64
+	if PageIndex <= 1 {
+		offset = 0
+	} else {
+		offset = int64((PageIndex - 1) * PageSize)
+	}
+
+	// 筛选参数
+	cond := orm.NewCondition().And("T_state", 1) //  1 正常  2 禁用\删除
+	if len(t.T_name) > 0 {
+		cond = cond.And("T_name__icontains", t.T_name) // .AndNot("status__in", 1).Or("profile__age__gt", 2000)
+	}
+	if len(t.T_uuid) >= 8 {
+		cond = cond.And("T_uuid", t.T_uuid) // 用户识别码
+	}
+	var r []ProductType
+	// 执行
+	qs.Limit(PageSize, offset).SetCond((*orm2.Condition)(cond)).OrderBy("-CreateTime").All(&r)
+	Total, _ = qs.SetCond((*orm2.Condition)(cond)).Count()
+
+	for _, v := range r {
+		tr := ProductType_List{
+			T_ProductID: v.T_ProductID,
+			T_name:      v.T_name,
+			T_prot:      v.T_prot,
+			T_mode:      v.T_mode,
+			CreateTime:  v.CreateTime,
+			UpdateTime:  v.UpdateTime,
+		}
+		r_ = append(r_, tr)
+
+	}
+	return r_, Total
+}
+
+// 获取列表
+func (t *ProductType) Lists_All() (r []ProductType) {
+
+	o := orm.NewOrm()
+
+	// 也可以直接使用 Model 结构体作为表名
+	qs := o.QueryTable(new(ProductType))
+
+	// 筛选参数
+	cond := orm.NewCondition()
+	if len(t.T_name) > 0 {
+		cond = cond.And("T_name__icontains", t.T_name) // .AndNot("status__in", 1).Or("profile__age__gt", 2000)
+	}
+	if len(t.T_ProductID) > 0 {
+		cond = cond.And("T_ProductID", t.T_ProductID) // .AndNot("status__in", 1).Or("profile__age__gt", 2000)
+	}
+	if len(t.T_uuid) >= 8 {
+		cond = cond.And("T_uuid", t.T_uuid) // 用户识别码
+	}
+	// 执行
+	qs.SetCond((*orm2.Condition)(cond)).OrderBy("-CreateTime").All(&r)
+	for i, _ := range r {
+		if len(r[i].T_TabData) > 0 {
+			var T_datajson []map[string]interface{}
+			json.Unmarshal([]byte(r[i].T_TabData), &T_datajson)
+			r[i].T_TabDataJson = T_datajson
+		}
+
+	}
+	return r
+}

+ 122 - 0
models/StatisticalData/ProductTypeCount.go

@@ -0,0 +1,122 @@
+package StatisticalData
+
+import (
+	"AIOTCOER/models"
+	_ "github.com/astaxie/beego/cache/redis"
+	"github.com/beego/beego/v2/adapter/orm"
+	orm2 "github.com/beego/beego/v2/client/orm"
+	_ "github.com/go-sql-driver/mysql"
+	"strings"
+)
+
+// 流量统计(每天)
+type FlowCount struct {
+	Id          int    `orm:"column(ID);size(11);auto;pk" json:"Id" form:"Id"`
+	T_ProductID string `orm:"size(8);" json:"T_ProductID" form:"T_ProductID"` // 产品型号 随机生成(8位)
+
+	T_send    int64 `orm:"default(0)" json:"T_datat"`  //设备发送 字节数
+	T_receive int64 `orm:"default(0)" json:"T_datar"`  //设备接受 字节数
+	T_relay   int64 `orm:"default(0)" json:"T_relays"` //转发次数
+
+	CreateTime models.Time `orm:"column(create_time);type(timestamp);auto_now_add" json:"CreateTime"`
+}
+type FlowCount_T struct {
+	T_send    int64
+	T_receive int64
+	T_relay   int64
+}
+
+var FlowCountMap map[string]*FlowCount_T
+
+func (t *FlowCount) TableName() string {
+	return "FlowCount" // 数据库名称   // ************** 替换 FormulaList **************
+}
+
+func init() {
+	//注册模型
+	orm.RegisterModel(new(FlowCount))
+	FlowCountMap = make(map[string]*FlowCount_T)
+
+}
+
+// 每天定时统计
+func FlowCountHandle() {
+	for k, v := range FlowCountMap {
+		// 只统计  有流量的
+		//if v.T_send == 0 && v.T_receive == 0 && v.T_relay == 0 {
+		//	continue
+		//}
+		r := FlowCount{
+			T_ProductID: k,
+			T_send:      v.T_send,
+			T_receive:   v.T_receive,
+			T_relay:     v.T_relay,
+		}
+		r.Add()
+		// 删除缓存
+		delete(FlowCountMap, k)
+	}
+
+}
+
+// 添加
+func (t *FlowCount) Add() (is bool) {
+	o := orm.NewOrm()
+	_, err := o.Insert(t)
+	if err != nil {
+		return false
+	}
+	return true
+}
+
+// 获取列表
+func FlowCountLists(T_ProductID string, PageSize int) (r []FlowCount) {
+
+	o := orm.NewOrm()
+
+	// 也可以直接使用 Model 结构体作为表名
+	qs := o.QueryTable(new(FlowCount))
+
+	// 筛选参数
+	cond := orm.NewCondition()
+
+	// 多产品查询
+	if len(T_ProductID) == 0 {
+		return []FlowCount{}
+	}
+	for _, v := range strings.Split(T_ProductID, ",") {
+		if len(v) > 0 {
+			cond = cond.And("T_ProductID", v) // .AndNot("status__in", 1).Or("profile__age__gt", 2000)
+		}
+	}
+
+	// == 1 代表只获取今天
+	if PageSize > 1 {
+		// 执行
+		qs.Limit(PageSize-1, 0).SetCond((*orm2.Condition)(cond)).All(&r)
+
+	}
+
+	for _, v := range strings.Split(T_ProductID, ",") {
+		if len(v) > 0 {
+			v_r, is := FlowCountMap[v]
+			if !is {
+				r = append(r, FlowCount{
+					T_ProductID: v,
+					T_send:      0,
+					T_receive:   0,
+					T_relay:     0,
+				})
+				continue
+			}
+			r = append(r, FlowCount{
+				T_ProductID: v,
+				T_send:      v_r.T_send,
+				T_receive:   v_r.T_receive,
+				T_relay:     v_r.T_relay,
+			})
+		}
+	}
+
+	return r
+}

+ 33 - 0
models/System/Logs.go

@@ -0,0 +1,33 @@
+package System
+
+import (
+	"github.com/beego/beego/v2/adapter/orm"
+	"time"
+)
+
+type Logs struct {
+	Id         int    `orm:"column(ID);size(11);auto;pk"`
+	Logs_class string `orm:"size(256);"`  //
+	Logs_Title string `orm:"size(256);"`  // 标题
+	Logs_Txt   string `orm:"type(text);"` // 详情
+
+	CreateTime time.Time `orm:"column(create_time);type(timestamp);auto_now_add"` //auto_now 每次 model 保存时都会对时间自动更新
+	UpdateTime time.Time `orm:"column(update_time);type(timestamp);auto_now"`     //auto_now_add 第一次保存时才设置时间
+}
+
+func (t *Logs) TableName() string {
+	return "Logs" // 数据库名称   // ************** 替换 FormulaList **************
+}
+
+func init() {
+	//注册模型
+	orm.RegisterModel(new(Logs))
+
+}
+
+// 添加  logs.Println("MqttServer","参数请求 [Rt_Parameter]","base")
+func Add_Logs(Logs_class string, Logs_Title string, Logs_Txt string) {
+	o := orm.NewOrm()
+	m := Logs{Logs_class: Logs_class, Logs_Title: Logs_Title, Logs_Txt: Logs_Txt}
+	o.Insert(&m)
+}

+ 5 - 0
plugin.sh

@@ -0,0 +1,5 @@
+
+go env -w GOPROXY="https://goproxy.cn,direct"
+
+
+go build -o AIOT_coer main.go

+ 28 - 0
routers/Device.go

@@ -0,0 +1,28 @@
+package routers
+
+import (
+	"AIOTCOER/controllers"
+	beego "github.com/beego/beego/v2/server/web"
+)
+
+func init() {
+	prefix := "/Device"
+
+	beego.Router(prefix+"/Create", &controllers.DeviceController{}, "*:Add") // 获取未读消息
+
+	beego.Router(prefix+"/WS", &controllers.DeviceController{}, "*:WS")         // *全部;  get,post:
+	beego.Router(prefix+"/SSE", &controllers.DeviceController{}, "*:SSE")       // *全部;  get,post:
+	beego.Router(prefix+"/Get", &controllers.DeviceController{}, "*:Get")       // 获取未读消息
+	beego.Router(prefix+"/Push", &controllers.DeviceController{}, "*:Push")     // 获取未读消息
+	beego.Router(prefix+"/List", &controllers.DeviceController{}, "*:List")     // 获取未读消息
+	beego.Router(prefix+"/Update", &controllers.DeviceController{}, "*:Update") // 获取未读消息
+
+	beego.Router(prefix+"/Data", &controllers.DeviceController{}, "*:DataList") // 获取未读消息
+	beego.Router(prefix+"/SSELog", &controllers.DeviceController{}, "*:SSELog") // 获取未读消息
+
+
+	// 产品协议
+	beego.Router(prefix+"Prot/Get", &controllers.ProductProtController{}, "*:Get") //
+	beego.Router(prefix+"Prot/Update", &controllers.ProductProtController{}, "*:Update") //
+
+}

+ 42 - 0
routers/Product.go

@@ -0,0 +1,42 @@
+package routers
+
+import (
+	"AIOTCOER/controllers"
+	beego "github.com/beego/beego/v2/server/web"
+)
+
+func init() {
+	prefix := "/Product"
+
+	// 产品类型
+	//beego.Router(prefix+"/ProductType/Add", &controllers.ProductTypeController{}, "*:Add")       //
+	beego.Router(prefix+"Type/Get", &controllers.ProductTypeController{}, "*:Get")       //
+	beego.Router(prefix+"Type/List", &controllers.ProductTypeController{}, "*:List")     //
+	beego.Router(prefix+"Type/Update", &controllers.ProductTypeController{}, "*:Update") //
+	beego.Router(prefix+"Type/Delete", &controllers.ProductTypeController{}, "*:Delete") //
+	// 统计流量
+	beego.Router(prefix+"Type/FlowCount", &controllers.StatisticalDataController{}, "*:FlowCountList") // *全部;  get,post:
+
+
+
+	// 接入网关
+	beego.Router(prefix+"Mode/Import", &controllers.ProductModeController{}, "*:Import")         //
+	beego.Router(prefix+"Mode/List", &controllers.ProductModeController{}, "*:ProductModeLists") //
+	beego.Router(prefix+"Mode/Updata", &controllers.ProductModeController{}, "*:Updata")         //
+	beego.Router(prefix+"Lang/List", &controllers.ProductProtController{}, "*:ProductLangList")  //
+
+
+	// 产品OTA
+	//----------- 配置图片
+	beego.Router(prefix+"OTA/FileToken", &controllers.UpFileController{}, "*:UpFileToken") // *全部;  get,post:
+	beego.Router(prefix+"OTA/Add", &controllers.ProductOTAController{}, "*:Add")       //
+	beego.Router(prefix+"OTA/Get", &controllers.ProductOTAController{}, "*:Get")       //
+	beego.Router(prefix+"OTA/List", &controllers.ProductOTAController{}, "*:List")     //
+	beego.Router(prefix+"OTA/Delete", &controllers.ProductOTAController{}, "*:Delete") //
+
+
+	beego.Router("/RunTime", &controllers.SystemController{}, "*:RunTime") //
+	beego.Router("/SystemConfig", &controllers.SystemController{}, "*:SystemConfig") //
+
+
+}

+ 12 - 0
tests/default_test.go

@@ -0,0 +1,12 @@
+package test
+
+import (
+	"github.com/google/uuid"
+	"testing"
+)
+
+func TestName(t *testing.T) {
+
+	println(uuid.New().String())
+
+}

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 6 - 0
views/index.tpl


BIN
核心通讯文档.docx


+ 65 - 0
说明.md

@@ -0,0 +1,65 @@
+
+
+docker run -p 3306:3306 --name mysql --restart=always --privileged=true \
+-e MYSQL_ROOT_PASSWORD=Ayunlot123  \
+-e MYSQL_DATABASE=yunlot \
+-e MYSQL_USER=yunlot \
+-e MYSQL_PASSWORD=yunlot123 \
+-d mysql:8.1
+
+
+-v /usr/local/mysql/log:/var/log/mysql \
+-v /usr/local/mysql/data:/var/lib/mysql \
+-v /usr/local/mysql/conf:/etc/mysql \
+-v /etc/localtime:/etc/localtime:ro \
+
+
+
+##Mongodb
+docker run -d --restart=always -p 27017:27017 --name mongo mongo:4.4.6 --auth
+                                -v /docker_volume/mongodb/data:/data/db
+docker exec -it mongo mongo admin
+db.createUser({ user: "yunlot" , pwd: "yunlot123", roles: ["root"]})
+
+
+
+##yunlot
+docker run -it --name yunlot -p 6200:6202 yunlot:latest \
+--restart=always --privileged \
+-v /var/run/docker.sock:/var/run/docker.sock \
+-v /usr/bin/docker:/bin/docker \
+
+
+docker run --privileged --name='yunlot' -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -itd yunlot:latest bash
+
+
+
+
+
+启动:/usr/local/redis/bin/redis-server& /usr/local/redis/redis.conf
+docker pull redis:latest
+docker run -itd --name redis -p 6379:6379 redis
+
+/usr/local/redis
+
+
+ docker container run  --restart=always \
+-p 8379:6379 \
+-v /usr/local/redis/redis.conf:/etc/redis/redis.conf \
+--privileged=true \
+--name myredis \
+-d redis redis-server /etc/redis/redis.conf --appendonly yes
+
+
+MQTT-----------------------
+docker pull emqx/emqx:5.0.23
+
+docker run -d --name emqx -p 6891:1883 -p 6892:8083 -p 6893:8084 -p 6894:8883 -p 6895:18083 emqx/emqx:5.0.23
+
+6885-->18083/tcp,6881-->1883/tcp,6882-->8083/tcp,6883-->8084/tcp,6884-->8883/tcp
+
+
+
+
+
+

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov