From 03153c1f1f305979c9c424a582dce3490689dc39 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期一, 16 十二月 2019 11:00:28 +0800
Subject: [PATCH] add pasteRules
---
sysMenuApi.go | 30 +++++++++++++++++++++++++-----
1 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/sysMenuApi.go b/sysMenuApi.go
index 8ede4bf..a5a7fb6 100644
--- a/sysMenuApi.go
+++ b/sysMenuApi.go
@@ -1,15 +1,35 @@
package dbapi
-import "encoding/json"
+import (
+ "encoding/json"
+ "strconv"
+)
type SysMenuApi struct {
-
+ Ip string
+ Port int
}
-func (api SysMenuApi) MenuTree() (bool,interface{}) {
- url := BASIC_URL + DATA_URL_PREFIX + "/menu/tree"
+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(userId string) (bool,interface{}) {
+ url := api.getBasicUrl() + DATA_URL_PREFIX + "/menu/tree"
client := NewClient()
- body, err := client.DoGetRequest(url, nil, nil)
+ query := map[string]string{
+ "userId": userId,
+ }
+ body, err := client.DoGetRequest(url, query, nil)
if err != nil {
return false,nil
}
--
Gitblit v1.8.0