mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-27 17:09:37 +08:00
孪生体
This commit is contained in:
@@ -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 == "" {
|
||||
|
||||
Reference in New Issue
Block a user