|
@@ -39,13 +39,13 @@ func ParseTopic(topic string) (string, string, string, string, error) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// ParseTopicHL 获取租户、设备类型、设备编码、MQTT协议topic固定部分(定义在topic.go文件)
|
|
// ParseTopicHL 获取租户、设备类型、设备编码、MQTT协议topic固定部分(定义在topic.go文件)
|
|
|
-func ParseTopicHL(topic string) (string, string, error) {
|
|
|
|
|
|
|
+func ParseTopicHL(topic string, defaultTenant string) (string, string, error) {
|
|
|
strList := strings.Split(topic, "/")
|
|
strList := strings.Split(topic, "/")
|
|
|
if len(strList) < 4 {
|
|
if len(strList) < 4 {
|
|
|
return "", "", errors.New("不支持的topic")
|
|
return "", "", errors.New("不支持的topic")
|
|
|
}
|
|
}
|
|
|
- if strList[3] == "longchi" {
|
|
|
|
|
- strList[0] = "100000"
|
|
|
|
|
|
|
+ if strList[3] == "longchi" && defaultTenant != "" {
|
|
|
|
|
+ strList[0] = defaultTenant
|
|
|
}
|
|
}
|
|
|
return strList[0], topic, nil
|
|
return strList[0], topic, nil
|
|
|
}
|
|
}
|
|
@@ -61,15 +61,16 @@ func ParseTopicCltLed(topic string) (string, string, string, string, string, err
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
type MainConfig struct {
|
|
type MainConfig struct {
|
|
|
- GB28181API string
|
|
|
|
|
- SRSLIVEDIR string
|
|
|
|
|
- SRSLIVEMP4 int
|
|
|
|
|
- SDKAppId string
|
|
|
|
|
- SecretId string
|
|
|
|
|
- SecretKey string
|
|
|
|
|
- SMSKey string
|
|
|
|
|
- SMSTemplateId string
|
|
|
|
|
- SMSReceiver []string
|
|
|
|
|
|
|
+ GB28181API string
|
|
|
|
|
+ SRSLIVEDIR string
|
|
|
|
|
+ SRSLIVEMP4 int
|
|
|
|
|
+ SDKAppId string
|
|
|
|
|
+ SecretId string
|
|
|
|
|
+ SecretKey string
|
|
|
|
|
+ SMSKey string
|
|
|
|
|
+ SMSTemplateId string
|
|
|
|
|
+ SMSReceiver []string
|
|
|
|
|
+ HLDefaultTenant string
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (o *MainConfig) ReadConfig(path, sec string) bool {
|
|
func (o *MainConfig) ReadConfig(path, sec string) bool {
|