package app import ( "f5" "mt" "main/constant" "github.com/gin-gonic/gin" ) type app struct { ginEngine *gin.Engine initCb func() unInitCb func() } func (this *app) GetPkgName() string { return "adminserver" } func (this *app) Run(initCb func(), unInitCb func()) { this.initCb = initCb this.unInitCb = unInitCb f5.Run(this) } func (this *app) Init() { f5.LoadMetaTable(mt.Table) this.registerDataSources() //this.ginEngine = gin.New() //this.ginEngine.Use(gin.Recovery()) this.initCb() } func (this *app) UnInit() { this.unInitCb() } func (this *app) Update() { } func (this *app) GetGin() *gin.Engine { return this.ginEngine } func (this *app) registerDataSources() { f5.GetJsStyleDb().RegisterDataSource( constant.GAME_DB, mt.Table.GameDb.GetById(0).GetHost(), mt.Table.GameDb.GetById(0).GetPort(), mt.Table.GameDb.GetById(0).GetUser(), mt.Table.GameDb.GetById(0).GetPasswd(), mt.Table.GameDb.GetById(0).GetDatabase(), 30) f5.GetJsStyleDb().RegisterDataSource( constant.FRIEND_DB, mt.Table.FriendDb.GetById(0).GetHost(), mt.Table.FriendDb.GetById(0).GetPort(), mt.Table.FriendDb.GetById(0).GetUser(), mt.Table.FriendDb.GetById(0).GetPasswd(), mt.Table.FriendDb.GetById(0).GetDatabase(), 30) }