孪生体

This commit is contained in:
XM-GO
2023-06-20 17:43:57 +08:00
parent 8b5a0206b9
commit e24f761ad6
2 changed files with 15 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ package api
// 生成人panda
// ==========================================================================
import (
"encoding/json"
"github.com/XM-GO/PandaKit/model"
"github.com/XM-GO/PandaKit/restfulx"
"github.com/emicklei/go-restful/v3"
@@ -80,6 +81,14 @@ func (p *VisualScreenApi) UpdateScreenStatus(rc *restfulx.ReqCtx) {
p.VisualScreenApp.Update(screen)
}
func (p *VisualScreenApi) ScreenTwinData(rc *restfulx.ReqCtx) {
twin := `[{"twinId":"1001","name":"监测站001","attrs":[{"key":"wd","type":"int64","name":"温度"},{"key":"sd","type":"int64","name":"湿度"}]},{"twinId":"2001","name":"控制器001","attrs":[{"key":"q","type":"int64","name":"灯光强度"},{"key":"open","type":"bool","name":"灯光开关"}]}]`
data := make([]map[string]interface{}, 0)
json.Unmarshal([]byte(twin), &data)
rc.ResData = data
}
func (p *VisualScreenApi) ScreenTwin(request *restful.Request, response *restful.Response) {
screenId := request.QueryParameter("screenId")
if screenId == "" {