@befly-addon/admin 1.0.4 → 1.0.5

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.
package/apis/admin/del.ts CHANGED
@@ -11,7 +11,7 @@ export default {
11
11
  handler: async (befly, ctx) => {
12
12
  // 检查管理员是否存在
13
13
  const admin = await befly.db.getOne({
14
- table: 'core_admin',
14
+ table: 'addon_admin_admin',
15
15
  where: { id: ctx.body.id }
16
16
  });
17
17
 
@@ -26,7 +26,7 @@ export default {
26
26
 
27
27
  // 删除管理员
28
28
  await befly.db.delData({
29
- table: 'core_admin',
29
+ table: 'addon_admin_admin',
30
30
  where: { id: ctx.body.id }
31
31
  });
32
32
 
@@ -22,7 +22,7 @@ export default {
22
22
 
23
23
  // 查询用户信息(框架自动转换为小驼峰)
24
24
  const admin = await befly.db.getOne({
25
- table: 'core_admin',
25
+ table: 'addon_admin_admin',
26
26
  where: { id: userId }
27
27
  });
28
28
 
@@ -34,7 +34,7 @@ export default {
34
34
  let roleInfo = null;
35
35
  if (admin.roleCode) {
36
36
  roleInfo = await befly.db.getOne({
37
- table: 'core_role',
37
+ table: 'addon_admin_role',
38
38
  where: { code: admin.roleCode }
39
39
  });
40
40
  }
package/apis/admin/ins.ts CHANGED
@@ -13,7 +13,7 @@ export default {
13
13
  // 检查用户名是否已存在
14
14
  if (ctx.body.username) {
15
15
  const existingByUsername = await befly.db.getOne({
16
- table: 'core_admin',
16
+ table: 'addon_admin_admin',
17
17
  where: { username: ctx.body.username }
18
18
  });
19
19
 
@@ -24,7 +24,7 @@ export default {
24
24
 
25
25
  // 检查邮箱是否已存在
26
26
  const existingByEmail = await befly.db.getOne({
27
- table: 'core_admin',
27
+ table: 'addon_admin_admin',
28
28
  where: { email: ctx.body.email }
29
29
  });
30
30
 
@@ -37,7 +37,7 @@ export default {
37
37
 
38
38
  // 创建管理员
39
39
  const adminId = await befly.db.insData({
40
- table: 'core_admin',
40
+ table: 'addon_admin_admin',
41
41
  data: {
42
42
  username: ctx.body.username,
43
43
  email: ctx.body.email,
@@ -9,7 +9,7 @@ export default {
9
9
  handler: async (befly, ctx) => {
10
10
  // 查询所有管理员(框架自动排除password字段,自动转换字段名为小驼峰)
11
11
  const result = await befly.db.getList({
12
- table: 'core_admin',
12
+ table: 'addon_admin_admin',
13
13
  page: ctx.body.page || 1,
14
14
  limit: ctx.body.limit || 10,
15
15
  orderBy: ['createdAt#DESC']
@@ -9,7 +9,7 @@ export default {
9
9
  handler: async (befly, ctx) => {
10
10
  // 查询管理员信息(框架自动转换为小驼峰)
11
11
  const admin = await befly.db.getOne({
12
- table: 'core_admin',
12
+ table: 'addon_admin_admin',
13
13
  where: { id: ctx.body.adminId }
14
14
  });
15
15
 
@@ -21,7 +21,7 @@ export default {
21
21
  let roleInfo = null;
22
22
  if (admin.roleCode) {
23
23
  roleInfo = await befly.db.getOne({
24
- table: 'core_role',
24
+ table: 'addon_admin_role',
25
25
  where: { code: admin.roleCode }
26
26
  });
27
27
  }
@@ -13,7 +13,7 @@ export default {
13
13
  handler: async (befly, ctx) => {
14
14
  // 查询角色是否存在(使用 roleCode 而非 roleId)
15
15
  const role = await befly.db.getOne({
16
- table: 'core_role',
16
+ table: 'addon_admin_role',
17
17
  where: { code: ctx.body.roleCode }
18
18
  });
19
19
 
@@ -26,7 +26,7 @@ export default {
26
26
 
27
27
  // 更新管理员的角色ID、角色编码和角色类型
28
28
  await befly.db.updData({
29
- table: 'core_admin',
29
+ table: 'addon_admin_admin',
30
30
  where: { id: ctx.body.adminId },
31
31
  data: {
32
32
  roleId: role.id,
package/apis/admin/upd.ts CHANGED
@@ -19,7 +19,7 @@ export default {
19
19
 
20
20
  // 检查管理员是否存在
21
21
  const admin = await befly.db.getOne({
22
- table: 'core_admin',
22
+ table: 'addon_admin_admin',
23
23
  where: { id }
24
24
  });
25
25
 
@@ -30,7 +30,7 @@ export default {
30
30
  // 如果更新邮箱,检查是否重复
31
31
  if (updateData.email && updateData.email !== admin.email) {
32
32
  const existingAdmin = await befly.db.getOne({
33
- table: 'core_admin',
33
+ table: 'addon_admin_admin',
34
34
  where: { email: updateData.email }
35
35
  });
36
36
 
@@ -41,7 +41,7 @@ export default {
41
41
 
42
42
  // 更新管理员信息
43
43
  await befly.db.updData({
44
- table: 'core_admin',
44
+ table: 'addon_admin_admin',
45
45
  data: updateData,
46
46
  where: { id }
47
47
  });
package/apis/api/all.ts CHANGED
@@ -16,7 +16,7 @@ export default {
16
16
  if (!allApis || allApis.length === 0) {
17
17
  befly.logger.info('接口缓存未命中,从数据库查询');
18
18
  allApis = await befly.db.getAll({
19
- table: 'core_api',
19
+ table: 'addon_admin_api',
20
20
  fields: ['id', 'name', 'path', 'method', 'description', 'addonName', 'addonTitle'],
21
21
  orderBy: ['addonName#ASC', 'path#ASC']
22
22
  });
@@ -16,7 +16,7 @@ export default {
16
16
  handler: async (befly, ctx) => {
17
17
  // 查询管理员(account 匹配 username 或 email)
18
18
  const admin = await befly.db.getOne({
19
- table: 'core_admin',
19
+ table: 'addon_admin_admin',
20
20
  where: {
21
21
  $or: [{ username: ctx.body.account }, { email: ctx.body.account }]
22
22
  }
@@ -44,7 +44,7 @@ export default {
44
44
 
45
45
  // 更新最后登录信息
46
46
  await befly.db.updData({
47
- table: 'core_admin',
47
+ table: 'addon_admin_admin',
48
48
  where: { id: admin.id },
49
49
  data: {
50
50
  lastLoginTime: Date.now(),
@@ -17,7 +17,7 @@ export default {
17
17
  handler: async (befly, ctx) => {
18
18
  // 检查邮箱是否已存在
19
19
  const existingAdmin = await befly.db.getOne({
20
- table: 'core_admin',
20
+ table: 'addon_admin_admin',
21
21
  where: { email: ctx.body.email }
22
22
  });
23
23
 
@@ -30,7 +30,7 @@ export default {
30
30
 
31
31
  // 创建管理员
32
32
  const adminId = await befly.db.insData({
33
- table: 'core_admin',
33
+ table: 'addon_admin_admin',
34
34
  data: {
35
35
  name: ctx.body.name,
36
36
  email: ctx.body.email,
@@ -9,17 +9,17 @@ export default {
9
9
  handler: async (befly, ctx) => {
10
10
  // 统计菜单数量
11
11
  const menuCount = await befly.db.count({
12
- table: 'core_menu'
12
+ table: 'addon_admin_menu'
13
13
  });
14
14
 
15
15
  // 统计接口数量
16
16
  const apiCount = await befly.db.count({
17
- table: 'core_api'
17
+ table: 'addon_admin_api'
18
18
  });
19
19
 
20
20
  // 统计角色数量
21
21
  const roleCount = await befly.db.count({
22
- table: 'core_role'
22
+ table: 'addon_admin_role'
23
23
  });
24
24
 
25
25
  return Yes('获取成功', {
@@ -9,17 +9,17 @@ export default {
9
9
  handler: async (befly, ctx) => {
10
10
  // 权限统计
11
11
  const menuCount = await befly.db.getCount({
12
- table: 'core_menu',
12
+ table: 'addon_admin_menu',
13
13
  where: { state: 1 }
14
14
  });
15
15
 
16
16
  const roleCount = await befly.db.getCount({
17
- table: 'core_role',
17
+ table: 'addon_admin_role',
18
18
  where: { state: 1 }
19
19
  });
20
20
 
21
21
  const apiCount = await befly.db.getCount({
22
- table: 'core_api',
22
+ table: 'addon_admin_api',
23
23
  where: { state: 1 }
24
24
  });
25
25
 
package/apis/dict/all.ts CHANGED
@@ -8,7 +8,7 @@ export default {
8
8
  handler: async (befly, ctx) => {
9
9
  try {
10
10
  const dicts = await befly.db.getAll({
11
- table: 'core_dict',
11
+ table: 'addon_admin_dict',
12
12
  fields: ['id', 'name', 'code', 'value', 'sort', 'pid', 'description', 'state', 'created_at', 'updated_at'],
13
13
  orderBy: [
14
14
  { field: 'sort', direction: 'ASC' },
package/apis/dict/del.ts CHANGED
@@ -4,7 +4,7 @@ export default {
4
4
  handler: async (befly, ctx) => {
5
5
  try {
6
6
  await befly.db.delData({
7
- table: 'core_dict',
7
+ table: 'addon_admin_dict',
8
8
  where: {
9
9
  id: ctx.body.id
10
10
  }
@@ -5,7 +5,7 @@ export default {
5
5
  handler: async (befly, ctx) => {
6
6
  try {
7
7
  const dict = await befly.db.getDetail({
8
- table: 'core_dict',
8
+ table: 'addon_admin_dict',
9
9
  fields: ['id', 'name', 'code', 'value', 'sort', 'pid', 'description', 'state', 'created_at', 'updated_at'],
10
10
  where: {
11
11
  id: ctx.body.id
package/apis/dict/ins.ts CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  handler: async (befly, ctx) => {
8
8
  try {
9
9
  const dictId = await befly.db.insData({
10
- table: 'core_dict',
10
+ table: 'addon_admin_dict',
11
11
  data: {
12
12
  name: ctx.body.name,
13
13
  code: ctx.body.code,
package/apis/dict/list.ts CHANGED
@@ -3,7 +3,7 @@ export default {
3
3
  name: '获取字典列表',
4
4
  handler: async (befly, ctx) => {
5
5
  const result = await befly.db.getList({
6
- table: 'core_dict',
6
+ table: 'addon_admin_dict',
7
7
  fields: ['id', 'name', 'code', 'value', 'sort', 'pid', 'description', 'state', 'created_at', 'updated_at'],
8
8
  page: ctx.body.page,
9
9
  limit: ctx.body.limit,
package/apis/dict/upd.ts CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  handler: async (befly, ctx) => {
8
8
  try {
9
9
  await befly.db.updData({
10
- table: 'core_dict',
10
+ table: 'addon_admin_dict',
11
11
  data: {
12
12
  name: ctx.body.name,
13
13
  code: ctx.body.code,
package/apis/menu/all.ts CHANGED
@@ -15,7 +15,7 @@ export default {
15
15
  try {
16
16
  // 2. 查询角色信息获取菜单权限(使用 roleCode 而非 roleId)
17
17
  const role = await befly.db.getOne({
18
- table: 'core_role',
18
+ table: 'addon_admin_role',
19
19
  where: { code: ctx.user.roleCode }
20
20
  });
21
21
 
@@ -40,7 +40,7 @@ export default {
40
40
  if (!allMenus || allMenus.length === 0) {
41
41
  befly.logger.info('菜单缓存未命中,从数据库查询');
42
42
  allMenus = await befly.db.getAll({
43
- table: 'core_menu',
43
+ table: 'addon_admin_menu',
44
44
  fields: ['id', 'pid', 'name', 'path', 'icon', 'type', 'sort'],
45
45
  orderBy: ['sort#ASC', 'id#ASC']
46
46
  });
package/apis/menu/del.ts CHANGED
@@ -10,7 +10,7 @@ export default {
10
10
  try {
11
11
  // 检查是否有子菜单(使用 getList 代替 getAll)
12
12
  const childrenList = await befly.db.getList({
13
- table: 'core_menu',
13
+ table: 'addon_admin_menu',
14
14
  where: { pid: ctx.body.id }
15
15
  });
16
16
 
@@ -20,7 +20,7 @@ export default {
20
20
 
21
21
  // 删除菜单
22
22
  await befly.db.delData({
23
- table: 'core_menu',
23
+ table: 'addon_admin_menu',
24
24
  where: { id: ctx.body.id }
25
25
  });
26
26
 
package/apis/menu/ins.ts CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  handler: async (befly, ctx) => {
8
8
  try {
9
9
  const menuId = await befly.db.insData({
10
- table: 'core_menu',
10
+ table: 'addon_admin_menu',
11
11
  data: ctx.body
12
12
  });
13
13
 
package/apis/menu/list.ts CHANGED
@@ -4,7 +4,7 @@ export default {
4
4
  handler: async (befly, ctx) => {
5
5
  try {
6
6
  const menus = await befly.db.getAll({
7
- table: 'core_menu',
7
+ table: 'addon_admin_menu',
8
8
  fields: ['id', 'name', 'path', 'icon', 'sort', 'pid', 'type', 'state', 'created_at', 'updated_at'],
9
9
  orderBy: [
10
10
  { field: 'sort', direction: 'ASC' },
package/apis/menu/upd.ts CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  handler: async (befly, ctx) => {
8
8
  try {
9
9
  await befly.db.updData({
10
- table: 'core_menu',
10
+ table: 'addon_admin_menu',
11
11
  where: { id: ctx.body.id },
12
12
  data: {
13
13
  name: ctx.body.name,
@@ -9,7 +9,7 @@ export default {
9
9
  handler: async (befly, ctx) => {
10
10
  // 查询角色信息
11
11
  const role = await befly.db.getOne({
12
- table: 'core_role',
12
+ table: 'addon_admin_role',
13
13
  where: { id: ctx.body.roleId }
14
14
  });
15
15
 
@@ -13,7 +13,7 @@ export default {
13
13
  handler: async (befly, ctx) => {
14
14
  // 查询角色是否存在
15
15
  const role = await befly.db.getOne({
16
- table: 'core_role',
16
+ table: 'addon_admin_role',
17
17
  where: { id: ctx.body.roleId }
18
18
  });
19
19
 
@@ -26,7 +26,7 @@ export default {
26
26
 
27
27
  // 更新角色的接口权限
28
28
  await befly.db.updData({
29
- table: 'core_role',
29
+ table: 'addon_admin_role',
30
30
  where: { id: ctx.body.roleId },
31
31
  data: {
32
32
  apis: apiIdsStr
package/apis/role/del.ts CHANGED
@@ -10,7 +10,7 @@ export default {
10
10
  try {
11
11
  // 检查是否有用户使用此角色(使用 getList 代替 getAll)
12
12
  const adminList = await befly.db.getList({
13
- table: 'core_admin',
13
+ table: 'addon_admin_admin',
14
14
  where: { roleId: ctx.body.id }
15
15
  });
16
16
 
@@ -20,13 +20,13 @@ export default {
20
20
 
21
21
  // 获取角色信息(用于删除缓存)
22
22
  const role = await befly.db.getDetail({
23
- table: 'core_role',
23
+ table: 'addon_admin_role',
24
24
  where: { id: ctx.body.id }
25
25
  });
26
26
 
27
27
  // 删除角色
28
28
  await befly.db.delData({
29
- table: 'core_role',
29
+ table: 'addon_admin_role',
30
30
  where: { id: ctx.body.id }
31
31
  });
32
32
 
@@ -10,7 +10,7 @@ export default {
10
10
  let roleInfo = null;
11
11
  if (ctx.body.id && ctx.user.roleType === 'admin') {
12
12
  roleInfo = await befly.db.getOne({
13
- table: 'core_role',
13
+ table: 'addon_admin_role',
14
14
  where: { code: ctx.body.id }
15
15
  });
16
16
  }
package/apis/role/ins.ts CHANGED
@@ -10,7 +10,7 @@ export default {
10
10
  handler: async (befly, ctx) => {
11
11
  // 检查角色代码是否已存在
12
12
  const existing = await befly.db.getOne({
13
- table: 'core_role',
13
+ table: 'addon_admin_role',
14
14
  where: { code: ctx.body.code }
15
15
  });
16
16
 
@@ -19,7 +19,7 @@ export default {
19
19
  }
20
20
 
21
21
  const roleId = await befly.db.insData({
22
- table: 'core_role',
22
+ table: 'addon_admin_role',
23
23
  data: {
24
24
  name: ctx.body.name,
25
25
  code: ctx.body.code,
package/apis/role/list.ts CHANGED
@@ -5,7 +5,7 @@ export default {
5
5
  handler: async (befly, ctx) => {
6
6
  const roles = await befly.db.getList({
7
7
  limit: 30,
8
- table: 'core_role',
8
+ table: 'addon_admin_role',
9
9
  orderBy: ['sort#ASC', 'id#ASC']
10
10
  });
11
11
 
@@ -9,7 +9,7 @@ export default {
9
9
  handler: async (befly, ctx) => {
10
10
  // 查询角色信息
11
11
  const role = await befly.db.getOne({
12
- table: 'core_role',
12
+ table: 'addon_admin_role',
13
13
  where: { id: ctx.body.roleId }
14
14
  });
15
15
 
@@ -13,7 +13,7 @@ export default {
13
13
  handler: async (befly, ctx) => {
14
14
  // 查询角色是否存在
15
15
  const role = await befly.db.getOne({
16
- table: 'core_role',
16
+ table: 'addon_admin_role',
17
17
  where: { id: ctx.body.roleId }
18
18
  });
19
19
 
@@ -26,7 +26,7 @@ export default {
26
26
 
27
27
  // 更新角色的菜单权限
28
28
  await befly.db.updData({
29
- table: 'core_role',
29
+ table: 'addon_admin_role',
30
30
  where: { id: ctx.body.roleId },
31
31
  data: {
32
32
  menus: menuIdsStr
package/apis/role/save.ts CHANGED
@@ -13,7 +13,7 @@ export default {
13
13
  try {
14
14
  // 查询角色是否存在(使用 roleCode 而非 roleId)
15
15
  const role = await befly.db.getOne({
16
- table: 'core_role',
16
+ table: 'addon_admin_role',
17
17
  where: { code: ctx.body.roleCode }
18
18
  });
19
19
 
@@ -26,7 +26,7 @@ export default {
26
26
 
27
27
  // 更新管理员的角色ID、角色编码和角色类型
28
28
  await befly.db.updData({
29
- table: 'core_admin',
29
+ table: 'addon_admin_admin',
30
30
  where: { id: ctx.body.adminId },
31
31
  data: {
32
32
  roleId: role.id,
package/apis/role/upd.ts CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  handler: async (befly, ctx) => {
8
8
  // 检查角色代码是否被其他角色占用
9
9
  const existing = await befly.db.getList({
10
- table: 'core_role',
10
+ table: 'addon_admin_role',
11
11
  where: {
12
12
  code: ctx.body.code,
13
13
  id$ne: ctx.body.id
@@ -19,7 +19,7 @@ export default {
19
19
  }
20
20
 
21
21
  await befly.db.updData({
22
- table: 'core_role',
22
+ table: 'addon_admin_role',
23
23
  where: { id: ctx.body.id },
24
24
  data: {
25
25
  name: ctx.body.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@befly-addon/admin",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Befly Admin Addon - 管理后台功能组件",
5
5
  "type": "module",
6
6
  "private": false,
@@ -39,5 +39,5 @@
39
39
  "peerDependencies": {
40
40
  "befly": "^3.0.0"
41
41
  },
42
- "gitHead": "cdd2d42fdd5e0f887b434fa70dff72028d9e31ed"
42
+ "gitHead": "131c2482f3668346adbbd153e14d5b74cd19e725"
43
43
  }