From 8a2e3a00bcc48a6468d271aa6142cdb146424970 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期二, 30 十一月 2021 20:31:01 +0800 Subject: [PATCH] fix GetUserProfile --- userApi.go | 26 ++++++++++++++++++++++---- 1 files changed, 22 insertions(+), 4 deletions(-) diff --git a/userApi.go b/userApi.go index f97f2a5..40b8d96 100644 --- a/userApi.go +++ b/userApi.go @@ -27,7 +27,7 @@ } func (api UserApi) FindAllUser(curUserId string) (bool,interface{}) { - url := DATA_URL_PREFIX + "/user/findAllUser" + url := "/data/api-u/users/findAllUser" netNode := getNetNode(url2Topic(Topic_System_Service, url)) client := NewClient(WithNodes(netNode)) query := map[string]string { @@ -46,7 +46,7 @@ } func (api UserApi) FindById(userId string) (bool,interface{}) { - url := DATA_URL_PREFIX + "/user/findById" + url := "/data/api-u/users/findById" netNode := getNetNode(url2Topic(Topic_System_Service, url)) client := NewClient(WithNodes(netNode)) paramBody := map[string]interface{}{ @@ -63,8 +63,26 @@ return res.Success,res.Data } +func (api UserApi) GetUserProfile(userId string) (bool,interface{}) { + url := "/data/api-u/users/profile" + netNode := getNetNode(url2Topic(Topic_System_Service, url)) + client := NewClient(WithNodes(netNode)) + header := map[string]string { + "Login_user_id": userId, + } + respBody, err := client.DoGetRequest(url, nil, header) + if err != nil { + return false,nil + } + var res Result + if err = json.Unmarshal(respBody, &res); err != nil { + return false,nil + } + return res.Success,res.Data +} + func (api UserApi) SaveAuth(paramBody map[string]interface{}) (bool,interface{}) { - url := DATA_URL_PREFIX + "/user/saveAuth" + url := "/data/api-u/users/saveAuth" netNode := getNetNode(url2Topic(Topic_System_Service, url)) client := NewClient(WithNodes(netNode)) respBody, err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody,nil, nil) @@ -79,7 +97,7 @@ } func (api UserApi) UpdatePwd(userId string, oldPwd string, newPwd string) (bool,interface{}) { - url := DATA_URL_PREFIX + "/user/updatePwd" + url := "/data/api-u/users/updatePwd" netNode := getNetNode(url2Topic(Topic_System_Service, url)) client := NewClient(WithNodes(netNode)) paramBody := map[string]interface{}{ -- Gitblit v1.8.0