befly 3.23.5 → 3.23.6
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/dictType/ins.js +4 -2
- package/apis/dictType/list.js +5 -2
- package/apis/dictType/upd.js +19 -26
- package/checks/menu.js +3 -2
- package/configs/beflyMenus.json +1 -1
- package/package.json +3 -3
package/apis/dictType/ins.js
CHANGED
|
@@ -9,7 +9,8 @@ export default {
|
|
|
9
9
|
code: dictTypeTable.code,
|
|
10
10
|
name: dictTypeTable.name,
|
|
11
11
|
description: dictTypeTable.description,
|
|
12
|
-
sort: dictTypeTable.sort
|
|
12
|
+
sort: dictTypeTable.sort,
|
|
13
|
+
state: dictTypeTable.state
|
|
13
14
|
},
|
|
14
15
|
required: ["code", "name"],
|
|
15
16
|
handler: async (befly, ctx) => {
|
|
@@ -28,7 +29,8 @@ export default {
|
|
|
28
29
|
code: ctx.body.code,
|
|
29
30
|
name: ctx.body.name,
|
|
30
31
|
description: ctx.body.description,
|
|
31
|
-
sort: ctx.body.sort
|
|
32
|
+
sort: ctx.body.sort,
|
|
33
|
+
state: ctx.body.state
|
|
32
34
|
}
|
|
33
35
|
});
|
|
34
36
|
|
package/apis/dictType/list.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import dictTypeTable from "../../tables/dictType.json";
|
|
2
|
+
|
|
1
3
|
export default {
|
|
2
4
|
name: "获取字典类型列表",
|
|
3
5
|
method: "POST",
|
|
@@ -7,14 +9,15 @@ export default {
|
|
|
7
9
|
page: { name: "页码", input: "integer", min: 1, max: 9999 },
|
|
8
10
|
limit: { name: "每页数量", input: "integer", min: 1, max: 100 },
|
|
9
11
|
keyword: { name: "关键词", input: "string", min: 0, max: 50 },
|
|
10
|
-
state:
|
|
12
|
+
state: dictTypeTable.state
|
|
11
13
|
},
|
|
12
14
|
required: [],
|
|
13
15
|
handler: async (befly, ctx) => {
|
|
14
16
|
const result = await befly.mysql.getList({
|
|
15
17
|
table: "beflyDictType",
|
|
16
18
|
where: {
|
|
17
|
-
name$like: ctx.body.keyword
|
|
19
|
+
$or: [{ name$like: ctx.body.keyword }, { code$like: ctx.body.keyword }],
|
|
20
|
+
state: ctx.body.state
|
|
18
21
|
},
|
|
19
22
|
orderBy: ["sort#ASC", "id#ASC"],
|
|
20
23
|
page: ctx.body.page,
|
package/apis/dictType/upd.js
CHANGED
|
@@ -10,40 +10,33 @@ export default {
|
|
|
10
10
|
code: dictTypeTable.code,
|
|
11
11
|
name: dictTypeTable.name,
|
|
12
12
|
description: dictTypeTable.description,
|
|
13
|
-
sort: dictTypeTable.sort
|
|
13
|
+
sort: dictTypeTable.sort,
|
|
14
|
+
state: dictTypeTable.state
|
|
14
15
|
},
|
|
15
16
|
required: ["id"],
|
|
16
17
|
handler: async (befly, ctx) => {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (code) {
|
|
24
|
-
const existing = await befly.mysql.getOne({
|
|
25
|
-
table: "beflyDictType",
|
|
26
|
-
where: {
|
|
27
|
-
code: code,
|
|
28
|
-
id$not: id
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
if (existing.data && existing.data.id) {
|
|
33
|
-
return befly.tool.No("类型代码已被使用");
|
|
18
|
+
const existing = await befly.mysql.getList({
|
|
19
|
+
table: "beflyDictType",
|
|
20
|
+
where: {
|
|
21
|
+
code: ctx.body.code,
|
|
22
|
+
id$not: ctx.body.id
|
|
34
23
|
}
|
|
35
|
-
}
|
|
24
|
+
});
|
|
36
25
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (description !== undefined) updateData["description"] = description;
|
|
41
|
-
if (sort !== undefined) updateData["sort"] = sort;
|
|
26
|
+
if (existing.data.total > 0) {
|
|
27
|
+
return befly.tool.No("类型代码已被使用");
|
|
28
|
+
}
|
|
42
29
|
|
|
43
30
|
await befly.mysql.updData({
|
|
44
31
|
table: "beflyDictType",
|
|
45
|
-
data:
|
|
46
|
-
|
|
32
|
+
data: {
|
|
33
|
+
code: ctx.body.code,
|
|
34
|
+
name: ctx.body.name,
|
|
35
|
+
description: ctx.body.description,
|
|
36
|
+
sort: ctx.body.sort,
|
|
37
|
+
state: ctx.body.state
|
|
38
|
+
},
|
|
39
|
+
where: { id: ctx.body.id }
|
|
47
40
|
});
|
|
48
41
|
|
|
49
42
|
return befly.tool.Yes("更新成功");
|
package/checks/menu.js
CHANGED
|
@@ -5,8 +5,9 @@ import { formatZodIssues } from "../utils/formatZodIssues.js";
|
|
|
5
5
|
|
|
6
6
|
z.config(z.locales.zhCN());
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const menuPathSegmentRegexSource = "[a-z][a-z0-9]*(?:-[a-z0-9]+)*";
|
|
9
|
+
const fullMenuPathRegex = new RegExp(`^/(?:core(?:/${menuPathSegmentRegexSource})*|(?:${menuPathSegmentRegexSource}(?:/${menuPathSegmentRegexSource})*)?)$`);
|
|
10
|
+
const childMenuPathRegex = new RegExp(`^/${menuPathSegmentRegexSource}$`);
|
|
10
11
|
|
|
11
12
|
const childMenuSchema = z
|
|
12
13
|
.object({
|
package/configs/beflyMenus.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "befly",
|
|
3
|
-
"version": "3.23.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "3.23.6",
|
|
4
|
+
"gitHead": "50fca5a7f581822abfdc886fcd77f2fce3db47ca",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Befly - 为 Bun 专属打造的 JavaScript API 接口框架核心引擎",
|
|
7
7
|
"keywords": [
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"test": "bun test"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"fast-xml-parser": "^5.7.
|
|
55
|
+
"fast-xml-parser": "^5.7.3",
|
|
56
56
|
"nodemailer": "^8.0.7",
|
|
57
57
|
"pathe": "^2.0.3",
|
|
58
58
|
"picomatch": "^4.0.4",
|