sqlite的api,便于内部使用
liuxiaolong
2019-10-19 d8d991f239fb5e2fcb8ca134da6feb1758f6dade
add ip config
18个文件已修改
534 ■■■■ 已修改文件
areaApi.go 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cameraApi.go 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cameraTaskApi.go 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cameraTaskArgsApi.go 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
client.go 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cluster.go 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dbpersonApi.go 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dbtableApi.go 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dicApi.go 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eventPush.go 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
sdkApi.go 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
soApi.go 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
sysMenuApi.go 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
sysRoleApi.go 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
syssetApi.go 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
taskApi.go 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
taskSdkRuleApi.go 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
userApi.go 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
areaApi.go
@@ -3,9 +3,25 @@
import (
    "encoding/json"
    "fmt"
    "strconv"
)
type AreaApi struct {
    Ip string
    Port int
}
func (api AreaApi) getBasicUrl() string {
    if api.Ip == "" {
        return BASIC_URL
    }
    if api.Ip == "" {
        api.Ip = DEFAULT_IP
    }
    if api.Port == 0 {
        api.Port = DEFAULT_PORT
    }
    return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
//parentId 要查寻的目录树的根节点id
@@ -16,7 +32,7 @@
    client := NewClient()
    url := BASIC_URL + DATA_URL_PREFIX + "/area/localmenu"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/area/localmenu"
    params := make(map[string]string, 0)
    params["parentId"] = parentId
    params["searchType"] = searchType
@@ -47,7 +63,7 @@
    client := NewClient()
    url := BASIC_URL + DATA_URL_PREFIX + "/area/gb28181Tree"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/area/gb28181Tree"
    params := make(map[string]string, 0)
    params["parentId"] = parentId
    params["searchType"] = searchType
@@ -72,7 +88,7 @@
func (api AreaApi) Gb28181TreeRefresh(id string) bool {
    flag := false
    url := BASIC_URL + DATA_URL_PREFIX + "/area/gb28181TreeRefresh"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/area/gb28181TreeRefresh"
    client := NewClient()
    paramBody := map[string]interface{}{
        "id":id,
@@ -91,7 +107,7 @@
func (api AreaApi) Gb28181TreeDelete() bool {
    flag := false
    url := BASIC_URL + DATA_URL_PREFIX + "/area/gb28181TreeDelete"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/area/gb28181TreeDelete"
    client := NewClient()
    respBody, err := client.DoPostRequest(url, CONTENT_TYPE_FORM, nil, nil, nil)
    if err != nil {
@@ -108,7 +124,7 @@
//添加目录节点
func (api AreaApi) AreaAdd(paramBody map[string]interface{}) bool {
    flag := false
    url := BASIC_URL + DATA_URL_PREFIX + "/area/add"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/area/add"
    client := NewClient()
    respBody, err := client.DoPostRequest(url, CONTENT_TYPE_FORM, paramBody, nil, nil)
    if err != nil {
@@ -125,7 +141,7 @@
//目录更新
func (api AreaApi) AreaUpdate(paramBody map[string]interface{}) bool {
    flag := false
    url := BASIC_URL + DATA_URL_PREFIX + "/area/update"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/area/update"
    client := NewClient()
    respBody, err := client.DoPostRequest(url, CONTENT_TYPE_FORM, paramBody,nil, nil)
@@ -147,7 +163,7 @@
    if id == "" {
        return flag
    }
    url := BASIC_URL + DATA_URL_PREFIX + "/area/del"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/area/del"
    client := NewClient()
    paramBody := make(map[string]interface{}, 0)
    paramBody["id"] = id
cameraApi.go
@@ -7,10 +7,26 @@
    "strconv"
)
type CameraApi struct{}
type CameraApi struct{
    Ip string
    Port int
}
func (api CameraApi) getBasicUrl() string {
    if api.Ip == "" {
        return BASIC_URL
    }
    if api.Ip == "" {
        api.Ip = DEFAULT_IP
    }
    if api.Port == 0 {
        api.Port = DEFAULT_PORT
    }
    return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
func (api CameraApi) CameraAdd(paramBody map[string]interface{}) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/add"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/add"
    client := NewClient()
    body, err := client.DoPostRequest(url,CONTENT_TYPE_JSON,paramBody,nil,nil)
    if err != nil {
@@ -25,7 +41,7 @@
}
func (api CameraApi) CameraUpdate(paramBody map[string]interface{}) bool {
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/update"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/update"
    client := NewClient()
    body, err := client.DoPutRequest(url,CONTENT_TYPE_JSON,paramBody,nil)
    if err != nil {
@@ -40,7 +56,7 @@
}
func (api CameraApi) UpdateSnapshotUrl(cameraId string, snapshot string) bool {
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/updateSnapshot"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/updateSnapshot"
    client := NewClient()
    paramBody :=make(map[string]interface{},0)
    paramBody["snapshot"] = snapshot
@@ -60,7 +76,7 @@
}
func (api CameraApi) CameraDelete(cid string) bool {
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/del/"+cid
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/del/"+cid
    client := NewClient()
    paramMap := make(map[string]string,0)
    paramMap["cid"] = cid
@@ -78,7 +94,7 @@
//通过cameraId获取摄像机信息
func (api CameraApi) GetCameraById(cameraId string) (camera protomsg.Camera, err error) {
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/show/" + cameraId
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/show/" + cameraId
    client := NewClient()
    body, err := client.DoGetRequest(url, nil, nil)
@@ -98,7 +114,7 @@
}
func (api CameraApi) FindAll() (cameras []protomsg.Camera) {
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/showAll"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/showAll"
    client := NewClient()
    body, err := client.DoGetRequest(url, nil, nil)
@@ -119,7 +135,7 @@
}
func (api CameraApi) GetAllCamerasByServer(serverId string,cameraName string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/getAllCamerasByServer"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/getAllCamerasByServer"
    client := NewClient()
    paramQuery := make(map[string]string,0)
    paramQuery["serverId"] = serverId
@@ -139,7 +155,7 @@
//获取所有摄像机的信息以及其所有任务
func (api CameraApi) FindAllCameraAndTask() (cameraTasks []protomsg.CameraAndTaskInfo){
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/queryCameraAndTaskInfo"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/queryCameraAndTaskInfo"
    client := NewClient()
    body, err := client.DoGetRequest(url, nil, nil)
@@ -160,7 +176,7 @@
}
func (api CameraApi) SaveCameraPolygon(paramBody map[string]interface{}) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/polygon/save"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/polygon/save"
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
    if err != nil {
@@ -177,7 +193,7 @@
}
func (api CameraApi) DeleteCameraPolygon(id string) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/polygon/delete"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/polygon/delete"
    client := NewClient()
    paramQuery := make(map[string]string,0)
    paramQuery["id"]=id
@@ -195,7 +211,7 @@
func (api CameraApi) FindAllPolygons() ([]protomsg.CameraPolygon) {
    polygons := make([]protomsg.CameraPolygon,0)
    url := BASIC_URL + DATA_URL_PREFIX + "/polygon/findAll"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/polygon/findAll"
    client := NewClient()
    body, err := client.DoGetRequest(url, nil, nil)
@@ -216,7 +232,7 @@
}
func (api CameraApi) FindPolygonsByCameraId(cameraId string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/polygon/findByCameraId"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/polygon/findByCameraId"
    client := NewClient()
    paramQuery := make(map[string]string,0)
    paramQuery["cameraId"] = cameraId
@@ -234,7 +250,7 @@
//新增或更新时间规则
func (api CameraApi) SaveCameraTimerule(paramBody map[string]interface{}) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/cameraTimerule/save"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTimerule/save"
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
    if err != nil {
@@ -251,7 +267,7 @@
}
func (api CameraApi) DeleteCameraTimerule (id string) bool {
    url := BASIC_URL + DATA_URL_PREFIX + "/cameraTimerule/delete"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTimerule/delete"
    client := NewClient()
    paramQuery := make(map[string]string,0)
    paramQuery["id"]=id
@@ -269,7 +285,7 @@
//根据摄像机id查找所有的时间规则
func (api CameraApi) FindAllTimeRules() (flag bool,rules []protomsg.CameraTimerule) {
    url := BASIC_URL + DATA_URL_PREFIX + "/cameraTimerule/findAll"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTimerule/findAll"
    client := NewClient()
    body, err := client.DoGetRequest(url, nil, nil)
    if err != nil {
@@ -288,7 +304,7 @@
}
func (api CameraApi) UpdateDefenceStateByPolygonId(polygonId string,state string) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/polygon/updateDefenceStateByPolygonId"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/polygon/updateDefenceStateByPolygonId"
    client := NewClient()
    paramQuery :=make(map[string]string,0)
    paramQuery["polygonId"] = polygonId
@@ -306,7 +322,7 @@
}
func (api CameraApi) UpdateDefenceStateByCameraId(cameraId string,state string) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/polygon/updateDefenceStateByCameraId"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/polygon/updateDefenceStateByCameraId"
    client := NewClient()
    paramQuery :=make(map[string]string,0)
    paramQuery["cameraId"] = cameraId
@@ -326,7 +342,7 @@
//根据运行类型获取摄像机列表
//runType(0:获取轮询列表,1:获取实时列表)
func (api CameraApi) GetCamerasByRunType(runType int,cameraName string)(flag bool,cameras []protomsg.Camera){
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/getCamerasByRunType"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/getCamerasByRunType"
    client := NewClient()
    paramQuery := make(map[string]string,2)
    paramQuery["runType"]=strconv.Itoa(runType)
@@ -353,7 +369,7 @@
}
func (api CameraApi) UpdateRunEnable(cameraId string,runEnable bool) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/updateRunEnable"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/updateRunEnable"
    client := NewClient()
    paramBody :=make(map[string]interface{},0)
    paramBody["cameraId"] = cameraId
@@ -373,7 +389,7 @@
}
func (api CameraApi) UpdateIsRunningState(cameraId string,isRunning bool) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/updateIsRunningState"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/updateIsRunningState"
    client := NewClient()
    paramBody :=make(map[string]interface{},0)
    paramBody["cameraId"] = cameraId
@@ -394,7 +410,7 @@
//批量切换摄像机轮询或实时状态
func (api CameraApi) ChangeRunType(paramBody map[string]interface{}) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/changeRunType"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/changeRunType"
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
    if err != nil {
cameraTaskApi.go
@@ -2,14 +2,29 @@
import (
    "encoding/json"
    "strconv"
)
type CameraTaskApi struct {
    Ip string
    Port int
}
func (api CameraTaskApi) getBasicUrl() string {
    if api.Ip == "" {
        return BASIC_URL
    }
    if api.Ip == "" {
        api.Ip = DEFAULT_IP
    }
    if api.Port == 0 {
        api.Port = DEFAULT_PORT
    }
    return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
func (api CameraTaskApi) AddTask(cameraId string,taskId string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/cameraTask/addTask"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTask/addTask"
    client := NewClient()
    paramBody := map[string]interface{}{
        "cameraId": cameraId,
@@ -27,7 +42,7 @@
}
func (api CameraTaskApi) CameraTaskSave(paramBody map[string]interface{}) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/saveTask"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/saveTask"
    client := NewClient()
    respBody, err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody,nil, nil)
    if err != nil {
@@ -41,7 +56,7 @@
}
func (api CameraTaskApi) FindTasksByCameraIds(cameraIds []string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/alltask"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/alltask"
    client := NewClient()
    paramBody :=make(map[string]interface{})
    paramBody["cameraIds"] = cameraIds
@@ -57,7 +72,7 @@
}
func (api CameraTaskApi) CameraTaskAll(cameraId string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/task/"+cameraId
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/task/"+cameraId
    client := NewClient()
    paramQuery :=make(map[string]string)
    paramQuery["cameraId"] = cameraId
@@ -73,7 +88,7 @@
}
func (api CameraTaskApi) DeleteCameraTask(cameraId string,taskId string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/delTask/"+cameraId+"/"+taskId
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/delTask/"+cameraId+"/"+taskId
    client := NewClient()
    respBody, err := client.DoDeleteRequest(url, CONTENT_TYPE_FORM, nil,nil)
    if err != nil {
@@ -87,7 +102,7 @@
}
func (api CameraTaskApi) SaveIsDataTrans(paramBody map[string]interface{}) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/cameraTask/saveIsDataTrans"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTask/saveIsDataTrans"
    client := NewClient()
    respBody, err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody,nil, nil)
    if err != nil {
@@ -101,7 +116,7 @@
}
func (api CameraTaskApi) SaveAlarmLevelByGroup(groupId string,alarmLevel int) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/cameraTask/saveAlarmLevelByGroup"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTask/saveAlarmLevelByGroup"
    client := NewClient()
    paramBody :=make(map[string]interface{},0)
    paramBody["group_id"] = groupId
@@ -119,7 +134,7 @@
//更新摄像机任务状态
func (api CameraTaskApi) UpdateCameraTaskStatus(cameraId string,taskId string,statusInt int) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/cameraTask/updateCameraTaskStatus"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTask/updateCameraTaskStatus"
    client := NewClient()
    paramBody :=make(map[string]interface{})
    paramBody["cameraId"] = cameraId
cameraTaskArgsApi.go
@@ -3,14 +3,29 @@
import (
    "basic.com/pubsub/protomsg.git"
    "encoding/json"
    "strconv"
)
type CameraTaskArgsApi struct {
    Ip string
    Port int
}
func (api CameraTaskArgsApi) getBasicUrl() string {
    if api.Ip == "" {
        return BASIC_URL
    }
    if api.Ip == "" {
        api.Ip = DEFAULT_IP
    }
    if api.Port == 0 {
        api.Port = DEFAULT_PORT
    }
    return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
func (api CameraTaskArgsApi) FindByCameraAndTask(cameraId string,taskId string,setType string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/getRulesByCameraAndTask"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/getRulesByCameraAndTask"
    client := NewClient()
    paramQuery :=make(map[string]string)
    paramQuery["cameraId"] = cameraId
@@ -28,7 +43,7 @@
}
func (api CameraTaskArgsApi) UpdateDefenceStateByGroup(groupId string,defenceState bool)(bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/cameraTaskArgs/updateDefenceStateByGroup"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTaskArgs/updateDefenceStateByGroup"
    client := NewClient()
    paramBody :=make(map[string]interface{},0)
    paramBody["groupId"] = groupId
@@ -45,7 +60,7 @@
}
func (api CameraTaskArgsApi) DeleteByGroup(groupId string)(bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/cameraTaskArgs/deleteByGroup"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTaskArgs/deleteByGroup"
    client := NewClient()
    paramQuery :=make(map[string]string)
    paramQuery["groupId"] = groupId
@@ -61,7 +76,7 @@
}
func (api CameraTaskArgsApi) FindAll() ([]protomsg.CameraTaskArgs){
    url := BASIC_URL + DATA_URL_PREFIX + "/cameraTaskArgs/findAll"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTaskArgs/findAll"
    client := NewClient()
    respBody, err := client.DoGetRequest(url, nil,nil)
    if err != nil {
@@ -78,7 +93,7 @@
}
func (api CameraTaskArgsApi) GetLinkRulesByCameraIds(paramBody map[string]interface{})(bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/cameraTaskArgs/getLinkRulesByCameraIds"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTaskArgs/getLinkRulesByCameraIds"
    client := NewClient()
    respBody, err := client.DoPostRequest(url,CONTENT_TYPE_JSON,paramBody,nil,nil)
    if err != nil {
@@ -92,7 +107,7 @@
}
func (api CameraTaskArgsApi) SaveLinkRulesByGroup(paramBody map[string]interface{}) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/cameraTaskArgs/saveLinkRulesByGroup"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTaskArgs/saveLinkRulesByGroup"
    client := NewClient()
    respBody, err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody,nil, nil)
    if err != nil {
client.go
@@ -15,6 +15,9 @@
var BASIC_URL            = "http://127.0.0.1:8001"
var DEFAULT_IP             = "127.0.0.1"
var DEFAULT_PORT         = 8001
const (
    DATA_URL_PREFIX      = "/data/api-v"
    CONTENT_TYPE_FORM    = "application/x-www-form-urlencoded"
cluster.go
@@ -1,13 +1,30 @@
package dbapi
import "encoding/json"
import (
    "encoding/json"
    "strconv"
)
type ClusterApi struct {
    Ip string
    Port int
}
func (api ClusterApi) getBasicUrl() string {
    if api.Ip == "" {
        return BASIC_URL
    }
    if api.Ip == "" {
        api.Ip = DEFAULT_IP
    }
    if api.Port == 0 {
        api.Port = DEFAULT_PORT
    }
    return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
func (api ClusterApi) FindCluster() (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/cluster/findCluster"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cluster/findCluster"
    client := NewClient()
    body,err := client.DoGetRequest(url, nil,nil)
    if err != nil {
@@ -23,7 +40,7 @@
}
func (api ClusterApi) Create(clusterName string, password string, virtualIp string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/cluster/create"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cluster/create"
    client := NewClient()
    paramBody := map[string]interface{}{
        "clusterName": clusterName,
@@ -44,7 +61,7 @@
}
func (api ClusterApi) Search(searchNum string, password string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/cluster/search"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cluster/search"
    client := NewClient()
    paramBody := map[string]interface{}{
        "searchNum": searchNum,
@@ -64,7 +81,7 @@
}
func (api ClusterApi) GetSearchNodes() (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/cluster/getSearchNodes"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cluster/getSearchNodes"
    client := NewClient()
    body,err := client.DoGetRequest(url, nil,nil)
    if err != nil {
@@ -80,7 +97,7 @@
}
func (api ClusterApi) StopSearching(searchNum string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/cluster/stopSearching"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cluster/stopSearching"
    client := NewClient()
    paramBody := map[string]interface{}{
        "searchNum": searchNum,
@@ -99,7 +116,7 @@
}
func (api ClusterApi) UpdateClusterName(clusterName string, virtualIp string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/cluster/updateClusterName"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cluster/updateClusterName"
    client := NewClient()
    paramBody := map[string]interface{}{
        "clusterName": clusterName,
@@ -119,7 +136,7 @@
}
func (api ClusterApi) Leave() (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/cluster/leave"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cluster/leave"
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_FORM, nil,nil,nil)
    if err != nil {
@@ -136,7 +153,7 @@
func (api ClusterApi) JoinCluster(paramBody map[string]interface{}) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/cluster/joinCluster"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/cluster/joinCluster"
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
    if err != nil {
dbpersonApi.go
@@ -7,11 +7,25 @@
)
type DbPersonApi struct {
    Ip string
    Port int
}
func (api DbPersonApi) getBasicUrl() string {
    if api.Ip == "" {
        return BASIC_URL
    }
    if api.Ip == "" {
        api.Ip = DEFAULT_IP
    }
    if api.Port == 0 {
        api.Port = DEFAULT_PORT
    }
    return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
func (api DbPersonApi) QueryDbPersonsByTbId(paramBody map[string]interface{}) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/queryDbPersonsByTbId"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/queryDbPersonsByTbId"
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
    if err != nil {
@@ -27,7 +41,7 @@
}
func (api DbPersonApi) UpdateDbPerson(paramBody map[string]interface{}) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/updateDbPerson"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/updateDbPerson"
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
    if err != nil {
@@ -43,7 +57,7 @@
}
func (api DbPersonApi) UpdateFace(id string,faceFeature string, pic string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/updateFace"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/updateFace"
    client := NewClient()
    paramBody := map[string]interface{}{
        "id": id,
@@ -64,7 +78,7 @@
}
func (api DbPersonApi) AddDbPerson(paramBody map[string]interface{}) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/addDbPerson"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/addDbPerson"
    client := NewClient()
    body,err := client.DoPutRequest(url,CONTENT_TYPE_JSON, paramBody,nil)
    if err != nil {
@@ -80,7 +94,7 @@
}
func (api DbPersonApi) DeleteDbPerson(id string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/deleteDbPersonById/"+id
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/deleteDbPersonById/"+id
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, nil,nil,nil)
    if err != nil {
@@ -96,7 +110,7 @@
}
func (api DbPersonApi) DeleteMoreDbPerson(paramBody map[string]interface{}) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/deleteMoreDbPerson"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/deleteMoreDbPerson"
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
    if err != nil {
@@ -112,7 +126,7 @@
}
func (api DbPersonApi) DeletePersonsByTbId(tableId string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/deletePersonsByTbId/"+tableId
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/deletePersonsByTbId/"+tableId
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, nil,nil,nil)
    if err != nil {
@@ -129,7 +143,7 @@
//根据底库人员id查询人员信息详情
func (api DbPersonApi) Dbpersoninfosbyid (ids []string) (persons []protomsg.Dbperson,err error) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/dbPersonInfoByIds"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/dbPersonInfoByIds"
    client := NewClient()
    paramBody := map[string]interface{}{
        "ids": ids,
@@ -151,7 +165,7 @@
}
func (api DbPersonApi) GetPersonTotal (tableId string) (total int64,err error) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/getPersonTotal"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/getPersonTotal"
    client := NewClient()
    paramBody := map[string]string{
        "tableId": tableId,
@@ -170,7 +184,7 @@
}
func (api DbPersonApi) GetPersonsCompareCacheBase (from int,size int) (persons []*protomsg.Esinfo,err error) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/getPersonsCompareCacheBase"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/getPersonsCompareCacheBase"
    client := NewClient()
    paramBody := map[string]string{
        "from": strconv.Itoa(from),
dbtableApi.go
@@ -4,14 +4,29 @@
    "basic.com/pubsub/protomsg.git"
    "encoding/json"
    "errors"
    "strconv"
)
type DbTableApi struct {
    Ip string
    Port int
}
func (dbt DbTableApi) AddDbTableInfo(paramBody map[string]interface{}) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dbtable/addDbTableInfo"
func (api DbTableApi) getBasicUrl() string {
    if api.Ip == "" {
        return BASIC_URL
    }
    if api.Ip == "" {
        api.Ip = DEFAULT_IP
    }
    if api.Port == 0 {
        api.Port = DEFAULT_PORT
    }
    return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
func (api DbTableApi) AddDbTableInfo(paramBody map[string]interface{}) (bool,interface{}) {
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbtable/addDbTableInfo"
    client := NewClient()
    body,err := client.DoPutRequest(url,CONTENT_TYPE_JSON, paramBody,nil)
    if err != nil {
@@ -26,8 +41,8 @@
    return res.Success,res.Data
}
func (dbt DbTableApi) QueryDbTables(isSync string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dbtable/queryDbTables/"+isSync
func (api DbTableApi) QueryDbTables(isSync string) (bool,interface{}) {
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbtable/queryDbTables/"+isSync
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, nil,nil,nil)
    if err != nil {
@@ -42,8 +57,8 @@
    return res.Success,res.Data
}
func (dbt DbTableApi) UpdateDbTables(paramBody map[string]interface{}) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dbtable/updateDbTables"
func (api DbTableApi) UpdateDbTables(paramBody map[string]interface{}) (bool,interface{}) {
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbtable/updateDbTables"
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
    if err != nil {
@@ -58,8 +73,8 @@
    return res.Success,res.Data
}
func (dbt DbTableApi) UpdateDbTableStatus(id string,enable int) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dbtable/updateDbTableStatus"
func (api DbTableApi) UpdateDbTableStatus(id string,enable int) (bool,interface{}) {
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbtable/updateDbTableStatus"
    client := NewClient()
    paramBody := map[string]interface{}{
        "id": id,
@@ -78,8 +93,8 @@
    return res.Success,res.Data
}
func (dbt DbTableApi) DeleteById(id string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dbtable/deleteDBtablesById/"+id
func (api DbTableApi) DeleteById(id string) (bool,interface{}) {
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbtable/deleteDBtablesById/"+id
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, nil,nil,nil)
    if err != nil {
@@ -95,8 +110,8 @@
}
//根据多个底库id查询底库信息
func (dbt DbTableApi) DbtablesById(ids []string) (dts []protomsg.Dbtable,err error) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dbtable/dbtablesByIds"
func (api DbTableApi) DbtablesById(ids []string) (dts []protomsg.Dbtable,err error) {
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbtable/dbtablesByIds"
    client := NewClient()
    paramBody := map[string]interface{}{
        "ids": ids,
@@ -118,8 +133,8 @@
}
// 根据tableid 查询tablename
func (dbt DbTableApi) Dbtablename(tableId string) (tableName string,err error) {
    dts, e := dbt.DbtablesById([]string{tableId})
func (api DbTableApi) Dbtablename(tableId string) (tableName string,err error) {
    dts, e := api.DbtablesById([]string{tableId})
    if e !=nil {
        return "",e
    }
@@ -129,8 +144,8 @@
    return "",errors.New("table not found")
}
func (dbt DbTableApi) FindAllDbTables() (dts []protomsg.Dbtable,err error) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dbtable/findAllDbTables"
func (api DbTableApi) FindAllDbTables() (dts []protomsg.Dbtable,err error) {
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbtable/findAllDbTables"
    client := NewClient()
    body,err := client.DoGetRequest(url, nil,nil)
    if err != nil {
@@ -148,8 +163,8 @@
    return dts,nil
}
func (dbt DbTableApi) FindAllDbTablesByCurServer(isDelete string) (dts []protomsg.Dbtable,err error){
    url := BASIC_URL + DATA_URL_PREFIX + "/dbtable/findAllDbTablesByCurServer"
func (api DbTableApi) FindAllDbTablesByCurServer(isDelete string) (dts []protomsg.Dbtable,err error){
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbtable/findAllDbTablesByCurServer"
    client := NewClient()
    paramQuery := map[string]string{
        "isDelete":isDelete,
dicApi.go
@@ -3,14 +3,29 @@
import (
    "encoding/json"
    "fmt"
    "strconv"
)
type DicApi struct {
    Ip string
    Port int
}
func (api DicApi) getBasicUrl() string {
    if api.Ip == "" {
        return BASIC_URL
    }
    if api.Ip == "" {
        api.Ip = DEFAULT_IP
    }
    if api.Port == 0 {
        api.Port = DEFAULT_PORT
    }
    return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
func (api DicApi) FindByType(dicType string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/dictionary/findByType"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dictionary/findByType"
    client := NewClient()
    paramMap := make(map[string]string)
    paramMap["type"] = dicType
@@ -27,7 +42,7 @@
}
func (api DicApi) FindByParentId(parentId string) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/dictionary/findByParentId"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/dictionary/findByParentId"
    client := NewClient()
    paramMap := make(map[string]string)
    paramMap["parentId"] = parentId
eventPush.go
@@ -4,14 +4,29 @@
    "basic.com/pubsub/protomsg.git"
    "encoding/json"
    "fmt"
    "strconv"
)
type EventPushApi struct {
    Ip string
    Port int
}
func (api EventPushApi) getBasicUrl() string {
    if api.Ip == "" {
        return BASIC_URL
    }
    if api.Ip == "" {
        api.Ip = DEFAULT_IP
    }
    if api.Port == 0 {
        api.Port = DEFAULT_PORT
    }
    return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
func (api EventPushApi) Save(paramBody map[string]interface{}) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/eventPush/save"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/eventPush/save"
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
    if err != nil {
@@ -28,7 +43,7 @@
}
func (api EventPushApi) FindByEventTopic(topic string,childType string) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/eventPush/findByEventTopic"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/eventPush/findByEventTopic"
    client := NewClient()
    paramQuery :=make(map[string]string,0)
    paramQuery["topic"] = topic
@@ -46,7 +61,7 @@
}
func (api EventPushApi) FindAll(name string) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/eventPush/findAll"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/eventPush/findAll"
    client := NewClient()
    paramQuery :=make(map[string]string,0)
    paramQuery["name"] = name
@@ -63,7 +78,7 @@
}
func (api EventPushApi) FindAllDetails() (b bool,allRules []protomsg.EventPush){
    url := BASIC_URL + DATA_URL_PREFIX + "/eventPush/findAllDetails"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/eventPush/findAllDetails"
    client := NewClient()
    body, err := client.DoGetRequest(url, nil, nil)
    if err != nil {
@@ -84,7 +99,7 @@
}
func (api EventPushApi) GetById(id string) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/eventPush/getById"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/eventPush/getById"
    client := NewClient()
    paramQuery :=make(map[string]string,0)
    paramQuery["id"] = id
@@ -101,7 +116,7 @@
}
func (api EventPushApi) ChangeStatus(id string,enable bool) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/eventPush/changeStatus"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/eventPush/changeStatus"
    client := NewClient()
    paramBody :=make(map[string]interface{},0)
    paramBody["id"] = id
@@ -119,7 +134,7 @@
}
func (api EventPushApi) Delete(id string) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/eventPush/delete"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/eventPush/delete"
    client := NewClient()
    paramForm :=make(map[string]interface{},0)
    paramForm["id"] = id
sdkApi.go
@@ -4,15 +4,31 @@
    "basic.com/pubsub/protomsg.git"
    "encoding/json"
    "fmt"
    "strconv"
)
type SdkApi struct{
    Ip string
    Port int
}
func (api SdkApi) getBasicUrl() string {
    if api.Ip == "" {
        return BASIC_URL
    }
    if api.Ip == "" {
        api.Ip = DEFAULT_IP
    }
    if api.Port == 0 {
        api.Port = DEFAULT_PORT
    }
    return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
//保存算法,新增(算法id为空),更新(算法id不为空)
func (api SdkApi)Save(paramBody map[string]interface{}) (bool,interface{}) {
    flag := false
    url := BASIC_URL + DATA_URL_PREFIX + "/sdk/saveSdk"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/sdk/saveSdk"
    client := NewClient()
    respBody, err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody, nil, nil)
    if err != nil {
@@ -29,7 +45,7 @@
//查找所有算法
func (api SdkApi) FindAll(sdkName string)[]protomsg.Sdk{
    var sdkArr []protomsg.Sdk
    url := BASIC_URL + DATA_URL_PREFIX + "/sdk/findAllSdk"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/sdk/findAllSdk"
    client := NewClient()
    paramMap := make(map[string]string, 0)
    paramMap["sdkName"] = sdkName
@@ -87,7 +103,7 @@
//通过id获取算法信息
func (api SdkApi) GetById(id string) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/sdk/getById"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/sdk/getById"
    client := NewClient()
    paramMap := make(map[string]string)
    paramMap["id"] = id
@@ -104,7 +120,7 @@
}
func (api SdkApi) FindByTaskId(taskId string) (flag bool,sdks []protomsg.Sdk) {
    url := BASIC_URL + DATA_URL_PREFIX + "/sdk/findByTaskId"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/sdk/findByTaskId"
    client := NewClient()
    paramMap := make(map[string]string)
    paramMap["taskId"] = taskId
@@ -123,7 +139,7 @@
}
func (api SdkApi) GetSdkArgs(sdkId string, scope string) (b bool,args []protomsg.SdkArg) {
    url := BASIC_URL + DATA_URL_PREFIX + "/sdkArg/getSdkArgs"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/sdkArg/getSdkArgs"
    client := NewClient()
    paramMap := make(map[string]string)
    paramMap["sdkId"] = sdkId
soApi.go
@@ -4,13 +4,30 @@
    "basic.com/pubsub/protomsg.git"
    "encoding/json"
    "fmt"
    "strconv"
)
type SoApi struct {}
type SoApi struct {
    Ip string
    Port int
}
func (api SoApi) getBasicUrl() string {
    if api.Ip == "" {
        return BASIC_URL
    }
    if api.Ip == "" {
        api.Ip = DEFAULT_IP
    }
    if api.Port == 0 {
        api.Port = DEFAULT_PORT
    }
    return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
//获取所有sdkId与soName映射信息
func (api SoApi) FindAll() (soInfos []protomsg.SoInfo) {
    url := BASIC_URL + DATA_URL_PREFIX + "/so/findAll"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/so/findAll"
    client := NewClient()
    respBody, err := client.DoGetRequest(url, nil, nil)
@@ -28,7 +45,7 @@
}
func (api SoApi) Add(paramBody map[string]interface{}) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/so/addSo"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/so/addSo"
    client := NewClient()
    respBody, err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody, nil, nil)
    if err != nil {
sysMenuApi.go
@@ -1,13 +1,30 @@
package dbapi
import "encoding/json"
import (
    "encoding/json"
    "strconv"
)
type SysMenuApi struct {
    Ip string
    Port int
}
func (api SysMenuApi) getBasicUrl() string {
    if api.Ip == "" {
        return BASIC_URL
    }
    if api.Ip == "" {
        api.Ip = DEFAULT_IP
    }
    if api.Port == 0 {
        api.Port = DEFAULT_PORT
    }
    return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
func (api SysMenuApi) MenuTree() (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/menu/tree"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/menu/tree"
    client := NewClient()
    body, err := client.DoGetRequest(url, nil, nil)
    if err != nil {
sysRoleApi.go
@@ -1,13 +1,30 @@
package dbapi
import "encoding/json"
import (
    "encoding/json"
    "strconv"
)
type SysRoleApi struct {
    Ip string
    Port int
}
func (sra SysRoleApi) FindAll() (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/role/findAll"
func (api SysRoleApi) getBasicUrl() string {
    if api.Ip == "" {
        return BASIC_URL
    }
    if api.Ip == "" {
        api.Ip = DEFAULT_IP
    }
    if api.Port == 0 {
        api.Port = DEFAULT_PORT
    }
    return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
func (api SysRoleApi) FindAll() (bool,interface{}) {
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/role/findAll"
    client := NewClient()
    body, err := client.DoGetRequest(url, nil, nil)
    if err != nil {
syssetApi.go
@@ -4,14 +4,29 @@
    "basic.com/pubsub/protomsg.git"
    "encoding/json"
    "fmt"
    "strconv"
)
type SysSetApi struct {
    Ip string
    Port int
}
func (api SysSetApi) getBasicUrl() string {
    if api.Ip == "" {
        return BASIC_URL
    }
    if api.Ip == "" {
        api.Ip = DEFAULT_IP
    }
    if api.Port == 0 {
        api.Port = DEFAULT_PORT
    }
    return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
//获取服务器本机配置信息
func (api SysSetApi) GetServerInfo() (flag bool,sysconf protomsg.LocalConfig){
    url := BASIC_URL + DATA_URL_PREFIX + "/sysset/getServerInfo"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/getServerInfo"
    client := NewClient()
    body, err := client.DoGetRequest(url, nil, nil)
@@ -38,7 +53,7 @@
}
//保存轮询配置
func (api SysSetApi) SavePollPeriod(period int) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/pollConfig/savePollPeriod"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/pollConfig/savePollPeriod"
    client := NewClient()
    paramBody := make(map[string]interface{},0)
    paramBody["period"] = period
@@ -57,7 +72,7 @@
}
func (api SysSetApi) SavePollDelay(delay int) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/pollConfig/savePollDelay"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/pollConfig/savePollDelay"
    client := NewClient()
    paramBody := make(map[string]interface{},0)
    paramBody["delay"] = delay
@@ -77,7 +92,7 @@
//获取轮询配置
func (api SysSetApi) GetPollConfig() (flag bool,config protomsg.PollConfig) {
    url := BASIC_URL + DATA_URL_PREFIX + "/pollConfig/getPollConfig"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/pollConfig/getPollConfig"
    client := NewClient()
    body, err := client.DoGetRequest(url, nil, nil)
@@ -105,7 +120,7 @@
//切换轮询是否开启和关闭
func (api SysSetApi) UpdatePollEnable(enable bool) bool{
    url := BASIC_URL + DATA_URL_PREFIX + "/pollConfig/updateEnable"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/pollConfig/updateEnable"
    client := NewClient()
    paramBody :=make(map[string]interface{},0)
    paramBody["enable"] = enable
@@ -123,7 +138,7 @@
}
func (api SysSetApi) AlarmEdit(paramBody map[string]interface{}) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/sysset/alarmEdit"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/alarmEdit"
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
    if err != nil {
@@ -139,7 +154,7 @@
}
func (api SysSetApi) VideoLenShow() (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/sysset/videoLenShow"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/videoLenShow"
    client := NewClient()
    body, err := client.DoGetRequest(url, nil, nil)
@@ -155,7 +170,7 @@
}
func (api SysSetApi) VideoLenEdit(maxVideoLen string,minVideoLen string) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/sysset/videoLenEdit"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/videoLenEdit"
    client := NewClient()
    paramBody :=make(map[string]interface{},0)
    paramBody["max_video_len"] = maxVideoLen
@@ -174,7 +189,7 @@
}
func (api SysSetApi) SaveServerInfo(paramBody map[string]interface{}) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/sysset/saveServerInfo"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/saveServerInfo"
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_FORM, paramBody,nil,nil)
    if err != nil {
@@ -190,7 +205,7 @@
}
func (api SysSetApi) Gb28181ConfigShow() (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/sysset/gb28181ConfigShow"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/gb28181ConfigShow"
    client := NewClient()
    body, err := client.DoGetRequest(url, nil, nil)
@@ -206,7 +221,7 @@
}
func (api SysSetApi) Gb28181ConfigEdit(paramBody map[string]interface{}) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/sysset/gb28181ConfigEdit"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/sysset/gb28181ConfigEdit"
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
    if err != nil {
taskApi.go
@@ -4,13 +4,30 @@
    "basic.com/pubsub/protomsg.git"
    "encoding/json"
    "fmt"
    "strconv"
)
type TaskApi struct {}
type TaskApi struct {
    Ip string
    Port int
}
func (api TaskApi) getBasicUrl() string {
    if api.Ip == "" {
        return BASIC_URL
    }
    if api.Ip == "" {
        api.Ip = DEFAULT_IP
    }
    if api.Port == 0 {
        api.Port = DEFAULT_PORT
    }
    return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
//获取所有任务信息(包含算法定义)
func (api TaskApi) FindAll() (taskInfos []protomsg.TaskSdkInfo) {
    url := BASIC_URL + DATA_URL_PREFIX + "/task/findAll"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/task/findAll"
    client := NewClient()
    respBody, err := client.DoGetRequest(url, nil, nil)
@@ -55,7 +72,7 @@
}
func (api TaskApi) Add(paramBody map[string]interface{}) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/task/addTask"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/task/addTask"
    client := NewClient()
    respBody, err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody, nil, nil)
    if err != nil {
@@ -70,7 +87,7 @@
}
func (api TaskApi) Delete(taskId string) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/task/delete"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/task/delete"
    client := NewClient()
    paramQuery :=make(map[string]string,0)
    paramQuery["taskId"] = taskId
@@ -86,7 +103,7 @@
}
func (api TaskApi) AddTaskSdk(paramBody map[string]interface{}) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/task/addTaskSdk"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/task/addTaskSdk"
    client := NewClient()
    respBody, err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody, nil,nil)
    if err != nil {
@@ -100,7 +117,7 @@
}
func (api TaskApi) UpdateTaskName(taskId string, taskName string) bool {
    url := BASIC_URL + DATA_URL_PREFIX + "/task/updateTaskName"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/task/updateTaskName"
    client := NewClient()
    paramBody := make(map[string]interface{},0)
    paramBody["taskId"] = taskId
@@ -117,7 +134,7 @@
}
func (api TaskApi) UpdateTaskStatus(paramBody map[string]interface{}) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/task/updateTaskStatus"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/task/updateTaskStatus"
    client := NewClient()
    respBody, err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody, nil, nil)
    if err != nil {
@@ -131,7 +148,7 @@
}
func (api TaskApi) DeleteTaskSdk(taskId string,sdkId string) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/task/delTaskSdk"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/task/delTaskSdk"
    client := NewClient()
    paramQuery :=make(map[string]string,0)
    paramQuery["taskId"] = taskId
taskSdkRuleApi.go
@@ -4,14 +4,29 @@
    "basic.com/pubsub/protomsg.git"
    "encoding/json"
    "fmt"
    "strconv"
)
type TaskSdkRuleApi struct {
    Ip string
    Port int
}
func (api TaskSdkRuleApi) getBasicUrl() string {
    if api.Ip == "" {
        return BASIC_URL
    }
    if api.Ip == "" {
        api.Ip = DEFAULT_IP
    }
    if api.Port == 0 {
        api.Port = DEFAULT_PORT
    }
    return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
func (api TaskSdkRuleApi) FindAllTaskSdkRules() (b bool,rules []protomsg.TaskSdkRule){
    url := BASIC_URL + DATA_URL_PREFIX + "/task/findAllTaskSdkRules"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/task/findAllTaskSdkRules"
    client := NewClient()
    body, err := client.DoGetRequest(url, nil, nil)
    if err != nil {
@@ -32,7 +47,7 @@
}
func (api TaskSdkRuleApi) GetRulesByTaskSdk(taskId string,sdkId string) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/task/getRulesByTaskSdk"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/task/getRulesByTaskSdk"
    client := NewClient()
    paramQ := make(map[string]string,0)
    paramQ["taskId"] = taskId
@@ -51,7 +66,7 @@
}
func (api TaskSdkRuleApi) DeleteTaskSdkRule(taskId string,sdkId string) bool{
    url := BASIC_URL + DATA_URL_PREFIX + "/task/deleteTaskSdkRule"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/task/deleteTaskSdkRule"
    client := NewClient()
    paramBody := map[string]interface{}{
        "taskId": taskId,
@@ -72,7 +87,7 @@
}
func (api TaskSdkRuleApi) SaveTaskSdkRule(paramBody map[string]interface{}) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/task/saveTaskSdkRule"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/task/saveTaskSdkRule"
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
    if err != nil {
userApi.go
@@ -1,13 +1,30 @@
package dbapi
import "encoding/json"
import (
    "encoding/json"
    "strconv"
)
type UserApi struct {
    Ip string
    Port int
}
func (api UserApi) getBasicUrl() string {
    if api.Ip == "" {
        return BASIC_URL
    }
    if api.Ip == "" {
        api.Ip = DEFAULT_IP
    }
    if api.Port == 0 {
        api.Port = DEFAULT_PORT
    }
    return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
func (api UserApi) Login(username string,password string) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/user/login"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/user/login"
    client := NewClient()
    paramBody :=make(map[string]interface{},0)
    paramBody["username"]=username
@@ -24,7 +41,7 @@
}
func (api UserApi) FindAllUser() (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/user/findAllUser"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/user/findAllUser"
    client := NewClient()
    body, err := client.DoGetRequest(url, nil, nil)
    if err != nil {
@@ -39,7 +56,7 @@
}
func (api UserApi) Edit(paramBody map[string]interface{}) (bool,interface{}) {
    url := BASIC_URL + DATA_URL_PREFIX + "/user/edit"
    url := api.getBasicUrl() + DATA_URL_PREFIX + "/user/edit"
    client := NewClient()
    respBody, err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody,nil, nil)
    if err != nil {