diff --git a/server/gamelog/common/types.go b/server/gamelog/common/types.go index 8759930b..d91b69ae 100644 --- a/server/gamelog/common/types.go +++ b/server/gamelog/common/types.go @@ -1,62 +1,8 @@ package common import ( - "github.com/gin-gonic/gin" ) -type AttachmentDto struct { - ItemId int32 `json:"itemid"` - ItemNum int32 `json:"itemnum"` -} - -type MailDto struct { - MailId string `json:"mailid"` - From string `json:"from"` - To string `json:"to"` - Subject string `json:"subject"` - Content string `json:"content"` - Flags int32 `json:"flags"` - SendTime int32 `json:"sendtime"` - ExpireTime int32 `json:"expiretime"` - MailType int32 `json:"mailtype"` - MailSubType int32 `json:"mailsubtype"` - Ext string `json:"ext"` - Attachments []*AttachmentDto `json:"attachments"` -} - type App interface { Run(func(), func()) } - -type Player interface { - Lock() bool - UnLock() - GetAccountId() string - GetRegisterTime() int32 - - MarkMails([]Mail) error - GetAttachment([]Mail) error - DeleteMails([]Mail) error - IsReadable(Mail) bool - IsUnread(Mail) bool -} - -type PlayerMgr interface { - GetPlayerByAccountId(string) Player - ForceCreatePlayer(string, string) Player -} - -type Mail interface { - GetMailId() int64 - IsValid(Player) bool - GetExpireTime() int32 -} - -type MailMgr interface{ - CaGetMailList(c *gin.Context) - CaMarkMail(c *gin.Context) - CaGetUnreadMailCnt(c *gin.Context) - CaGetAttachment(c *gin.Context) - CaDeleteMails(c *gin.Context) - HasTask() bool -} diff --git a/server/gamelog/constant/constant.go b/server/gamelog/constant/constant.go index 143ff9a0..d8dd29ec 100644 --- a/server/gamelog/constant/constant.go +++ b/server/gamelog/constant/constant.go @@ -2,7 +2,6 @@ package constant const ( APP_MODULE_IDX = iota - MAIL_MGR_MODULE_IDX CONTROLLER_MGR_MODULE_IDX MAX_MODULE_IDX ) diff --git a/server/gamelog/global/global.go b/server/gamelog/global/global.go index 98b5a707..6868ff2f 100644 --- a/server/gamelog/global/global.go +++ b/server/gamelog/global/global.go @@ -9,20 +9,14 @@ import ( var modules [constant.MAX_MODULE_IDX]q5.Module var initOrders = []int32{ - constant.MAIL_MGR_MODULE_IDX, } var app common.App -var mailMgr common.MailMgr func GetApp() common.App { return app } -func GetMailMgr() common.MailMgr { - return mailMgr -} - func RegModule(idx int32, m q5.Module) { fmt.Printf("RegModule module %d\n", idx) @@ -32,10 +26,6 @@ func RegModule(idx int32, m q5.Module) { { app = m.(common.App) } - case constant.MAIL_MGR_MODULE_IDX: - { - mailMgr = m.(common.MailMgr) - } default: { panic("unknow module") diff --git a/server/gamelog/model/inbox.go b/server/gamelog/model/inbox.go deleted file mode 100644 index cac29668..00000000 --- a/server/gamelog/model/inbox.go +++ /dev/null @@ -1,69 +0,0 @@ -package model - -import ( - "q5" - "f5" - "main/constant" -) - -type inbox struct { - -} - -var Inbox = new(inbox) - -func (this *inbox) Mark(accountId string, mailId int64, nowTime int64, expireTime int32) error { - var result error - f5.GetGoStyleDb().Upsert( - constant.MAIL_DB, - "t_inbox", - [][]string{ - {"account_id", accountId}, - {"mail_id", q5.ToString(mailId)}, - }, - [][]string{ - {"state", q5.ToString(constant.INBOX_STATE_READ)}, - {"expiretime", q5.ToString(expireTime)}, - {"modifytime", q5.ToString(nowTime)}, - }, - [][]string{ - {"account_id", accountId}, - {"mail_id", q5.ToString(mailId)}, - {"state", q5.ToString(constant.INBOX_STATE_READ)}, - {"expiretime", q5.ToString(expireTime)}, - {"createtime", q5.ToString(nowTime)}, - {"modifytime", q5.ToString(nowTime)}, - }, - func (err error, lastInsertId int64, rowsAffected int64) { - result = err - }) - return result -} - -func (this *inbox) Delete(accountId string, mailId int64, nowTime int64, expireTime int32) error { - var result error - f5.GetGoStyleDb().Upsert( - constant.MAIL_DB, - "t_inbox", - [][]string{ - {"account_id", accountId}, - {"mail_id", q5.ToString(mailId)}, - }, - [][]string{ - {"state", q5.ToString(constant.INBOX_STATE_DELETED)}, - {"expiretime", q5.ToString(expireTime)}, - {"modifytime", q5.ToString(nowTime)}, - }, - [][]string{ - {"account_id", accountId}, - {"mail_id", q5.ToString(mailId)}, - {"state", q5.ToString(constant.INBOX_STATE_DELETED)}, - {"expiretime", q5.ToString(expireTime)}, - {"createtime", q5.ToString(nowTime)}, - {"modifytime", q5.ToString(nowTime)}, - }, - func (err error, lastInsertId int64, rowsAffected int64) { - result = err - }) - return result -}