1
This commit is contained in:
parent
a6cb00a606
commit
9e3fa61a11
@ -1,38 +0,0 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"main/global"
|
||||
"main/mail"
|
||||
"main/player"
|
||||
)
|
||||
|
||||
type ApiGroup struct {
|
||||
Mail MailApi
|
||||
MailMgr MailMgrApi
|
||||
}
|
||||
|
||||
var ApiGroupApp = new(ApiGroup)
|
||||
|
||||
func GetPlayerMgr() *player.PlayerMgr {
|
||||
playerMgrPtr, ok := global.GetPlayerMgr().(*player.PlayerMgr)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return playerMgrPtr
|
||||
}
|
||||
|
||||
func GetMailMgr() *mail.MailMgr {
|
||||
mailMgrPtr, ok := global.GetMailMgr().(*mail.MailMgr)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return mailMgrPtr
|
||||
}
|
||||
|
||||
func errorResponse(errCode int, err error) gin.H {
|
||||
return gin.H{
|
||||
"errcode": errCode,
|
||||
"errmsg": err.Error(),
|
||||
}
|
||||
}
|
@ -1,160 +0,0 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"main/common"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type MailApi struct{}
|
||||
|
||||
// 获取我的邮件列表
|
||||
type getMailsReq struct {
|
||||
SessionId string `form:"session_id" binding:"required"`
|
||||
AccountId string `form:"account_id" binding:"required"`
|
||||
MailType int32 `form:"mailtype"`
|
||||
MailSubType int32 `form:"mailsubtype"`
|
||||
}
|
||||
|
||||
func (api *MailApi) GetMailList(c *gin.Context) {
|
||||
var req getMailsReq
|
||||
if err := c.ShouldBindQuery(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, errorResponse(http.StatusBadRequest, err))
|
||||
return
|
||||
}
|
||||
|
||||
// 加载player 慢
|
||||
accountObj := GetPlayerMgr().AsyncGetPlayer(req.AccountId)
|
||||
if accountObj == nil {
|
||||
err := fmt.Errorf("account is null")
|
||||
c.JSON(http.StatusBadRequest, errorResponse(http.StatusBadRequest, err))
|
||||
return
|
||||
}
|
||||
commonPlayer := (common.Player)(accountObj)
|
||||
mails := GetMailMgr().GetMailList(commonPlayer)
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errcode": 0,
|
||||
"errmsg": "",
|
||||
"maillist": mails,
|
||||
})
|
||||
}
|
||||
|
||||
// 设置邮件标记
|
||||
type markMailReq struct {
|
||||
SessionId string `form:"session_id" binding:"required"`
|
||||
AccountId string `form:"account_id" binding:"required"`
|
||||
MailIds string `form:"mail_ids" binding:"required"`
|
||||
Flag string `form:"flag" binding:"required"`
|
||||
}
|
||||
|
||||
func (api *MailApi) MarkMail(c *gin.Context) {
|
||||
var req markMailReq
|
||||
if err := c.ShouldBindQuery(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, errorResponse(http.StatusBadRequest, err))
|
||||
return
|
||||
}
|
||||
if req.Flag != "read" {
|
||||
c.JSON(http.StatusBadRequest, errorResponse(http.StatusBadRequest, fmt.Errorf("flag is not `read`")))
|
||||
return
|
||||
}
|
||||
|
||||
accountObj := GetPlayerMgr().AsyncGetPlayer(req.AccountId)
|
||||
if accountObj == nil {
|
||||
err := fmt.Errorf("account is null")
|
||||
c.JSON(http.StatusBadRequest, errorResponse(http.StatusBadRequest, err))
|
||||
return
|
||||
}
|
||||
accountObj.MarkMail(req.MailIds)
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errcode": 0,
|
||||
"errmsg": "",
|
||||
})
|
||||
}
|
||||
|
||||
// 获取未读邮件数
|
||||
type getUnreadMailCountReq struct {
|
||||
SessionId string `form:"session_id" binding:"required"`
|
||||
AccountId string `form:"account_id" binding:"required"`
|
||||
}
|
||||
|
||||
func (api *MailApi) GetUnreadMailCount(c *gin.Context) {
|
||||
var req getUnreadMailCountReq
|
||||
if err := c.ShouldBindQuery(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, errorResponse(http.StatusBadRequest, err))
|
||||
return
|
||||
}
|
||||
|
||||
accountObj := GetPlayerMgr().AsyncGetPlayer(req.AccountId)
|
||||
if accountObj == nil {
|
||||
err := fmt.Errorf("account is null")
|
||||
c.JSON(http.StatusBadRequest, errorResponse(http.StatusBadRequest, err))
|
||||
return
|
||||
}
|
||||
commonPlayer := (common.Player)(accountObj)
|
||||
mailCount := GetMailMgr().GetUnreadMailCount(commonPlayer)
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errcode": 0,
|
||||
"errmsg": "",
|
||||
"unread_mail_cnt": mailCount,
|
||||
})
|
||||
}
|
||||
|
||||
// 领取邮件附件
|
||||
type getMailAttachmentReq struct {
|
||||
SessionId string `form:"session_id" binding:"required"`
|
||||
AccountId string `form:"account_id" binding:"required"`
|
||||
MailIds string `form:"mail_ids" binding:"required"`
|
||||
}
|
||||
|
||||
func (api *MailApi) GetMailAttachment(c *gin.Context) {
|
||||
var req getMailAttachmentReq
|
||||
if err := c.ShouldBindQuery(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, errorResponse(http.StatusBadRequest, err))
|
||||
return
|
||||
}
|
||||
|
||||
accountObj := GetPlayerMgr().AsyncGetPlayer(req.AccountId)
|
||||
if accountObj == nil {
|
||||
err := fmt.Errorf("account is null")
|
||||
c.JSON(http.StatusBadRequest, errorResponse(http.StatusBadRequest, err))
|
||||
return
|
||||
}
|
||||
att := accountObj.GetAttachment(req.MailIds)
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errcode": 0,
|
||||
"errmsg": "",
|
||||
"attachments": att,
|
||||
})
|
||||
}
|
||||
|
||||
// 删除邮件
|
||||
type deleteMailsReq struct {
|
||||
SessionId string `form:"session_id" binding:"required"`
|
||||
AccountId string `form:"account_id" binding:"required"`
|
||||
MailIds string `form:"mail_ids" binding:"required"`
|
||||
}
|
||||
|
||||
func (api *MailApi) DeleteMails(c *gin.Context) {
|
||||
var req deleteMailsReq
|
||||
if err := c.ShouldBindQuery(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, errorResponse(http.StatusBadRequest, err))
|
||||
return
|
||||
}
|
||||
|
||||
accountObj := GetPlayerMgr().AsyncGetPlayer(req.AccountId)
|
||||
if accountObj == nil {
|
||||
err := fmt.Errorf("account is null")
|
||||
c.JSON(http.StatusBadRequest, errorResponse(http.StatusBadRequest, err))
|
||||
return
|
||||
}
|
||||
accountObj.DeleteMails(req.MailIds)
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errcode": 0,
|
||||
"errmsg": "",
|
||||
})
|
||||
}
|
@ -1,228 +0,0 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"main/constant"
|
||||
"main/mail"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
type MailMgrApi struct{}
|
||||
|
||||
type getMailListReq struct {
|
||||
GameId int `form:"gameid" binding:"required"`
|
||||
}
|
||||
|
||||
func (api *MailMgrApi) GetMailList(c *gin.Context) {
|
||||
var req getMailListReq
|
||||
if err := c.ShouldBindQuery(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, errorResponse(http.StatusBadRequest, err))
|
||||
return
|
||||
}
|
||||
|
||||
mails := GetMailMgr().GetGMMailList(req.GameId)
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errcode": 0,
|
||||
"errmsg": "",
|
||||
"maillist": mails,
|
||||
})
|
||||
}
|
||||
|
||||
type sendMailReq struct {
|
||||
GameId int `form:"gameid" binding:"required"`
|
||||
To string `form:"to" binding:"min=0"`
|
||||
From string `form:"from" binding:"min=0,max=60"`
|
||||
MailType int `form:"mailtype" binding:"min=0,max=2"`
|
||||
MailSubType int `form:"mailsubtype" binding:""`
|
||||
UserType int `form:"usertype" binding:"min=0"`
|
||||
Content string `form:"content" binding:"required"`
|
||||
Subject string `form:"subject" binding:"required"`
|
||||
SendTime int32 `form:"sendtime" binding:"required"`
|
||||
ExpireTime int32 `form:"expiretime" binding:"required"`
|
||||
Attachments string `form:"attachments" binding:"min=0"`
|
||||
EXT string `form:"ext" binding:"min=0"`
|
||||
}
|
||||
|
||||
func (api *MailMgrApi) SendMail(c *gin.Context) {
|
||||
var req sendMailReq
|
||||
// ShouldBindJSON
|
||||
if err := c.ShouldBindQuery(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, errorResponse(http.StatusBadRequest, err))
|
||||
return
|
||||
}
|
||||
|
||||
var mailId = f5.GetApp().NewUuid()
|
||||
nowUnixSec := int32(time.Now().Unix())
|
||||
if req.ExpireTime < nowUnixSec {
|
||||
c.JSON(http.StatusBadRequest, gin.H{
|
||||
"errcode": http.StatusBadRequest,
|
||||
"errmsg": "expireTime error",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
sql := fmt.Sprintf("INSERT INTO mailbox SET gameid=%d, mailid=%d, mailtype=%d, mailsubtype=%d, _to='%s', subject='%s', content='%s', deleted=0, attachments='%s', sendtime=%d, expiretime=%d, createtime=%d, modifytime=%d, ext='%s', usertype=%d",
|
||||
req.GameId,
|
||||
mailId,
|
||||
req.MailType,
|
||||
req.MailSubType,
|
||||
req.To,
|
||||
req.Subject,
|
||||
req.Content,
|
||||
req.Attachments,
|
||||
req.SendTime,
|
||||
req.ExpireTime,
|
||||
nowUnixSec,
|
||||
nowUnixSec,
|
||||
req.EXT,
|
||||
req.UserType)
|
||||
f5.GetGoStyleDb().SyncSelectCustomQuery(
|
||||
constant.MAIL_DB,
|
||||
sql,
|
||||
func(err error, rows *f5.DataSet) {
|
||||
if err != nil {
|
||||
f5.GetSysLog().Info("SendMail err:%v \n", err)
|
||||
return
|
||||
}
|
||||
newMail := mail.NewMail()
|
||||
newMail.GameId = req.GameId
|
||||
newMail.MailId = mailId
|
||||
newMail.From = req.From
|
||||
newMail.To = req.To
|
||||
newMail.Subject = req.Subject
|
||||
newMail.Content = req.Content
|
||||
newMail.MailType = req.MailType
|
||||
newMail.MailSubType = req.MailSubType
|
||||
newMail.UserType = req.UserType
|
||||
newMail.SendTime = req.SendTime
|
||||
newMail.ExpireTime = req.ExpireTime
|
||||
newMail.CreateTime = nowUnixSec
|
||||
newMail.Ext = req.EXT
|
||||
newMail.ParseAttachments(req.Attachments)
|
||||
GetMailMgr().AddMail(newMail)
|
||||
},
|
||||
)
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errcode": 0,
|
||||
"errmsg": "",
|
||||
})
|
||||
}
|
||||
|
||||
type deleteReq struct {
|
||||
GameId int `form:"gameid" binding:"required"`
|
||||
MailId int64 `form:"mailid" binding:"required"`
|
||||
}
|
||||
|
||||
func (api *MailMgrApi) DeleteMail(c *gin.Context) {
|
||||
var req deleteReq
|
||||
if err := c.ShouldBindQuery(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, errorResponse(http.StatusBadRequest, err))
|
||||
return
|
||||
}
|
||||
|
||||
m := GetMailMgr().GetMail(req.MailId)
|
||||
if m == nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{
|
||||
"errcode": http.StatusBadRequest,
|
||||
"errmsg": "mail is not exists",
|
||||
})
|
||||
return
|
||||
}
|
||||
if m.GameId != req.GameId {
|
||||
c.JSON(http.StatusBadRequest, gin.H{
|
||||
"errcode": http.StatusBadRequest,
|
||||
"errmsg": "mail gameid error",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
nowUnixSec := int32(time.Now().Unix())
|
||||
sql := fmt.Sprintf("UPDATE mailbox SET deleted=1,modifytime=%d WHERE mailid=%d", nowUnixSec, req.MailId)
|
||||
f5.GetGoStyleDb().SyncSelectCustomQuery(
|
||||
constant.MAIL_DB,
|
||||
sql,
|
||||
func(err error, rows *f5.DataSet) {
|
||||
if err != nil {
|
||||
f5.GetSysLog().Info("DeleteMail err:%v \n", err)
|
||||
return
|
||||
}
|
||||
GetMailMgr().InternalGMDeleteMail(req.MailId)
|
||||
},
|
||||
)
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errcode": 0,
|
||||
"errmsg": "",
|
||||
})
|
||||
}
|
||||
|
||||
type updateReq struct {
|
||||
GameId int `form:"gameid" binding:"required"`
|
||||
MailId int64 `form:"mailid" binding:"required"`
|
||||
Subject string `form:"subject" binding:""`
|
||||
Content string `form:"content" binding:""`
|
||||
SendTime int32 `form:"sendtime" binding:"required"`
|
||||
ExpireTime int32 `form:"expiretime" binding:"required"`
|
||||
Attachments string `form:"attachments" binding:"min=0"`
|
||||
EXT string `form:"ext" binding:"min=0"`
|
||||
}
|
||||
|
||||
func (api *MailMgrApi) UpdateMail(c *gin.Context) {
|
||||
var req updateReq
|
||||
if err := c.ShouldBindQuery(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, errorResponse(http.StatusBadRequest, err))
|
||||
return
|
||||
}
|
||||
|
||||
nowUnixSec := int32(time.Now().Unix())
|
||||
if req.ExpireTime < nowUnixSec {
|
||||
c.JSON(http.StatusBadRequest, gin.H{
|
||||
"errcode": http.StatusBadRequest,
|
||||
"errmsg": "expireTime error",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
m := GetMailMgr().GetMail(req.MailId)
|
||||
if m == nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{
|
||||
"errcode": http.StatusBadRequest,
|
||||
"errmsg": "mail is not exists",
|
||||
})
|
||||
return
|
||||
}
|
||||
if m.GameId != req.GameId {
|
||||
c.JSON(http.StatusBadRequest, gin.H{
|
||||
"errcode": http.StatusBadRequest,
|
||||
"errmsg": "mail gameid error",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
sql := fmt.Sprintf("UPDATE mailbox SET content='%s',subject='%s',sendtime=%d,expiretime=%d,ext='%s', attachments='%s' WHERE mailid=%d", req.Content, req.Subject, req.SendTime, req.ExpireTime, req.EXT, req.Attachments, req.MailId)
|
||||
f5.GetGoStyleDb().SyncSelectCustomQuery(
|
||||
constant.MAIL_DB,
|
||||
sql,
|
||||
func(err error, rows *f5.DataSet) {
|
||||
if err != nil {
|
||||
f5.GetSysLog().Info("UpdateMail err:%v \n", err)
|
||||
return
|
||||
}
|
||||
m.Content = req.Content
|
||||
m.Subject = req.Subject
|
||||
m.SendTime = req.SendTime
|
||||
m.ExpireTime = req.ExpireTime
|
||||
m.Ext = req.EXT
|
||||
m.ParseAttachments(req.Attachments)
|
||||
},
|
||||
)
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errcode": 0,
|
||||
"errmsg": "",
|
||||
})
|
||||
}
|
@ -5,7 +5,6 @@ import (
|
||||
. "main/global"
|
||||
_ "main/mail"
|
||||
_ "main/player"
|
||||
_ "main/router"
|
||||
)
|
||||
|
||||
func Init() {
|
||||
|
@ -1,36 +0,0 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Auth() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
accountID := c.Query("account_id")
|
||||
sessionID := c.Query("session_id")
|
||||
if accountID == "" || sessionID == "" {
|
||||
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{
|
||||
"errcode": http.StatusUnauthorized,
|
||||
"errmsg": "Bad Request: authorization account_id or session_id is not provided",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if !isValidSession(accountID, sessionID) {
|
||||
f5.GetSysLog().Info("logUnauthorizedAccess, clientIP:%s, requestURL:%s", c.ClientIP(), c.Request.URL.String())
|
||||
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{
|
||||
"errcode": http.StatusUnauthorized,
|
||||
"errmsg": "Bad Request: token is invalid",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
func isValidSession(accountID, sessionID string) bool {
|
||||
return true
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Cors() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
method := c.Request.Method
|
||||
//origin := c.Request.Header.Get("Origin")
|
||||
//if origin != "" {
|
||||
c.Header("Access-Control-Allow-Origin", "*") // 可将将 * 替换为指定的域名
|
||||
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, UPDATE")
|
||||
c.Header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization")
|
||||
c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Cache-Control, Content-Language, Content-Type")
|
||||
c.Header("Access-Control-Allow-Credentials", "true")
|
||||
//}
|
||||
if method == "OPTIONS" {
|
||||
c.AbortWithStatus(http.StatusNoContent)
|
||||
}
|
||||
c.Next()
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package mail
|
||||
|
||||
type emailReq struct {
|
||||
Mailtype int `binding:"required" json:"mailtype"`
|
||||
Usertype int `json:"usertype"`
|
||||
Attachments string `json:"attachments"`
|
||||
Ext string `json:"ext"`
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package system
|
||||
|
||||
type Annc struct {
|
||||
Idx uint64 `json:"idx" `
|
||||
Title string `json:"title" binding:"required" `
|
||||
Version string `json:"version" binding:"required" `
|
||||
Model uint `json:"model" binding:"required" `
|
||||
Type uint `json:"type" binding:"required"`
|
||||
IsEffect uint `json:"is_effect"`
|
||||
Content string `json:"content" binding:"required" `
|
||||
}
|
||||
|
||||
func (this Annc) TableName() string {
|
||||
return "t_announcement"
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package system
|
||||
|
||||
type Audit struct {
|
||||
Idx uint `json:"idx" `
|
||||
Version string `json:"version" binding:"required" `
|
||||
Model uint `json:"model" binding:"required" `
|
||||
IsAuditing uint `json:"is_auditing" `
|
||||
}
|
||||
|
||||
func (this Audit) TableName() string {
|
||||
return "t_audit"
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package system
|
||||
|
||||
type SysUser struct {
|
||||
Idx uint64 `json:"idx"`
|
||||
Username string `gorm:"uniqueIndex;comment:用户登录名" json:"username"`
|
||||
Password string `gorm:"comment:用户登录密码" json:"password"`
|
||||
Roles []string `json:"roles" gorm:"-"'`
|
||||
}
|
||||
|
||||
func (SysUser) TableName() string {
|
||||
return "t_user"
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"main/constant"
|
||||
"main/global"
|
||||
)
|
||||
|
||||
var _routerMgr = new(routerMgr)
|
||||
|
||||
func init() {
|
||||
global.RegModule(constant.ROUTER_MODULE_IDX, _routerMgr)
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"main/api"
|
||||
)
|
||||
|
||||
type MailRoute struct{}
|
||||
|
||||
func (r *MailRoute) InitMailRouter(mailRouter *gin.RouterGroup) {
|
||||
// mailRouter := pubRouter.Group("/")
|
||||
mailAPI := api.ApiGroupApp.Mail
|
||||
mailRouter.GET("getMailList", mailAPI.GetMailList)
|
||||
mailRouter.GET("markMail", mailAPI.MarkMail)
|
||||
mailRouter.GET("getUnreadMailCount", mailAPI.GetUnreadMailCount)
|
||||
mailRouter.GET("getMailAttachment", mailAPI.GetMailAttachment)
|
||||
mailRouter.GET("deleteMails", mailAPI.DeleteMails)
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"main/api"
|
||||
)
|
||||
|
||||
type MailMgrRoute struct{}
|
||||
|
||||
func (r *MailMgrRoute) InitMailRouter(mailMgrRouter *gin.RouterGroup) {
|
||||
mailMgrApi := api.ApiGroupApp.MailMgr
|
||||
mailMgrRouter.GET("getMailList", mailMgrApi.GetMailList)
|
||||
mailMgrRouter.GET("sendMail", mailMgrApi.SendMail)
|
||||
mailMgrRouter.GET("deleteMail", mailMgrApi.DeleteMail)
|
||||
mailMgrRouter.GET("updateMail", mailMgrApi.UpdateMail)
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"github.com/gin-gonic/gin"
|
||||
"main/middleware"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type routerMgr struct {
|
||||
mail MailRoute
|
||||
mailMgr MailMgrRoute
|
||||
}
|
||||
|
||||
func (rm *routerMgr) Init() {
|
||||
router := f5.GetApp().GetGinEngine()
|
||||
router.NoRoute(func(c *gin.Context) {
|
||||
c.JSON(http.StatusNotFound, gin.H{
|
||||
"errcode": http.StatusNotFound,
|
||||
"errmsg": "Not Found",
|
||||
})
|
||||
})
|
||||
router.Use(gin.Logger())
|
||||
|
||||
// player mail
|
||||
mailRouterGroup := router.Group("mail")
|
||||
mailRouterGroup.Use(middleware.Auth())
|
||||
rm.mail.InitMailRouter(mailRouterGroup)
|
||||
|
||||
//// gm mail
|
||||
milMgrRouterGroup := router.Group("mail_mgr")
|
||||
rm.mailMgr.InitMailRouter(milMgrRouterGroup)
|
||||
|
||||
}
|
||||
|
||||
func (rm *routerMgr) UnInit() {
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user