sqlite的api,便于内部使用
liuxiaolong
2019-06-22 bdad84a12fea50ab5cef4adf6fe50b53fdf47330
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package dbapi
 
import (
    "basic.com/pubsub/protomsg.git"
    "encoding/json"
)
 
type SysSetApi struct {
 
}
 
func (api SysSetApi) GetServerInfo() (flag bool,sysconf protomsg.LocalConfig){
    url := BASIC_URL + DATA_URL_PREFIX + "/sysset/getServerInfo"
    client := NewClient()
 
    body, err := client.DoGetRequest(url, nil, nil)
    if err != nil {
        return false, sysconf
    }
 
    var res Result
    if err = json.Unmarshal(body, &res); err != nil {
        return false, sysconf
    }
 
    b, err := json.Marshal(res.Data)
    if err !=nil {
        return false,sysconf
    } else {
        err = json.Unmarshal(b, &sysconf)
        if err !=nil {
            return false,sysconf
        } else {
            return true,sysconf
        }
    }
}
//保存轮询配置
func (api SysSetApi) SavePollConfig(paramBody map[string]interface{}) bool{
    return false
}
 
//获取轮询配置
func (api SysSetApi) GetPollConfig() (flag bool,config protomsg.PollConfig) {
    return false,config
}