diff --git a/g/net/ghttp/ghttp_response_view.go b/g/net/ghttp/ghttp_response_view.go index 2a4ec4780..aeb2c55e7 100644 --- a/g/net/ghttp/ghttp_response_view.go +++ b/g/net/ghttp/ghttp_response_view.go @@ -43,7 +43,7 @@ func (r *Response) WriteTplContent(content string, params map[string]interface{} } // 解析模板文件,并返回模板内容 -func (r *Response) ParseTpl(tpl string, params map[string]interface{}, funcmap...map[string]interface{}) ([]byte, error) { +func (r *Response) ParseTpl(tpl string, params gview.Params, funcmap...map[string]interface{}) ([]byte, error) { fmap := make(gview.FuncMap) if len(funcmap) > 0 { fmap = funcmap[0] @@ -52,7 +52,7 @@ func (r *Response) ParseTpl(tpl string, params map[string]interface{}, funcmap.. } // 解析并返回模板内容 -func (r *Response) ParseTplContent(content string, params map[string]interface{}, funcmap...map[string]interface{}) ([]byte, error) { +func (r *Response) ParseTplContent(content string, params gview.Params, funcmap...map[string]interface{}) ([]byte, error) { fmap := make(gview.FuncMap) if len(funcmap) > 0 { fmap = funcmap[0] diff --git a/g/os/gview/gview.go b/g/os/gview/gview.go index 962026dab..e410694b0 100644 --- a/g/os/gview/gview.go +++ b/g/os/gview/gview.go @@ -112,7 +112,7 @@ func (view *View) Assign(key string, value interface{}) { } // 解析模板,返回解析后的内容 -func (view *View) Parse(file string, params map[string]interface{}, funcmap...map[string]interface{}) ([]byte, error) { +func (view *View) Parse(file string, params Params, funcmap...map[string]interface{}) ([]byte, error) { path := view.paths.Search(file) if path == "" { return nil, errors.New("tpl \"" + file + "\" not found") @@ -155,7 +155,7 @@ func (view *View) Parse(file string, params map[string]interface{}, funcmap...ma } // 直接解析模板内容,返回解析后的内容 -func (view *View) ParseContent(content string, params map[string]interface{}, funcmap...map[string]interface{}) ([]byte, error) { +func (view *View) ParseContent(content string, params Params, funcmap...map[string]interface{}) ([]byte, error) { view.mu.RLock() defer view.mu.RUnlock() name := gconv.String(ghash.BKDRHash64([]byte(content)))