package lc import ( "github.com/sirupsen/logrus" "net/http" ) type Programm struct { Type string `json:"type"` //节目类型 Name string `json:"name"` //节目名 ImageInfo ImageInfo `json:"imageinfo"` //图片,视频资源url TextInfo Textinfo `json:"textinfo"` //文本内容 } type Textinfo struct { Content string `json:"content"` LfFaceName string `json:"lfFaceName"` BackColor string `json:"backcolor"` TextColor string `json:"textcolor"` Duration string `json:"duration"` IsScroll string `json:"IsScroll"` Speed string `json:"Speed"` //滚动速度pixels/秒 } type ImageInfo struct { Urls []string `json:"urls"` Duration string `json:"duration"` InEffect InEffect `json:"inEffect"` } type InEffect struct { Type string `json:"Type"` //0- No transition, 1-Random, 2-Left unveil, 3-Right unveil Time string `json:"Time"` } // SwitchProgram 切换节目 func SwitchProgram(id int) { name := "来车new-55" if id == 0 { name = "路口new-54" } url := "http://192.168.1.213/api/" + "vsns/sources/lan/vsns/" + name + ".vsn/activated" request, err := http.NewRequest("PUT", url, nil) if err != nil { logrus.Errorf("Newrequest出错:%v", err) return } request.Header.Set("Accept", "application/json") _, err = http.DefaultClient.Do(request) if err != nil { logrus.Errorf("http错误%v", err) return } }