123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920 |
- package api
- import (
- "gadmin/config"
- "gadmin/internal/admin/forms"
- "gadmin/internal/admin/service"
- "gadmin/utility/serializer"
- "gadmin/utility/token"
- "github.com/gin-gonic/gin"
- "os"
- )
- type (
- Map = map[string]interface{}
- )
- func MenuDynamic(c *gin.Context) {
- systemId := token.GetSystemId(c)
- t := c.GetHeader("authorization")
- roleId, _ := c.Get("admin_role_id")
- list, err := service.Menu.GetRoleMenuList(systemId, roleId.(int64), t)
- if err != nil {
- c.JSON(200, ErrorResponse(err))
- return
- }
- c.JSON(200, serializer.Suc(list, "获取成功"))
- return
- }
- func GetAllMenuList(c *gin.Context) (map[int32][]*forms.Menu, error) {
- systems, err := service.AdminRole.GetAllSystem()
- if err != nil {
- return nil, err
- }
- t := c.GetHeader("authorization")
- roleId, _ := c.Get("admin_role_id")
- systemMap := make(map[int32][]*forms.Menu)
- for _, sys := range systems {
- menus, err := service.Menu.GetRoleMenuList(sys.ID, roleId.(int64), t)
- if err != nil {
- return nil, err
- }
- systemMap[sys.ID] = menus
- }
- return systemMap, nil
- }
- func GetMenuList(c *gin.Context) []Map {
- var (
- lists []Map
- localHidden = true // 本地显示的菜单
- )
- if os.Getenv("ADMIN_IS_LOCAL") == "1" {
- localHidden = false
- }
- // 控制台
- lists = append(lists, Map{
- "id": 1,
- "path": "/dashboard",
- "name": "Dashboard",
- "component": "LAYOUT",
- "redirect": "/dashboard/console",
- "meta": Map{
- "title": "Dashboard",
- "icon": "DashboardOutlined",
- },
- "children": []Map{
- {
- "id": 1001,
- "path": "console",
- "name": "dashboard_console",
- "component": "/dashboard/console/console",
- "meta": Map{
- "title": "主控台",
- },
- },
- },
- })
- // 玩家管理
- lists = append(lists, Map{
- "id": 2,
- "path": "/account",
- "name": "Account",
- "component": "LAYOUT",
- "redirect": "/account/account-list",
- "meta": Map{
- "icon": "UserOutlined",
- "title": "玩家管理",
- "sort": 2,
- },
- "children": []Map{
- {
- "id": 2001,
- "path": "account-list",
- "name": "account-list",
- "component": "/account/accountList/index",
- "meta": Map{
- "title": "玩家列表",
- },
- },
- {
- "id": 2002,
- "path": "account-info/:id?",
- "name": "account-info",
- "component": "/account/accountList/info",
- "meta": Map{
- "title": "基础详情",
- "hidden": true,
- "activeMenu": "account-list",
- },
- },
- {
- "id": 2003,
- "path": "account-search",
- "name": "account-search",
- "component": "/account/accountList/search",
- "meta": Map{
- "title": "全服查找",
- },
- },
- /*{
- "path": "account-banLogs",
- "name": "account-banLogs",
- "component": "/account/accountList/banLogs",
- "meta": Map{
- "title": "拉黑记录",
- },
- },
- {
- "path": "retrofit-list",
- "name": "retrofit-list",
- "component": "/retrofit/index",
- "meta": Map{
- "title": "配装模板",
- },
- },
- {
- "path": "consumption-details",
- "name": "consumption-details",
- "component": "/recharge/consumption/index",
- "meta": Map{
- "title": "消费变动记录",
- },
- },
- {
- "path": "consumption-statistics",
- "name": "consumption-statistics",
- "component": "/recharge/consumptionStatistics/index",
- "meta": Map{
- "title": "消费统计",
- },
- },
- {
- "path": "game-data-alarm",
- "name": "game-data-alarm",
- "component": "/account/gameDataAlarm/index",
- "meta": Map{
- "title": "游戏异常",
- },
- },
- {
- "path": "game-cheating-alarm",
- "name": "game-cheating-alarm",
- "component": "/account/gameCheatingAlarm/index",
- "meta": Map{
- "title": "作弊数据筛选",
- },
- },
- {
- "path": "chat-report-list",
- "name": "chat-report-list",
- "component": "/account/chatReportList/index",
- "meta": Map{
- "title": "聊天举报记录",
- },
- },
- {
- "path": "chat-log-list",
- "name": "chat-log-list",
- "component": "/account/chatLogList/index",
- "meta": Map{
- "title": "聊天记录",
- },
- },*/
- },
- })
- if config.IsSuperRole(service.User.GetUserRoleId(c)) {
- // 权限管理
- lists = append(lists, Map{
- "id": 3,
- "path": "/permission",
- "name": "Permission",
- "component": "LAYOUT",
- "redirect": "/permission/menu",
- "meta": Map{
- "icon": "SafetyCertificateOutlined",
- "title": "权限管理",
- "sort": 1,
- },
- "children": []Map{
- {
- "id": 3003,
- "path": "menu",
- "name": "permission_menu",
- "component": "/permission/menu/menu",
- "meta": Map{
- "title": "菜单权限",
- },
- },
- {
- "id": 3001,
- "path": "user",
- "name": "permission_user",
- "component": "/permission/user/user",
- "meta": Map{
- "title": "后台用户",
- },
- },
- {
- "id": 3002,
- "path": "role",
- "name": "permission_role",
- "component": "/permission/role/role",
- "meta": Map{
- "title": "角色管理",
- },
- },
- },
- })
- }
- // 充值管理
- /*lists = append(lists, Map{
- "id": 4,
- "path": "/recharge",
- "name": "Recharge",
- "component": "LAYOUT",
- "redirect": "/recharge/recharge-list",
- "meta": Map{
- "icon": "PayCircleOutlined",
- "title": "充值订单",
- "sort": 2,
- },
- "children": []Map{
- {
- "id": 4001,
- "path": "recharge-list",
- "name": "recharge-list",
- "component": "/recharge/rechargeList/index",
- "meta": Map{
- "title": "订单记录",
- },
- },
- {
- "id": 4002,
- "path": "recharge-dailyStatistics",
- "name": "recharge-dailyStatistics",
- "component": "/recharge/dailyStatistics/index",
- "meta": Map{
- "title": "每日统计",
- },
- },
- {
- "id": 4003,
- "path": "recharge-ordersSettle",
- "name": "recharge-ordersSettle",
- "component": "/recharge/ordersSettle/index",
- "meta": Map{
- "title": "余额平账",
- "keepAlive": true,
- },
- },
- {
- "id": 4004,
- "path": "recharge-abnormalOrder",
- "name": "recharge-abnormalOrder",
- "component": "/recharge/abnormalOrder/index",
- "meta": Map{
- "title": "异常订单",
- "keepAlive": true,
- },
- },
- },
- })*/
- // 排行榜
- /*lists = append(lists, Map{
- "id": 5,
- "path": "/ranking",
- "name": "Ranking",
- "component": "LAYOUT",
- "redirect": "/ranking/index",
- "meta": Map{
- "icon": "CellularOutline",
- "title": "排行榜",
- "sort": 2,
- },
- "children": []Map{
- {
- "id": 5001,
- "path": "recharge-ranking",
- "name": "recharge-ranking",
- "component": "/ranking/recharge/index",
- "meta": Map{
- "title": "充值排行",
- },
- },
- {
- "id": 5002,
- "path": "diamond-ranking",
- "name": "diamond-ranking",
- "component": "/ranking/diamond/index",
- "meta": Map{
- "title": "消费排行",
- },
- },
- {
- "id": 5003,
- "path": "level-ranking",
- "name": "level-ranking",
- "component": "/ranking/level/index",
- "meta": Map{
- "title": "等级排行",
- },
- },
- {
- "id": 5004,
- "path": "elrank-ranking",
- "name": "elrank-ranking",
- "component": "/ranking/elrank/index",
- "meta": Map{
- "title": "无尽排行",
- },
- },
- {
- "id": 5005,
- "path": "duel-ranking",
- "name": "duel-ranking",
- "component": "/ranking/duel/index",
- "meta": Map{
- "title": "狭路排行",
- },
- },
- {
- "id": 5006,
- "path": "gudong-ranking",
- "name": "gudong-ranking",
- "component": "/ranking/gudong/index",
- "meta": Map{
- "title": "古玩排行",
- },
- },
- {
- "id": 5007,
- "path": "idiom-ranking",
- "name": "idiom-ranking",
- "component": "/ranking/idiom/index",
- "meta": Map{
- "title": "金榜题名",
- },
- },
- {
- "id": 5008,
- "path": "boss-ranking",
- "name": "boss-ranking",
- "component": "/ranking/boss/index",
- "meta": Map{
- "title": "暗影突袭",
- },
- },
- {
- "id": 5009,
- "path": "adv-ranking",
- "name": "adv-ranking",
- "component": "/ranking/adv/index",
- "meta": Map{
- "title": "看广告排行",
- },
- },
- {
- "id": 5010,
- "path": "login-ranking",
- "name": "login-ranking",
- "component": "/ranking/login/index",
- "meta": Map{
- "title": "登录排行",
- },
- },
- },
- })*/
- // 数据统计
- /*lists = append(lists, Map{
- "id": 6,
- "path": "/echarts",
- "name": "Echarts",
- "component": "LAYOUT",
- "redirect": "/echarts/index",
- "meta": Map{
- "icon": "BarChartOutline",
- "title": "数据统计",
- "sort": 2,
- },
- "children": []Map{
- {
- "id": 6001,
- "path": "login-echarts",
- "name": "login-echarts",
- "component": "/echarts/login/index",
- "meta": Map{
- "title": "登录数据",
- },
- },
- {
- "id": 6002,
- "path": "chapter-echarts",
- "name": "chapter-echarts",
- "component": "/echarts/chapter/index",
- "meta": Map{
- "title": "关卡数据",
- },
- },
- {
- "id": 6003,
- "path": "basic-echarts",
- "name": "basic-echarts",
- "component": "/echarts/basic/index",
- "meta": Map{
- "title": "基础数据",
- },
- },
- {
- "id": 6004,
- "path": "adv-echarts",
- "name": "adv-echarts",
- "component": "/echarts/adv/index",
- "meta": Map{
- "title": "广告数据",
- },
- },
- {
- "id": 6005,
- "path": "echarts-tests",
- "name": "echarts-tests",
- "component": "/echarts/adv/index2",
- "meta": Map{
- "hidden": localHidden,
- "title": "图表测试",
- },
- },
- {
- "id": 6006,
- "path": "goods-echarts",
- "name": "goods-echarts",
- "component": "/echarts/goods/index",
- "meta": Map{
- "title": "商品数据",
- },
- },
- {
- "id": 6007,
- "path": "gudong-echarts",
- "name": "gudong-echarts",
- "component": "/echarts/gudong/index",
- "meta": Map{
- "title": "古玩数据",
- },
- },
- {
- "id": 6008,
- "path": "duel-echarts",
- "name": "duel-echarts",
- "component": "/echarts/duel/index",
- "meta": Map{
- "title": "狭路对决",
- },
- },
- {
- "id": 6009,
- "path": "expedition-echarts",
- "name": "expedition-echarts",
- "component": "/echarts/expedition/index",
- "meta": Map{
- "title": "远征数据",
- },
- },
- {
- "id": 6010,
- "path": "idiom-echarts",
- "name": "idiom-echarts",
- "component": "/echarts/idiom/index",
- "meta": Map{
- "title": "金榜题名",
- },
- },
- {
- "id": 6011,
- "path": "boss-echarts",
- "name": "boss-echarts",
- "component": "/echarts/boss/index",
- "meta": Map{
- "title": "暗影突袭",
- },
- },
- {
- "id": 6012,
- "path": "seven-echarts",
- "name": "seven-echarts",
- "component": "/echarts/seven/index",
- "meta": Map{
- "title": "七日任务",
- },
- },
- {
- "id": 6013,
- "path": "disconnect-echarts",
- "name": "disconnect-echarts",
- "component": "/echarts/disconnect/index",
- "meta": Map{
- "title": "重连数据",
- },
- },
- {
- "id": 6014,
- "path": "gem-echarts",
- "name": "gem-echarts",
- "component": "/echarts/gem/index",
- "meta": Map{
- "title": "宝石数据",
- },
- },
- {
- "id": 6015,
- "path": "limitgift-echarts",
- "name": "limitgift-echarts",
- "component": "/echarts/limitgift/index",
- "meta": Map{
- "title": "限时礼包",
- },
- },
- {
- "id": 6016,
- "path": "treasure-echarts",
- "name": "treasure-echarts",
- "component": "/echarts/treasure/index",
- "meta": Map{
- "title": "宝物数据",
- },
- },
- {
- "id": 6017,
- "path": "grandmaster-echarts",
- "name": "grandmaster-echarts",
- "component": "/echarts/grandmaster/index",
- "meta": Map{
- "title": "最强王者",
- },
- },
- {
- "id": 6018,
- "path": "gradeDistribution-echarts",
- "name": "gradeDistribution-echarts",
- "component": "/echarts/gradeDistribution/index",
- "meta": Map{
- "title": "玩家等级分布",
- },
- },
- {
- "id": 6019,
- "path": "roles-echarts",
- "name": "roles-echarts",
- "component": "/echarts/roles/index",
- "meta": Map{
- "title": "玩家拥有角色",
- },
- },
- {
- "id": 6020,
- "path": "heroLevelDistribution-echarts",
- "name": "heroLevelDistribution-echarts",
- "component": "/echarts/heroLevelDistribution/index",
- "meta": Map{
- "title": "角色等级分布",
- },
- },
- {
- "id": 6021,
- "path": "levelOutput-echarts",
- "name": "levelOutput-echarts",
- "component": "/echarts/levelOutput/index",
- "meta": Map{
- "title": "玩家等级产出",
- },
- },
- },
- })*/
- gameToolMap := make([]Map, 0)
- gameToolMap = append(gameToolMap, Map{
- "id": 7001,
- "path": "config",
- "name": "system_config",
- "component": "/system/config/config",
- "meta": Map{
- "title": "服务配置",
- },
- }, Map{
- "id": 7002,
- "path": "deploy",
- "name": "system_deploy",
- "component": "/deploy/index",
- "meta": Map{
- "title": "服务部署",
- },
- })
- //// 非正式环境加载工具库
- //if os.Getenv("GIN_MODE") != "release" && os.Getenv("GIN_MODE") != "" {
- // gameToolMap = append(gameToolMap, Map{
- // "path": "reboot",
- // "name": "system_reboot",
- // "component": "/system/reboot/index",
- // "meta": Map{
- // "title": "重启服务",
- // }})
- //}
- /*gameToolMap = append(gameToolMap, Map{
- "path": "activity-tool",
- "name": "activity-tool",
- "component": "/tool/activity/index",
- "meta": Map{
- "title": "活动查询",
- },
- })*/
- // 游戏工具
- lists = append(lists, Map{
- "id": 7,
- "path": "/tool",
- "name": "Tool",
- "component": "LAYOUT",
- "redirect": "/tool/index",
- "meta": Map{
- "icon": "ToolOutlined",
- "title": "游戏工具",
- "sort": 5,
- },
- "children": gameToolMap,
- })
- // 邮件通知
- /*lists = append(lists, Map{
- "id": 8,
- "path": "/email",
- "name": "email",
- "component": "LAYOUT",
- //"redirect": "/frame/docs",
- "meta": Map{
- "icon": "MailOutlined",
- "sort": 10,
- "isRoot": true,
- "activeMenu": "email_index",
- },
- "children": []Map{
- {
- "id": 8001,
- "path": "index",
- "name": "email_index",
- "component": "/email/index",
- "meta": Map{
- "title": "邮件通知",
- "activeMenu": "email_index",
- },
- }},
- })*/
- // 邮件通知
- /*lists = append(lists, Map{
- "id": 9,
- "path": "/Mail",
- "name": "mail",
- "component": "LAYOUT",
- //"redirect": "/frame/docs",
- "meta": Map{
- "icon": "MailOutlined",
- "sort": 10,
- "isRoot": true,
- "activeMenu": "mail_index",
- },
- "children": []Map{
- {
- "id": 9001,
- "path": "index",
- "name": "mail_index",
- "component": "/mail/index",
- "meta": Map{
- "title": "邮件通知(旧)",
- "activeMenu": "mail_index",
- },
- }},
- })*/
- // 广播通知
- /*lists = append(lists, Map{
- "id": 10,
- "path": "/notice",
- "name": "notice",
- "component": "LAYOUT",
- //"redirect": "/frame/docs",
- "meta": Map{
- "icon": "MegaphoneOutline",
- "sort": 10,
- "title": "广播管理",
- //"isRoot": true,
- //"activeMenu": "noticev2_index",
- },
- "children": []Map{
- {
- "id": 10001,
- "path": "noticev2_index", // ?
- "name": "noticev2_index",
- "component": "/noticev2/index",
- "meta": Map{
- "title": "广播通知",
- //"activeMenu": "noticev2_index",
- },
- },
- //{
- // "path": "index",
- // "name": "notice_index",
- // "component": "/notice/index",
- // "meta": Map{
- // "title": "广播通知(旧)",
- // //"activeMenu": "notice_index",
- // },
- //},
- },
- })*/
- // 客服记录
- /*lists = append(lists, Map{
- "id": 11,
- "path": "/chatLog",
- "name": "ChatLog",
- "component": "LAYOUT",
- "meta": Map{
- "icon": "ChatboxEllipsesOutline",
- "sort": 10,
- "title": "客服记录",
- "permissions": "ChatLog",
- },
- "children": []Map{
- {
- "id": 11001,
- "path": "chatLog-index",
- "name": "chatLog-index",
- "component": "/chatLog/index",
- "meta": Map{
- "title": "客服记录",
- },
- },
- },
- })*/
- // 兑换码
- /*lists = append(lists, Map{
- "id": 12,
- "path": "/cdk",
- "name": "cdk",
- "component": "LAYOUT",
- //"redirect": "/frame/docs",
- "meta": Map{
- "icon": "TicketOutline",
- "sort": 10,
- //"isRoot": true,
- //"activeMenu": "cdk_index",
- "title": "兑换码管理",
- },
- "children": []Map{
- {
- "id": 12001,
- "path": "index",
- "name": "cdk_index",
- "component": "/cdk/index",
- "meta": Map{
- "title": "批次列表",
- "activeMenu": "cdk_index",
- },
- },
- {
- "id": 12002,
- "path": "cdk-redeemCodeList/:sn?",
- "name": "cdk-redeemCodeList",
- "component": "/cdk/redeemCodeList",
- "meta": Map{
- "title": "兑换码列表",
- //"hidden": true,
- //"activeMenu": "cdk_index",
- },
- },
- },
- })*/
- // 设置页面
- lists = append(lists, Map{
- "id": 13,
- "path": "/setting",
- "name": "Setting",
- "component": "LAYOUT",
- "redirect": "/setting/account",
- "meta": Map{
- "icon": "SettingOutlined",
- "title": "账户设置",
- "sort": 20,
- },
- "hidden": false,
- "children": []Map{
- {
- "id": 13001,
- "path": "account",
- "name": "setting-account",
- "component": "/setting/account/account",
- "meta": Map{
- "title": "个人信息",
- },
- },
- //{
- // "path": "info",
- // "name": "result-info",
- // "component": "/setting/system/system",
- // "meta": Map{
- // "title": "信息页",
- // },
- //},
- {
- "id": 13002,
- "path": "log",
- "name": "log-index",
- "component": "/log/index",
- "meta": Map{
- "title": "操作日志",
- },
- },
- {
- "id": 13003,
- "path": "log-view/:id?",
- "name": "log-view",
- "component": "/log/view",
- "meta": Map{
- "title": "日志详情",
- "hidden": true,
- "activeMenu": "log-index",
- },
- },
- },
- })
- t := c.GetHeader("authorization")
- // 管理后台切换
- lists = append(lists, Map{
- "id": 14,
- "path": "/server_select",
- "name": "ServerSelect",
- "component": "LAYOUT",
- "meta": Map{
- "icon": "ServerOutline",
- "title": "管理后台切换",
- "sort": 5,
- },
- "children": []Map{
- {
- "id": 14001,
- "path": "/redirect",
- "name": "http://101.43.249.6:7004/gadmin/?access-token=%s" + t,
- "component": "LAYOUT",
- "meta": Map{
- "title": "魔君测试服",
- },
- },
- {
- "id": 14002,
- "path": "/redirect",
- "name": "http://101.43.249.6:7006/cadmin/?access-token=" + t,
- "component": "LAYOUT",
- "meta": Map{
- "title": "空之契约测试服",
- },
- },
- {
- "id": 14003,
- "path": "/redirect",
- "name": "http://192.168.0.186:8253/gadmin/?access-token=" + t,
- "component": "LAYOUT",
- "meta": Map{
- "title": "魔君本地",
- },
- },
- },
- })
- // 文档
- if localHidden == false {
- lists = append(lists, Map{
- "id": 15,
- "path": "/external",
- "name": "https://www.naiveui.com",
- "component": "LAYOUT",
- "meta": Map{
- "icon": "DocumentTextOutline",
- "title": "NaiveUi文档",
- "sort": 99,
- },
- "children": []Map{},
- })
- }
- return lists
- }
|