Refine the context and Try to fix the nil issue.

This commit is contained in:
zicla
2019-04-28 00:36:21 +08:00
parent fa28bbb83f
commit 3ffc4090e0
34 changed files with 246 additions and 167 deletions

View File

@ -1,5 +1,7 @@
package rest
import "github.com/eyebluecn/tank/code/core"
//@Service
type SessionService struct {
Bean
@ -12,12 +14,12 @@ func (this *SessionService) Init() {
this.Bean.Init()
//手动装填本实例的Bean. 这里必须要用中间变量方可。
b := CONTEXT.GetBean(this.userDao)
b := core.CONTEXT.GetBean(this.userDao)
if b, ok := b.(*UserDao); ok {
this.userDao = b
}
b = CONTEXT.GetBean(this.sessionDao)
b = core.CONTEXT.GetBean(this.sessionDao)
if b, ok := b.(*SessionDao); ok {
this.sessionDao = b
}
@ -27,7 +29,7 @@ func (this *SessionService) Init() {
//执行清理操作
func (this *SessionService) Cleanup() {
this.logger.Info("[SessionService]执行清理清除缓存中所有Session记录共%d条。", CONTEXT.SessionCache.Count())
this.logger.Info("[SessionService]执行清理清除缓存中所有Session记录共%d条。", core.CONTEXT.GetSessionCache().Count())
CONTEXT.SessionCache.Truncate()
core.CONTEXT.GetSessionCache().Truncate()
}