Commit aaf1490f authored by astaxie's avatar astaxie

fix router

parent a62ed10a
...@@ -36,7 +36,7 @@ type Controller struct { ...@@ -36,7 +36,7 @@ type Controller struct {
} }
type ControllerInterface interface { type ControllerInterface interface {
Init(ct *context.Context, childName string) Init(ct *context.Context, childName string, app interface{})
Prepare() Prepare()
Get() Get()
Post() Post()
......
...@@ -445,7 +445,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -445,7 +445,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
//call the controller init function //call the controller init function
method := vc.MethodByName("Init") method := vc.MethodByName("Init")
in := make([]reflect.Value, 2) in := make([]reflect.Value, 3)
in[0] = reflect.ValueOf(context) in[0] = reflect.ValueOf(context)
in[1] = reflect.ValueOf(runrouter.controllerType.Name()) in[1] = reflect.ValueOf(runrouter.controllerType.Name())
in[2] = reflect.ValueOf(vc.Interface()) in[2] = reflect.ValueOf(vc.Interface())
...@@ -653,9 +653,10 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -653,9 +653,10 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
//call the controller init function //call the controller init function
init := vc.MethodByName("Init") init := vc.MethodByName("Init")
in := make([]reflect.Value, 2) in := make([]reflect.Value, 3)
in[0] = reflect.ValueOf(context) in[0] = reflect.ValueOf(context)
in[1] = reflect.ValueOf(controllerType.Name()) in[1] = reflect.ValueOf(controllerType.Name())
in[2] = reflect.ValueOf(vc.Interface())
init.Call(in) init.Call(in)
//call prepare function //call prepare function
in = make([]reflect.Value, 0) in = make([]reflect.Value, 0)
......
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