@befly-addon/admin 1.0.8 → 1.0.10

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/api/all.ts CHANGED
@@ -11,7 +11,6 @@ export default {
11
11
  try {
12
12
  // 从 Redis 缓存读取所有接口
13
13
  let allApis = await befly.redis.getObject<any[]>('apis:all');
14
-
15
14
  // 如果缓存不存在,从数据库查询
16
15
  if (!allApis || allApis.length === 0) {
17
16
  befly.logger.info('接口缓存未命中,从数据库查询');
@@ -20,7 +19,6 @@ export default {
20
19
  fields: ['id', 'name', 'path', 'method', 'description', 'addonName', 'addonTitle'],
21
20
  orderBy: ['addonName#ASC', 'path#ASC']
22
21
  });
23
-
24
22
  // 回写缓存
25
23
  if (allApis.length > 0) {
26
24
  await befly.redis.setObject('apis:all', allApis);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@befly-addon/admin",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "Befly Admin Addon - 管理后台功能组件",
5
5
  "type": "module",
6
6
  "private": false,
@@ -32,8 +32,8 @@
32
32
  "url": "https://github.com/chenbimo/befly.git",
33
33
  "directory": "packages/addon-admin"
34
34
  },
35
- "peerDependencies": {
36
- "befly": "^3.0.0"
37
- },
38
- "gitHead": "c9933a45ed268f79ee3428d8c9179fbe885cb888"
35
+ "gitHead": "c0844203f8fee734d2a8742f3b77b67bf0874681",
36
+ "dependencies": {
37
+ "befly": "3.8.2"
38
+ }
39
39
  }
package/tables/admin.json CHANGED
@@ -1,14 +1,158 @@
1
- {
2
- "name": "姓名|string|2|50|null|0|null",
3
- "nickname": "昵称|string|2|50|null|0|null",
4
- "email": "邮箱|string|5|100|null|1|^[\\w.-]+@[\\w.-]+\\.\\w+$",
5
- "phone": "手机号|string|11|11|null|0|^1[3-9]\\d{9}$",
6
- "username": "用户名|string|3|30|null|0|^[a-zA-Z0-9_]+$",
7
- "password": "密码|string|6|500|null|0|null",
8
- "avatar": "头像|string|0|500|null|0|null",
9
- "roleId": "角色ID|number|1|999999999999999|null|1|null",
10
- "roleCode": "角色编码|string|2|50|null|0|^[a-zA-Z0-9_]+$",
11
- "roleType": "角色类型|string|4|5|user|1|^(admin|user)$",
12
- "lastLoginTime": "最后登录时间|number|0|null|0|0|null",
13
- "lastLoginIp": "最后登录IP|string|0|50|null|0|null"
1
+ {
2
+ "name": {
3
+ "name": "姓名",
4
+ "detail": "",
5
+ "type": "string",
6
+ "min": 2,
7
+ "max": 50,
8
+ "default": null,
9
+ "index": false,
10
+ "unique": false,
11
+ "nullable": false,
12
+ "unsigned": true,
13
+ "regexp": null
14
+ },
15
+ "nickname": {
16
+ "name": "昵称",
17
+ "detail": "",
18
+ "type": "string",
19
+ "min": 2,
20
+ "max": 50,
21
+ "default": null,
22
+ "index": false,
23
+ "unique": false,
24
+ "nullable": false,
25
+ "unsigned": true,
26
+ "regexp": null
27
+ },
28
+ "email": {
29
+ "name": "邮箱",
30
+ "detail": "",
31
+ "type": "string",
32
+ "min": 5,
33
+ "max": 100,
34
+ "default": null,
35
+ "index": true,
36
+ "unique": false,
37
+ "nullable": false,
38
+ "unsigned": true,
39
+ "regexp": "^[\\w.-]+@[\\w.-]+\\.\\w+$"
40
+ },
41
+ "phone": {
42
+ "name": "手机号",
43
+ "detail": "",
44
+ "type": "string",
45
+ "min": 11,
46
+ "max": 11,
47
+ "default": null,
48
+ "index": false,
49
+ "unique": false,
50
+ "nullable": false,
51
+ "unsigned": true,
52
+ "regexp": "^1[3-9]\\d{9}$"
53
+ },
54
+ "username": {
55
+ "name": "用户名",
56
+ "detail": "",
57
+ "type": "string",
58
+ "min": 3,
59
+ "max": 30,
60
+ "default": null,
61
+ "index": false,
62
+ "unique": false,
63
+ "nullable": false,
64
+ "unsigned": true,
65
+ "regexp": "^[a-zA-Z0-9_]+$"
66
+ },
67
+ "password": {
68
+ "name": "密码",
69
+ "detail": "",
70
+ "type": "string",
71
+ "min": 6,
72
+ "max": 500,
73
+ "default": null,
74
+ "index": false,
75
+ "unique": false,
76
+ "nullable": false,
77
+ "unsigned": true,
78
+ "regexp": null
79
+ },
80
+ "avatar": {
81
+ "name": "头像",
82
+ "detail": "",
83
+ "type": "string",
84
+ "min": 0,
85
+ "max": 500,
86
+ "default": null,
87
+ "index": false,
88
+ "unique": false,
89
+ "nullable": false,
90
+ "unsigned": true,
91
+ "regexp": null
92
+ },
93
+ "roleId": {
94
+ "name": "角色ID",
95
+ "detail": "",
96
+ "type": "number",
97
+ "min": 1,
98
+ "max": 999999999999999,
99
+ "default": null,
100
+ "index": true,
101
+ "unique": false,
102
+ "nullable": false,
103
+ "unsigned": true,
104
+ "regexp": null
105
+ },
106
+ "roleCode": {
107
+ "name": "角色编码",
108
+ "detail": "",
109
+ "type": "string",
110
+ "min": 2,
111
+ "max": 50,
112
+ "default": null,
113
+ "index": false,
114
+ "unique": false,
115
+ "nullable": false,
116
+ "unsigned": true,
117
+ "regexp": "^[a-zA-Z0-9_]+$"
118
+ },
119
+ "roleType": {
120
+ "name": "角色类型",
121
+ "detail": "",
122
+ "type": "string",
123
+ "min": 4,
124
+ "max": 5,
125
+ "default": "user",
126
+ "index": true,
127
+ "unique": false,
128
+ "nullable": false,
129
+ "unsigned": true,
130
+ "regexp": "^(admin|user)$"
131
+ },
132
+ "lastLoginTime": {
133
+ "name": "最后登录时间",
134
+ "detail": "",
135
+ "type": "number",
136
+ "min": 0,
137
+ "max": null,
138
+ "default": 0,
139
+ "index": false,
140
+ "unique": false,
141
+ "nullable": false,
142
+ "unsigned": true,
143
+ "regexp": null
144
+ },
145
+ "lastLoginIp": {
146
+ "name": "最后登录IP",
147
+ "detail": "",
148
+ "type": "string",
149
+ "min": 0,
150
+ "max": 50,
151
+ "default": null,
152
+ "index": false,
153
+ "unique": false,
154
+ "nullable": false,
155
+ "unsigned": true,
156
+ "regexp": null
157
+ }
14
158
  }
package/tables/api.json CHANGED
@@ -1,8 +1,80 @@
1
- {
2
- "name": "接口名称|string|2|100|null|1|null",
3
- "path": "接口路径|string|1|200|null|1|null",
4
- "method": "请求方法|string|3|10|POST|1|^(GET|POST|PUT|DELETE|PATCH)$",
5
- "description": "接口描述|string|0|500|null|0|null",
6
- "addonName": "所属插件|string|0|50|null|0|null",
7
- "addonTitle": "插件标题|string|0|100|null|0|null"
1
+ {
2
+ "name": {
3
+ "name": "接口名称",
4
+ "detail": "",
5
+ "type": "string",
6
+ "min": 2,
7
+ "max": 100,
8
+ "default": null,
9
+ "index": true,
10
+ "unique": false,
11
+ "nullable": false,
12
+ "unsigned": true,
13
+ "regexp": null
14
+ },
15
+ "path": {
16
+ "name": "接口路径",
17
+ "detail": "",
18
+ "type": "string",
19
+ "min": 1,
20
+ "max": 200,
21
+ "default": null,
22
+ "index": true,
23
+ "unique": false,
24
+ "nullable": false,
25
+ "unsigned": true,
26
+ "regexp": null
27
+ },
28
+ "method": {
29
+ "name": "请求方法",
30
+ "detail": "",
31
+ "type": "string",
32
+ "min": 3,
33
+ "max": 10,
34
+ "default": "POST",
35
+ "index": true,
36
+ "unique": false,
37
+ "nullable": false,
38
+ "unsigned": true,
39
+ "regexp": "^(GET|POST|PUT|DELETE|PATCH)$"
40
+ },
41
+ "description": {
42
+ "name": "接口描述",
43
+ "detail": "",
44
+ "type": "string",
45
+ "min": 0,
46
+ "max": 500,
47
+ "default": null,
48
+ "index": false,
49
+ "unique": false,
50
+ "nullable": false,
51
+ "unsigned": true,
52
+ "regexp": null
53
+ },
54
+ "addonName": {
55
+ "name": "所属插件",
56
+ "detail": "",
57
+ "type": "string",
58
+ "min": 0,
59
+ "max": 50,
60
+ "default": null,
61
+ "index": false,
62
+ "unique": false,
63
+ "nullable": false,
64
+ "unsigned": true,
65
+ "regexp": null
66
+ },
67
+ "addonTitle": {
68
+ "name": "插件标题",
69
+ "detail": "",
70
+ "type": "string",
71
+ "min": 0,
72
+ "max": 100,
73
+ "default": null,
74
+ "index": false,
75
+ "unique": false,
76
+ "nullable": false,
77
+ "unsigned": true,
78
+ "regexp": null
79
+ }
8
80
  }
package/tables/dict.json CHANGED
@@ -1,8 +1,80 @@
1
- {
2
- "name": "字典名称|string|2|50|null|1|null",
3
- "code": "字典代码|string|2|50|null|1|^[a-zA-Z0-9_]+$",
4
- "value": "字典值|string|0|200|null|1|null",
5
- "sort": "排序|number|0|9999|0|0|null",
6
- "pid": "父级ID|number|0|999999999999999|0|1|null",
7
- "description": "描述|string|0|200|null|0|null"
1
+ {
2
+ "name": {
3
+ "name": "字典名称",
4
+ "detail": "",
5
+ "type": "string",
6
+ "min": 2,
7
+ "max": 50,
8
+ "default": null,
9
+ "index": true,
10
+ "unique": false,
11
+ "nullable": false,
12
+ "unsigned": true,
13
+ "regexp": null
14
+ },
15
+ "code": {
16
+ "name": "字典代码",
17
+ "detail": "",
18
+ "type": "string",
19
+ "min": 2,
20
+ "max": 50,
21
+ "default": null,
22
+ "index": true,
23
+ "unique": false,
24
+ "nullable": false,
25
+ "unsigned": true,
26
+ "regexp": "^[a-zA-Z0-9_]+$"
27
+ },
28
+ "value": {
29
+ "name": "字典值",
30
+ "detail": "",
31
+ "type": "string",
32
+ "min": 0,
33
+ "max": 200,
34
+ "default": null,
35
+ "index": true,
36
+ "unique": false,
37
+ "nullable": false,
38
+ "unsigned": true,
39
+ "regexp": null
40
+ },
41
+ "sort": {
42
+ "name": "排序",
43
+ "detail": "",
44
+ "type": "number",
45
+ "min": 0,
46
+ "max": 9999,
47
+ "default": 0,
48
+ "index": false,
49
+ "unique": false,
50
+ "nullable": false,
51
+ "unsigned": true,
52
+ "regexp": null
53
+ },
54
+ "pid": {
55
+ "name": "父级ID",
56
+ "detail": "",
57
+ "type": "number",
58
+ "min": 0,
59
+ "max": 999999999999999,
60
+ "default": 0,
61
+ "index": true,
62
+ "unique": false,
63
+ "nullable": false,
64
+ "unsigned": true,
65
+ "regexp": null
66
+ },
67
+ "description": {
68
+ "name": "描述",
69
+ "detail": "",
70
+ "type": "string",
71
+ "min": 0,
72
+ "max": 200,
73
+ "default": null,
74
+ "index": false,
75
+ "unique": false,
76
+ "nullable": false,
77
+ "unsigned": true,
78
+ "regexp": null
79
+ }
8
80
  }
package/tables/menu.json CHANGED
@@ -1,8 +1,80 @@
1
- {
2
- "name": "菜单名称|string|2|50|null|1|null",
3
- "path": "路由路径|string|1|200|null|1|null",
4
- "icon": "图标名称|string|0|50|null|0|null",
5
- "sort": "排序|number|0|9999|0|0|null",
6
- "pid": "父级ID|number|0|999999999999999|0|1|null",
7
- "type": "菜单类型|number|1|2|1|1|^(1|2)$"
1
+ {
2
+ "name": {
3
+ "name": "菜单名称",
4
+ "detail": "",
5
+ "type": "string",
6
+ "min": 2,
7
+ "max": 50,
8
+ "default": null,
9
+ "index": true,
10
+ "unique": false,
11
+ "nullable": false,
12
+ "unsigned": true,
13
+ "regexp": null
14
+ },
15
+ "path": {
16
+ "name": "路由路径",
17
+ "detail": "",
18
+ "type": "string",
19
+ "min": 1,
20
+ "max": 200,
21
+ "default": null,
22
+ "index": true,
23
+ "unique": false,
24
+ "nullable": false,
25
+ "unsigned": true,
26
+ "regexp": null
27
+ },
28
+ "icon": {
29
+ "name": "图标名称",
30
+ "detail": "",
31
+ "type": "string",
32
+ "min": 0,
33
+ "max": 50,
34
+ "default": null,
35
+ "index": false,
36
+ "unique": false,
37
+ "nullable": false,
38
+ "unsigned": true,
39
+ "regexp": null
40
+ },
41
+ "sort": {
42
+ "name": "排序",
43
+ "detail": "",
44
+ "type": "number",
45
+ "min": 0,
46
+ "max": 9999,
47
+ "default": 0,
48
+ "index": false,
49
+ "unique": false,
50
+ "nullable": false,
51
+ "unsigned": true,
52
+ "regexp": null
53
+ },
54
+ "pid": {
55
+ "name": "父级ID",
56
+ "detail": "",
57
+ "type": "number",
58
+ "min": 0,
59
+ "max": 999999999999999,
60
+ "default": 0,
61
+ "index": true,
62
+ "unique": false,
63
+ "nullable": false,
64
+ "unsigned": true,
65
+ "regexp": null
66
+ },
67
+ "type": {
68
+ "name": "菜单类型",
69
+ "detail": "",
70
+ "type": "number",
71
+ "min": 1,
72
+ "max": 2,
73
+ "default": 1,
74
+ "index": true,
75
+ "unique": false,
76
+ "nullable": false,
77
+ "unsigned": true,
78
+ "regexp": "^(1|2)$"
79
+ }
8
80
  }
package/tables/role.json CHANGED
@@ -1,8 +1,80 @@
1
- {
2
- "name": "角色名称|string|2|50|null|1|null",
3
- "code": "角色编码|string|2|50|null|1|^[a-zA-Z0-9_]+$",
4
- "description": "角色描述|string|0|200|null|0|null",
5
- "menus": "菜单权限|array_text|null|null|null|0|null",
6
- "apis": "接口权限|array_text|null|null|null|0|null",
7
- "sort": "排序|number|0|9999|0|0|null"
1
+ {
2
+ "name": {
3
+ "name": "角色名称",
4
+ "detail": "",
5
+ "type": "string",
6
+ "min": 2,
7
+ "max": 50,
8
+ "default": null,
9
+ "index": true,
10
+ "unique": false,
11
+ "nullable": false,
12
+ "unsigned": true,
13
+ "regexp": null
14
+ },
15
+ "code": {
16
+ "name": "角色编码",
17
+ "detail": "",
18
+ "type": "string",
19
+ "min": 2,
20
+ "max": 50,
21
+ "default": null,
22
+ "index": true,
23
+ "unique": false,
24
+ "nullable": false,
25
+ "unsigned": true,
26
+ "regexp": "^[a-zA-Z0-9_]+$"
27
+ },
28
+ "description": {
29
+ "name": "角色描述",
30
+ "detail": "",
31
+ "type": "string",
32
+ "min": 0,
33
+ "max": 200,
34
+ "default": null,
35
+ "index": false,
36
+ "unique": false,
37
+ "nullable": false,
38
+ "unsigned": true,
39
+ "regexp": null
40
+ },
41
+ "menus": {
42
+ "name": "菜单权限",
43
+ "detail": "",
44
+ "type": "array_text",
45
+ "min": null,
46
+ "max": null,
47
+ "default": null,
48
+ "index": false,
49
+ "unique": false,
50
+ "nullable": false,
51
+ "unsigned": true,
52
+ "regexp": null
53
+ },
54
+ "apis": {
55
+ "name": "接口权限",
56
+ "detail": "",
57
+ "type": "array_text",
58
+ "min": null,
59
+ "max": null,
60
+ "default": null,
61
+ "index": false,
62
+ "unique": false,
63
+ "nullable": false,
64
+ "unsigned": true,
65
+ "regexp": null
66
+ },
67
+ "sort": {
68
+ "name": "排序",
69
+ "detail": "",
70
+ "type": "number",
71
+ "min": 0,
72
+ "max": 9999,
73
+ "default": 0,
74
+ "index": false,
75
+ "unique": false,
76
+ "nullable": false,
77
+ "unsigned": true,
78
+ "regexp": null
79
+ }
8
80
  }