menu.go 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993
  1. package api
  2. import (
  3. "context"
  4. "gadmin/config"
  5. "gadmin/internal/admin/forms"
  6. "gadmin/internal/admin/service"
  7. "gadmin/internal/gorm/query"
  8. "gadmin/utility/character"
  9. "gadmin/utility/serializer"
  10. "github.com/gin-gonic/gin"
  11. "github.com/sirupsen/logrus"
  12. "os"
  13. "sort"
  14. "strings"
  15. )
  16. type (
  17. Map = map[string]interface{}
  18. )
  19. func MenuDynamic(c *gin.Context) {
  20. list, err := GetRoleMenuList(c)
  21. if err != nil {
  22. c.JSON(200, ErrorResponse(err))
  23. return
  24. }
  25. c.JSON(200, serializer.Suc(list, "获取成功"))
  26. return
  27. }
  28. func GetRoleMenuList(c *gin.Context) ([]*forms.Menu, error) {
  29. //lists := GetMenuList(c)
  30. lists, err := service.Menu.GetMenuList()
  31. if err != nil {
  32. return nil, err
  33. }
  34. t := c.GetHeader("authorization")
  35. for _, item := range lists {
  36. if strings.Contains(item.Name, "{access-token}") {
  37. item.Name = strings.ReplaceAll(item.Name, "{access-token}", t)
  38. }
  39. if len(item.Children) > 0 {
  40. for _, children := range item.Children {
  41. if strings.Contains(children.Name, "{access-token}") {
  42. children.Name = strings.ReplaceAll(children.Name, "{access-token}", t)
  43. }
  44. }
  45. }
  46. }
  47. // 获取角色可查看的页面
  48. roleId, _ := c.Get("admin_role_id")
  49. // 超管查看所有页面
  50. if config.IsSuperRole(roleId.(int64)) {
  51. return lists, nil
  52. }
  53. var rolePages []int32
  54. rdb := query.Use(config.DB).AdminRoleMenu
  55. m := rdb.WithContext(context.Background())
  56. err = m.Where(rdb.RoleID.Eq(int32(roleId.(int64)))).Pluck(rdb.PageID, &rolePages)
  57. if err != nil {
  58. logrus.Error("AdminRole... err:%+v", err)
  59. return nil, err
  60. }
  61. newList := make([]*forms.Menu, 0)
  62. if len(rolePages) == 0 { // 没有配置权限默认全部
  63. newList = lists
  64. } else {
  65. tmpPages := make(map[int32]*forms.Menu)
  66. for _, item := range lists {
  67. if character.InSlice(rolePages, item.Id) {
  68. tmpPages[item.Id] = &forms.Menu{
  69. Id: item.Id,
  70. Component: item.Component,
  71. Meta: item.Meta,
  72. Name: item.Name,
  73. Path: item.Name,
  74. Redirect: item.Redirect,
  75. Children: []*forms.Menu{},
  76. }
  77. }
  78. if len(item.Children) > 0 {
  79. for _, children := range item.Children {
  80. if !character.InSlice(rolePages, children.Id) {
  81. continue
  82. }
  83. if _, ok2 := tmpPages[item.Id]; ok2 {
  84. tmpPages[item.Id].Children = append(tmpPages[item.Id].Children, children)
  85. } else {
  86. tmpPages[item.Id] = &forms.Menu{
  87. Id: item.Id,
  88. Component: item.Component,
  89. Meta: item.Meta,
  90. Name: item.Name,
  91. Path: item.Name,
  92. Redirect: item.Redirect,
  93. Children: []*forms.Menu{children},
  94. }
  95. }
  96. }
  97. }
  98. }
  99. for _, item := range tmpPages {
  100. sort.Slice(item.Children, func(i, j int) bool {
  101. return item.Children[i].Meta.Sort < item.Children[j].Meta.Sort
  102. })
  103. newList = append(newList, item)
  104. }
  105. }
  106. // 排序
  107. sort.Slice(newList, func(i, j int) bool {
  108. return newList[i].Meta.Sort < newList[j].Meta.Sort
  109. })
  110. return newList, nil
  111. }
  112. func GetMenuList(c *gin.Context) []Map {
  113. var (
  114. lists []Map
  115. localHidden = true // 本地显示的菜单
  116. )
  117. if os.Getenv("ADMIN_IS_LOCAL") == "1" {
  118. localHidden = false
  119. }
  120. // 控制台
  121. lists = append(lists, Map{
  122. "id": 1,
  123. "path": "/dashboard",
  124. "name": "Dashboard",
  125. "component": "LAYOUT",
  126. "redirect": "/dashboard/console",
  127. "meta": Map{
  128. "title": "Dashboard",
  129. "icon": "DashboardOutlined",
  130. },
  131. "children": []Map{
  132. {
  133. "id": 1001,
  134. "path": "console",
  135. "name": "dashboard_console",
  136. "component": "/dashboard/console/console",
  137. "meta": Map{
  138. "title": "主控台",
  139. },
  140. },
  141. },
  142. })
  143. // 玩家管理
  144. lists = append(lists, Map{
  145. "id": 2,
  146. "path": "/account",
  147. "name": "Account",
  148. "component": "LAYOUT",
  149. "redirect": "/account/account-list",
  150. "meta": Map{
  151. "icon": "UserOutlined",
  152. "title": "玩家管理",
  153. "sort": 2,
  154. },
  155. "children": []Map{
  156. {
  157. "id": 2001,
  158. "path": "account-list",
  159. "name": "account-list",
  160. "component": "/account/accountList/index",
  161. "meta": Map{
  162. "title": "玩家列表",
  163. },
  164. },
  165. {
  166. "id": 2002,
  167. "path": "account-info/:id?",
  168. "name": "account-info",
  169. "component": "/account/accountList/info",
  170. "meta": Map{
  171. "title": "基础详情",
  172. "hidden": true,
  173. "activeMenu": "account-list",
  174. },
  175. },
  176. {
  177. "id": 2003,
  178. "path": "account-search",
  179. "name": "account-search",
  180. "component": "/account/accountList/search",
  181. "meta": Map{
  182. "title": "全服查找",
  183. },
  184. },
  185. /*{
  186. "path": "account-banLogs",
  187. "name": "account-banLogs",
  188. "component": "/account/accountList/banLogs",
  189. "meta": Map{
  190. "title": "拉黑记录",
  191. },
  192. },
  193. {
  194. "path": "retrofit-list",
  195. "name": "retrofit-list",
  196. "component": "/retrofit/index",
  197. "meta": Map{
  198. "title": "配装模板",
  199. },
  200. },
  201. {
  202. "path": "consumption-details",
  203. "name": "consumption-details",
  204. "component": "/recharge/consumption/index",
  205. "meta": Map{
  206. "title": "消费变动记录",
  207. },
  208. },
  209. {
  210. "path": "consumption-statistics",
  211. "name": "consumption-statistics",
  212. "component": "/recharge/consumptionStatistics/index",
  213. "meta": Map{
  214. "title": "消费统计",
  215. },
  216. },
  217. {
  218. "path": "game-data-alarm",
  219. "name": "game-data-alarm",
  220. "component": "/account/gameDataAlarm/index",
  221. "meta": Map{
  222. "title": "游戏异常",
  223. },
  224. },
  225. {
  226. "path": "game-cheating-alarm",
  227. "name": "game-cheating-alarm",
  228. "component": "/account/gameCheatingAlarm/index",
  229. "meta": Map{
  230. "title": "作弊数据筛选",
  231. },
  232. },
  233. {
  234. "path": "chat-report-list",
  235. "name": "chat-report-list",
  236. "component": "/account/chatReportList/index",
  237. "meta": Map{
  238. "title": "聊天举报记录",
  239. },
  240. },
  241. {
  242. "path": "chat-log-list",
  243. "name": "chat-log-list",
  244. "component": "/account/chatLogList/index",
  245. "meta": Map{
  246. "title": "聊天记录",
  247. },
  248. },*/
  249. },
  250. })
  251. if config.IsSuperRole(service.User.GetUserRoleId(c)) {
  252. // 权限管理
  253. lists = append(lists, Map{
  254. "id": 3,
  255. "path": "/permission",
  256. "name": "Permission",
  257. "component": "LAYOUT",
  258. "redirect": "/permission/menu",
  259. "meta": Map{
  260. "icon": "SafetyCertificateOutlined",
  261. "title": "权限管理",
  262. "sort": 1,
  263. },
  264. "children": []Map{
  265. {
  266. "id": 3003,
  267. "path": "menu",
  268. "name": "permission_menu",
  269. "component": "/permission/menu/menu",
  270. "meta": Map{
  271. "title": "菜单权限",
  272. },
  273. },
  274. {
  275. "id": 3001,
  276. "path": "user",
  277. "name": "permission_user",
  278. "component": "/permission/user/user",
  279. "meta": Map{
  280. "title": "后台用户",
  281. },
  282. },
  283. {
  284. "id": 3002,
  285. "path": "role",
  286. "name": "permission_role",
  287. "component": "/permission/role/role",
  288. "meta": Map{
  289. "title": "角色管理",
  290. },
  291. },
  292. },
  293. })
  294. }
  295. // 充值管理
  296. /*lists = append(lists, Map{
  297. "id": 4,
  298. "path": "/recharge",
  299. "name": "Recharge",
  300. "component": "LAYOUT",
  301. "redirect": "/recharge/recharge-list",
  302. "meta": Map{
  303. "icon": "PayCircleOutlined",
  304. "title": "充值订单",
  305. "sort": 2,
  306. },
  307. "children": []Map{
  308. {
  309. "id": 4001,
  310. "path": "recharge-list",
  311. "name": "recharge-list",
  312. "component": "/recharge/rechargeList/index",
  313. "meta": Map{
  314. "title": "订单记录",
  315. },
  316. },
  317. {
  318. "id": 4002,
  319. "path": "recharge-dailyStatistics",
  320. "name": "recharge-dailyStatistics",
  321. "component": "/recharge/dailyStatistics/index",
  322. "meta": Map{
  323. "title": "每日统计",
  324. },
  325. },
  326. {
  327. "id": 4003,
  328. "path": "recharge-ordersSettle",
  329. "name": "recharge-ordersSettle",
  330. "component": "/recharge/ordersSettle/index",
  331. "meta": Map{
  332. "title": "余额平账",
  333. "keepAlive": true,
  334. },
  335. },
  336. {
  337. "id": 4004,
  338. "path": "recharge-abnormalOrder",
  339. "name": "recharge-abnormalOrder",
  340. "component": "/recharge/abnormalOrder/index",
  341. "meta": Map{
  342. "title": "异常订单",
  343. "keepAlive": true,
  344. },
  345. },
  346. },
  347. })*/
  348. // 排行榜
  349. /*lists = append(lists, Map{
  350. "id": 5,
  351. "path": "/ranking",
  352. "name": "Ranking",
  353. "component": "LAYOUT",
  354. "redirect": "/ranking/index",
  355. "meta": Map{
  356. "icon": "CellularOutline",
  357. "title": "排行榜",
  358. "sort": 2,
  359. },
  360. "children": []Map{
  361. {
  362. "id": 5001,
  363. "path": "recharge-ranking",
  364. "name": "recharge-ranking",
  365. "component": "/ranking/recharge/index",
  366. "meta": Map{
  367. "title": "充值排行",
  368. },
  369. },
  370. {
  371. "id": 5002,
  372. "path": "diamond-ranking",
  373. "name": "diamond-ranking",
  374. "component": "/ranking/diamond/index",
  375. "meta": Map{
  376. "title": "消费排行",
  377. },
  378. },
  379. {
  380. "id": 5003,
  381. "path": "level-ranking",
  382. "name": "level-ranking",
  383. "component": "/ranking/level/index",
  384. "meta": Map{
  385. "title": "等级排行",
  386. },
  387. },
  388. {
  389. "id": 5004,
  390. "path": "elrank-ranking",
  391. "name": "elrank-ranking",
  392. "component": "/ranking/elrank/index",
  393. "meta": Map{
  394. "title": "无尽排行",
  395. },
  396. },
  397. {
  398. "id": 5005,
  399. "path": "duel-ranking",
  400. "name": "duel-ranking",
  401. "component": "/ranking/duel/index",
  402. "meta": Map{
  403. "title": "狭路排行",
  404. },
  405. },
  406. {
  407. "id": 5006,
  408. "path": "gudong-ranking",
  409. "name": "gudong-ranking",
  410. "component": "/ranking/gudong/index",
  411. "meta": Map{
  412. "title": "古玩排行",
  413. },
  414. },
  415. {
  416. "id": 5007,
  417. "path": "idiom-ranking",
  418. "name": "idiom-ranking",
  419. "component": "/ranking/idiom/index",
  420. "meta": Map{
  421. "title": "金榜题名",
  422. },
  423. },
  424. {
  425. "id": 5008,
  426. "path": "boss-ranking",
  427. "name": "boss-ranking",
  428. "component": "/ranking/boss/index",
  429. "meta": Map{
  430. "title": "暗影突袭",
  431. },
  432. },
  433. {
  434. "id": 5009,
  435. "path": "adv-ranking",
  436. "name": "adv-ranking",
  437. "component": "/ranking/adv/index",
  438. "meta": Map{
  439. "title": "看广告排行",
  440. },
  441. },
  442. {
  443. "id": 5010,
  444. "path": "login-ranking",
  445. "name": "login-ranking",
  446. "component": "/ranking/login/index",
  447. "meta": Map{
  448. "title": "登录排行",
  449. },
  450. },
  451. },
  452. })*/
  453. // 数据统计
  454. /*lists = append(lists, Map{
  455. "id": 6,
  456. "path": "/echarts",
  457. "name": "Echarts",
  458. "component": "LAYOUT",
  459. "redirect": "/echarts/index",
  460. "meta": Map{
  461. "icon": "BarChartOutline",
  462. "title": "数据统计",
  463. "sort": 2,
  464. },
  465. "children": []Map{
  466. {
  467. "id": 6001,
  468. "path": "login-echarts",
  469. "name": "login-echarts",
  470. "component": "/echarts/login/index",
  471. "meta": Map{
  472. "title": "登录数据",
  473. },
  474. },
  475. {
  476. "id": 6002,
  477. "path": "chapter-echarts",
  478. "name": "chapter-echarts",
  479. "component": "/echarts/chapter/index",
  480. "meta": Map{
  481. "title": "关卡数据",
  482. },
  483. },
  484. {
  485. "id": 6003,
  486. "path": "basic-echarts",
  487. "name": "basic-echarts",
  488. "component": "/echarts/basic/index",
  489. "meta": Map{
  490. "title": "基础数据",
  491. },
  492. },
  493. {
  494. "id": 6004,
  495. "path": "adv-echarts",
  496. "name": "adv-echarts",
  497. "component": "/echarts/adv/index",
  498. "meta": Map{
  499. "title": "广告数据",
  500. },
  501. },
  502. {
  503. "id": 6005,
  504. "path": "echarts-tests",
  505. "name": "echarts-tests",
  506. "component": "/echarts/adv/index2",
  507. "meta": Map{
  508. "hidden": localHidden,
  509. "title": "图表测试",
  510. },
  511. },
  512. {
  513. "id": 6006,
  514. "path": "goods-echarts",
  515. "name": "goods-echarts",
  516. "component": "/echarts/goods/index",
  517. "meta": Map{
  518. "title": "商品数据",
  519. },
  520. },
  521. {
  522. "id": 6007,
  523. "path": "gudong-echarts",
  524. "name": "gudong-echarts",
  525. "component": "/echarts/gudong/index",
  526. "meta": Map{
  527. "title": "古玩数据",
  528. },
  529. },
  530. {
  531. "id": 6008,
  532. "path": "duel-echarts",
  533. "name": "duel-echarts",
  534. "component": "/echarts/duel/index",
  535. "meta": Map{
  536. "title": "狭路对决",
  537. },
  538. },
  539. {
  540. "id": 6009,
  541. "path": "expedition-echarts",
  542. "name": "expedition-echarts",
  543. "component": "/echarts/expedition/index",
  544. "meta": Map{
  545. "title": "远征数据",
  546. },
  547. },
  548. {
  549. "id": 6010,
  550. "path": "idiom-echarts",
  551. "name": "idiom-echarts",
  552. "component": "/echarts/idiom/index",
  553. "meta": Map{
  554. "title": "金榜题名",
  555. },
  556. },
  557. {
  558. "id": 6011,
  559. "path": "boss-echarts",
  560. "name": "boss-echarts",
  561. "component": "/echarts/boss/index",
  562. "meta": Map{
  563. "title": "暗影突袭",
  564. },
  565. },
  566. {
  567. "id": 6012,
  568. "path": "seven-echarts",
  569. "name": "seven-echarts",
  570. "component": "/echarts/seven/index",
  571. "meta": Map{
  572. "title": "七日任务",
  573. },
  574. },
  575. {
  576. "id": 6013,
  577. "path": "disconnect-echarts",
  578. "name": "disconnect-echarts",
  579. "component": "/echarts/disconnect/index",
  580. "meta": Map{
  581. "title": "重连数据",
  582. },
  583. },
  584. {
  585. "id": 6014,
  586. "path": "gem-echarts",
  587. "name": "gem-echarts",
  588. "component": "/echarts/gem/index",
  589. "meta": Map{
  590. "title": "宝石数据",
  591. },
  592. },
  593. {
  594. "id": 6015,
  595. "path": "limitgift-echarts",
  596. "name": "limitgift-echarts",
  597. "component": "/echarts/limitgift/index",
  598. "meta": Map{
  599. "title": "限时礼包",
  600. },
  601. },
  602. {
  603. "id": 6016,
  604. "path": "treasure-echarts",
  605. "name": "treasure-echarts",
  606. "component": "/echarts/treasure/index",
  607. "meta": Map{
  608. "title": "宝物数据",
  609. },
  610. },
  611. {
  612. "id": 6017,
  613. "path": "grandmaster-echarts",
  614. "name": "grandmaster-echarts",
  615. "component": "/echarts/grandmaster/index",
  616. "meta": Map{
  617. "title": "最强王者",
  618. },
  619. },
  620. {
  621. "id": 6018,
  622. "path": "gradeDistribution-echarts",
  623. "name": "gradeDistribution-echarts",
  624. "component": "/echarts/gradeDistribution/index",
  625. "meta": Map{
  626. "title": "玩家等级分布",
  627. },
  628. },
  629. {
  630. "id": 6019,
  631. "path": "roles-echarts",
  632. "name": "roles-echarts",
  633. "component": "/echarts/roles/index",
  634. "meta": Map{
  635. "title": "玩家拥有角色",
  636. },
  637. },
  638. {
  639. "id": 6020,
  640. "path": "heroLevelDistribution-echarts",
  641. "name": "heroLevelDistribution-echarts",
  642. "component": "/echarts/heroLevelDistribution/index",
  643. "meta": Map{
  644. "title": "角色等级分布",
  645. },
  646. },
  647. {
  648. "id": 6021,
  649. "path": "levelOutput-echarts",
  650. "name": "levelOutput-echarts",
  651. "component": "/echarts/levelOutput/index",
  652. "meta": Map{
  653. "title": "玩家等级产出",
  654. },
  655. },
  656. },
  657. })*/
  658. gameToolMap := make([]Map, 0)
  659. gameToolMap = append(gameToolMap, Map{
  660. "id": 7001,
  661. "path": "config",
  662. "name": "system_config",
  663. "component": "/system/config/config",
  664. "meta": Map{
  665. "title": "服务配置",
  666. },
  667. }, Map{
  668. "id": 7002,
  669. "path": "deploy",
  670. "name": "system_deploy",
  671. "component": "/deploy/index",
  672. "meta": Map{
  673. "title": "服务部署",
  674. },
  675. })
  676. //// 非正式环境加载工具库
  677. //if os.Getenv("GIN_MODE") != "release" && os.Getenv("GIN_MODE") != "" {
  678. // gameToolMap = append(gameToolMap, Map{
  679. // "path": "reboot",
  680. // "name": "system_reboot",
  681. // "component": "/system/reboot/index",
  682. // "meta": Map{
  683. // "title": "重启服务",
  684. // }})
  685. //}
  686. /*gameToolMap = append(gameToolMap, Map{
  687. "path": "activity-tool",
  688. "name": "activity-tool",
  689. "component": "/tool/activity/index",
  690. "meta": Map{
  691. "title": "活动查询",
  692. },
  693. })*/
  694. // 游戏工具
  695. lists = append(lists, Map{
  696. "id": 7,
  697. "path": "/tool",
  698. "name": "Tool",
  699. "component": "LAYOUT",
  700. "redirect": "/tool/index",
  701. "meta": Map{
  702. "icon": "ToolOutlined",
  703. "title": "游戏工具",
  704. "sort": 5,
  705. },
  706. "children": gameToolMap,
  707. })
  708. // 邮件通知
  709. /*lists = append(lists, Map{
  710. "id": 8,
  711. "path": "/email",
  712. "name": "email",
  713. "component": "LAYOUT",
  714. //"redirect": "/frame/docs",
  715. "meta": Map{
  716. "icon": "MailOutlined",
  717. "sort": 10,
  718. "isRoot": true,
  719. "activeMenu": "email_index",
  720. },
  721. "children": []Map{
  722. {
  723. "id": 8001,
  724. "path": "index",
  725. "name": "email_index",
  726. "component": "/email/index",
  727. "meta": Map{
  728. "title": "邮件通知",
  729. "activeMenu": "email_index",
  730. },
  731. }},
  732. })*/
  733. // 邮件通知
  734. /*lists = append(lists, Map{
  735. "id": 9,
  736. "path": "/Mail",
  737. "name": "mail",
  738. "component": "LAYOUT",
  739. //"redirect": "/frame/docs",
  740. "meta": Map{
  741. "icon": "MailOutlined",
  742. "sort": 10,
  743. "isRoot": true,
  744. "activeMenu": "mail_index",
  745. },
  746. "children": []Map{
  747. {
  748. "id": 9001,
  749. "path": "index",
  750. "name": "mail_index",
  751. "component": "/mail/index",
  752. "meta": Map{
  753. "title": "邮件通知(旧)",
  754. "activeMenu": "mail_index",
  755. },
  756. }},
  757. })*/
  758. // 广播通知
  759. /*lists = append(lists, Map{
  760. "id": 10,
  761. "path": "/notice",
  762. "name": "notice",
  763. "component": "LAYOUT",
  764. //"redirect": "/frame/docs",
  765. "meta": Map{
  766. "icon": "MegaphoneOutline",
  767. "sort": 10,
  768. "title": "广播管理",
  769. //"isRoot": true,
  770. //"activeMenu": "noticev2_index",
  771. },
  772. "children": []Map{
  773. {
  774. "id": 10001,
  775. "path": "noticev2_index", // ?
  776. "name": "noticev2_index",
  777. "component": "/noticev2/index",
  778. "meta": Map{
  779. "title": "广播通知",
  780. //"activeMenu": "noticev2_index",
  781. },
  782. },
  783. //{
  784. // "path": "index",
  785. // "name": "notice_index",
  786. // "component": "/notice/index",
  787. // "meta": Map{
  788. // "title": "广播通知(旧)",
  789. // //"activeMenu": "notice_index",
  790. // },
  791. //},
  792. },
  793. })*/
  794. // 客服记录
  795. /*lists = append(lists, Map{
  796. "id": 11,
  797. "path": "/chatLog",
  798. "name": "ChatLog",
  799. "component": "LAYOUT",
  800. "meta": Map{
  801. "icon": "ChatboxEllipsesOutline",
  802. "sort": 10,
  803. "title": "客服记录",
  804. "permissions": "ChatLog",
  805. },
  806. "children": []Map{
  807. {
  808. "id": 11001,
  809. "path": "chatLog-index",
  810. "name": "chatLog-index",
  811. "component": "/chatLog/index",
  812. "meta": Map{
  813. "title": "客服记录",
  814. },
  815. },
  816. },
  817. })*/
  818. // 兑换码
  819. /*lists = append(lists, Map{
  820. "id": 12,
  821. "path": "/cdk",
  822. "name": "cdk",
  823. "component": "LAYOUT",
  824. //"redirect": "/frame/docs",
  825. "meta": Map{
  826. "icon": "TicketOutline",
  827. "sort": 10,
  828. //"isRoot": true,
  829. //"activeMenu": "cdk_index",
  830. "title": "兑换码管理",
  831. },
  832. "children": []Map{
  833. {
  834. "id": 12001,
  835. "path": "index",
  836. "name": "cdk_index",
  837. "component": "/cdk/index",
  838. "meta": Map{
  839. "title": "批次列表",
  840. "activeMenu": "cdk_index",
  841. },
  842. },
  843. {
  844. "id": 12002,
  845. "path": "cdk-redeemCodeList/:sn?",
  846. "name": "cdk-redeemCodeList",
  847. "component": "/cdk/redeemCodeList",
  848. "meta": Map{
  849. "title": "兑换码列表",
  850. //"hidden": true,
  851. //"activeMenu": "cdk_index",
  852. },
  853. },
  854. },
  855. })*/
  856. // 设置页面
  857. lists = append(lists, Map{
  858. "id": 13,
  859. "path": "/setting",
  860. "name": "Setting",
  861. "component": "LAYOUT",
  862. "redirect": "/setting/account",
  863. "meta": Map{
  864. "icon": "SettingOutlined",
  865. "title": "账户设置",
  866. "sort": 20,
  867. },
  868. "hidden": false,
  869. "children": []Map{
  870. {
  871. "id": 13001,
  872. "path": "account",
  873. "name": "setting-account",
  874. "component": "/setting/account/account",
  875. "meta": Map{
  876. "title": "个人信息",
  877. },
  878. },
  879. //{
  880. // "path": "info",
  881. // "name": "result-info",
  882. // "component": "/setting/system/system",
  883. // "meta": Map{
  884. // "title": "信息页",
  885. // },
  886. //},
  887. {
  888. "id": 13002,
  889. "path": "log",
  890. "name": "log-index",
  891. "component": "/log/index",
  892. "meta": Map{
  893. "title": "操作日志",
  894. },
  895. },
  896. {
  897. "id": 13003,
  898. "path": "log-view/:id?",
  899. "name": "log-view",
  900. "component": "/log/view",
  901. "meta": Map{
  902. "title": "日志详情",
  903. "hidden": true,
  904. "activeMenu": "log-index",
  905. },
  906. },
  907. },
  908. })
  909. t := c.GetHeader("authorization")
  910. // 管理后台切换
  911. lists = append(lists, Map{
  912. "id": 14,
  913. "path": "/server_select",
  914. "name": "ServerSelect",
  915. "component": "LAYOUT",
  916. "meta": Map{
  917. "icon": "ServerOutline",
  918. "title": "管理后台切换",
  919. "sort": 5,
  920. },
  921. "children": []Map{
  922. {
  923. "id": 14001,
  924. "path": "/redirect",
  925. "name": "http://101.43.249.6:7004/gadmin/?access-token=%s" + t,
  926. "component": "LAYOUT",
  927. "meta": Map{
  928. "title": "魔君测试服",
  929. },
  930. },
  931. {
  932. "id": 14002,
  933. "path": "/redirect",
  934. "name": "http://101.43.249.6:7006/cadmin/?access-token=" + t,
  935. "component": "LAYOUT",
  936. "meta": Map{
  937. "title": "空之契约测试服",
  938. },
  939. },
  940. {
  941. "id": 14003,
  942. "path": "/redirect",
  943. "name": "http://192.168.0.186:8253/gadmin/?access-token=" + t,
  944. "component": "LAYOUT",
  945. "meta": Map{
  946. "title": "魔君本地",
  947. },
  948. },
  949. },
  950. })
  951. // 文档
  952. if localHidden == false {
  953. lists = append(lists, Map{
  954. "id": 15,
  955. "path": "/external",
  956. "name": "https://www.naiveui.com",
  957. "component": "LAYOUT",
  958. "meta": Map{
  959. "icon": "DocumentTextOutline",
  960. "title": "NaiveUi文档",
  961. "sort": 99,
  962. },
  963. "children": []Map{},
  964. })
  965. }
  966. return lists
  967. }