Menu.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. <?php
  2. declare (strict_types=1);
  3. namespace app\controller;
  4. use app\BaseController;
  5. use app\service\MenuService;
  6. use app\service\PermissionService;
  7. class Menu extends BaseController
  8. {
  9. /**
  10. * 获取用户菜单列表
  11. */
  12. public function getUserMenus()
  13. {
  14. // return json_success([
  15. // [
  16. // 'meta' => [
  17. // 'title' => 'page.dashboard.title'
  18. // ],
  19. // 'name' => 'Dashboard',
  20. // 'path' => '/',
  21. // 'redirect' => '/analytics',
  22. // 'children' => [
  23. // [
  24. // 'name' => 'Analytics',
  25. // 'path' => '/analytics',
  26. // 'component' => '/dashboard/analytics/index',
  27. // 'meta' => [
  28. // 'affixTab' => true,
  29. // 'title' => 'page.dashboard.analytics'
  30. // ]
  31. // ]
  32. // ]
  33. // ]
  34. // ]);
  35. $webMenu = [];
  36. $webMenu[] = [
  37. "meta" => [
  38. "icon" => "solar:widget-5-linear",
  39. "order" => -1,
  40. "title" => "page.dashboard.title",
  41. ],
  42. "name" => "Dashboard",
  43. "path" => "/dashboard",
  44. "children" => [
  45. [
  46. "name" => "Analytics",
  47. "path" => "/analytics",
  48. "component" => "/dashboard/analytics/index.vue",
  49. "meta" => [
  50. "affixTab" => true,
  51. "icon" => "lucide:area-chart",
  52. "title" => "dashboard.analytics_title",
  53. ],
  54. ],
  55. [
  56. "name" => "GgrReport",
  57. "path" => "/ggr-report",
  58. "component" => "/dashboard/ggr_report/index.vue",
  59. "meta" => [
  60. "icon" => "solar:align-bottom-outline",
  61. "title" => "dashboard.ggr_report_title",
  62. ],
  63. ],
  64. ],
  65. ];
  66. // 综合数据
  67. $webMenu[] = [
  68. "meta" => [
  69. "keepAlive" => true,
  70. "icon" => "solar:cloud-check-outline",
  71. "order" => 1,
  72. "title" => "data_statistics.title",
  73. ],
  74. "name" => "DataStatistics",
  75. "path" => "/data-statistics",
  76. "children" => [
  77. [
  78. "meta" => [
  79. "title" => "data_statistics.data_agent_title",
  80. "icon" => "solar:server-minimalistic-linear",
  81. "keepAlive" => true,
  82. ],
  83. "name" => "Agent",
  84. "path" => "/data-statistics/agent",
  85. "component" => "/data_statistics/agent/index.vue",
  86. ],
  87. [
  88. "meta" => [
  89. "title" => "data_statistics.daily_title",
  90. "icon" => "solar:notebook-linear",
  91. "keepAlive" => true,
  92. ],
  93. "name" => "Daily",
  94. "path" => "/data-statistics/daily",
  95. "children" => [
  96. [
  97. "meta" => [
  98. "title" => "data_statistics.agent_title",
  99. "keepAlive" => true,
  100. ],
  101. "name" => "DailyAgent",
  102. "path" => "/data-statistics/daily/agent",
  103. "component" => "/data_statistics/daily/agent/index.vue",
  104. ],
  105. [
  106. "meta" => [
  107. "title" => "data_statistics.game_title",
  108. "keepAlive" => true,
  109. ],
  110. "name" => "DailyGame",
  111. "path" => "/data-statistics/daily/game",
  112. "component" => "/data_statistics/daily/game/index.vue",
  113. ],
  114. ],
  115. ],
  116. [
  117. "meta" => [
  118. "title" => "data_statistics.history_title",
  119. "icon" => "solar:sort-by-time-outline",
  120. "keepAlive" => true,
  121. ],
  122. "name" => "History",
  123. "path" => "/data-statistics/history",
  124. "children" => [
  125. [
  126. "meta" => [
  127. "title" => "data_statistics.history_agent_title",
  128. "keepAlive" => true,
  129. ],
  130. "name" => "HistoryAgent",
  131. "path" => "/data-statistics/history/agent",
  132. "component" => "/data_statistics/history/agent/index.vue",
  133. ],
  134. ],
  135. ],
  136. [
  137. "meta" => [
  138. "title" => "data_statistics.trend_title",
  139. "icon" => "solar:chart-square-outline",
  140. "keepAlive" => true,
  141. ],
  142. "name" => "Trend",
  143. "path" => "/data-statistics/trend",
  144. "children" => [
  145. [
  146. "meta" => [
  147. "title" => "data_statistics.trend_win_lose_title",
  148. "keepAlive" => true,
  149. ],
  150. "name" => "TrendWinLose",
  151. "path" => "/data-statistics/trend/win_lose",
  152. "component" => "/data_statistics/trend/win_lose/index.vue",
  153. ],
  154. [
  155. "meta" => [
  156. "title" => "data_statistics.trend_rewards_title",
  157. "keepAlive" => true,
  158. ],
  159. "name" => "TrendRewards",
  160. "path" => "/data-statistics/trend/rewards",
  161. "component" => "/data_statistics/trend/rewards/index.vue",
  162. ],
  163. [
  164. "meta" => [
  165. "title" => "data_statistics.trend_agent_title",
  166. "keepAlive" => true,
  167. ],
  168. "name" => "TrendAgent",
  169. "path" => "/data-statistics/trend/agent",
  170. "component" => "/data_statistics/trend/agent/index.vue",
  171. ],
  172. ],
  173. ],
  174. [
  175. "meta" => [
  176. "title" => "data_statistics.rank_title",
  177. "icon" => "solar:ranking-outline",
  178. "keepAlive" => true,
  179. ],
  180. "name" => "Rank",
  181. "path" => "/data-statistics/rank",
  182. "children" => [
  183. [
  184. "meta" => [
  185. "title" => "data_statistics.rank_win_title",
  186. "keepAlive" => true,
  187. ],
  188. "name" => "RankWin",
  189. "path" => "/data-statistics/rank/win",
  190. "component" => "/data_statistics/rank/win/index.vue",
  191. ],
  192. [
  193. "meta" => [
  194. "title" => "data_statistics.rank_lose_title",
  195. "keepAlive" => true,
  196. ],
  197. "name" => "RankLose",
  198. "path" => "/data-statistics/rank/lose",
  199. "component" => "/data_statistics/rank/lose/index.vue",
  200. ],
  201. [
  202. "meta" => [
  203. "title" => "data_statistics.rank_bet_title",
  204. "keepAlive" => true,
  205. ],
  206. "name" => "RankBet",
  207. "path" => "/data-statistics/rank/bet_amount",
  208. "component" => "/data_statistics/rank/bet/index.vue",
  209. ],
  210. ],
  211. ],
  212. ],
  213. ];
  214. // 玩家数据
  215. $webMenu[] = [
  216. "meta" => [
  217. "keepAlive" => true,
  218. "icon" => "solar:user-broken",
  219. "order" => 2,
  220. "title" => "player_data.title",
  221. ],
  222. "name" => "PlayerData",
  223. "path" => "/player-data",
  224. "children" => [
  225. [
  226. "meta" => [
  227. "title" => "player_data.player_list",
  228. "icon" => "solar:users-group-rounded-outline",
  229. "keepAlive" => true,
  230. ],
  231. "name" => "AntDesignPlayerList",
  232. "path" => "/player-data/player-list",
  233. "component" => "/player_data/player_list/index.vue",
  234. ],
  235. [
  236. "meta" => [
  237. "title" => "player_data.game_records",
  238. "icon" => "solar:gamepad-minimalistic-outline",
  239. "keepAlive" => true,
  240. ],
  241. "name" => "GameRecordList",
  242. "path" => "/player-data/game-records",
  243. "component" => "/player_data/game_records/index.vue",
  244. ],
  245. [
  246. "meta" => [
  247. "title" => "player_data.funds_change",
  248. "icon" => "solar:reorder-broken",
  249. "keepAlive" => true,
  250. ],
  251. "name" => "FundsChangeList",
  252. "path" => "/player-data/funds-change",
  253. "component" => "/player_data/funds_change/index.vue",
  254. ],
  255. [
  256. "meta" => [
  257. "title" => "player_data.transform_records",
  258. "icon" => "solar:card-recive-line-duotone",
  259. "keepAlive" => true,
  260. ],
  261. "name" => "TransformRecordsList",
  262. "path" => "/player-data/transform-records",
  263. "component" => "/player_data/transform_records/index.vue",
  264. ],
  265. ],
  266. ];
  267. // 游戏数据
  268. $webMenu[] = [
  269. "meta" => [
  270. "icon" => "solar:ghost-smile-outline",
  271. "keepAlive" => true,
  272. "order" => 3,
  273. "title" => "game_data.title",
  274. ],
  275. "name" => "gameData",
  276. "path" => "/game-data",
  277. "children" => [
  278. [
  279. "meta" => [
  280. "title" => "game_data.game_summary_title",
  281. "icon" => "solar:dollar-outline",
  282. "keepAlive" => true,
  283. ],
  284. "name" => "gameDataGameSummary",
  285. "path" => "/game-data/game-summary",
  286. "component" => "/game_data/game_summary/index.vue",
  287. ],
  288. [
  289. "meta" => [
  290. "title" => "game_data.bet_level_title",
  291. "icon" => "solar:card-transfer-outline",
  292. "keepAlive" => true,
  293. ],
  294. "name" => "gameDataBetLevel",
  295. "path" => "/game-data/bet-level",
  296. "component" => "/game_data/bet_level/index.vue",
  297. ],
  298. ],
  299. ];
  300. // 游戏调整
  301. $webMenu[] = [
  302. "meta" => [
  303. "icon" => "solar:gamepad-outline",
  304. "keepAlive" => true,
  305. "order" => 4,
  306. "title" => "game_control.title",
  307. ],
  308. "name" => "gameControl",
  309. "path" => "/game-control",
  310. "children" => [
  311. [
  312. "meta" => [
  313. "title" => "game_control.game_config",
  314. "icon" => "solar:gamepad-old-outline",
  315. "keepAlive" => true,
  316. ],
  317. "name" => "GameControlGameConfig",
  318. "path" => "/game-control/game_config",
  319. "component" => "/game_control/game_config/index.vue",
  320. ],
  321. [
  322. "meta" => [
  323. "title" => "game_control.play_control_title",
  324. "icon" => "solar:remote-controller-outline",
  325. "keepAlive" => true,
  326. ],
  327. "name" => "GameControlGamePlayerControl",
  328. "path" => "/game-control/player-control",
  329. "children" => [
  330. [
  331. "meta" => [
  332. "title" => "game_control.play_control_list_title",
  333. "keepAlive" => true,
  334. ],
  335. "name" => "GameControlGamePlayerControlList",
  336. "path" => "/game-control/player-control/list",
  337. "component" =>
  338. "/game_control/player_control/list/index.vue",
  339. ],
  340. [
  341. "meta" => [
  342. "title" => "game_control.play_control_record_title",
  343. "keepAlive" => true,
  344. ],
  345. "name" => "GameControlGamePlayerControlRecord",
  346. "path" => "/game-control/player-control/record",
  347. "component" =>
  348. "/game_control/player_control/record/index.vue",
  349. ],
  350. ],
  351. ],
  352. [
  353. "meta" => [
  354. "title" => "game_control.control_auto_rtp_title",
  355. "icon" => "solar:station-outline",
  356. "keepAlive" => true,
  357. ],
  358. "name" => "GameControlGameAutoRtpControl",
  359. "path" => "/game-control/auto-rtp",
  360. "children" => [
  361. [
  362. "meta" => [
  363. "title" => "game_control.control_auto_rtp_config_title",
  364. "keepAlive" => true,
  365. ],
  366. "name" => "GameControlGameAutoRtpControlConfig",
  367. "path" => "/game-control/auto-rtp/config",
  368. "component" => "/game_control/auto_rtp/config/index.vue",
  369. ],
  370. ],
  371. ],
  372. [
  373. "meta" => [
  374. "title" => "feed_user.feed_user_title",
  375. "icon" => "solar:bomb-emoji-broken",
  376. "keepAlive" => true,
  377. ],
  378. "name" => "FeedUser",
  379. "path" => "/game-control/feed-user",
  380. "children" => [
  381. [
  382. "meta" => [
  383. "title" => "feed_user.feed_user_global_title",
  384. "keepAlive" => true,
  385. ],
  386. "name" => "FeedUserGlobal",
  387. "path" => "/game-control/feed-user/global",
  388. "component" => "/game_control/feed_user/global/index.vue",
  389. ],
  390. [
  391. "meta" => [
  392. "title" => "feed_user.feed_user_list_title",
  393. "keepAlive" => true,
  394. ],
  395. "name" => "FeedUserList",
  396. "path" => "/game-control/feed-user/list",
  397. "component" => "/game_control/feed_user/list/index.vue",
  398. ],
  399. [
  400. "meta" => [
  401. "title" => "feed_user.feed_user_record_title",
  402. "keepAlive" => true,
  403. ],
  404. "name" => "FeedUserRecord",
  405. "path" => "/game-control/feed-user/record",
  406. "component" => "/game_control/feed_user/record/index.vue",
  407. ],
  408. ],
  409. ],
  410. ],
  411. ];
  412. // 日志管理
  413. $webMenu[] = [
  414. "meta" => [
  415. "keepAlive" => true,
  416. "icon" => "solar:document-text-outline",
  417. "order" => 4,
  418. "title" => "log.title",
  419. ],
  420. "name" => "Log",
  421. "path" => "/log",
  422. "children" => [
  423. [
  424. "meta" => [
  425. "title" => "log.agent_title",
  426. "icon" => "solar:document-add-linear",
  427. "keepAlive" => true,
  428. ],
  429. "name" => "LogAgent",
  430. "path" => "/log/agent",
  431. "children" => [
  432. [
  433. "meta" => [
  434. "title" => "log.login_title",
  435. "keepAlive" => true,
  436. ],
  437. "name" => "LogAgentLogin",
  438. "path" => "/log/agent/login",
  439. "component" => "/log/agent/login/index.vue",
  440. ],
  441. [
  442. "meta" => [
  443. "title" => "log.operation_title",
  444. "keepAlive" => true,
  445. ],
  446. "name" => "LogOperation",
  447. "path" => "/log/agent/operation",
  448. "component" => "/log/agent/operation/index.vue",
  449. ],
  450. ],
  451. ],
  452. ],
  453. ];
  454. // 权限管理
  455. $webMenu[] = [
  456. "meta" => [
  457. "icon" => "solar:verified-check-outline",
  458. "keepAlive" => true,
  459. "order" => 4,
  460. "title" => "user.title",
  461. ],
  462. "name" => "Permission",
  463. "path" => "/user",
  464. "children" => [
  465. [
  466. "meta" => [
  467. "title" => "user.role_list",
  468. "icon" => "solar:shield-user-outline",
  469. ],
  470. "name" => "RoleList",
  471. "path" => "/user/role-list",
  472. "component" => "/user/role_list/index.vue",
  473. ],
  474. [
  475. "meta" => [
  476. "title" => "user.user_list",
  477. "icon" => "solar:users-group-rounded-outline",
  478. ],
  479. "name" => "UserList",
  480. "path" => "/user/user-list",
  481. "component" => "/user/user_list/index.vue",
  482. ],
  483. ],
  484. ];
  485. try {
  486. $menus = MenuService::getMenuTree($this->userId);
  487. $menus = $webMenu;
  488. return json_success($menus);
  489. } catch (\Exception $e) {
  490. return json_error('获取菜单失败:' . $e->getMessage());
  491. }
  492. }
  493. /**
  494. * 获取所有权限配置(用于角色权限分配)
  495. */
  496. public function getAllPermissions()
  497. {
  498. try {
  499. $permissions = PermissionService::getAllPermissions();
  500. return json_success($permissions);
  501. } catch (\Exception $e) {
  502. return json_error([], '获取权限配置失败:' . $e->getMessage());
  503. }
  504. }
  505. }