This commit is contained in:
aozhiwei 2024-04-27 09:44:17 +08:00
parent 32717a04d3
commit f341aee0e0
2 changed files with 21 additions and 15 deletions

View File

@ -5,7 +5,6 @@ import (
"main/constant"
"mt"
"main/middleware"
. "main/global"
)
type app struct {
@ -32,11 +31,6 @@ func (this *app) Init() {
this.registerDataSources()
this.initCb()
f5.GetApp().GetGinEngine().Use(middleware.CaForward, middleware.CaAuth)
f5.GetApp().RegisterCaHandle("Mail", "getMailList", GetMailMgr().CaGetMailList)
f5.GetApp().RegisterCaHandle("Mail", "markMail", GetMailMgr().CaMarkMail)
f5.GetApp().RegisterCaHandle("Mail", "getUnreadMailCnt", GetMailMgr().CaGetUnreadMailCnt)
f5.GetApp().RegisterCaHandle("Mail", "getAttachment", GetMailMgr().CaGetAttachment)
f5.GetApp().RegisterCaHandle("Mail", "deleteMails", GetMailMgr().CaDeleteMails)
}
func (this *app) UnInit() {
@ -54,7 +48,7 @@ func (this *app) registerDataSources() {
mt.Table.MailDb.GetById(0).GetUser(),
mt.Table.MailDb.GetById(0).GetPasswd(),
mt.Table.MailDb.GetById(0).GetDatabase(),
30)
3)
}
func (this *app) HasTask() bool {

View File

@ -27,6 +27,11 @@ func (this *mailMgr) Init() {
this.loadMails()
this.loadGroups()
this.loadGroupMembers()
f5.GetApp().RegisterCaHandle("Mail", "getMailList", this.CaGetMailList)
f5.GetApp().RegisterCaHandle("Mail", "markMail", this.CaMarkMail)
f5.GetApp().RegisterCaHandle("Mail", "getUnreadMailCnt", this.CaGetUnreadMailCnt)
f5.GetApp().RegisterCaHandle("Mail", "getAttachment", this.CaGetAttachment)
f5.GetApp().RegisterCaHandle("Mail", "deleteMails", this.CaDeleteMails)
}
func (this *mailMgr) UnInit() {
@ -94,7 +99,8 @@ func (this *mailMgr) loadGroupMembers() {
q5.GetSyncMapSize(this.idHash))
}
func (this *mailMgr) CaGetMailList(hum common.Player, c *gin.Context) {
func (this *mailMgr) CaGetMailList(c *gin.Context) {
/*
rspObj := struct {
ErrCode int32 `json:"errcode"`
ErrMsg string `json:"errmsg"`
@ -111,10 +117,11 @@ func (this *mailMgr) CaGetMailList(hum common.Player, c *gin.Context) {
}
return true
})
c.JSON(200, rspObj)
c.JSON(200, rspObj)*/
}
func (this *mailMgr) CaMarkMail(hum common.Player, c *gin.Context) {
func (this *mailMgr) CaMarkMail(c *gin.Context) {
/*
mailIds := q5.StrSplit(c.DefaultQuery("mail_ids", ""), ",")
mails := []common.Mail{}
for _, str := range(mailIds) {
@ -129,9 +136,11 @@ func (this *mailMgr) CaMarkMail(hum common.Player, c *gin.Context) {
ErrMsg string `json:"errmsg"`
}{}
c.JSON(200, rspObj)
*/
}
func (this *mailMgr) CaGetUnreadMailCnt(hum common.Player, c *gin.Context) {
func (this *mailMgr) CaGetUnreadMailCnt(c *gin.Context) {
/*
rspObj := struct {
ErrCode int32 `json:"errcode"`
ErrMsg string `json:"errmsg"`
@ -146,10 +155,11 @@ func (this *mailMgr) CaGetUnreadMailCnt(hum common.Player, c *gin.Context) {
}
return true
})
c.JSON(200, rspObj)
c.JSON(200, rspObj)*/
}
func (this *mailMgr) CaGetAttachment(hum common.Player, c *gin.Context) {
func (this *mailMgr) CaGetAttachment(c *gin.Context) {
/*
mailIds := q5.StrSplit(c.DefaultQuery("mail_ids", ""), ",")
mails := []common.Mail{}
for _, str := range(mailIds) {
@ -163,10 +173,11 @@ func (this *mailMgr) CaGetAttachment(hum common.Player, c *gin.Context) {
ErrCode int32 `json:"errcode"`
ErrMsg string `json:"errmsg"`
}{}
c.JSON(200, rspObj)
c.JSON(200, rspObj)*/
}
func (this *mailMgr) CaDeleteMails(hum common.Player, c *gin.Context) {
func (this *mailMgr) CaDeleteMails(c *gin.Context) {
/*
mailIds := q5.StrSplit(c.DefaultQuery("mail_ids", ""), ",")
mails := []common.Mail{}
for _, str := range(mailIds) {
@ -181,6 +192,7 @@ func (this *mailMgr) CaDeleteMails(hum common.Player, c *gin.Context) {
ErrMsg string `json:"errmsg"`
}{}
c.JSON(200, rspObj)
*/
}
func (this *mailMgr) traversePlayerMail(hum common.Player, cb func(*mail) bool) {