mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 17:00:55 +00:00
parent
e79d756d06
commit
a62ed10ab3
@ -32,6 +32,7 @@ type Controller struct {
|
|||||||
gotofunc string
|
gotofunc string
|
||||||
CruSession session.SessionStore
|
CruSession session.SessionStore
|
||||||
XSRFExpire int
|
XSRFExpire int
|
||||||
|
AppController interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
type ControllerInterface interface {
|
type ControllerInterface interface {
|
||||||
@ -48,13 +49,14 @@ type ControllerInterface interface {
|
|||||||
Render() error
|
Render() error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) Init(ctx *context.Context, childName string) {
|
func (c *Controller) Init(ctx *context.Context, childName string, app interface{}) {
|
||||||
c.Data = make(map[interface{}]interface{})
|
c.Data = make(map[interface{}]interface{})
|
||||||
c.Layout = ""
|
c.Layout = ""
|
||||||
c.TplNames = ""
|
c.TplNames = ""
|
||||||
c.ChildName = childName
|
c.ChildName = childName
|
||||||
c.Ctx = ctx
|
c.Ctx = ctx
|
||||||
c.TplExt = "tpl"
|
c.TplExt = "tpl"
|
||||||
|
c.AppController = app
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) Prepare() {
|
func (c *Controller) Prepare() {
|
||||||
|
@ -448,6 +448,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
|
|||||||
in := make([]reflect.Value, 2)
|
in := make([]reflect.Value, 2)
|
||||||
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())
|
||||||
method.Call(in)
|
method.Call(in)
|
||||||
|
|
||||||
//if XSRF is Enable then check cookie where there has any cookie in the request's cookie _csrf
|
//if XSRF is Enable then check cookie where there has any cookie in the request's cookie _csrf
|
||||||
|
Loading…
Reference in New Issue
Block a user