Finish all the abstract things.
This commit is contained in:
parent
e043b6b8d7
commit
8aa0d11cbb
@ -20,7 +20,7 @@ type Context interface {
|
|||||||
GetSessionCache() *cache.Table
|
GetSessionCache() *cache.Table
|
||||||
|
|
||||||
//获取全局的ControllerMap
|
//获取全局的ControllerMap
|
||||||
GetControllerMap() map[string]IController
|
GetControllerMap() map[string]Controller
|
||||||
|
|
||||||
//系统安装成功
|
//系统安装成功
|
||||||
InstallOk()
|
InstallOk()
|
||||||
|
@ -2,7 +2,7 @@ package core
|
|||||||
|
|
||||||
import "net/http"
|
import "net/http"
|
||||||
|
|
||||||
type IController interface {
|
type Controller interface {
|
||||||
Bean
|
Bean
|
||||||
//注册自己固定的路由。
|
//注册自己固定的路由。
|
||||||
RegisterRoutes() map[string]func(writer http.ResponseWriter, request *http.Request)
|
RegisterRoutes() map[string]func(writer http.ResponseWriter, request *http.Request)
|
||||||
|
@ -12,8 +12,6 @@ const (
|
|||||||
FALSE = "false"
|
FALSE = "false"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Time time.Time
|
|
||||||
|
|
||||||
type IBase interface {
|
type IBase interface {
|
||||||
//返回其对应的数据库表名
|
//返回其对应的数据库表名
|
||||||
TableName() string
|
TableName() string
|
||||||
|
@ -20,7 +20,7 @@ type TankContext struct {
|
|||||||
//各类的Bean Map。这里面是包含ControllerMap中所有元素
|
//各类的Bean Map。这里面是包含ControllerMap中所有元素
|
||||||
BeanMap map[string]core.Bean
|
BeanMap map[string]core.Bean
|
||||||
//只包含了Controller的map
|
//只包含了Controller的map
|
||||||
ControllerMap map[string]core.IController
|
ControllerMap map[string]core.Controller
|
||||||
//处理所有路由请求
|
//处理所有路由请求
|
||||||
Router *TankRouter
|
Router *TankRouter
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ func (this *TankContext) Init() {
|
|||||||
|
|
||||||
//初始化Map
|
//初始化Map
|
||||||
this.BeanMap = make(map[string]core.Bean)
|
this.BeanMap = make(map[string]core.Bean)
|
||||||
this.ControllerMap = make(map[string]core.IController)
|
this.ControllerMap = make(map[string]core.Controller)
|
||||||
|
|
||||||
//注册各类Beans.在这个方法里面顺便把Controller装入ControllerMap中去。
|
//注册各类Beans.在这个方法里面顺便把Controller装入ControllerMap中去。
|
||||||
this.registerBeans()
|
this.registerBeans()
|
||||||
@ -58,7 +58,7 @@ func (this *TankContext) GetSessionCache() *cache.Table {
|
|||||||
return this.SessionCache
|
return this.SessionCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *TankContext) GetControllerMap() map[string]core.IController {
|
func (this *TankContext) GetControllerMap() map[string]core.Controller {
|
||||||
return this.ControllerMap
|
return this.ControllerMap
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ func (this *TankContext) registerBean(bean core.Bean) {
|
|||||||
this.BeanMap[typeName] = element
|
this.BeanMap[typeName] = element
|
||||||
|
|
||||||
//看看是不是controller类型,如果是,那么单独放在ControllerMap中。
|
//看看是不是controller类型,如果是,那么单独放在ControllerMap中。
|
||||||
if controller, ok1 := bean.(core.IController); ok1 {
|
if controller, ok1 := bean.(core.Controller); ok1 {
|
||||||
this.ControllerMap[typeName] = controller
|
this.ControllerMap[typeName] = controller
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user