aaf1490f by astaxie

fix router

1 parent a62ed10a
...@@ -36,7 +36,7 @@ type Controller struct { ...@@ -36,7 +36,7 @@ type Controller struct {
36 } 36 }
37 37
38 type ControllerInterface interface { 38 type ControllerInterface interface {
39 Init(ct *context.Context, childName string) 39 Init(ct *context.Context, childName string, app interface{})
40 Prepare() 40 Prepare()
41 Get() 41 Get()
42 Post() 42 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)
445 445
446 //call the controller init function 446 //call the controller init function
447 method := vc.MethodByName("Init") 447 method := vc.MethodByName("Init")
448 in := make([]reflect.Value, 2) 448 in := make([]reflect.Value, 3)
449 in[0] = reflect.ValueOf(context) 449 in[0] = reflect.ValueOf(context)
450 in[1] = reflect.ValueOf(runrouter.controllerType.Name()) 450 in[1] = reflect.ValueOf(runrouter.controllerType.Name())
451 in[2] = reflect.ValueOf(vc.Interface()) 451 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)
653 653
654 //call the controller init function 654 //call the controller init function
655 init := vc.MethodByName("Init") 655 init := vc.MethodByName("Init")
656 in := make([]reflect.Value, 2) 656 in := make([]reflect.Value, 3)
657 in[0] = reflect.ValueOf(context) 657 in[0] = reflect.ValueOf(context)
658 in[1] = reflect.ValueOf(controllerType.Name()) 658 in[1] = reflect.ValueOf(controllerType.Name())
659 in[2] = reflect.ValueOf(vc.Interface())
659 init.Call(in) 660 init.Call(in)
660 //call prepare function 661 //call prepare function
661 in = make([]reflect.Value, 0) 662 in = make([]reflect.Value, 0)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!