Commit 466fa48a authored by Eric's avatar Eric

add authclient for needauth request

parent a9e4d5f4
...@@ -51,37 +51,35 @@ func (c *WrapperClient) Get(url string, res interface{}, needAuth bool) error { ...@@ -51,37 +51,35 @@ func (c *WrapperClient) Get(url string, res interface{}, needAuth bool) error {
} }
func (c *WrapperClient) Post(url string, data interface{}, res interface{}, needAuth bool) error { func (c *WrapperClient) Post(url string, data interface{}, res interface{}, needAuth bool) error {
//if needAuth { if needAuth {
// c.Http.SetAuth(c.Auth.Sign()) return c.AuthClient.Post(url, data, res)
//} else { } else {
// c.Http.SetAuth("") return c.Http.Post(url, data, res)
//} }
return c.Http.Post(url, data, res)
} }
func (c *WrapperClient) Delete(url string, res interface{}, needAuth bool) error { func (c *WrapperClient) Delete(url string, res interface{}, needAuth bool) error {
//if needAuth { if needAuth {
// c.Http.SetAuth(c.Auth.Sign()) return c.AuthClient.Delete(url, res)
//} else { } else {
// c.Http.SetAuth("") return c.Http.Delete(url, res)
//} }
return c.Http.Delete(url, res)
} }
func (c *WrapperClient) Put(url string, data interface{}, res interface{}, needAuth bool) error { func (c *WrapperClient) Put(url string, data interface{}, res interface{}, needAuth bool) error {
//if needAuth { if needAuth {
// c.Http.SetAuth(c.Auth.Sign()) return c.AuthClient.Put(url, data, res)
//} else { } else {
// c.Http.SetAuth("") return c.Http.Put(url, data, res)
//} }
return c.Http.Put(url, data, res)
} }
func (c *WrapperClient) Patch(url string, data interface{}, res interface{}, needAuth bool) error { func (c *WrapperClient) Patch(url string, data interface{}, res interface{}, needAuth bool) error {
//if needAuth { if needAuth {
// c.Http.SetAuth(c.Auth.Sign()) return c.AuthClient.Patch(url, data, res)
//} else { } else {
// c.Http.SetAuth("") return c.Http.Patch(url, data, res)
//} }
return c.Http.Patch(url, data, res)
} }
...@@ -13,7 +13,7 @@ func GetSystemUserAssetAuthInfo(systemUserID, assetID string) (info sdk.SystemUs ...@@ -13,7 +13,7 @@ func GetSystemUserAssetAuthInfo(systemUserID, assetID string) (info sdk.SystemUs
func GetSystemUserAuthInfo(systemUserID string) (info sdk.SystemUserAuthInfo) { func GetSystemUserAuthInfo(systemUserID string) (info sdk.SystemUserAuthInfo) {
Url := fmt.Sprintf(sdk.SystemUserAuthInfoURL, systemUserID) Url := fmt.Sprintf(sdk.SystemUserAuthInfoURL, systemUserID)
err := Client.Get(Url, &info, true) err := client.Get(Url, &info, true)
if err != nil { if err != nil {
logger.Error("Get system user auth info failed") logger.Error("Get system user auth info failed")
} }
......
package service
import "cocogo/pkg/sdk"
var client = sdk.WrapperClient{}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment