From a2a93e906ffbef9289873cb69613b3c00b7853ea Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期四, 16 一月 2020 10:24:26 +0800
Subject: [PATCH] add UpdateIsRunningAll,use in pollcontrol

---
 dicApi.go |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/dicApi.go b/dicApi.go
index 0a2e455..bd0edda 100644
--- a/dicApi.go
+++ b/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

--
Gitblit v1.8.0