From 80b0c688ce12214b39792fd235f2a10b7db59429 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期二, 29 十月 2019 15:31:19 +0800
Subject: [PATCH] add JoinDbTable
---
taskSdkRuleApi.go | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/taskSdkRuleApi.go b/taskSdkRuleApi.go
index e8718c2..9b31170 100644
--- a/taskSdkRuleApi.go
+++ b/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 {
--
Gitblit v1.8.0