befly 3.54.0 → 3.56.0
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/tongJi/infoStats.js +7 -9
- package/apis/tongJi/onlineStats.js +7 -9
- package/checks/config.js +1 -18
- package/configs/beflyMenus.json +5 -0
- package/index.js +5 -1
- package/package.json +1 -1
package/apis/tongJi/infoStats.js
CHANGED
|
@@ -72,10 +72,9 @@ function buildEmptyVisitStats(reportDate, monthStartDate, recentDateList, projec
|
|
|
72
72
|
|
|
73
73
|
for (const item of projectLists) {
|
|
74
74
|
products.push({
|
|
75
|
-
key: item.
|
|
76
|
-
productName: item.
|
|
77
|
-
productCode: item.
|
|
78
|
-
productVersion: item.productVersion || "",
|
|
75
|
+
key: item.code,
|
|
76
|
+
productName: item.name,
|
|
77
|
+
productCode: item.code,
|
|
79
78
|
today: 0,
|
|
80
79
|
yesterday: 0,
|
|
81
80
|
dayBeforeYesterday: 0,
|
|
@@ -117,13 +116,12 @@ async function buildVisitStatsProducts(befly, now, reportDate, monthStartDate, r
|
|
|
117
116
|
const products = [];
|
|
118
117
|
|
|
119
118
|
for (const item of projectLists) {
|
|
120
|
-
const summary = await getVisitStatsSummary(befly, now, reportDate, monthStartDate, recentDateList, item.
|
|
119
|
+
const summary = await getVisitStatsSummary(befly, now, reportDate, monthStartDate, recentDateList, item.code);
|
|
121
120
|
|
|
122
121
|
products.push({
|
|
123
|
-
key: item.
|
|
124
|
-
productName: item.
|
|
125
|
-
productCode: item.
|
|
126
|
-
productVersion: item.productVersion || "",
|
|
122
|
+
key: item.code,
|
|
123
|
+
productName: item.name,
|
|
124
|
+
productCode: item.code,
|
|
127
125
|
today: summary.today.count,
|
|
128
126
|
yesterday: summary.yesterday.count,
|
|
129
127
|
dayBeforeYesterday: summary.dayBeforeYesterday.count,
|
|
@@ -19,11 +19,10 @@ async function buildOnlineStatsProducts(befly, projectLists, now) {
|
|
|
19
19
|
|
|
20
20
|
for (const item of projectLists) {
|
|
21
21
|
products.push({
|
|
22
|
-
key: item.
|
|
23
|
-
productName: item.
|
|
24
|
-
productCode: item.
|
|
25
|
-
|
|
26
|
-
onlineCount: await getOnlineStatsProductOnlineCount(befly, item.productCode, now)
|
|
22
|
+
key: item.code,
|
|
23
|
+
productName: item.name,
|
|
24
|
+
productCode: item.code,
|
|
25
|
+
onlineCount: await getOnlineStatsProductOnlineCount(befly, item.code, now)
|
|
27
26
|
});
|
|
28
27
|
}
|
|
29
28
|
|
|
@@ -41,10 +40,9 @@ function buildEmptyOnlineStatsProducts(projectLists) {
|
|
|
41
40
|
|
|
42
41
|
for (const item of projectLists) {
|
|
43
42
|
products.push({
|
|
44
|
-
key: item.
|
|
45
|
-
productName: item.
|
|
46
|
-
productCode: item.
|
|
47
|
-
productVersion: item.productVersion || "",
|
|
43
|
+
key: item.code,
|
|
44
|
+
productName: item.name,
|
|
45
|
+
productCode: item.code,
|
|
48
46
|
onlineCount: 0
|
|
49
47
|
});
|
|
50
48
|
}
|
package/checks/config.js
CHANGED
|
@@ -16,19 +16,14 @@ const projectListCodeSchema = z.string().regex(/^[a-z][a-zA-Z0-9]*$/, "必须是
|
|
|
16
16
|
const projectListItemSchema = z
|
|
17
17
|
.object({
|
|
18
18
|
code: projectListCodeSchema,
|
|
19
|
-
name: noTrimString.min(1)
|
|
20
|
-
productName: noTrimString.min(1),
|
|
21
|
-
productCode: noTrimString.min(1),
|
|
22
|
-
productVersion: noTrimString.optional()
|
|
19
|
+
name: noTrimString.min(1)
|
|
23
20
|
})
|
|
24
21
|
.strict();
|
|
25
22
|
const projectListsSchema = z.array(projectListItemSchema).superRefine((projectLists, ctx) => {
|
|
26
23
|
const codeSet = new Set();
|
|
27
|
-
const productCodeSet = new Set();
|
|
28
24
|
|
|
29
25
|
for (let index = 0; index < projectLists.length; index += 1) {
|
|
30
26
|
const code = projectLists[index].code;
|
|
31
|
-
const productCode = projectLists[index].productCode;
|
|
32
27
|
|
|
33
28
|
if (codeSet.has(code)) {
|
|
34
29
|
ctx.addIssue({
|
|
@@ -36,21 +31,9 @@ const projectListsSchema = z.array(projectListItemSchema).superRefine((projectLi
|
|
|
36
31
|
message: `projectLists[${index}].code 重复`,
|
|
37
32
|
path: [index, "code"]
|
|
38
33
|
});
|
|
39
|
-
continue;
|
|
40
34
|
}
|
|
41
35
|
|
|
42
36
|
codeSet.add(code);
|
|
43
|
-
|
|
44
|
-
if (productCodeSet.has(productCode)) {
|
|
45
|
-
ctx.addIssue({
|
|
46
|
-
code: "custom",
|
|
47
|
-
message: `projectLists[${index}].productCode 重复`,
|
|
48
|
-
path: [index, "productCode"]
|
|
49
|
-
});
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
productCodeSet.add(productCode);
|
|
54
37
|
}
|
|
55
38
|
});
|
|
56
39
|
|
package/configs/beflyMenus.json
CHANGED
package/index.js
CHANGED
|
@@ -64,6 +64,7 @@ function mergeProjectListsByCode(projectLists) {
|
|
|
64
64
|
|
|
65
65
|
for (const item of projectLists) {
|
|
66
66
|
const code = String(item?.code || "");
|
|
67
|
+
const name = String(item?.name || "");
|
|
67
68
|
|
|
68
69
|
if (!code) {
|
|
69
70
|
continue;
|
|
@@ -73,7 +74,10 @@ function mergeProjectListsByCode(projectLists) {
|
|
|
73
74
|
itemMap.delete(code);
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
itemMap.set(code,
|
|
77
|
+
itemMap.set(code, {
|
|
78
|
+
code: code,
|
|
79
|
+
name: name
|
|
80
|
+
});
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
return Array.from(itemMap.values());
|