@befly-addon/admin 1.1.29 → 1.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/apis/admin/cacheRefresh.ts +29 -24
  2. package/apis/admin/del.ts +12 -12
  3. package/apis/admin/detail.ts +9 -41
  4. package/apis/admin/ins.ts +28 -21
  5. package/apis/admin/list.ts +12 -12
  6. package/apis/admin/upd.ts +49 -14
  7. package/apis/api/all.ts +14 -10
  8. package/apis/api/list.ts +16 -25
  9. package/apis/auth/login.ts +55 -52
  10. package/apis/auth/sendSmsCode.ts +6 -6
  11. package/apis/dashboard/configStatus.ts +18 -18
  12. package/apis/dashboard/environmentInfo.ts +12 -12
  13. package/apis/dashboard/performanceMetrics.ts +5 -5
  14. package/apis/dashboard/permissionStats.ts +7 -7
  15. package/apis/dashboard/serviceStatus.ts +29 -29
  16. package/apis/dashboard/systemInfo.ts +5 -5
  17. package/apis/dashboard/systemOverview.ts +7 -7
  18. package/apis/dashboard/systemResources.ts +8 -8
  19. package/apis/dict/all.ts +24 -7
  20. package/apis/dict/del.ts +9 -17
  21. package/apis/dict/detail.ts +30 -16
  22. package/apis/dict/ins.ts +36 -18
  23. package/apis/dict/items.ts +27 -0
  24. package/apis/dict/list.ts +35 -10
  25. package/apis/dict/upd.ts +54 -20
  26. package/apis/dictType/all.ts +11 -0
  27. package/apis/dictType/del.ts +32 -0
  28. package/apis/dictType/detail.ts +17 -0
  29. package/apis/dictType/ins.ts +30 -0
  30. package/apis/dictType/list.ts +22 -0
  31. package/apis/dictType/upd.ts +42 -0
  32. package/apis/email/config.ts +4 -4
  33. package/apis/email/logList.ts +10 -10
  34. package/apis/email/send.ts +18 -18
  35. package/apis/email/verify.ts +5 -5
  36. package/apis/loginLog/list.ts +10 -10
  37. package/apis/menu/all.ts +17 -20
  38. package/apis/menu/list.ts +12 -13
  39. package/apis/operateLog/list.ts +10 -10
  40. package/apis/role/all.ts +7 -7
  41. package/apis/role/apiSave.ts +14 -16
  42. package/apis/role/apis.ts +24 -0
  43. package/apis/role/del.ts +27 -19
  44. package/apis/role/detail.ts +6 -7
  45. package/apis/role/ins.ts +10 -10
  46. package/apis/role/list.ts +11 -11
  47. package/apis/role/menuSave.ts +12 -14
  48. package/apis/role/menus.ts +24 -0
  49. package/apis/role/save.ts +14 -15
  50. package/apis/role/upd.ts +10 -10
  51. package/apis/sysConfig/all.ts +5 -6
  52. package/apis/sysConfig/del.ts +10 -10
  53. package/apis/sysConfig/get.ts +10 -11
  54. package/apis/sysConfig/ins.ts +11 -11
  55. package/apis/sysConfig/list.ts +9 -9
  56. package/apis/sysConfig/upd.ts +11 -11
  57. package/libs/emailHelper.ts +7 -7
  58. package/package.json +46 -34
  59. package/plugins/email.ts +9 -9
  60. package/tables/admin.json +0 -6
  61. package/tables/dict.json +13 -19
  62. package/tables/dictType.json +28 -0
  63. package/tables/role.json +4 -2
  64. package/views/403_1/index.vue +19 -3
  65. package/views/config/dict/components/edit.vue +76 -124
  66. package/views/config/dict/index.vue +142 -84
  67. package/views/config/dictType/components/edit.vue +105 -0
  68. package/views/config/dictType/index.vue +242 -0
  69. package/views/config/index.vue +12 -0
  70. package/views/config/system/components/edit.vue +36 -36
  71. package/views/config/system/index.vue +79 -50
  72. package/views/index/components/addonList.vue +3 -3
  73. package/views/index/components/environmentInfo.vue +10 -10
  74. package/views/index/components/operationLogs.vue +10 -10
  75. package/views/index/components/performanceMetrics.vue +8 -8
  76. package/views/index/components/quickActions.vue +3 -3
  77. package/views/index/components/serviceStatus.vue +19 -19
  78. package/views/index/components/systemNotifications.vue +12 -12
  79. package/views/index/components/systemOverview.vue +7 -7
  80. package/views/index/components/systemResources.vue +11 -11
  81. package/views/index/components/userInfo.vue +20 -19
  82. package/views/index/index.vue +12 -5
  83. package/views/log/email/index.vue +58 -51
  84. package/views/log/index.vue +12 -0
  85. package/views/log/login/index.vue +45 -38
  86. package/views/log/operate/index.vue +55 -48
  87. package/views/login_1/index.vue +191 -2
  88. package/views/people/admin/components/edit.vue +28 -29
  89. package/views/people/admin/index.vue +76 -40
  90. package/views/people/index.vue +12 -0
  91. package/views/permission/api/index.vue +21 -15
  92. package/views/permission/index.vue +12 -0
  93. package/views/permission/menu/index.vue +31 -16
  94. package/views/permission/role/components/api.vue +23 -23
  95. package/views/permission/role/components/edit.vue +18 -18
  96. package/views/permission/role/components/menu.vue +17 -19
  97. package/views/permission/role/index.vue +84 -49
  98. package/apis/admin/roleDetail.ts +0 -29
  99. package/apis/admin/roleSave.ts +0 -39
  100. package/apis/auth/logout.ts +0 -17
  101. package/apis/auth/register.ts +0 -43
  102. package/apis/dashboard/changelog.ts +0 -31
  103. package/apis/role/apiDetail.ts +0 -24
  104. package/apis/role/menuDetail.ts +0 -24
  105. package/views/403_1/meta.json +0 -4
  106. package/views/config/dict/meta.json +0 -4
  107. package/views/config/meta.json +0 -4
  108. package/views/config/system/meta.json +0 -4
  109. package/views/index/meta.json +0 -4
  110. package/views/log/email/meta.json +0 -4
  111. package/views/log/login/meta.json +0 -4
  112. package/views/log/meta.json +0 -4
  113. package/views/log/operate/meta.json +0 -4
  114. package/views/login_1/components/emailLoginForm.vue +0 -174
  115. package/views/login_1/components/registerForm.vue +0 -175
  116. package/views/login_1/components/welcomePanel.vue +0 -61
  117. package/views/login_1/meta.json +0 -4
  118. package/views/people/admin/meta.json +0 -4
  119. package/views/people/meta.json +0 -4
  120. package/views/permission/api/meta.json +0 -4
  121. package/views/permission/menu/meta.json +0 -4
  122. package/views/permission/meta.json +0 -4
  123. package/views/permission/role/meta.json +0 -4
