This commit is contained in:
aozhiwei 2024-04-27 09:40:45 +08:00
parent d912e285f7
commit 32717a04d3
3 changed files with 17 additions and 10 deletions

View File

@ -5,6 +5,7 @@ import (
"main/constant" "main/constant"
"mt" "mt"
"main/middleware" "main/middleware"
. "main/global"
) )
type app struct { type app struct {
@ -31,11 +32,11 @@ func (this *app) Init() {
this.registerDataSources() this.registerDataSources()
this.initCb() this.initCb()
f5.GetApp().GetGinEngine().Use(middleware.CaForward, middleware.CaAuth) f5.GetApp().GetGinEngine().Use(middleware.CaForward, middleware.CaAuth)
/*f5.GetApp().RegisterCaHandle("Mail", "getMailList", mail_getMailList) f5.GetApp().RegisterCaHandle("Mail", "getMailList", GetMailMgr().CaGetMailList)
f5.GetApp().RegisterCaHandle("Mail", "markMail", mail_markMail) f5.GetApp().RegisterCaHandle("Mail", "markMail", GetMailMgr().CaMarkMail)
f5.GetApp().RegisterCaHandle("Mail", "getUnreadMailCnt", mail_getUnreadMailCnt) f5.GetApp().RegisterCaHandle("Mail", "getUnreadMailCnt", GetMailMgr().CaGetUnreadMailCnt)
f5.GetApp().RegisterCaHandle("Mail", "getAttachment", mail_getAttachment) f5.GetApp().RegisterCaHandle("Mail", "getAttachment", GetMailMgr().CaGetAttachment)
f5.GetApp().RegisterCaHandle("Mail", "deleteMails", mail_deleteMails)*/ f5.GetApp().RegisterCaHandle("Mail", "deleteMails", GetMailMgr().CaDeleteMails)
} }
func (this *app) UnInit() { func (this *app) UnInit() {

View File

@ -1,6 +1,7 @@
package common package common
import ( import (
"github.com/gin-gonic/gin"
) )
type AttachmentDto struct { type AttachmentDto struct {
@ -49,4 +50,9 @@ type Mail interface {
} }
type MailMgr interface{ type MailMgr interface{
CaGetMailList(c *gin.Context)
CaMarkMail(c *gin.Context)
CaGetUnreadMailCnt(c *gin.Context)
CaGetAttachment(c *gin.Context)
CaDeleteMails(c *gin.Context)
} }

View File

@ -94,7 +94,7 @@ func (this *mailMgr) loadGroupMembers() {
q5.GetSyncMapSize(this.idHash)) 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 { rspObj := struct {
ErrCode int32 `json:"errcode"` ErrCode int32 `json:"errcode"`
ErrMsg string `json:"errmsg"` ErrMsg string `json:"errmsg"`
@ -114,7 +114,7 @@ func (this *mailMgr) caGetMailList(hum common.Player, c *gin.Context) {
c.JSON(200, rspObj) 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", ""), ",") mailIds := q5.StrSplit(c.DefaultQuery("mail_ids", ""), ",")
mails := []common.Mail{} mails := []common.Mail{}
for _, str := range(mailIds) { for _, str := range(mailIds) {
@ -131,7 +131,7 @@ func (this *mailMgr) caMarkMail(hum common.Player, c *gin.Context) {
c.JSON(200, rspObj) 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 { rspObj := struct {
ErrCode int32 `json:"errcode"` ErrCode int32 `json:"errcode"`
ErrMsg string `json:"errmsg"` ErrMsg string `json:"errmsg"`
@ -149,7 +149,7 @@ func (this *mailMgr) caGetUnreadMailCnt(hum common.Player, c *gin.Context) {
c.JSON(200, rspObj) 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", ""), ",") mailIds := q5.StrSplit(c.DefaultQuery("mail_ids", ""), ",")
mails := []common.Mail{} mails := []common.Mail{}
for _, str := range(mailIds) { for _, str := range(mailIds) {
@ -166,7 +166,7 @@ func (this *mailMgr) caGetAttachment(hum common.Player, c *gin.Context) {
c.JSON(200, rspObj) 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", ""), ",") mailIds := q5.StrSplit(c.DefaultQuery("mail_ids", ""), ",")
mails := []common.Mail{} mails := []common.Mail{}
for _, str := range(mailIds) { for _, str := range(mailIds) {