From be43c562727ad6c4c1f68de65174067b34f135c1 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期四, 24 十月 2019 15:27:48 +0800
Subject: [PATCH] fix url
---
sysMenuApi.go | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/sysMenuApi.go b/sysMenuApi.go
index 8ede4bf..7c10ad1 100644
--- a/sysMenuApi.go
+++ b/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 {
--
Gitblit v1.8.0