alemonjs 2.0.10 → 2.0.12
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/lib/app/event-processor-cycle.js +20 -5
- package/lib/app/load.js +7 -10
- package/package.json +1 -1
|
@@ -24,10 +24,8 @@ const showLog = (event, select) => {
|
|
|
24
24
|
if (typeof event['MessageId'] == 'string' && event['MessageId'] != '') {
|
|
25
25
|
log['MessageId'] = event['MessageId'];
|
|
26
26
|
}
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
const txt = content.join('');
|
|
30
|
-
log['text'] = txt;
|
|
27
|
+
if (typeof event['MessageText'] == 'string' && event['MessageText'] != '') {
|
|
28
|
+
log['MessageText'] = event['MessageText'];
|
|
31
29
|
}
|
|
32
30
|
logger.info({
|
|
33
31
|
code: ResultCode.Ok,
|
|
@@ -76,7 +74,24 @@ const expendCycle = async (valueEvent, select) => {
|
|
|
76
74
|
}
|
|
77
75
|
expendMiddleware(valueEvent, select, nextMount);
|
|
78
76
|
};
|
|
79
|
-
|
|
77
|
+
if (process.env?.ALEMONJS_EVENT_LOGS_CHANNEL_ID) {
|
|
78
|
+
try {
|
|
79
|
+
const channelIds = JSON.parse(process.env?.ALEMONJS_EVENT_LOGS_CHANNEL_ID);
|
|
80
|
+
if (channelIds && channelIds.length > 0 && channelIds.includes(valueEvent['ChannelId'])) {
|
|
81
|
+
showLog(valueEvent, select);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
logger.error({
|
|
86
|
+
code: ResultCode.FailParams,
|
|
87
|
+
message: 'ALEMONJS_EVENT_LOGS_CHANNEL_ID is not json string',
|
|
88
|
+
data: null
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
showLog(valueEvent, select);
|
|
94
|
+
}
|
|
80
95
|
// create
|
|
81
96
|
expendSubscribeCreate(valueEvent, select, nextCreate);
|
|
82
97
|
};
|
package/lib/app/load.js
CHANGED
|
@@ -120,19 +120,16 @@ const loadChildren = async (mainPath, appName) => {
|
|
|
120
120
|
mwData.push(middleware);
|
|
121
121
|
}
|
|
122
122
|
App.pushMiddleware(mwData);
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
App.on();
|
|
124
|
+
try {
|
|
125
|
+
if (typeof app?.onMounted == 'function') {
|
|
126
126
|
await app?.onMounted({ response: resData, middleware: mwData });
|
|
127
|
-
// 校验完周期后,再进行挂载。
|
|
128
|
-
// 防止校验过程中,出现初始化完周期,就执行匹配
|
|
129
|
-
App.on();
|
|
130
|
-
}
|
|
131
|
-
catch (e) {
|
|
132
|
-
unMounted(e);
|
|
133
|
-
return;
|
|
134
127
|
}
|
|
135
128
|
}
|
|
129
|
+
catch (e) {
|
|
130
|
+
unMounted(e);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
136
133
|
}
|
|
137
134
|
catch (e) {
|
|
138
135
|
unMounted(e);
|