| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 | package controllersimport (    "github.com/astaxie/beego"    "wb/cc"    "wb/lg"    "wb/st"    "wb/om"    "wb/ii"    "wb/ut"    "wb/ctrl/uibuilder"    "testbench/models/iot"    "strings"    "testbench/models/etc"    "wb/cfg")type ViewController struct {    beego.Controller}func (this *ViewController)UiView(){    sn := strings.TrimSpace(this.GetString(cc.Col.Sn))    itemName := iot.GetThingTypeById(sn)    oItemInfo, c:= ii.GetItemInfoByName(itemName)    if sn == "" {        lg.Error("ui.UiView", st.ParamSnIsNone)        this.Ctx.WriteString(st.ParamSnIsNone)        return    }    params := om.Params{etc.Sid: sn}    c, oldValueMap := om.Table(itemName).Get(params)    statusUrl := "/" +itemName + "/status?sn=" + sn    this.Data["ItemName"] = itemName    this.Data["StatusUrl"] = statusUrl    showCate := strings.TrimSpace(this.GetString("cate"))    if c == "success" {        this.Data["Sn"] = ut.Maps.GetString(oldValueMap, cc.Col.Sn)        this.Data["Sid"] = ut.Maps.GetString(oldValueMap, "sid")        oldValueMap = om.TransInfo(oItemInfo, oldValueMap)        this.Data["ViewPanels"] = uibuilder.BuildViewPanelFromItemInfo(oItemInfo, oldValueMap, showCate)        customTpl := cfg.WebConfig.ViewsPath + "/" + oItemInfo.Name + "/" + "view.tpl"        if ut.IsPathExist(customTpl){            this.TplName = oItemInfo.Name + "/" + "view.tpl"        }else{            this.TplName = "item/view.tpl"        }    } else {        this.Ctx.WriteString(st.ItemNotFound)    }}
 |