From 0213e81df2bcddb9ba59ba9a3d745992b2e4159e Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期三, 04 十二月 2019 13:42:47 +0800
Subject: [PATCH] add UpdateChannelCount

---
 sysRoleApi.go |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/sysRoleApi.go b/sysRoleApi.go
index a20ca13..a608450 100644
--- a/sysRoleApi.go
+++ b/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 {

--
Gitblit v1.8.0