sqlite的api,便于内部使用
liuxiaolong
2019-06-27 7afd6516806710fa1fa22c40fc11e9393ca4720b
fix url
2个文件已修改
29 ■■■■ 已修改文件
api_test.go 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
syssetApi.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api_test.go
@@ -2,6 +2,7 @@
import (
    "basic.com/pubsub/protomsg.git"
    "crypto/rand"
    "encoding/json"
    "fmt"
    "reflect"
@@ -12,6 +13,14 @@
func Add(a,b string) (string,string) {
    ret := a+" "+b
    return ret,ret
}
func PseudoUuid() (uuid string) {
    b := make([]byte, 16)
    rand.Read(b)
    uuid = fmt.Sprintf("%X-%X-%X-%X-%X", b[0:4], b[4:6], b[6:8], b[8:10], b[10:])
    return uuid
}
var funcMap = map[string]interface{}{"add":Add}
@@ -35,7 +44,7 @@
    //fmt.Println(body)
    ret := Call("add", "hello", "world")
    fmt.Println("NewUUID:",PseudoUuid())
    fmt.Println(ret)
}
@@ -166,3 +175,17 @@
    all := api.FindAll()
    fmt.Println("all:",all)
}
func TestSysSetApi_GetServerInfo(t *testing.T) {
    var api SysSetApi
    flag, sysconf := api.GetServerInfo()
    fmt.Println("flag:",flag)
    fmt.Println("server.Info:",sysconf)
}
func TestCameraApi_GetCamerasByRunType(t *testing.T) {
    var api CameraApi
    flag, cameras := api.GetCamerasByRunType(0,"")
    fmt.Println("flag:",flag)
    fmt.Println("cameras:",cameras)
}
syssetApi.go
@@ -38,7 +38,7 @@
}
//保存轮询配置
func (api SysSetApi) SavePollPeriod(period int) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/pollConfig/savePollConfig"
    url := BASIC_URL + DATA_URL_PREFIX + "/pollConfig/savePollPeriod"
    client := NewClient()
    paramBody := make(map[string]interface{},0)
    paramBody["period"] = period
@@ -57,7 +57,7 @@
}
func (api SysSetApi) SavePollDelay(delay int) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/pollConfig/savePollConfig"
    url := BASIC_URL + DATA_URL_PREFIX + "/pollConfig/savePollDelay"
    client := NewClient()
    paramBody := make(map[string]interface{},0)
    paramBody["delay"] = delay