diff --git a/server/mailserver/app/app.go b/server/mailserver/app/app.go index 7761a2ae..4808b43f 100644 --- a/server/mailserver/app/app.go +++ b/server/mailserver/app/app.go @@ -5,6 +5,7 @@ import ( "main/constant" "mt" "main/middleware" + . "main/global" ) type app struct { @@ -31,11 +32,11 @@ func (this *app) Init() { this.registerDataSources() this.initCb() f5.GetApp().GetGinEngine().Use(middleware.CaForward, middleware.CaAuth) - /*f5.GetApp().RegisterCaHandle("Mail", "getMailList", mail_getMailList) - f5.GetApp().RegisterCaHandle("Mail", "markMail", mail_markMail) - f5.GetApp().RegisterCaHandle("Mail", "getUnreadMailCnt", mail_getUnreadMailCnt) - f5.GetApp().RegisterCaHandle("Mail", "getAttachment", mail_getAttachment) - f5.GetApp().RegisterCaHandle("Mail", "deleteMails", mail_deleteMails)*/ + 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() { diff --git a/server/mailserver/common/types.go b/server/mailserver/common/types.go index 649f1c66..3df455e6 100644 --- a/server/mailserver/common/types.go +++ b/server/mailserver/common/types.go @@ -1,6 +1,7 @@ package common import ( + "github.com/gin-gonic/gin" ) type AttachmentDto struct { @@ -49,4 +50,9 @@ type Mail interface { } type MailMgr interface{ + CaGetMailList(c *gin.Context) + CaMarkMail(c *gin.Context) + CaGetUnreadMailCnt(c *gin.Context) + CaGetAttachment(c *gin.Context) + CaDeleteMails(c *gin.Context) } diff --git a/server/mailserver/mail/mailmgr.go b/server/mailserver/mail/mailmgr.go index 38f0d736..fdcb2673 100644 --- a/server/mailserver/mail/mailmgr.go +++ b/server/mailserver/mail/mailmgr.go @@ -94,7 +94,7 @@ func (this *mailMgr) loadGroupMembers() { q5.GetSyncMapSize(this.idHash)) } -func (this *mailMgr) caGetMailList(hum common.Player, c *gin.Context) { +func (this *mailMgr) CaGetMailList(hum common.Player, c *gin.Context) { rspObj := struct { ErrCode int32 `json:"errcode"` ErrMsg string `json:"errmsg"` @@ -114,7 +114,7 @@ func (this *mailMgr) caGetMailList(hum common.Player, c *gin.Context) { c.JSON(200, rspObj) } -func (this *mailMgr) caMarkMail(hum common.Player, c *gin.Context) { +func (this *mailMgr) CaMarkMail(hum common.Player, c *gin.Context) { mailIds := q5.StrSplit(c.DefaultQuery("mail_ids", ""), ",") mails := []common.Mail{} for _, str := range(mailIds) { @@ -131,7 +131,7 @@ func (this *mailMgr) caMarkMail(hum common.Player, c *gin.Context) { c.JSON(200, rspObj) } -func (this *mailMgr) caGetUnreadMailCnt(hum common.Player, c *gin.Context) { +func (this *mailMgr) CaGetUnreadMailCnt(hum common.Player, c *gin.Context) { rspObj := struct { ErrCode int32 `json:"errcode"` ErrMsg string `json:"errmsg"` @@ -149,7 +149,7 @@ func (this *mailMgr) caGetUnreadMailCnt(hum common.Player, c *gin.Context) { c.JSON(200, rspObj) } -func (this *mailMgr) caGetAttachment(hum common.Player, c *gin.Context) { +func (this *mailMgr) CaGetAttachment(hum common.Player, c *gin.Context) { mailIds := q5.StrSplit(c.DefaultQuery("mail_ids", ""), ",") mails := []common.Mail{} for _, str := range(mailIds) { @@ -166,7 +166,7 @@ func (this *mailMgr) caGetAttachment(hum common.Player, c *gin.Context) { c.JSON(200, rspObj) } -func (this *mailMgr) caDeleteMails(hum common.Player, c *gin.Context) { +func (this *mailMgr) CaDeleteMails(hum common.Player, c *gin.Context) { mailIds := q5.StrSplit(c.DefaultQuery("mail_ids", ""), ",") mails := []common.Mail{} for _, str := range(mailIds) {