Refine the base bean.
This commit is contained in:
@ -11,7 +11,7 @@ import (
|
||||
|
||||
//@Service
|
||||
type AlienService struct {
|
||||
Bean
|
||||
BaseBean
|
||||
matterDao *MatterDao
|
||||
matterService *MatterService
|
||||
userDao *UserDao
|
||||
@ -23,7 +23,7 @@ type AlienService struct {
|
||||
|
||||
//初始化方法
|
||||
func (this *AlienService) Init() {
|
||||
this.Bean.Init()
|
||||
this.BaseBean.Init()
|
||||
|
||||
//手动装填本实例的Bean. 这里必须要用中间变量方可。
|
||||
b := core.CONTEXT.GetBean(this.matterDao)
|
||||
|
@ -7,30 +7,30 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Bean struct {
|
||||
type BaseBean struct {
|
||||
logger core.Logger
|
||||
}
|
||||
|
||||
func (this *Bean) Init() {
|
||||
func (this *BaseBean) Init() {
|
||||
this.logger = core.LOGGER
|
||||
}
|
||||
|
||||
func (this *Bean) Bootstrap() {
|
||||
func (this *BaseBean) Bootstrap() {
|
||||
|
||||
}
|
||||
|
||||
//系统大清理,一般时产品即将上线时,清除脏数据,只执行一次。
|
||||
func (this *Bean) Cleanup() {
|
||||
func (this *BaseBean) Cleanup() {
|
||||
|
||||
}
|
||||
|
||||
//处理错误的统一方法 可以省去if err!=nil 这段代码
|
||||
func (this *Bean) PanicError(err error) {
|
||||
func (this *BaseBean) PanicError(err error) {
|
||||
util.PanicError(err)
|
||||
}
|
||||
|
||||
//能找到一个user就找到一个
|
||||
func (this *Bean) findUser(writer http.ResponseWriter, request *http.Request) *User {
|
||||
func (this *BaseBean) findUser(writer http.ResponseWriter, request *http.Request) *User {
|
||||
|
||||
//验证用户是否已经登录。
|
||||
//登录身份有效期以数据库中记录的为准
|
||||
@ -62,7 +62,7 @@ func (this *Bean) findUser(writer http.ResponseWriter, request *http.Request) *U
|
||||
}
|
||||
|
||||
//获取当前登录的用户,找不到就返回登录错误
|
||||
func (this *Bean) checkUser(writer http.ResponseWriter, request *http.Request) *User {
|
||||
func (this *BaseBean) checkUser(writer http.ResponseWriter, request *http.Request) *User {
|
||||
if this.findUser(writer, request) == nil {
|
||||
panic(result.ConstWebResult(result.CODE_WRAPPER_LOGIN))
|
||||
} else {
|
@ -10,14 +10,14 @@ import (
|
||||
)
|
||||
|
||||
type BaseController struct {
|
||||
Bean
|
||||
BaseBean
|
||||
userDao *UserDao
|
||||
sessionDao *SessionDao
|
||||
}
|
||||
|
||||
func (this *BaseController) Init() {
|
||||
|
||||
this.Bean.Init()
|
||||
this.BaseBean.Init()
|
||||
|
||||
//手动装填本实例的Bean.
|
||||
b := core.CONTEXT.GetBean(this.userDao)
|
||||
|
@ -3,7 +3,7 @@ package rest
|
||||
import "github.com/eyebluecn/tank/code/tool/builder"
|
||||
|
||||
type BaseDao struct {
|
||||
Bean
|
||||
BaseBean
|
||||
}
|
||||
|
||||
//根据一个sortMap,获取到order字符串
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
//@Service
|
||||
type DashboardService struct {
|
||||
Bean
|
||||
BaseBean
|
||||
dashboardDao *DashboardDao
|
||||
footprintDao *FootprintDao
|
||||
matterDao *MatterDao
|
||||
@ -19,7 +19,7 @@ type DashboardService struct {
|
||||
|
||||
//初始化方法
|
||||
func (this *DashboardService) Init() {
|
||||
this.Bean.Init()
|
||||
this.BaseBean.Init()
|
||||
|
||||
//手动装填本实例的Bean. 这里必须要用中间变量方可。
|
||||
b := core.CONTEXT.GetBean(this.dashboardDao)
|
||||
|
@ -23,14 +23,14 @@ import (
|
||||
*/
|
||||
//@Service
|
||||
type DavService struct {
|
||||
Bean
|
||||
BaseBean
|
||||
matterDao *MatterDao
|
||||
matterService *MatterService
|
||||
}
|
||||
|
||||
//初始化方法
|
||||
func (this *DavService) Init() {
|
||||
this.Bean.Init()
|
||||
this.BaseBean.Init()
|
||||
|
||||
//手动装填本实例的Bean. 这里必须要用中间变量方可。
|
||||
b := core.CONTEXT.GetBean(this.matterDao)
|
||||
|
@ -12,14 +12,14 @@ import (
|
||||
|
||||
//@Service
|
||||
type FootprintService struct {
|
||||
Bean
|
||||
BaseBean
|
||||
footprintDao *FootprintDao
|
||||
userDao *UserDao
|
||||
}
|
||||
|
||||
//初始化方法
|
||||
func (this *FootprintService) Init() {
|
||||
this.Bean.Init()
|
||||
this.BaseBean.Init()
|
||||
|
||||
//手动装填本实例的Bean. 这里必须要用中间变量方可。
|
||||
b := core.CONTEXT.GetBean(this.footprintDao)
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
|
||||
//@Service
|
||||
type ImageCacheService struct {
|
||||
Bean
|
||||
BaseBean
|
||||
imageCacheDao *ImageCacheDao
|
||||
userDao *UserDao
|
||||
matterDao *MatterDao
|
||||
@ -23,7 +23,7 @@ type ImageCacheService struct {
|
||||
|
||||
//初始化方法
|
||||
func (this *ImageCacheService) Init() {
|
||||
this.Bean.Init()
|
||||
this.BaseBean.Init()
|
||||
|
||||
//手动装填本实例的Bean. 这里必须要用中间变量方可。
|
||||
b := core.CONTEXT.GetBean(this.imageCacheDao)
|
||||
|
@ -18,7 +18,7 @@ import (
|
||||
*/
|
||||
//@Service
|
||||
type MatterService struct {
|
||||
Bean
|
||||
BaseBean
|
||||
matterDao *MatterDao
|
||||
userDao *UserDao
|
||||
userService *UserService
|
||||
@ -28,7 +28,7 @@ type MatterService struct {
|
||||
|
||||
//初始化方法
|
||||
func (this *MatterService) Init() {
|
||||
this.Bean.Init()
|
||||
this.BaseBean.Init()
|
||||
|
||||
//手动装填本实例的Bean. 这里必须要用中间变量方可。
|
||||
b := core.CONTEXT.GetBean(this.matterDao)
|
||||
|
@ -4,14 +4,14 @@ import "github.com/eyebluecn/tank/code/core"
|
||||
|
||||
//@Service
|
||||
type PreferenceService struct {
|
||||
Bean
|
||||
BaseBean
|
||||
preferenceDao *PreferenceDao
|
||||
preference *Preference
|
||||
}
|
||||
|
||||
//初始化方法
|
||||
func (this *PreferenceService) Init() {
|
||||
this.Bean.Init()
|
||||
this.BaseBean.Init()
|
||||
|
||||
//手动装填本实例的Bean. 这里必须要用中间变量方可。
|
||||
b := core.CONTEXT.GetBean(this.preferenceDao)
|
||||
|
@ -4,14 +4,14 @@ import "github.com/eyebluecn/tank/code/core"
|
||||
|
||||
//@Service
|
||||
type SessionService struct {
|
||||
Bean
|
||||
BaseBean
|
||||
userDao *UserDao
|
||||
sessionDao *SessionDao
|
||||
}
|
||||
|
||||
//初始化方法
|
||||
func (this *SessionService) Init() {
|
||||
this.Bean.Init()
|
||||
this.BaseBean.Init()
|
||||
|
||||
//手动装填本实例的Bean. 这里必须要用中间变量方可。
|
||||
b := core.CONTEXT.GetBean(this.userDao)
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
|
||||
//@Service
|
||||
type UserService struct {
|
||||
Bean
|
||||
BaseBean
|
||||
userDao *UserDao
|
||||
sessionDao *SessionDao
|
||||
|
||||
@ -20,7 +20,7 @@ type UserService struct {
|
||||
|
||||
//初始化方法
|
||||
func (this *UserService) Init() {
|
||||
this.Bean.Init()
|
||||
this.BaseBean.Init()
|
||||
|
||||
//手动装填本实例的Bean. 这里必须要用中间变量方可。
|
||||
b := core.CONTEXT.GetBean(this.userDao)
|
||||
|
Reference in New Issue
Block a user