func (h *http) Get(r *ghttp.Request, url string, data interface{}) (resp *define.RespService, err error) {
var dataMap = make(map[string]string)
if data != nil {
dataMap = gconv.MapStrStr(data)
}
var queryString string
if len(dataMap) > 1 {
for key, value := range dataMap {
tmpQueryString := key + "=" + value + "&"
queryString = queryString + tmpQueryString
}
}
var qs string
if len(queryString) > 0 {
qs = queryString[:len(queryString)-1]
}
g.Log().Info(reflect.TypeOf(resp))
url = url + "?" + qs
res, err := g.Client().Get(url)
if err != nil {
return nil, err
}
defer res.Close()
content := res.ReadAll()
g.Log().Info("post请求链接地址url:", url)
g.Log().Info("post请求参数:", data)
g.Log().Info("post请求返回内容:", content)
result := gconv.Map(content)
fmt.Printf("%T\n",resp)
if err := gconv.Struct(content, &resp); err != nil {
g.Log().Info(11,err)
}
g.Log().Info(1111,resp)
if err := gconv.Struct(result, &resp); err != nil {
g.Log().Info(222,err)
}
g.Log().Info(2222,resp)
return resp, err
}