|
|
@@ -7,6 +7,7 @@ import (
|
|
|
"sparrow/pkg/models"
|
|
|
"sparrow/pkg/rpcs"
|
|
|
"sparrow/pkg/server"
|
|
|
+ "sparrow/pkg/utils"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
@@ -112,6 +113,17 @@ func getAccessRPCHost(deviceid string) (string, error) {
|
|
|
}
|
|
|
|
|
|
func (a *TaskExecutor) saveHis(id string, action *Action) error {
|
|
|
+
|
|
|
+ client := utils.NewHttpClient()
|
|
|
+ url := "http://127.0.0.1:8199/iot/v1/scene_history"
|
|
|
+ body := make(map[string]interface{})
|
|
|
+ body["scene_id"] = id
|
|
|
+ body["time"] = time.Now()
|
|
|
+ _, err := client.Post(url, "application/json", gjson.New(body))
|
|
|
+ if err != nil {
|
|
|
+ server.Log.Errorf("sync his error:%s", err.Error())
|
|
|
+ }
|
|
|
+
|
|
|
args := models.SceneHis{
|
|
|
RecordId: guid.S(),
|
|
|
SceneID: id,
|