Finish the dashboard summary things.

This commit is contained in:
zicla
2018-12-01 21:45:58 +08:00
parent 439d23df2d
commit 2d1a95594f
12 changed files with 229 additions and 61 deletions

View File

@ -46,17 +46,17 @@ func (this *Context) Init() {
this.Router = NewRouter()
}
func (this *Context) OpenDb() {
var err error = nil
this.DB, err = gorm.Open("mysql", CONFIG.MysqlUrl)
//是否打开sql日志
this.DB.LogMode(false)
if err != nil {
panic("failed to connect mysql database")
LOGGER.Panic("failed to connect mysql database")
}
//是否打开sql日志(在调试阶段可以打开以方便查看执行的SQL)
this.DB.LogMode(false)
}
func (this *Context) CloseDb() {
@ -91,8 +91,7 @@ func (this *Context) registerBean(bean IBean) {
}
} else {
err := fmt.Sprintf("注册的【%s】不是Bean类型。", typeName)
panic(err)
LOGGER.Panic("注册的【%s】不是Bean类型。", typeName)
}
}
@ -154,8 +153,8 @@ func (this *Context) GetBean(bean IBean) IBean {
if val, ok := this.BeanMap[typeName]; ok {
return val
} else {
err := fmt.Sprintf("【%s】没有注册。", typeName)
panic(err)
LOGGER.Panic("【%s】没有注册。", typeName)
return nil
}
}