This commit is contained in:
aozhiwei 2024-04-13 11:54:59 +08:00
parent 9a78606124
commit c750ccb698
3 changed files with 41 additions and 13 deletions

View File

@ -1,5 +1,9 @@
package common
import (
"github.com/gin-gonic/gin"
)
type App interface {
Run(func(), func())
}
@ -7,17 +11,18 @@ type App interface {
type Player interface {
Lock()
UnLock()
GetAccountId() string
GetRegisterTime() int32
CaGetMailList(*gin.Context)
CaMarkMail(*gin.Context)
CaGetUnreadMailCnt(*gin.Context)
CaGetAttachment(*gin.Context)
CaDeleteMails(*gin.Context)
}
type PlayerMgr interface{
GetPlayerByAccountId() Player
}
type MailMgr interface{
}
type ControllerMgr interface{
}

View File

@ -11,13 +11,11 @@ var modules [constant.MAX_MODULE_IDX]q5.Module
var initOrders = []int32{
constant.PLAYER_MGR_MODULE_IDX,
constant.MAIL_MGR_MODULE_IDX,
constant.CONTROLLER_MGR_MODULE_IDX,
}
var app common.App
var playerMgr common.PlayerMgr
var mailMgr common.MailMgr
var controllerMgr common.ControllerMgr
func GetApp() common.App {
return app
@ -47,10 +45,6 @@ func RegModule(idx int32, m q5.Module) {
{
mailMgr = m.(common.MailMgr)
}
case constant.CONTROLLER_MGR_MODULE_IDX:
{
controllerMgr = m.(common.ControllerMgr)
}
default:
{
panic("unknow module")

View File

@ -4,6 +4,7 @@ import (
"f5"
"sync"
"time"
"github.com/gin-gonic/gin"
)
type ReadMail struct {
@ -19,7 +20,7 @@ type DeletedMail struct {
}
type player struct {
sync.Mutex
lock sync.Mutex
AccountId string
SessionId string
RegisterTime int32
@ -31,3 +32,31 @@ type player struct {
attacher *f5.TimerAttacher
dirty bool // 标记数据已修改
}
func (this *player) Lock() {
this.lock.Lock()
}
func (this *player) UnLock() {
this.lock.Unlock()
}
func (this *player) CaGetMailList(*gin.Context) {
}
func (this *player) CaMarkMail(*gin.Context) {
}
func (this *player) CaGetUnreadMailCnt(*gin.Context) {
}
func (this *player) CaGetAttachment(*gin.Context) {
}
func (this *player) CaDeleteMails(*gin.Context) {
}