@@ -11,9 +11,9 @@
11
11
  </template>
12
12
 
13
13
  <script setup>
14
- import { Dialog as TDialog, Tree as TTree, Button as TButton, MessagePlugin } from 'tdesign-vue-next';
15
- import { arrayToTree } from '@/utils';
16
- import { $Http } from '@/plugins/http';
14
+ import { Dialog as TDialog, Tree as TTree, Button as TButton, MessagePlugin } from "tdesign-vue-next";
15
+ import { arrayToTree } from "befly-vite/utils/arrayToTree";
16
+ import { $Http } from "@/plugins/http";
17
17
 
18
18
  const $Prop = defineProps({
19
19
  modelValue: {
@@ -26,7 +26,7 @@ const $Prop = defineProps({
26
26
  }
27
27
  });
28
28
 
29
- const $Emit = defineEmits(['update:modelValue', 'success']);
29
+ const $Emit = defineEmits(["update:modelValue", "success"]);
30
30
 
31
31
  const $Data = $ref({
32
32
  visible: false,
@@ -51,20 +51,19 @@ const $Method = {
51
51
  onClose() {
52
52
  $Data.visible = false;
53
53
  setTimeout(() => {
54
- $Emit('update:modelValue', false);
54
+ $Emit("update:modelValue", false);
55
55
  }, 300);
56
56
  },
57
57
 
58
58
  // 加载菜单树(用于配置权限)
59
59
  async apiMenuAll() {
60
60
  try {
61
- const res = await $Http('/addon/admin/menu/all');
61
+ const res = await $Http("/addon/admin/menu/all");
62
62
  // menuAll 返回的 data 直接就是菜单数组
63
63
  const menuList = Array.isArray(res.data) ? res.data : [];
64
64
  $Data.menuTreeData = arrayToTree(menuList);
65
65
  } catch (error) {
66
- console.error('加载菜单失败:', error);
67
- MessagePlugin.error('加载菜单失败');
66
+ MessagePlugin.error("加载菜单失败");
68
67
  }
69
68
  },
70
69
 
@@ -73,14 +72,14 @@ const $Method = {
73
72
  if (!$Prop.rowData.id) return;
74
73
 
75
74
  try {
76
- const res = await $Http('/addon/admin/role/menuDetail', {
77
- roleId: $Prop.rowData.id
75
+ const res = await $Http("/addon/admin/role/menus", {
76
+ roleCode: $Prop.rowData.code
78
77
  });
79
78
 
80
- // roleMenuDetail 返回的 data 直接就是菜单 ID 数组
79
+ // menus 返回的 data 直接就是菜单 ID 数组
81
80
  $Data.menuTreeCheckedKeys = Array.isArray(res.data) ? res.data : [];
82
81
  } catch (error) {
83
- console.error('加载角色菜单失败:', error);
82
+ MessagePlugin.error("加载数据失败");
84
83
  }
85
84
  },
86
85
 
@@ -89,21 +88,20 @@ const $Method = {
89
88
  try {
90
89
  $Data.submitting = true;
91
90
 
92
- const res = await $Http('/addon/admin/role/menuSave', {
93
- roleId: $Prop.rowData.id,
91
+ const res = await $Http("/addon/admin/role/menuSave", {
92
+ roleCode: $Prop.rowData.code,
94
93
  menuIds: $Data.menuTreeCheckedKeys
95
94
  });
96
95
 
97
96
  if (res.code === 0) {
98
- MessagePlugin.success('保存成功');
97
+ MessagePlugin.success("保存成功");
99
98
  $Data.visible = false;
100
- $Emit('success');
99
+ $Emit("success");
101
100
  } else {
102
- MessagePlugin.error(res.msg || '保存失败');
101
+ MessagePlugin.error(res.msg || "保存失败");
103
102
  }
104
103
  } catch (error) {
105
- console.error('保存失败:', error);
106
- MessagePlugin.error('保存失败');
104
+ MessagePlugin.error("保存失败");
107
105
  } finally {
108
106
  $Data.submitting = false;
109
107
  }
@@ -18,7 +18,16 @@
18
18
  </div>
19
19
  <div class="main-content">
20
20
  <div class="main-table">
21
- <TTable :data="$Data.tableData" :columns="$Data.columns" :loading="$Data.loading" :active-row-keys="$Data.activeRowKeys" row-key="id" height="calc(100vh - var(--search-height) - var(--pagination-height) - var(--layout-gap) * 4)" active-row-type="single" @active-change="$Method.onActiveChange">
21
+ <TTable
22
+ :data="$Data.tableData"
23
+ :columns="$Data.columns"
24
+ :loading="$Data.loading"
25
+ :active-row-keys="$Data.activeRowKeys"
26
+ row-key="id"
27
+ height="calc(100vh - var(--search-height) - var(--pagination-height) - var(--layout-gap) * 4)"
28
+ active-row-type="single"
29
+ @active-change="$Method.onActiveChange"
30
+ >
22
31
  <template #state="{ row }">
23
32
  <TTag v-if="row.state === 1" shape="round" theme="success" variant="light-outline">正常</TTag>
24
33
  <TTag v-else-if="row.state === 2" shape="round" theme="warning" variant="light-outline">禁用</TTag>
@@ -74,20 +83,27 @@
74
83
  </template>
75
84
 
76
85
  <script setup>
77
- import { Button as TButton, Table as TTable, Tag as TTag, Dropdown as TDropdown, DropdownMenu as TDropdownMenu, DropdownItem as TDropdownItem, Pagination as TPagination, MessagePlugin, DialogPlugin } from 'tdesign-vue-next';
78
- import ILucidePlus from '~icons/lucide/plus';
79
- import ILucideRotateCw from '~icons/lucide/rotate-cw';
80
- import ILucidePencil from '~icons/lucide/pencil';
81
- import ILucideSettings from '~icons/lucide/settings';
82
- import ILucideCode from '~icons/lucide/code';
83
- import ILucideTrash2 from '~icons/lucide/trash-2';
84
- import ILucideChevronDown from '~icons/lucide/chevron-down';
85
- import EditDialog from './components/edit.vue';
86
- import MenuDialog from './components/menu.vue';
87
- import ApiDialog from './components/api.vue';
88
- import DetailPanel from '@/components/DetailPanel.vue';
89
- import { $Http } from '@/plugins/http';
90
- import { withDefaultColumns } from 'befly-shared/withDefaultColumns';
86
+ import { Button as TButton, Table as TTable, Tag as TTag, Dropdown as TDropdown, DropdownMenu as TDropdownMenu, DropdownItem as TDropdownItem, Pagination as TPagination, MessagePlugin, DialogPlugin } from "tdesign-vue-next";
87
+ import ILucidePlus from "~icons/lucide/plus";
88
+ import ILucideRotateCw from "~icons/lucide/rotate-cw";
89
+ import ILucidePencil from "~icons/lucide/pencil";
90
+ import ILucideSettings from "~icons/lucide/settings";
91
+ import ILucideCode from "~icons/lucide/code";
92
+ import ILucideTrash2 from "~icons/lucide/trash-2";
93
+ import ILucideChevronDown from "~icons/lucide/chevron-down";
94
+ import EditDialog from "./components/edit.vue";
95
+ import MenuDialog from "./components/menu.vue";
96
+ import ApiDialog from "./components/api.vue";
97
+ import DetailPanel from "@/components/DetailPanel.vue";
98
+ import { $Http } from "@/plugins/http";
99
+ import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
100
+
101
+ definePage({
102
+ meta: {
103
+ title: "角色管理",
104
+ order: 1
105
+ }
106
+ });
91
107
 
92
108
  // 响应式数据
93
109
  const $Data = $ref({
@@ -96,25 +112,25 @@ const $Data = $ref({
96
112
  activeRowKeys: [],
97
113
  currentRow: null,
98
114
  columns: withDefaultColumns([
99
- { colKey: 'id', title: 'ID' },
100
- { colKey: 'name', title: '角色名称' },
101
- { colKey: 'code', title: '角色代码' },
102
- { colKey: 'description', title: '描述' },
103
- { colKey: 'sort', title: '排序' },
104
- { colKey: 'state', title: '状态' },
105
- { colKey: 'operation', title: '操作' }
115
+ { colKey: "id", title: "ID" },
116
+ { colKey: "name", title: "角色名称" },
117
+ { colKey: "code", title: "角色代码" },
118
+ { colKey: "description", title: "描述" },
119
+ { colKey: "sort", title: "排序" },
120
+ { colKey: "state", title: "状态" },
121
+ { colKey: "operation", title: "操作" }
106
122
  ]),
107
123
  pagerConfig: {
108
124
  currentPage: 1,
109
125
  limit: 30,
110
126
  total: 0,
111
- align: 'right',
112
- layout: 'total, prev, pager, next, jumper'
127
+ align: "right",
128
+ layout: "total, prev, pager, next, jumper"
113
129
  },
114
130
  editVisible: false,
115
131
  menuVisible: false,
116
132
  apiVisible: false,
117
- actionType: 'add',
133
+ actionType: "add",
118
134
  rowData: {}
119
135
  });
120
136
 
@@ -127,7 +143,7 @@ const $Method = {
127
143
  async apiRoleList() {
128
144
  $Data.loading = true;
129
145
  try {
130
- const res = await $Http('/addon/admin/role/list', {
146
+ const res = await $Http("/addon/admin/role/list", {
131
147
  page: $Data.pagerConfig.currentPage,
132
148
  limit: $Data.pagerConfig.limit
133
149
  });
@@ -143,8 +159,7 @@ const $Method = {
143
159
  $Data.activeRowKeys = [];
144
160
  }
145
161
  } catch (error) {
146
- console.error('加载角色列表失败:', error);
147
- MessagePlugin.error('加载数据失败');
162
+ MessagePlugin.error("加载数据失败");
148
163
  } finally {
149
164
  $Data.loading = false;
150
165
  }
@@ -152,22 +167,43 @@ const $Method = {
152
167
 
153
168
  // 删除角色
154
169
  async apiRoleDel(row) {
155
- DialogPlugin.confirm({
156
- header: '确认删除',
157
- body: `确定要删除角色“${row.name}” 吗?`,
158
- status: 'warning'
159
- }).then(async () => {
160
- try {
161
- const res = await $Http('/addon/admin/role/del', { id: row.id });
162
- if (res.code === 0) {
163
- MessagePlugin.success('删除成功');
164
- $Method.apiRoleList();
165
- } else {
166
- MessagePlugin.error(res.msg || '删除失败');
170
+ let dialog = null;
171
+ let destroyed = false;
172
+
173
+ const destroy = () => {
174
+ if (destroyed) return;
175
+ destroyed = true;
176
+ if (dialog && typeof dialog.destroy === "function") {
177
+ dialog.destroy();
178
+ }
179
+ };
180
+
181
+ dialog = DialogPlugin.confirm({
182
+ header: "确认删除",
183
+ body: `确认删除角色“${row.name}”吗?`,
184
+ status: "warning",
185
+ confirmBtn: "删除",
186
+ cancelBtn: "取消",
187
+ onConfirm: async () => {
188
+ if (dialog && typeof dialog.setConfirmLoading === "function") {
189
+ dialog.setConfirmLoading(true);
190
+ }
191
+
192
+ try {
193
+ await $Http("/addon/admin/role/del", { id: row.id });
194
+ MessagePlugin.success("删除成功");
195
+ destroy();
196
+ await $Method.apiRoleList();
197
+ } catch (error) {
198
+ MessagePlugin.error("删除失败");
199
+ } finally {
200
+ if (dialog && typeof dialog.setConfirmLoading === "function") {
201
+ dialog.setConfirmLoading(false);
202
+ }
167
203
  }
168
- } catch (error) {
169
- console.error('删除失败:', error);
170
- MessagePlugin.error('删除失败');
204
+ },
205
+ onClose: () => {
206
+ destroy();
171
207
  }
172
208
  });
173
209
  },
@@ -207,13 +243,13 @@ const $Method = {
207
243
  onAction(command, rowData) {
208
244
  $Data.actionType = command;
209
245
  $Data.rowData = rowData;
210
- if (command === 'add' || command === 'upd') {
246
+ if (command === "add" || command === "upd") {
211
247
  $Data.editVisible = true;
212
- } else if (command === 'menu') {
248
+ } else if (command === "menu") {
213
249
  $Data.menuVisible = true;
214
- } else if (command === 'api') {
250
+ } else if (command === "api") {
215
251
  $Data.apiVisible = true;
216
- } else if (command === 'del') {
252
+ } else if (command === "del") {
217
253
  $Method.apiRoleDel(rowData);
218
254
  }
219
255
  }
@@ -223,6 +259,5 @@ $Method.initData();
223
259
  </script>
224
260
 
225
261
  <style scoped lang="scss">
226
- .page-role {
227
- }
262
+ /* page styles */
228
263
  </style>
@@ -1,29 +0,0 @@
1
- export default {
2
- name: '获取管理员角色',
3
- handler: async (befly, ctx) => {
4
- // 查询管理员信息(框架自动转换为小驼峰)
5
- const admin = await befly.db.getOne({
6
- table: 'addon_admin_admin',
7
- where: { id: ctx.body.adminId }
8
- });
9
-
10
- if (!admin) {
11
- return befly.tool.No('管理员不存在');
12
- }
13
-
14
- // 如果有角色编码,查询角色详细信息(使用 roleCode 而非 roleId)
15
- let roleInfo = null;
16
- if (admin.roleCode) {
17
- roleInfo = await befly.db.getOne({
18
- table: 'addon_admin_role',
19
- where: { code: admin.roleCode }
20
- });
21
- }
22
-
23
- return befly.tool.Yes('操作成功', {
24
- roleId: admin.roleId,
25
- roleCode: admin.roleCode,
26
- role: roleInfo
27
- });
28
- }
29
- };
@@ -1,39 +0,0 @@
1
- export default {
2
- name: '管理员角色保存',
3
- fields: {
4
- roleCode: {
5
- name: '角色编码',
6
- type: 'string',
7
- min: 2,
8
- max: 50,
9
- regexp: '^[a-zA-Z0-9_]+$'
10
- }
11
- },
12
- handler: async (befly, ctx) => {
13
- // 查询角色是否存在(使用 roleCode 而非 roleId)
14
- const role = await befly.db.getOne({
15
- table: 'addon_admin_role',
16
- where: { code: ctx.body.roleCode }
17
- });
18
-
19
- if (!role) {
20
- return befly.tool.No('角色不存在');
21
- }
22
-
23
- // 根据角色编码判断角色类型(硬编码规则)
24
- const roleType = role.code === 'dev' || role.code === 'admin' ? 'admin' : 'user';
25
-
26
- // 更新管理员的角色ID、角色编码和角色类型
27
- await befly.db.updData({
28
- table: 'addon_admin_admin',
29
- where: { id: ctx.body.id },
30
- data: {
31
- roleId: role.id,
32
- roleCode: role.code,
33
- roleType: roleType
34
- }
35
- });
36
-
37
- return befly.tool.Yes('操作成功');
38
- }
39
- };
@@ -1,17 +0,0 @@
1
- export default {
2
- name: '退出登录',
3
- handler: async (befly, ctx) => {
4
- // JWT token 是无状态的,前端删除 token 即可
5
- // 如果需要实现 token 黑名单,可以在这里将 token 加入 Redis 黑名单
6
-
7
- const token = ctx.headers.authorization?.replace('Bearer ', '');
8
-
9
- if (token && befly.redis) {
10
- // 将 token 加入黑名单,有效期设置为 token 的剩余有效期
11
- const key = `token_blacklist:${token}`;
12
- await befly.redis.set(key, '1', 'EX', 7 * 24 * 60 * 60); // 7天
13
- }
14
-
15
- return befly.tool.Yes('退出成功');
16
- }
17
- };
@@ -1,43 +0,0 @@
1
- import adminTable from '../../tables/admin.json';
2
-
3
- export default {
4
- name: '管理员注册',
5
- auth: false,
6
- fields: {
7
- name: adminTable.name,
8
- email: adminTable.email,
9
- password: adminTable.password
10
- },
11
- required: ['name', 'email', 'password'],
12
- handler: async (befly, ctx) => {
13
- // 检查邮箱是否已存在
14
- const existingAdmin = await befly.db.getOne({
15
- table: 'addon_admin_admin',
16
- where: { email: ctx.body.email }
17
- });
18
-
19
- if (existingAdmin) {
20
- return befly.tool.No('该邮箱已被注册');
21
- }
22
-
23
- // 加密密码
24
- const hashedPassword = await befly.cipher.hashPassword(ctx.body.password);
25
-
26
- // 创建管理员
27
- const adminId = await befly.db.insData({
28
- table: 'addon_admin_admin',
29
- data: {
30
- name: ctx.body.name,
31
- email: ctx.body.email,
32
- password: hashedPassword,
33
- role: 'user' // 默认为普通用户,state 由框架自动设置为 1
34
- }
35
- });
36
-
37
- return befly.tool.Yes('注册成功', {
38
- id: adminId,
39
- name: ctx.body.name,
40
- email: ctx.body.email
41
- });
42
- }
43
- };
@@ -1,31 +0,0 @@
1
- export default {
2
- name: '获取更新日志',
3
- handler: async (befly, ctx) => {
4
- // 更新日志数据(实际项目中可以从配置文件或数据库读取)
5
- const changelog = [
6
- {
7
- version: 'v1.0.0',
8
- date: '2025-10-25',
9
- changes: ['新增角色权限管理功能', '新增菜单权限分配功能', '新增接口权限管理功能', '优化菜单同步性能', '优化字段类型验证', '修复数组类型字段验证bug']
10
- },
11
- {
12
- version: 'v0.9.0',
13
- date: '2025-10-20',
14
- changes: ['初始版本发布', '完成基础框架搭建', '实现用户认证功能', '实现RBAC权限系统']
15
- },
16
- {
17
- version: 'v0.8.0',
18
- date: '2025-10-15',
19
- changes: ['完成数据库设计', '实现核心API', '添加字段验证器', '集成Redis缓存']
20
- }
21
- ];
22
-
23
- // 根据 limit 参数返回指定数量的日志
24
- const limit = ctx.body.limit || 5;
25
- const lists = changelog.slice(0, limit);
26
-
27
- return befly.tool.Yes('获取成功', {
28
- lists: lists
29
- });
30
- }
31
- };
@@ -1,24 +0,0 @@
1
- export default {
2
- name: '获取角色接口权限',
3
- handler: async (befly, ctx) => {
4
- // 查询角色信息
5
- const role = await befly.db.getOne({
6
- table: 'addon_admin_role',
7
- where: { id: ctx.body.roleId }
8
- });
9
-
10
- if (!role) {
11
- return befly.tool.No('角色不存在');
12
- }
13
-
14
- // 解析接口ID列表(逗号分隔的字符串转为数组)
15
- const apiIds = role.apis
16
- ? role.apis
17
- .split(',')
18
- .map((id: string) => parseInt(id.trim()))
19
- .filter((id: number) => !isNaN(id))
20
- : [];
21
-
22
- return befly.tool.Yes('操作成功', { apiIds });
23
- }
24
- };
@@ -1,24 +0,0 @@
1
- export default {
2
- name: '获取角色菜单权限',
3
- handler: async (befly, ctx) => {
4
- // 查询角色信息
5
- const role = await befly.db.getOne({
6
- table: 'addon_admin_role',
7
- where: { id: ctx.body.roleId }
8
- });
9
-
10
- if (!role) {
11
- return befly.tool.No('角色不存在');
12
- }
13
-
14
- // 解析菜单ID列表(逗号分隔的字符串转为数组)
15
- const menuIds = role.menus
16
- ? role.menus
17
- .split(',')
18
- .map((id: string) => parseInt(id.trim()))
19
- .filter((id: number) => !isNaN(id))
20
- : [];
21
-
22
- return befly.tool.Yes('操作成功', menuIds);
23
- }
24
- };
@@ -1,4 +0,0 @@
1
- {
2
- "name": "403",
3
- "order": 101
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "name": "字典配置",
3
- "order": 1
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "name": "配置管理",
3
- "order": 30
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "name": "系统配置",
3
- "order": 2
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "name": "首页",
3
- "order": 0
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "name": "邮件日志",
3
- "order": 2
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "name": "登录日志",
3
- "order": 1
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "name": "日志管理",
3
- "order": 40
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "name": "操作日志",
3
- "order": 3
4
- }