flexbiz-server 12.5.22 → 12.5.24
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/package.json
CHANGED
|
@@ -195,21 +195,9 @@ class controllerRPT {
|
|
|
195
195
|
res.setHeader('Content-Disposition', 'attachment; filename="' + rptId + '".xlsx');
|
|
196
196
|
//convert sang buffer nếu data là một object có type ==Buffer
|
|
197
197
|
let data = result;
|
|
198
|
-
|
|
199
|
-
if (Buffer.isBuffer(data)) {
|
|
200
|
-
// OK
|
|
201
|
-
}
|
|
202
|
-
else if (data?.type === 'Buffer' && Array.isArray(data.data)) {
|
|
198
|
+
if (data?.type === 'Buffer' && Array.isArray(data.data)) {
|
|
203
199
|
data = Buffer.from(data.data);
|
|
204
200
|
}
|
|
205
|
-
else if (typeof data === 'string') {
|
|
206
|
-
data = Buffer.from(data, 'base64');
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
console.error("[controllerRPT] Dữ liệu không hợp lệ", typeof(data))
|
|
210
|
-
return res.status(400).send({error:'Dữ liệu không hợp lệ'});
|
|
211
|
-
}
|
|
212
|
-
|
|
213
201
|
res.setHeader('Content-Length', data.length);
|
|
214
202
|
res.end(data);
|
|
215
203
|
break;
|
|
@@ -73,7 +73,7 @@ class WorkerPool {
|
|
|
73
73
|
|
|
74
74
|
this.queue_running = this.queue_running.filter(q=>q.id!==task.id);
|
|
75
75
|
|
|
76
|
-
console.log("[WorkerStaticPool] Các loại kết quả trả về...",Object.keys(message));
|
|
76
|
+
//console.log("[WorkerStaticPool] Các loại kết quả trả về...",Object.keys(message));
|
|
77
77
|
console.log("[WorkerStaticPool] data type is buffer",Buffer.isBuffer(message?.result?.data));
|
|
78
78
|
|
|
79
79
|
task.callback(message,task.id);
|
|
@@ -31,14 +31,15 @@ const handleReport =async (msg)=>{
|
|
|
31
31
|
}
|
|
32
32
|
})
|
|
33
33
|
}
|
|
34
|
-
//Chỉ parse lại nếu không phải là buffer
|
|
35
|
-
|
|
36
34
|
if(!result?.data || !Buffer.isBuffer(result?.data)){
|
|
37
|
-
|
|
35
|
+
try {
|
|
36
|
+
result = structuredClone(result);
|
|
37
|
+
} catch (e) {
|
|
38
|
+
result = JSON.parse(JSON.stringify(result));
|
|
39
|
+
}
|
|
38
40
|
}
|
|
39
|
-
|
|
40
41
|
//console.log("[reportWorker] result type",typeof(result));
|
|
41
|
-
console.log("[reportWorker] data type is buffer",Buffer.isBuffer(result?.data));//true
|
|
42
|
+
console.log("[reportWorker] data type is buffer:",Buffer.isBuffer(result?.data));//true nhưng parent lại nhận được là một object không phải là buffer
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
parentPort.postMessage({
|