|
|
@@ -2,9 +2,7 @@ package manager
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
- "github.com/gogf/gf/util/guid"
|
|
|
"github.com/gogf/gf/v2/encoding/gjson"
|
|
|
- "sparrow/pkg/models"
|
|
|
"sparrow/pkg/rpcs"
|
|
|
"sparrow/pkg/server"
|
|
|
"sparrow/pkg/utils"
|
|
|
@@ -108,7 +106,7 @@ func getAccessRPCHost(deviceid string) (string, error) {
|
|
|
return reply.AccessRPCHost, nil
|
|
|
}
|
|
|
|
|
|
-func (a *TaskExecutor) saveHis(id string, conditionId []string, action *Action) error {
|
|
|
+func (a *TaskExecutor) saveHis(id string, conditionId []string) error {
|
|
|
|
|
|
client := utils.NewHttpClient()
|
|
|
url := "http://127.0.0.1:8199/iot/v1/scene_history"
|
|
|
@@ -120,20 +118,20 @@ func (a *TaskExecutor) saveHis(id string, conditionId []string, action *Action)
|
|
|
if err != nil {
|
|
|
server.Log.Errorf("sync his error:%s", err.Error())
|
|
|
}
|
|
|
-
|
|
|
- args := models.SceneHis{
|
|
|
- RecordId: guid.S(),
|
|
|
- SceneID: id,
|
|
|
- DeviceId: action.DeviceID,
|
|
|
- SubDeviceId: action.SubDeviceId,
|
|
|
- }
|
|
|
- if action.ExecutorProperty.FunctionCode != "" {
|
|
|
- args.Cmd = action.ExecutorProperty.FunctionCode
|
|
|
- args.Params = gjson.New(action.ExecutorProperty.FunctionValue).MustToJsonString()
|
|
|
- }
|
|
|
- if action.PlcPubMessage != nil {
|
|
|
- args.Topic = action.PlcPubMessage.Topic
|
|
|
- args.Payload = string(action.PlcPubMessage.Payload)
|
|
|
- }
|
|
|
- return server.RPCCallByName(nil, rpcs.RegistryServerName, "Registry.CreateSceneHis", args, &rpcs.ReplyEmptyResult{})
|
|
|
+ return err
|
|
|
+ //args := models.SceneHis{
|
|
|
+ // RecordId: guid.S(),
|
|
|
+ // SceneID: id,
|
|
|
+ // DeviceId: action.DeviceID,
|
|
|
+ // SubDeviceId: action.SubDeviceId,
|
|
|
+ //}
|
|
|
+ //if action.ExecutorProperty.FunctionCode != "" {
|
|
|
+ // args.Cmd = action.ExecutorProperty.FunctionCode
|
|
|
+ // args.Params = gjson.New(action.ExecutorProperty.FunctionValue).MustToJsonString()
|
|
|
+ //}
|
|
|
+ //if action.PlcPubMessage != nil {
|
|
|
+ // args.Topic = action.PlcPubMessage.Topic
|
|
|
+ // args.Payload = string(action.PlcPubMessage.Payload)
|
|
|
+ //}
|
|
|
+ //return server.RPCCallByName(nil, rpcs.RegistryServerName, "Registry.CreateSceneHis", args, &rpcs.ReplyEmptyResult{})
|
|
|
}
|