fix issue in ghttp.Session.GetMap*

This commit is contained in:
John 2019-09-05 23:48:54 +08:00
parent d63c2882fd
commit 8f953dabe5
2 changed files with 13 additions and 11 deletions

View File

@ -2,10 +2,12 @@ package main
import ( import (
"fmt" "fmt"
"net/url"
"github.com/gogf/gf/os/gcmd"
) )
func main() { func main() {
fmt.Println(gcmd.Scan("input:")) parse1, _ := url.Parse("https://gf.cdn.johng.cn")
parse2, _ := url.Parse("https://gf.cdn.johng.cn/cli/")
fmt.Println(parse1.Host)
fmt.Println(parse2.Host)
} }

View File

@ -301,20 +301,20 @@ func (s *Session) GetDuration(key string, def ...interface{}) time.Duration {
return gconv.Duration(s.Get(key, def...)) return gconv.Duration(s.Get(key, def...))
} }
func (s *Session) GetMap(value interface{}, tags ...string) map[string]interface{} { func (s *Session) GetMap(key string, tags ...string) map[string]interface{} {
return gconv.Map(value, tags...) return gconv.Map(s.Get(key), tags...)
} }
func (s *Session) GetMapDeep(value interface{}, tags ...string) map[string]interface{} { func (s *Session) GetMapDeep(key string, tags ...string) map[string]interface{} {
return gconv.MapDeep(value, tags...) return gconv.MapDeep(s.Get(key), tags...)
} }
func (s *Session) GetMaps(value interface{}, tags ...string) []map[string]interface{} { func (s *Session) GetMaps(key string, tags ...string) []map[string]interface{} {
return gconv.Maps(value, tags...) return gconv.Maps(s.Get(key), tags...)
} }
func (s *Session) GetMapsDeep(value interface{}, tags ...string) []map[string]interface{} { func (s *Session) GetMapsDeep(key string, tags ...string) []map[string]interface{} {
return gconv.MapsDeep(value, tags...) return gconv.MapsDeep(s.Get(key), tags...)
} }
func (s *Session) GetStruct(key string, pointer interface{}, mapping ...map[string]string) error { func (s *Session) GetStruct(key string, pointer interface{}, mapping ...map[string]string) error {