|
@@ -2,8 +2,8 @@ package manager
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
"fmt"
|
|
"fmt"
|
|
|
- "github.com/gogf/gf/encoding/gjson"
|
|
|
|
|
"github.com/gogf/gf/util/guid"
|
|
"github.com/gogf/gf/util/guid"
|
|
|
|
|
+ "github.com/gogf/gf/v2/encoding/gjson"
|
|
|
"sparrow/pkg/models"
|
|
"sparrow/pkg/models"
|
|
|
"sparrow/pkg/rpcs"
|
|
"sparrow/pkg/rpcs"
|
|
|
"sparrow/pkg/server"
|
|
"sparrow/pkg/server"
|
|
@@ -117,10 +117,14 @@ func (a *TaskExecutor) saveHis(id string, action *Action) error {
|
|
|
SceneID: id,
|
|
SceneID: id,
|
|
|
DeviceId: action.DeviceID,
|
|
DeviceId: action.DeviceID,
|
|
|
SubDeviceId: action.SubDeviceId,
|
|
SubDeviceId: action.SubDeviceId,
|
|
|
- Cmd: action.ExecutorProperty.FunctionCode,
|
|
|
|
|
- Params: gjson.New(action.ExecutorProperty.FunctionValue).MustToJsonString(),
|
|
|
|
|
- Topic: action.PlcPubMessage.Topic,
|
|
|
|
|
- Payload: string(action.PlcPubMessage.Payload),
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ if action.ExecutorProperty.FunctionCode != "" {
|
|
|
|
|
+ args.Cmd = action.ExecutorProperty.FunctionCode
|
|
|
|
|
+ args.Params = gjson.New(action.ExecutorProperty.FunctionValue).MustToJsonString()
|
|
|
|
|
+ }
|
|
|
|
|
+ if action.PlcPubMessage.Topic != "" {
|
|
|
|
|
+ args.Topic = action.PlcPubMessage.Topic
|
|
|
|
|
+ args.Payload = string(action.PlcPubMessage.Payload)
|
|
|
}
|
|
}
|
|
|
return server.RPCCallByName(nil, rpcs.RegistryServerName, "Registry.CreateEvent", args, &rpcs.ReplyEmptyResult{})
|
|
return server.RPCCallByName(nil, rpcs.RegistryServerName, "Registry.CreateEvent", args, &rpcs.ReplyEmptyResult{})
|
|
|
}
|
|
}
|