fix router
Showing
2 changed files
with
4 additions
and
3 deletions
| ... | @@ -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) | ... | ... |
-
Please register or sign in to post a comment