更新报错

This commit is contained in:
XM-GO
2023-09-01 16:47:22 +08:00
parent 9e53f07d92
commit 64d61b14ad
5 changed files with 2 additions and 36 deletions

View File

View File

@@ -1,6 +0,0 @@
2023-08-22 15:15:49--------------------------------
2023-08-22 15:51:54--------------------------------
2023-08-23 16:11:33--------------------------------

View File

@@ -146,8 +146,6 @@ func (s *HookService) OnClientDisconnected(ctx context.Context, in *exhook.Clien
Datas: string(v), Datas: string(v),
Type: message.DisConnectMes, Type: message.DisConnectMes,
} }
// todo 网关掉线子设备全部离线状态,更改设备下线状态
s.messageCh <- data s.messageCh <- data
return &exhook.EmptySuccess{}, nil return &exhook.EmptySuccess{}, nil
} }

View File

@@ -104,17 +104,16 @@ func getRuleChain(etoken *tool.DeviceAuth) *ruleEntity.RuleDataJson {
return &ruleData return &ruleData
} }
func buildRuleMessage(etoken *tool.DeviceAuth, dei *DeviceEventInfo, msgType string) message.Message { func buildRuleMessage(etoken *tool.DeviceAuth, dei *DeviceEventInfo, msgType string) *message.Message {
metadataVals := map[string]interface{}{ metadataVals := map[string]interface{}{
"deviceId": etoken.DeviceId, "deviceId": etoken.DeviceId,
"deviceName": etoken.Name, "deviceName": etoken.Name,
"deviceType": etoken.DeviceType, "deviceType": etoken.DeviceType,
"productId": etoken.ProductId, "productId": etoken.ProductId,
} }
metadata := message.NewDefaultMetadata(metadataVals)
msgVals := make(map[string]interface{}) msgVals := make(map[string]interface{})
json.Unmarshal([]byte(dei.Datas), &msgVals) json.Unmarshal([]byte(dei.Datas), &msgVals)
return message.NewMessageWithDetail(etoken.User, msgType, msgVals, metadata) return message.NewMessage(etoken.User, msgType, msgVals, metadataVals)
} }
func SendZtWebsocket(deviceId, message string) { func SendZtWebsocket(deviceId, message string) {

View File

@@ -1,25 +0,0 @@
package iothub
// 指令下发
/*func Control(assets, thingModel, device_name, parameter string, operation bool) error {
topic := fmt.Sprintf("control/%s/%s", assets, device_name)
log.Println(topic)
payload := fmt.Sprintf(`{"method":"control","data":{"parameter": "%s","operation":%t}}`, parameter, operation)
//Publish(*global.GVA_MQTT, topic, 1, payload)
return nil
}
func ControlState(assets, thingModel, device_name string) (map[string]interface{}, error) {
topic := fmt.Sprintf("control/%s/%s", assets, device_name)
payload := fmt.Sprintf(`{"method":"state","data":{}}`)
if Publish(*global.GVA_MQTT, topic, 1, payload) != nil {
return nil, errors.New("下发获取状态参数指令失败")
}
select {
case state := <-controlState:
return state, nil
case <-time.After(10 * time.Second):
return nil, errors.New("请求指令状态超时")
}
}
*/