From a47ddaef3711c5a34b24886a7639c96eb4e354df Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期四, 12 十二月 2019 12:01:13 +0800
Subject: [PATCH] add FindAllTaskDefaultArgs
---
soApi.go | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/soApi.go b/soApi.go
index ec35758..fc888b5 100644
--- a/soApi.go
+++ b/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)
+}
//鑾峰彇鎵�鏈塻dkId涓巗oName鏄犲皠淇℃伅
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 {
--
Gitblit v1.8.0