2025-04-18 17:17:23 +08:00
|
|
|
|
package server
|
|
|
|
|
|
|
|
|
|
import (
|
2025-04-24 20:39:31 +08:00
|
|
|
|
"admin/internal/consts"
|
2025-04-18 17:17:23 +08:00
|
|
|
|
"admin/lib/web"
|
|
|
|
|
)
|
|
|
|
|
|
2025-05-08 15:48:34 +08:00
|
|
|
|
func (srv *Server) Route(engine *web.Engine, sdkEngine *web.Engine) {
|
2025-05-12 11:09:11 +08:00
|
|
|
|
|
2025-05-08 15:48:34 +08:00
|
|
|
|
{ // gm后台内部路由
|
|
|
|
|
engine.Use(srv.CheckToken)
|
|
|
|
|
|
|
|
|
|
apiGroup := engine.Group("/api", "")
|
|
|
|
|
|
2025-04-24 20:39:31 +08:00
|
|
|
|
{
|
2025-05-08 15:48:34 +08:00
|
|
|
|
// 注册项目增删改查接口
|
|
|
|
|
projectGroup := apiGroup.Group("/"+consts.ResourcesName_Project, "项目")
|
|
|
|
|
projectGroup.Get("", "查看列表", consts.WebPathPermit_Read, srv.ctl.CommonList)
|
|
|
|
|
projectGroup.Post("", "新增", consts.WebPathPermit_Read, srv.ctl.CommonPost)
|
|
|
|
|
projectGroup.Put("", "编辑", consts.WebPathPermit_Read, srv.ctl.CommonPut)
|
|
|
|
|
projectGroup.Delete("", "删除", consts.WebPathPermit_Read, srv.ctl.CommonDelete)
|
|
|
|
|
|
|
|
|
|
// 注册项目之下其它所有资源通用增删改查接口
|
|
|
|
|
{
|
|
|
|
|
resourceUnderProjectGroup := projectGroup.Group("/:projectId/:resource", "")
|
|
|
|
|
resourceUnderProjectGroup.Get("", "查看列表", consts.WebPathPermit_Read, srv.ctl.CommonList)
|
|
|
|
|
resourceUnderProjectGroup.Post("", "新增", consts.WebPathPermit_Read, srv.ctl.CommonPost)
|
|
|
|
|
resourceUnderProjectGroup.Put("", "编辑", consts.WebPathPermit_Read, srv.ctl.CommonPut)
|
|
|
|
|
resourceUnderProjectGroup.Delete("", "删除", consts.WebPathPermit_Read, srv.ctl.CommonDelete)
|
2025-05-12 18:43:41 +08:00
|
|
|
|
resourceUnderProjectGroup.Post("/selection", "多选", consts.WebPathPermit_Read, srv.ctl.CommonDelete)
|
2025-05-08 15:48:34 +08:00
|
|
|
|
}
|
2025-05-04 22:07:13 +08:00
|
|
|
|
|
2025-05-08 15:48:34 +08:00
|
|
|
|
projectGroup.Get("/:projectId/items", "获取项目所有道具列表", consts.WebPathPermit_Read, srv.ctl.GetProjectAllItems)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// 礼包码特殊接口
|
|
|
|
|
cdkeyGroup := projectGroup.Group("/:projectId/cdkey/special", "")
|
|
|
|
|
cdkeyGroup.Get("/add_count", "礼包码数量追加", consts.WebPathPermit_Write, srv.ctl.CDKeyAddCount)
|
|
|
|
|
cdkeyGroup.Get("/export", "导出礼包码文件", consts.WebPathPermit_Write, srv.ctl.CDKeyExportFile)
|
|
|
|
|
cdkeyGroup.Get("/used", "查看礼包码使用情况", consts.WebPathPermit_Write, srv.ctl.CDKeyUsedHistory)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-05-07 18:25:31 +08:00
|
|
|
|
|
2025-05-08 15:48:34 +08:00
|
|
|
|
{ // gm后台作为sdk,供内部其它游戏调用的路由
|
|
|
|
|
sdkGroup := sdkEngine.Group("/api", "")
|
2025-05-07 18:25:31 +08:00
|
|
|
|
{
|
2025-05-08 15:48:34 +08:00
|
|
|
|
sdkGroup.Get("/cdkey/use", "使用奖励码", consts.WebPathPermit_Write, srv.ctl.CDKeyUse)
|
2025-05-07 18:25:31 +08:00
|
|
|
|
}
|
2025-04-22 15:46:48 +08:00
|
|
|
|
}
|
2025-04-18 17:17:23 +08:00
|
|
|
|
}
|