@pisell/pisellos 2.2.204 → 2.2.205
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/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Order/index.js +9 -3
- package/dist/modules/Payment/index.d.ts +0 -13
- package/dist/modules/Payment/index.js +449 -833
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.js +730 -619
- package/dist/server/modules/index.d.ts +2 -0
- package/dist/server/modules/index.js +2 -0
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/solution/BaseSales/index.d.ts +6 -1
- package/dist/solution/BaseSales/index.js +67 -18
- package/dist/solution/BookingTicket/index.js +1 -1
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +51 -52
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/Order/index.js +5 -1
- package/lib/modules/Payment/index.d.ts +0 -13
- package/lib/modules/Payment/index.js +6 -149
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +6 -0
- package/lib/server/index.js +46 -0
- package/lib/server/modules/index.d.ts +2 -0
- package/lib/server/modules/index.js +3 -0
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +192 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +17 -0
- package/lib/solution/BaseSales/index.d.ts +6 -1
- package/lib/solution/BaseSales/index.js +51 -5
- package/lib/solution/BookingTicket/index.js +1 -1
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +1 -2
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -29,6 +29,7 @@ import { ScheduleModuleEx } from "./modules/schedule";
|
|
|
29
29
|
import { ResourceModule } from "./modules/resource";
|
|
30
30
|
import { FloorPlanModule } from "./modules/floor-plan";
|
|
31
31
|
import { FloorPlanHooks } from "./modules/floor-plan/types";
|
|
32
|
+
import { PaymentServerModule } from "./modules/payment";
|
|
32
33
|
import { extractScheduleIdsFromMenus, extractTimePointsFromSchedules } from "./utils/schedule";
|
|
33
34
|
import { ProductsHooks } from "./modules/products/types";
|
|
34
35
|
import { perfMark } from "./utils/product";
|
|
@@ -70,6 +71,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
70
71
|
_defineProperty(this, "resource", void 0);
|
|
71
72
|
_defineProperty(this, "order", void 0);
|
|
72
73
|
_defineProperty(this, "floor_plan", void 0);
|
|
74
|
+
_defineProperty(this, "payment", void 0);
|
|
75
|
+
_defineProperty(this, "paymentRouteModule", void 0);
|
|
76
|
+
_defineProperty(this, "paymentRouteModuleInFlight", void 0);
|
|
73
77
|
/** GET 前缀路由(最长前缀优先匹配) */
|
|
74
78
|
_defineProperty(this, "prefixRouterGet", []);
|
|
75
79
|
// 路由注册表
|
|
@@ -139,6 +143,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
139
143
|
list: []
|
|
140
144
|
}
|
|
141
145
|
},
|
|
146
|
+
payment: {
|
|
147
|
+
name: 'payment',
|
|
148
|
+
moduleClass: PaymentServerModule,
|
|
149
|
+
moduleName: 'server_payment',
|
|
150
|
+
version: '1.0.0',
|
|
151
|
+
defaultStore: {
|
|
152
|
+
payMethods: []
|
|
153
|
+
}
|
|
154
|
+
},
|
|
142
155
|
resource: {
|
|
143
156
|
name: 'resource',
|
|
144
157
|
moduleClass: ResourceModule,
|
|
@@ -162,20 +175,53 @@ var Server = /*#__PURE__*/function () {
|
|
|
162
175
|
}
|
|
163
176
|
}
|
|
164
177
|
});
|
|
178
|
+
_defineProperty(this, "handlePaymentMethods", /*#__PURE__*/function () {
|
|
179
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
180
|
+
var data, config, payment, payMethods;
|
|
181
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
182
|
+
while (1) switch (_context.prev = _context.next) {
|
|
183
|
+
case 0:
|
|
184
|
+
data = _ref.data, config = _ref.config;
|
|
185
|
+
debugger;
|
|
186
|
+
_context.next = 4;
|
|
187
|
+
return _this.getPaymentRouteModule();
|
|
188
|
+
case 4:
|
|
189
|
+
payment = _context.sent;
|
|
190
|
+
_context.next = 7;
|
|
191
|
+
return payment.getPayMethodListAsync({
|
|
192
|
+
shouldFilter: (data === null || data === void 0 ? void 0 : data.filterPaymentMethods) === true || (config === null || config === void 0 ? void 0 : config.filterPaymentMethods) === true
|
|
193
|
+
});
|
|
194
|
+
case 7:
|
|
195
|
+
payMethods = _context.sent;
|
|
196
|
+
return _context.abrupt("return", {
|
|
197
|
+
code: 200,
|
|
198
|
+
status: true,
|
|
199
|
+
data: payMethods
|
|
200
|
+
});
|
|
201
|
+
case 9:
|
|
202
|
+
case "end":
|
|
203
|
+
return _context.stop();
|
|
204
|
+
}
|
|
205
|
+
}, _callee);
|
|
206
|
+
}));
|
|
207
|
+
return function (_x) {
|
|
208
|
+
return _ref2.apply(this, arguments);
|
|
209
|
+
};
|
|
210
|
+
}());
|
|
165
211
|
/**
|
|
166
212
|
* 处理商品查询请求
|
|
167
213
|
* 存储订阅者信息,便于数据变更时推送最新结果
|
|
168
214
|
*/
|
|
169
215
|
_defineProperty(this, "handleProductQuery", /*#__PURE__*/function () {
|
|
170
|
-
var
|
|
171
|
-
var url, method, data, config, menu_list_ids, schedule_datetime, schedule_date, customer_id, ids,
|
|
172
|
-
return _regeneratorRuntime().wrap(function
|
|
173
|
-
while (1) switch (
|
|
216
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3) {
|
|
217
|
+
var url, method, data, config, menu_list_ids, schedule_datetime, schedule_date, customer_id, ids, _ref5, callback, subscriberId;
|
|
218
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
219
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
174
220
|
case 0:
|
|
175
|
-
url =
|
|
221
|
+
url = _ref3.url, method = _ref3.method, data = _ref3.data, config = _ref3.config;
|
|
176
222
|
console.log('[Server] handleProductQuery:', url, method, data, config);
|
|
177
223
|
menu_list_ids = data.menu_list_ids, schedule_datetime = data.schedule_datetime, schedule_date = data.schedule_date, customer_id = data.customer_id, ids = data.ids;
|
|
178
|
-
|
|
224
|
+
_ref5 = config || {}, callback = _ref5.callback, subscriberId = _ref5.subscriberId;
|
|
179
225
|
_this.logInfo('handleProductQuery: 开始处理商品查询请求', {
|
|
180
226
|
menu_list_ids: menu_list_ids,
|
|
181
227
|
ids: ids,
|
|
@@ -201,7 +247,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
201
247
|
totalSubscribers: _this.productQuerySubscribers.size
|
|
202
248
|
});
|
|
203
249
|
}
|
|
204
|
-
return
|
|
250
|
+
return _context2.abrupt("return", _this.computeProductQueryResult({
|
|
205
251
|
menu_list_ids: menu_list_ids,
|
|
206
252
|
ids: ids,
|
|
207
253
|
schedule_date: schedule_date,
|
|
@@ -210,12 +256,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
210
256
|
}));
|
|
211
257
|
case 7:
|
|
212
258
|
case "end":
|
|
213
|
-
return
|
|
259
|
+
return _context2.stop();
|
|
214
260
|
}
|
|
215
|
-
},
|
|
261
|
+
}, _callee2);
|
|
216
262
|
}));
|
|
217
|
-
return function (
|
|
218
|
-
return
|
|
263
|
+
return function (_x2) {
|
|
264
|
+
return _ref4.apply(this, arguments);
|
|
219
265
|
};
|
|
220
266
|
}());
|
|
221
267
|
/**
|
|
@@ -223,24 +269,24 @@ var Server = /*#__PURE__*/function () {
|
|
|
223
269
|
* schedule_date 必填:query 或 data;schedule_datetime 可选。不走订阅。
|
|
224
270
|
*/
|
|
225
271
|
_defineProperty(this, "handleProductQueryById", /*#__PURE__*/function () {
|
|
226
|
-
var
|
|
272
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref6) {
|
|
227
273
|
var path, method, data, url, pathname, idMatch, productId, scheduleDateFromData, schedule_date, scheduleDtFromData, scheduleDtFromUrl, scheduleDatetime;
|
|
228
|
-
return _regeneratorRuntime().wrap(function
|
|
229
|
-
while (1) switch (
|
|
274
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
275
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
230
276
|
case 0:
|
|
231
|
-
path =
|
|
277
|
+
path = _ref6.path, method = _ref6.method, data = _ref6.data, url = _ref6.url;
|
|
232
278
|
pathname = _this.parseRequestPath(url || '', path);
|
|
233
279
|
idMatch = pathname.match(/^\/shop\/product\/query\/(\d+)$/);
|
|
234
280
|
productId = idMatch ? Number(idMatch[1]) : NaN;
|
|
235
281
|
console.log('[Server] handleProductQueryById:', pathname, method, data);
|
|
236
282
|
if (Number.isFinite(productId)) {
|
|
237
|
-
|
|
283
|
+
_context3.next = 8;
|
|
238
284
|
break;
|
|
239
285
|
}
|
|
240
286
|
_this.logWarning('handleProductQueryById: 无效的商品 id', {
|
|
241
287
|
path: pathname
|
|
242
288
|
});
|
|
243
|
-
return
|
|
289
|
+
return _context3.abrupt("return", {
|
|
244
290
|
code: 400,
|
|
245
291
|
message: '无效的商品路径',
|
|
246
292
|
status: false,
|
|
@@ -252,13 +298,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
252
298
|
scheduleDateFromData = data && _typeof(data) === 'object' && typeof data.schedule_date === 'string' ? data.schedule_date.trim() : '';
|
|
253
299
|
schedule_date = scheduleDateFromData || (_this.extractQueryParam(url || '', 'schedule_date') || '').trim() || dayjs().format('YYYY-MM-DD');
|
|
254
300
|
if (schedule_date) {
|
|
255
|
-
|
|
301
|
+
_context3.next = 13;
|
|
256
302
|
break;
|
|
257
303
|
}
|
|
258
304
|
_this.logWarning('handleProductQueryById: 缺少 schedule_date', {
|
|
259
305
|
productId: productId
|
|
260
306
|
});
|
|
261
|
-
return
|
|
307
|
+
return _context3.abrupt("return", {
|
|
262
308
|
code: 400,
|
|
263
309
|
message: 'schedule_date 为必填(query 或 data)',
|
|
264
310
|
status: false,
|
|
@@ -273,46 +319,46 @@ var Server = /*#__PURE__*/function () {
|
|
|
273
319
|
schedule_date: schedule_date,
|
|
274
320
|
schedule_datetime: scheduleDatetime
|
|
275
321
|
});
|
|
276
|
-
return
|
|
322
|
+
return _context3.abrupt("return", _this.computeProductQueryResult({
|
|
277
323
|
schedule_date: schedule_date,
|
|
278
324
|
schedule_datetime: scheduleDatetime,
|
|
279
325
|
product_id: productId
|
|
280
326
|
}));
|
|
281
327
|
case 18:
|
|
282
328
|
case "end":
|
|
283
|
-
return
|
|
329
|
+
return _context3.stop();
|
|
284
330
|
}
|
|
285
|
-
},
|
|
331
|
+
}, _callee3);
|
|
286
332
|
}));
|
|
287
|
-
return function (
|
|
288
|
-
return
|
|
333
|
+
return function (_x3) {
|
|
334
|
+
return _ref7.apply(this, arguments);
|
|
289
335
|
};
|
|
290
336
|
}());
|
|
291
337
|
/**
|
|
292
338
|
* 取消商品查询订阅(HTTP 路由入口)
|
|
293
339
|
*/
|
|
294
340
|
_defineProperty(this, "handleUnsubscribeProductQuery", /*#__PURE__*/function () {
|
|
295
|
-
var
|
|
296
|
-
var data,
|
|
297
|
-
return _regeneratorRuntime().wrap(function
|
|
298
|
-
while (1) switch (
|
|
341
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref8) {
|
|
342
|
+
var data, _ref10, subscriberId;
|
|
343
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
344
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
299
345
|
case 0:
|
|
300
|
-
data =
|
|
301
|
-
|
|
346
|
+
data = _ref8.data;
|
|
347
|
+
_ref10 = data || {}, subscriberId = _ref10.subscriberId;
|
|
302
348
|
_this.removeProductQuerySubscriber(subscriberId);
|
|
303
|
-
return
|
|
349
|
+
return _context4.abrupt("return", {
|
|
304
350
|
code: 200,
|
|
305
351
|
message: 'ok',
|
|
306
352
|
status: true
|
|
307
353
|
});
|
|
308
354
|
case 4:
|
|
309
355
|
case "end":
|
|
310
|
-
return
|
|
356
|
+
return _context4.stop();
|
|
311
357
|
}
|
|
312
|
-
},
|
|
358
|
+
}, _callee4);
|
|
313
359
|
}));
|
|
314
|
-
return function (
|
|
315
|
-
return
|
|
360
|
+
return function (_x4) {
|
|
361
|
+
return _ref9.apply(this, arguments);
|
|
316
362
|
};
|
|
317
363
|
}());
|
|
318
364
|
/**
|
|
@@ -320,22 +366,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
320
366
|
* 存储订阅者信息,本地计算结果;数据变更时通过 callback 推送
|
|
321
367
|
*/
|
|
322
368
|
_defineProperty(this, "handleOrderList", /*#__PURE__*/function () {
|
|
323
|
-
var
|
|
324
|
-
var url, method, data, config, queryPayload,
|
|
325
|
-
return _regeneratorRuntime().wrap(function
|
|
326
|
-
while (1) switch (
|
|
369
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref11) {
|
|
370
|
+
var url, method, data, config, queryPayload, _ref13, callback, subscriberId, useLocal;
|
|
371
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
372
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
327
373
|
case 0:
|
|
328
|
-
url =
|
|
374
|
+
url = _ref11.url, method = _ref11.method, data = _ref11.data, config = _ref11.config;
|
|
329
375
|
console.log('[Server] handleOrderList:', url, method, data, config);
|
|
330
376
|
queryPayload = data && _typeof(data) === 'object' ? _objectSpread({}, data) : {};
|
|
331
|
-
|
|
377
|
+
_ref13 = config || {}, callback = _ref13.callback, subscriberId = _ref13.subscriberId;
|
|
332
378
|
useLocal = _this.shouldUseLocalOrderQuery(queryPayload);
|
|
333
379
|
_this.logInfo('handleOrderList: 开始处理订单列表请求', {
|
|
334
380
|
data: queryPayload,
|
|
335
381
|
useLocal: useLocal
|
|
336
382
|
});
|
|
337
383
|
if (!useLocal) {
|
|
338
|
-
|
|
384
|
+
_context5.next = 9;
|
|
339
385
|
break;
|
|
340
386
|
}
|
|
341
387
|
if (subscriberId && typeof callback === 'function') {
|
|
@@ -348,7 +394,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
348
394
|
totalSubscribers: _this.orderQuerySubscribers.size
|
|
349
395
|
});
|
|
350
396
|
}
|
|
351
|
-
return
|
|
397
|
+
return _context5.abrupt("return", _this.computeOrderQueryResult(queryPayload));
|
|
352
398
|
case 9:
|
|
353
399
|
if (subscriberId) {
|
|
354
400
|
_this.orderQuerySubscribers.delete(subscriberId);
|
|
@@ -357,28 +403,28 @@ var Server = /*#__PURE__*/function () {
|
|
|
357
403
|
remaining: _this.orderQuerySubscribers.size
|
|
358
404
|
});
|
|
359
405
|
}
|
|
360
|
-
return
|
|
406
|
+
return _context5.abrupt("return", _this.fetchOrderListFromAPI(queryPayload));
|
|
361
407
|
case 11:
|
|
362
408
|
case "end":
|
|
363
|
-
return
|
|
409
|
+
return _context5.stop();
|
|
364
410
|
}
|
|
365
|
-
},
|
|
411
|
+
}, _callee5);
|
|
366
412
|
}));
|
|
367
|
-
return function (
|
|
368
|
-
return
|
|
413
|
+
return function (_x5) {
|
|
414
|
+
return _ref12.apply(this, arguments);
|
|
369
415
|
};
|
|
370
416
|
}());
|
|
371
417
|
/**
|
|
372
418
|
* 取消订单列表查询订阅(HTTP 路由入口)
|
|
373
419
|
*/
|
|
374
420
|
_defineProperty(this, "handleUnsubscribeOrderQuery", /*#__PURE__*/function () {
|
|
375
|
-
var
|
|
376
|
-
var data,
|
|
377
|
-
return _regeneratorRuntime().wrap(function
|
|
378
|
-
while (1) switch (
|
|
421
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref14) {
|
|
422
|
+
var data, _ref16, subscriberId;
|
|
423
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
424
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
379
425
|
case 0:
|
|
380
|
-
data =
|
|
381
|
-
|
|
426
|
+
data = _ref14.data;
|
|
427
|
+
_ref16 = data || {}, subscriberId = _ref16.subscriberId;
|
|
382
428
|
if (subscriberId) {
|
|
383
429
|
_this.orderQuerySubscribers.delete(subscriberId);
|
|
384
430
|
_this.logInfo('handleUnsubscribeOrderQuery: 已移除订阅者', {
|
|
@@ -386,19 +432,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
386
432
|
remaining: _this.orderQuerySubscribers.size
|
|
387
433
|
});
|
|
388
434
|
}
|
|
389
|
-
return
|
|
435
|
+
return _context6.abrupt("return", {
|
|
390
436
|
code: 200,
|
|
391
437
|
message: 'ok',
|
|
392
438
|
status: true
|
|
393
439
|
});
|
|
394
440
|
case 4:
|
|
395
441
|
case "end":
|
|
396
|
-
return
|
|
442
|
+
return _context6.stop();
|
|
397
443
|
}
|
|
398
|
-
},
|
|
444
|
+
}, _callee6);
|
|
399
445
|
}));
|
|
400
|
-
return function (
|
|
401
|
-
return
|
|
446
|
+
return function (_x6) {
|
|
447
|
+
return _ref15.apply(this, arguments);
|
|
402
448
|
};
|
|
403
449
|
}());
|
|
404
450
|
/**
|
|
@@ -411,22 +457,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
411
457
|
* 今天:注册订阅者 + 本地数据筛选;非今天:清理订阅者 + 走真实 API
|
|
412
458
|
*/
|
|
413
459
|
_defineProperty(this, "handleBookingList", /*#__PURE__*/function () {
|
|
414
|
-
var
|
|
415
|
-
var url, method, data, config, queryPayload,
|
|
416
|
-
return _regeneratorRuntime().wrap(function
|
|
417
|
-
while (1) switch (
|
|
460
|
+
var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref17) {
|
|
461
|
+
var url, method, data, config, queryPayload, _ref19, callback, subscriberId, useLocal, withFields, requestPayload, cacheKey;
|
|
462
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
463
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
418
464
|
case 0:
|
|
419
|
-
url =
|
|
465
|
+
url = _ref17.url, method = _ref17.method, data = _ref17.data, config = _ref17.config;
|
|
420
466
|
console.log('[Server] handleBookingList:', url, method, data, config);
|
|
421
467
|
queryPayload = data && _typeof(data) === 'object' ? _objectSpread({}, data) : {};
|
|
422
|
-
|
|
468
|
+
_ref19 = config || {}, callback = _ref19.callback, subscriberId = _ref19.subscriberId;
|
|
423
469
|
useLocal = _this.shouldUseLocalBookingQuery(queryPayload);
|
|
424
470
|
_this.logInfo('handleBookingList: 开始处理预约列表请求', {
|
|
425
471
|
data: queryPayload,
|
|
426
472
|
useLocal: useLocal
|
|
427
473
|
});
|
|
428
474
|
if (!useLocal) {
|
|
429
|
-
|
|
475
|
+
_context7.next = 12;
|
|
430
476
|
break;
|
|
431
477
|
}
|
|
432
478
|
if (subscriberId) {
|
|
@@ -442,7 +488,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
442
488
|
totalSubscribers: _this.bookingQuerySubscribers.size
|
|
443
489
|
});
|
|
444
490
|
}
|
|
445
|
-
return
|
|
491
|
+
return _context7.abrupt("return", _this.computeBookingQueryResult(queryPayload));
|
|
446
492
|
case 12:
|
|
447
493
|
if (subscriberId) {
|
|
448
494
|
_this.bookingQuerySubscribers.delete(subscriberId);
|
|
@@ -468,15 +514,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
468
514
|
remaining: _this.bookingQuerySubscribers.size
|
|
469
515
|
});
|
|
470
516
|
}
|
|
471
|
-
return
|
|
517
|
+
return _context7.abrupt("return", _this.fetchBookingListFromAPI(queryPayload));
|
|
472
518
|
case 16:
|
|
473
519
|
case "end":
|
|
474
|
-
return
|
|
520
|
+
return _context7.stop();
|
|
475
521
|
}
|
|
476
|
-
},
|
|
522
|
+
}, _callee7);
|
|
477
523
|
}));
|
|
478
|
-
return function (
|
|
479
|
-
return
|
|
524
|
+
return function (_x7) {
|
|
525
|
+
return _ref18.apply(this, arguments);
|
|
480
526
|
};
|
|
481
527
|
}());
|
|
482
528
|
/**
|
|
@@ -484,13 +530,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
484
530
|
* 转发到资源模块去
|
|
485
531
|
*/
|
|
486
532
|
_defineProperty(this, "handleResourceList", /*#__PURE__*/function () {
|
|
487
|
-
var
|
|
533
|
+
var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref20) {
|
|
488
534
|
var _this$resource;
|
|
489
535
|
var url, method, data, config, list;
|
|
490
|
-
return _regeneratorRuntime().wrap(function
|
|
491
|
-
while (1) switch (
|
|
536
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
537
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
492
538
|
case 0:
|
|
493
|
-
url =
|
|
539
|
+
url = _ref20.url, method = _ref20.method, data = _ref20.data, config = _ref20.config;
|
|
494
540
|
console.log('[Server] handleResourceList:', url, method, data, config);
|
|
495
541
|
list = (_this$resource = _this.resource) === null || _this$resource === void 0 ? void 0 : _this$resource.getResources({
|
|
496
542
|
skip: (data === null || data === void 0 ? void 0 : data.skip) || 1,
|
|
@@ -499,7 +545,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
499
545
|
_this.logInfo('Server 劫持 Resource 接口:handleResourceList: 资源列表查询结果', {
|
|
500
546
|
list: list
|
|
501
547
|
});
|
|
502
|
-
return
|
|
548
|
+
return _context8.abrupt("return", {
|
|
503
549
|
code: 200,
|
|
504
550
|
data: {
|
|
505
551
|
list: list,
|
|
@@ -510,12 +556,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
510
556
|
});
|
|
511
557
|
case 5:
|
|
512
558
|
case "end":
|
|
513
|
-
return
|
|
559
|
+
return _context8.stop();
|
|
514
560
|
}
|
|
515
|
-
},
|
|
561
|
+
}, _callee8);
|
|
516
562
|
}));
|
|
517
|
-
return function (
|
|
518
|
-
return
|
|
563
|
+
return function (_x8) {
|
|
564
|
+
return _ref21.apply(this, arguments);
|
|
519
565
|
};
|
|
520
566
|
}());
|
|
521
567
|
/**
|
|
@@ -533,35 +579,35 @@ var Server = /*#__PURE__*/function () {
|
|
|
533
579
|
* @example 批量:GET /update/localOrder?order_ids=96971,96972,96973
|
|
534
580
|
*/
|
|
535
581
|
_defineProperty(this, "handleUpdateLocalOrder", /*#__PURE__*/function () {
|
|
536
|
-
var
|
|
537
|
-
var
|
|
582
|
+
var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref22) {
|
|
583
|
+
var _ref24, _this$app;
|
|
538
584
|
var url, data, batchIds, rawOrderId, orderId, backendPath, _response$data, response, fresh, exists, _yield$_this$order$ov, overwritten, errorMessage;
|
|
539
|
-
return _regeneratorRuntime().wrap(function
|
|
540
|
-
while (1) switch (
|
|
585
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
586
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
541
587
|
case 0:
|
|
542
|
-
url =
|
|
588
|
+
url = _ref22.url, data = _ref22.data;
|
|
543
589
|
batchIds = _this.parseOrderIdsParam(url, data);
|
|
544
590
|
if (!(batchIds.length > 0)) {
|
|
545
|
-
|
|
591
|
+
_context9.next = 4;
|
|
546
592
|
break;
|
|
547
593
|
}
|
|
548
|
-
return
|
|
594
|
+
return _context9.abrupt("return", _this.handleUpdateLocalOrdersBatch(batchIds));
|
|
549
595
|
case 4:
|
|
550
|
-
rawOrderId = (
|
|
596
|
+
rawOrderId = (_ref24 = data && _typeof(data) === 'object' ? data.order_id : undefined) !== null && _ref24 !== void 0 ? _ref24 : _this.extractQueryParam(url, 'order_id');
|
|
551
597
|
orderId = rawOrderId === undefined || rawOrderId === null || rawOrderId === '' ? null : String(rawOrderId).trim();
|
|
552
598
|
_this.logInfo('handleUpdateLocalOrder: 开始处理', {
|
|
553
599
|
url: url,
|
|
554
600
|
orderId: orderId
|
|
555
601
|
});
|
|
556
602
|
if (orderId) {
|
|
557
|
-
|
|
603
|
+
_context9.next = 10;
|
|
558
604
|
break;
|
|
559
605
|
}
|
|
560
606
|
_this.logWarning('handleUpdateLocalOrder: order_id 缺失', {
|
|
561
607
|
url: url,
|
|
562
608
|
data: data
|
|
563
609
|
});
|
|
564
|
-
return
|
|
610
|
+
return _context9.abrupt("return", {
|
|
565
611
|
code: 400,
|
|
566
612
|
status: false,
|
|
567
613
|
message: 'order_id 缺失',
|
|
@@ -569,11 +615,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
569
615
|
});
|
|
570
616
|
case 10:
|
|
571
617
|
if (_this.order) {
|
|
572
|
-
|
|
618
|
+
_context9.next = 13;
|
|
573
619
|
break;
|
|
574
620
|
}
|
|
575
621
|
_this.logError('handleUpdateLocalOrder: Order 模块未注册');
|
|
576
|
-
return
|
|
622
|
+
return _context9.abrupt("return", {
|
|
577
623
|
code: 500,
|
|
578
624
|
status: false,
|
|
579
625
|
message: 'Order 模块未注册',
|
|
@@ -581,11 +627,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
581
627
|
});
|
|
582
628
|
case 13:
|
|
583
629
|
if ((_this$app = _this.app) !== null && _this$app !== void 0 && _this$app.request) {
|
|
584
|
-
|
|
630
|
+
_context9.next = 16;
|
|
585
631
|
break;
|
|
586
632
|
}
|
|
587
633
|
_this.logError('handleUpdateLocalOrder: app.request 不可用');
|
|
588
|
-
return
|
|
634
|
+
return _context9.abrupt("return", {
|
|
589
635
|
code: 500,
|
|
590
636
|
status: false,
|
|
591
637
|
message: 'app.request 不可用',
|
|
@@ -593,23 +639,23 @@ var Server = /*#__PURE__*/function () {
|
|
|
593
639
|
});
|
|
594
640
|
case 16:
|
|
595
641
|
backendPath = "/shop/order/sales/".concat(encodeURIComponent(orderId), "?with%5B%5D=all");
|
|
596
|
-
|
|
597
|
-
|
|
642
|
+
_context9.prev = 17;
|
|
643
|
+
_context9.next = 20;
|
|
598
644
|
return _this.app.request.get(backendPath, undefined, {
|
|
599
645
|
isShopApi: true
|
|
600
646
|
});
|
|
601
647
|
case 20:
|
|
602
|
-
response =
|
|
648
|
+
response = _context9.sent;
|
|
603
649
|
fresh = (_response$data = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data !== void 0 ? _response$data : response;
|
|
604
650
|
if (!(!fresh || _typeof(fresh) !== 'object' || fresh.order_id == null)) {
|
|
605
|
-
|
|
651
|
+
_context9.next = 25;
|
|
606
652
|
break;
|
|
607
653
|
}
|
|
608
654
|
_this.logError('handleUpdateLocalOrder: 后端返回订单为空', {
|
|
609
655
|
orderId: orderId,
|
|
610
656
|
backendPath: backendPath
|
|
611
657
|
});
|
|
612
|
-
return
|
|
658
|
+
return _context9.abrupt("return", {
|
|
613
659
|
code: 500,
|
|
614
660
|
status: false,
|
|
615
661
|
message: '后端返回订单为空',
|
|
@@ -618,19 +664,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
618
664
|
case 25:
|
|
619
665
|
exists = !!_this.order.getOrderByOrderId(orderId);
|
|
620
666
|
if (!exists) {
|
|
621
|
-
|
|
667
|
+
_context9.next = 33;
|
|
622
668
|
break;
|
|
623
669
|
}
|
|
624
|
-
|
|
670
|
+
_context9.next = 29;
|
|
625
671
|
return _this.order.overwriteExistingOrder(fresh);
|
|
626
672
|
case 29:
|
|
627
|
-
_yield$_this$order$ov =
|
|
673
|
+
_yield$_this$order$ov = _context9.sent;
|
|
628
674
|
overwritten = _yield$_this$order$ov.overwritten;
|
|
629
675
|
_this.logInfo('handleUpdateLocalOrder: 覆盖完成', {
|
|
630
676
|
orderId: orderId,
|
|
631
677
|
overwritten: overwritten
|
|
632
678
|
});
|
|
633
|
-
return
|
|
679
|
+
return _context9.abrupt("return", {
|
|
634
680
|
code: 200,
|
|
635
681
|
status: true,
|
|
636
682
|
message: '',
|
|
@@ -641,13 +687,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
641
687
|
}
|
|
642
688
|
});
|
|
643
689
|
case 33:
|
|
644
|
-
|
|
690
|
+
_context9.next = 35;
|
|
645
691
|
return _this.order.upsertOrdersFromRemote([fresh]);
|
|
646
692
|
case 35:
|
|
647
693
|
_this.logInfo('handleUpdateLocalOrder: 本地合并新订单完成', {
|
|
648
694
|
orderId: orderId
|
|
649
695
|
});
|
|
650
|
-
return
|
|
696
|
+
return _context9.abrupt("return", {
|
|
651
697
|
code: 200,
|
|
652
698
|
status: true,
|
|
653
699
|
message: '',
|
|
@@ -658,15 +704,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
658
704
|
}
|
|
659
705
|
});
|
|
660
706
|
case 39:
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
errorMessage =
|
|
707
|
+
_context9.prev = 39;
|
|
708
|
+
_context9.t0 = _context9["catch"](17);
|
|
709
|
+
errorMessage = _context9.t0 instanceof Error ? _context9.t0.message : String(_context9.t0);
|
|
664
710
|
_this.logError('handleUpdateLocalOrder: 请求失败', {
|
|
665
711
|
orderId: orderId,
|
|
666
712
|
backendPath: backendPath,
|
|
667
713
|
error: errorMessage
|
|
668
714
|
});
|
|
669
|
-
return
|
|
715
|
+
return _context9.abrupt("return", {
|
|
670
716
|
code: 500,
|
|
671
717
|
status: false,
|
|
672
718
|
message: errorMessage,
|
|
@@ -674,66 +720,66 @@ var Server = /*#__PURE__*/function () {
|
|
|
674
720
|
});
|
|
675
721
|
case 44:
|
|
676
722
|
case "end":
|
|
677
|
-
return
|
|
723
|
+
return _context9.stop();
|
|
678
724
|
}
|
|
679
|
-
},
|
|
725
|
+
}, _callee9, null, [[17, 39]]);
|
|
680
726
|
}));
|
|
681
|
-
return function (
|
|
682
|
-
return
|
|
727
|
+
return function (_x9) {
|
|
728
|
+
return _ref23.apply(this, arguments);
|
|
683
729
|
};
|
|
684
730
|
}());
|
|
685
731
|
_defineProperty(this, "handleOrderSalesCheckout", /*#__PURE__*/function () {
|
|
686
|
-
var
|
|
732
|
+
var _ref26 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref25) {
|
|
687
733
|
var data;
|
|
688
|
-
return _regeneratorRuntime().wrap(function
|
|
689
|
-
while (1) switch (
|
|
734
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
735
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
690
736
|
case 0:
|
|
691
|
-
data =
|
|
692
|
-
return
|
|
737
|
+
data = _ref25.data;
|
|
738
|
+
return _context10.abrupt("return", _this.handleOrderCheckoutSubmit({
|
|
693
739
|
backendPath: '/shop/order/sales/checkout',
|
|
694
740
|
data: data,
|
|
695
741
|
title: 'handleOrderSalesCheckout'
|
|
696
742
|
}));
|
|
697
743
|
case 2:
|
|
698
744
|
case "end":
|
|
699
|
-
return
|
|
745
|
+
return _context10.stop();
|
|
700
746
|
}
|
|
701
|
-
},
|
|
747
|
+
}, _callee10);
|
|
702
748
|
}));
|
|
703
|
-
return function (
|
|
704
|
-
return
|
|
749
|
+
return function (_x10) {
|
|
750
|
+
return _ref26.apply(this, arguments);
|
|
705
751
|
};
|
|
706
752
|
}());
|
|
707
753
|
_defineProperty(this, "handleOrderCheckout", /*#__PURE__*/function () {
|
|
708
|
-
var
|
|
754
|
+
var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref27) {
|
|
709
755
|
var data;
|
|
710
|
-
return _regeneratorRuntime().wrap(function
|
|
711
|
-
while (1) switch (
|
|
756
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
757
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
712
758
|
case 0:
|
|
713
|
-
data =
|
|
714
|
-
return
|
|
759
|
+
data = _ref27.data;
|
|
760
|
+
return _context11.abrupt("return", _this.handleOrderCheckoutSubmit({
|
|
715
761
|
backendPath: '/order/checkout',
|
|
716
762
|
data: data,
|
|
717
763
|
title: 'handleOrderCheckout'
|
|
718
764
|
}));
|
|
719
765
|
case 2:
|
|
720
766
|
case "end":
|
|
721
|
-
return
|
|
767
|
+
return _context11.stop();
|
|
722
768
|
}
|
|
723
|
-
},
|
|
769
|
+
}, _callee11);
|
|
724
770
|
}));
|
|
725
|
-
return function (
|
|
726
|
-
return
|
|
771
|
+
return function (_x11) {
|
|
772
|
+
return _ref28.apply(this, arguments);
|
|
727
773
|
};
|
|
728
774
|
}());
|
|
729
775
|
_defineProperty(this, "handleOrderSalesDetail", /*#__PURE__*/function () {
|
|
730
|
-
var
|
|
776
|
+
var _ref30 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref29) {
|
|
731
777
|
var _this$app2;
|
|
732
778
|
var url, data, path, requestPath, lookup, localOrder, backendPath, _response$data2, response, fresh, savedOrder, errorMessage;
|
|
733
|
-
return _regeneratorRuntime().wrap(function
|
|
734
|
-
while (1) switch (
|
|
779
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
780
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
735
781
|
case 0:
|
|
736
|
-
url =
|
|
782
|
+
url = _ref29.url, data = _ref29.data, path = _ref29.path;
|
|
737
783
|
requestPath = _this.parseRequestPath(url, path);
|
|
738
784
|
lookup = _this.extractOrderSalesDetailLookup(requestPath);
|
|
739
785
|
_this.logInfo('handleOrderSalesDetail: 开始处理', {
|
|
@@ -742,14 +788,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
742
788
|
lookup: lookup
|
|
743
789
|
});
|
|
744
790
|
if (lookup) {
|
|
745
|
-
|
|
791
|
+
_context12.next = 7;
|
|
746
792
|
break;
|
|
747
793
|
}
|
|
748
794
|
_this.logWarning('handleOrderSalesDetail: lookup 缺失', {
|
|
749
795
|
url: url,
|
|
750
796
|
path: requestPath
|
|
751
797
|
});
|
|
752
|
-
return
|
|
798
|
+
return _context12.abrupt("return", {
|
|
753
799
|
code: 400,
|
|
754
800
|
status: false,
|
|
755
801
|
message: '订单 lookup 缺失',
|
|
@@ -757,11 +803,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
757
803
|
});
|
|
758
804
|
case 7:
|
|
759
805
|
if (_this.order) {
|
|
760
|
-
|
|
806
|
+
_context12.next = 10;
|
|
761
807
|
break;
|
|
762
808
|
}
|
|
763
809
|
_this.logError('handleOrderSalesDetail: Order 模块未注册');
|
|
764
|
-
return
|
|
810
|
+
return _context12.abrupt("return", {
|
|
765
811
|
code: 500,
|
|
766
812
|
status: false,
|
|
767
813
|
message: 'Order 模块未注册',
|
|
@@ -769,21 +815,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
769
815
|
});
|
|
770
816
|
case 10:
|
|
771
817
|
if (_this.shouldForceRemoteSalesDetail(data)) {
|
|
772
|
-
|
|
818
|
+
_context12.next = 17;
|
|
773
819
|
break;
|
|
774
820
|
}
|
|
775
|
-
|
|
821
|
+
_context12.next = 13;
|
|
776
822
|
return _this.order.getLocalOrderByLookup(lookup);
|
|
777
823
|
case 13:
|
|
778
|
-
localOrder =
|
|
824
|
+
localOrder = _context12.sent;
|
|
779
825
|
if (!localOrder) {
|
|
780
|
-
|
|
826
|
+
_context12.next = 17;
|
|
781
827
|
break;
|
|
782
828
|
}
|
|
783
829
|
_this.logInfo('handleOrderSalesDetail: 命中本地订单', {
|
|
784
830
|
lookup: lookup
|
|
785
831
|
});
|
|
786
|
-
return
|
|
832
|
+
return _context12.abrupt("return", {
|
|
787
833
|
code: 200,
|
|
788
834
|
status: true,
|
|
789
835
|
message: '',
|
|
@@ -791,11 +837,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
791
837
|
});
|
|
792
838
|
case 17:
|
|
793
839
|
if ((_this$app2 = _this.app) !== null && _this$app2 !== void 0 && _this$app2.request) {
|
|
794
|
-
|
|
840
|
+
_context12.next = 20;
|
|
795
841
|
break;
|
|
796
842
|
}
|
|
797
843
|
_this.logError('handleOrderSalesDetail: app.request 不可用');
|
|
798
|
-
return
|
|
844
|
+
return _context12.abrupt("return", {
|
|
799
845
|
code: 500,
|
|
800
846
|
status: false,
|
|
801
847
|
message: 'app.request 不可用',
|
|
@@ -803,8 +849,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
803
849
|
});
|
|
804
850
|
case 20:
|
|
805
851
|
backendPath = _this.buildOrderSalesDetailBackendPath(lookup, data);
|
|
806
|
-
|
|
807
|
-
|
|
852
|
+
_context12.prev = 21;
|
|
853
|
+
_context12.next = 24;
|
|
808
854
|
return _this.app.request.get(backendPath, {
|
|
809
855
|
lookup_mode: 'multi'
|
|
810
856
|
}, {
|
|
@@ -812,38 +858,38 @@ var Server = /*#__PURE__*/function () {
|
|
|
812
858
|
customToast: function customToast() {}
|
|
813
859
|
});
|
|
814
860
|
case 24:
|
|
815
|
-
response =
|
|
861
|
+
response = _context12.sent;
|
|
816
862
|
fresh = (_response$data2 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data2 !== void 0 ? _response$data2 : response;
|
|
817
863
|
if (!(!fresh || _typeof(fresh) !== 'object' || fresh.order_id == null)) {
|
|
818
|
-
|
|
864
|
+
_context12.next = 29;
|
|
819
865
|
break;
|
|
820
866
|
}
|
|
821
867
|
_this.logInfo('handleOrderSalesDetail: 后端返回订单为空', {
|
|
822
868
|
lookup: lookup,
|
|
823
869
|
backendPath: backendPath
|
|
824
870
|
});
|
|
825
|
-
return
|
|
871
|
+
return _context12.abrupt("return", {
|
|
826
872
|
code: 500,
|
|
827
873
|
status: false,
|
|
828
874
|
message: '后端返回订单为空',
|
|
829
875
|
data: null
|
|
830
876
|
});
|
|
831
877
|
case 29:
|
|
832
|
-
|
|
878
|
+
_context12.next = 31;
|
|
833
879
|
return _this.order.upsertOrdersFromRemote([fresh]);
|
|
834
880
|
case 31:
|
|
835
|
-
|
|
881
|
+
_context12.next = 33;
|
|
836
882
|
return _this.order.getLocalOrderByLookup(lookup);
|
|
837
883
|
case 33:
|
|
838
|
-
savedOrder =
|
|
884
|
+
savedOrder = _context12.sent;
|
|
839
885
|
if (savedOrder) {
|
|
840
|
-
|
|
886
|
+
_context12.next = 37;
|
|
841
887
|
break;
|
|
842
888
|
}
|
|
843
889
|
_this.logError('handleOrderSalesDetail: 订单写入后回读失败', {
|
|
844
890
|
lookup: lookup
|
|
845
891
|
});
|
|
846
|
-
return
|
|
892
|
+
return _context12.abrupt("return", {
|
|
847
893
|
code: 500,
|
|
848
894
|
status: false,
|
|
849
895
|
message: '订单写入后回读失败',
|
|
@@ -853,22 +899,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
853
899
|
_this.logInfo('handleOrderSalesDetail: 远端订单已同步到本地', {
|
|
854
900
|
lookup: lookup
|
|
855
901
|
});
|
|
856
|
-
return
|
|
902
|
+
return _context12.abrupt("return", {
|
|
857
903
|
code: 200,
|
|
858
904
|
status: true,
|
|
859
905
|
message: '',
|
|
860
906
|
data: savedOrder
|
|
861
907
|
});
|
|
862
908
|
case 41:
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
errorMessage =
|
|
909
|
+
_context12.prev = 41;
|
|
910
|
+
_context12.t0 = _context12["catch"](21);
|
|
911
|
+
errorMessage = _context12.t0 instanceof Error ? _context12.t0.message : String(_context12.t0);
|
|
866
912
|
_this.logError('handleOrderSalesDetail: 请求失败', {
|
|
867
913
|
lookup: lookup,
|
|
868
914
|
backendPath: backendPath,
|
|
869
915
|
error: errorMessage
|
|
870
916
|
});
|
|
871
|
-
return
|
|
917
|
+
return _context12.abrupt("return", {
|
|
872
918
|
code: 500,
|
|
873
919
|
status: false,
|
|
874
920
|
message: errorMessage,
|
|
@@ -876,28 +922,28 @@ var Server = /*#__PURE__*/function () {
|
|
|
876
922
|
});
|
|
877
923
|
case 46:
|
|
878
924
|
case "end":
|
|
879
|
-
return
|
|
925
|
+
return _context12.stop();
|
|
880
926
|
}
|
|
881
|
-
},
|
|
927
|
+
}, _callee12, null, [[21, 41]]);
|
|
882
928
|
}));
|
|
883
|
-
return function (
|
|
884
|
-
return
|
|
929
|
+
return function (_x12) {
|
|
930
|
+
return _ref30.apply(this, arguments);
|
|
885
931
|
};
|
|
886
932
|
}());
|
|
887
933
|
/**
|
|
888
934
|
* GET /shop/schedule/floor-plan* 前缀路由:读本地 store;支持 subscriberId + callback 订阅更新
|
|
889
935
|
*/
|
|
890
936
|
_defineProperty(this, "handleFloorPlanGet", /*#__PURE__*/function () {
|
|
891
|
-
var
|
|
892
|
-
var url, data, config, routePath, base, path, _subscriberId,
|
|
893
|
-
return _regeneratorRuntime().wrap(function
|
|
894
|
-
while (1) switch (
|
|
937
|
+
var _ref32 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_ref31) {
|
|
938
|
+
var url, data, config, routePath, base, path, _subscriberId, _ref33, callback, subscriberId, ctx;
|
|
939
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
940
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
895
941
|
case 0:
|
|
896
|
-
url =
|
|
942
|
+
url = _ref31.url, data = _ref31.data, config = _ref31.config, routePath = _ref31.path;
|
|
897
943
|
base = '/shop/schedule/floor-plan';
|
|
898
944
|
path = _this.parseRequestPath(url, routePath);
|
|
899
945
|
if (!(path === "".concat(base, "/unsubscribe"))) {
|
|
900
|
-
|
|
946
|
+
_context13.next = 7;
|
|
901
947
|
break;
|
|
902
948
|
}
|
|
903
949
|
_subscriberId = data === null || data === void 0 ? void 0 : data.subscriberId;
|
|
@@ -908,19 +954,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
908
954
|
remaining: _this.floorPlanQuerySubscribers.size
|
|
909
955
|
});
|
|
910
956
|
}
|
|
911
|
-
return
|
|
957
|
+
return _context13.abrupt("return", {
|
|
912
958
|
code: 200,
|
|
913
959
|
message: 'ok',
|
|
914
960
|
status: true
|
|
915
961
|
});
|
|
916
962
|
case 7:
|
|
917
|
-
|
|
963
|
+
_ref33 = config || {}, callback = _ref33.callback, subscriberId = _ref33.subscriberId;
|
|
918
964
|
ctx = _this.resolveFloorPlanQueryContext(path, base);
|
|
919
965
|
if (ctx) {
|
|
920
|
-
|
|
966
|
+
_context13.next = 11;
|
|
921
967
|
break;
|
|
922
968
|
}
|
|
923
|
-
return
|
|
969
|
+
return _context13.abrupt("return", {
|
|
924
970
|
status: false,
|
|
925
971
|
code: 404,
|
|
926
972
|
message: 'Not Found',
|
|
@@ -938,28 +984,28 @@ var Server = /*#__PURE__*/function () {
|
|
|
938
984
|
total: _this.floorPlanQuerySubscribers.size
|
|
939
985
|
});
|
|
940
986
|
}
|
|
941
|
-
return
|
|
987
|
+
return _context13.abrupt("return", _this.computeFloorPlanQueryResult(ctx));
|
|
942
988
|
case 13:
|
|
943
989
|
case "end":
|
|
944
|
-
return
|
|
990
|
+
return _context13.stop();
|
|
945
991
|
}
|
|
946
|
-
},
|
|
992
|
+
}, _callee13);
|
|
947
993
|
}));
|
|
948
|
-
return function (
|
|
949
|
-
return
|
|
994
|
+
return function (_x13) {
|
|
995
|
+
return _ref32.apply(this, arguments);
|
|
950
996
|
};
|
|
951
997
|
}());
|
|
952
998
|
/**
|
|
953
999
|
* 取消预约列表查询订阅(HTTP 路由入口)
|
|
954
1000
|
*/
|
|
955
1001
|
_defineProperty(this, "handleUnsubscribeBookingQuery", /*#__PURE__*/function () {
|
|
956
|
-
var
|
|
957
|
-
var data,
|
|
958
|
-
return _regeneratorRuntime().wrap(function
|
|
959
|
-
while (1) switch (
|
|
1002
|
+
var _ref35 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(_ref34) {
|
|
1003
|
+
var data, _ref36, subscriberId;
|
|
1004
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1005
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
960
1006
|
case 0:
|
|
961
|
-
data =
|
|
962
|
-
|
|
1007
|
+
data = _ref34.data;
|
|
1008
|
+
_ref36 = data || {}, subscriberId = _ref36.subscriberId;
|
|
963
1009
|
if (subscriberId) {
|
|
964
1010
|
_this.bookingQuerySubscribers.delete(subscriberId);
|
|
965
1011
|
_this.bookingRemoteQuerySubscribers.delete(subscriberId);
|
|
@@ -969,19 +1015,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
969
1015
|
remainingRemote: _this.bookingRemoteQuerySubscribers.size
|
|
970
1016
|
});
|
|
971
1017
|
}
|
|
972
|
-
return
|
|
1018
|
+
return _context14.abrupt("return", {
|
|
973
1019
|
code: 200,
|
|
974
1020
|
message: 'ok',
|
|
975
1021
|
status: true
|
|
976
1022
|
});
|
|
977
1023
|
case 4:
|
|
978
1024
|
case "end":
|
|
979
|
-
return
|
|
1025
|
+
return _context14.stop();
|
|
980
1026
|
}
|
|
981
|
-
},
|
|
1027
|
+
}, _callee14);
|
|
982
1028
|
}));
|
|
983
|
-
return function (
|
|
984
|
-
return
|
|
1029
|
+
return function (_x14) {
|
|
1030
|
+
return _ref35.apply(this, arguments);
|
|
985
1031
|
};
|
|
986
1032
|
}());
|
|
987
1033
|
/**
|
|
@@ -989,13 +1035,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
989
1035
|
* 通过餐牌ID列表获取所有相关日程的时间段点
|
|
990
1036
|
*/
|
|
991
1037
|
_defineProperty(this, "handleGetScheduleTimePoints", /*#__PURE__*/function () {
|
|
992
|
-
var
|
|
1038
|
+
var _ref38 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(_ref37) {
|
|
993
1039
|
var _menu_list_ids$length;
|
|
994
1040
|
var url, method, data, config, menu_list_ids, _menu_list_ids$length2, menuList, scheduleIds, scheduleList, timePoints, errorMessage;
|
|
995
|
-
return _regeneratorRuntime().wrap(function
|
|
996
|
-
while (1) switch (
|
|
1041
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1042
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
997
1043
|
case 0:
|
|
998
|
-
url =
|
|
1044
|
+
url = _ref37.url, method = _ref37.method, data = _ref37.data, config = _ref37.config;
|
|
999
1045
|
console.log('[Server] handleGetScheduleTimePoints:', url, method, data, config);
|
|
1000
1046
|
menu_list_ids = data.menu_list_ids;
|
|
1001
1047
|
_this.logInfo('handleGetScheduleTimePoints 开始处理', {
|
|
@@ -1005,12 +1051,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
1005
1051
|
|
|
1006
1052
|
// 检查必要的模块是否已注册
|
|
1007
1053
|
if (_this.menu) {
|
|
1008
|
-
|
|
1054
|
+
_context15.next = 8;
|
|
1009
1055
|
break;
|
|
1010
1056
|
}
|
|
1011
1057
|
console.error('[Server] Menu 模块未注册');
|
|
1012
1058
|
_this.logError('handleGetScheduleTimePoints: Menu 模块未注册');
|
|
1013
|
-
return
|
|
1059
|
+
return _context15.abrupt("return", {
|
|
1014
1060
|
code: 500,
|
|
1015
1061
|
message: 'Menu 模块未注册',
|
|
1016
1062
|
data: [],
|
|
@@ -1018,12 +1064,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
1018
1064
|
});
|
|
1019
1065
|
case 8:
|
|
1020
1066
|
if (_this.schedule) {
|
|
1021
|
-
|
|
1067
|
+
_context15.next = 12;
|
|
1022
1068
|
break;
|
|
1023
1069
|
}
|
|
1024
1070
|
console.error('[Server] Schedule 模块未注册');
|
|
1025
1071
|
_this.logError('handleGetScheduleTimePoints: Schedule 模块未注册');
|
|
1026
|
-
return
|
|
1072
|
+
return _context15.abrupt("return", {
|
|
1027
1073
|
code: 500,
|
|
1028
1074
|
message: 'Schedule 模块未注册',
|
|
1029
1075
|
data: [],
|
|
@@ -1031,7 +1077,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1031
1077
|
});
|
|
1032
1078
|
case 12:
|
|
1033
1079
|
if (!(!menu_list_ids || !Array.isArray(menu_list_ids) || menu_list_ids.length === 0)) {
|
|
1034
|
-
|
|
1080
|
+
_context15.next = 16;
|
|
1035
1081
|
break;
|
|
1036
1082
|
}
|
|
1037
1083
|
console.error('[Server] menu_list_ids 参数无效');
|
|
@@ -1039,14 +1085,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
1039
1085
|
menuListIdsCount: (_menu_list_ids$length2 = menu_list_ids === null || menu_list_ids === void 0 ? void 0 : menu_list_ids.length) !== null && _menu_list_ids$length2 !== void 0 ? _menu_list_ids$length2 : 0,
|
|
1040
1086
|
menu_list_ids: menu_list_ids
|
|
1041
1087
|
});
|
|
1042
|
-
return
|
|
1088
|
+
return _context15.abrupt("return", {
|
|
1043
1089
|
code: 400,
|
|
1044
1090
|
message: 'menu_list_ids 参数无效',
|
|
1045
1091
|
data: [],
|
|
1046
1092
|
status: false
|
|
1047
1093
|
});
|
|
1048
1094
|
case 16:
|
|
1049
|
-
|
|
1095
|
+
_context15.prev = 16;
|
|
1050
1096
|
// 1. 获取餐牌列表
|
|
1051
1097
|
menuList = _this.menu.getMenuByIds(menu_list_ids);
|
|
1052
1098
|
console.log("[Server] \u627E\u5230 ".concat(menuList.length, " \u4E2A\u9910\u724C"));
|
|
@@ -1064,13 +1110,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
1064
1110
|
scheduleCount: scheduleIds.length
|
|
1065
1111
|
});
|
|
1066
1112
|
if (!(scheduleIds.length === 0)) {
|
|
1067
|
-
|
|
1113
|
+
_context15.next = 26;
|
|
1068
1114
|
break;
|
|
1069
1115
|
}
|
|
1070
1116
|
_this.logInfo('handleGetScheduleTimePoints: 没有找到相关日程', {
|
|
1071
1117
|
menuListIdsCount: menu_list_ids.length
|
|
1072
1118
|
});
|
|
1073
|
-
return
|
|
1119
|
+
return _context15.abrupt("return", {
|
|
1074
1120
|
code: 200,
|
|
1075
1121
|
message: '没有找到相关日程',
|
|
1076
1122
|
data: [],
|
|
@@ -1094,22 +1140,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
1094
1140
|
scheduleCount: scheduleList.length,
|
|
1095
1141
|
timePointCount: timePoints.length
|
|
1096
1142
|
});
|
|
1097
|
-
return
|
|
1143
|
+
return _context15.abrupt("return", {
|
|
1098
1144
|
code: 200,
|
|
1099
1145
|
message: '获取成功',
|
|
1100
1146
|
data: timePoints,
|
|
1101
1147
|
status: true
|
|
1102
1148
|
});
|
|
1103
1149
|
case 35:
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
errorMessage =
|
|
1107
|
-
console.error('[Server] 获取日程时间点失败:',
|
|
1150
|
+
_context15.prev = 35;
|
|
1151
|
+
_context15.t0 = _context15["catch"](16);
|
|
1152
|
+
errorMessage = _context15.t0 instanceof Error ? _context15.t0.message : '未知错误';
|
|
1153
|
+
console.error('[Server] 获取日程时间点失败:', _context15.t0);
|
|
1108
1154
|
_this.logError('handleGetScheduleTimePoints: 获取日程时间点失败', {
|
|
1109
1155
|
menuListIdsCount: menu_list_ids.length,
|
|
1110
1156
|
error: errorMessage
|
|
1111
1157
|
});
|
|
1112
|
-
return
|
|
1158
|
+
return _context15.abrupt("return", {
|
|
1113
1159
|
code: 500,
|
|
1114
1160
|
message: "\u83B7\u53D6\u5931\u8D25: ".concat(errorMessage),
|
|
1115
1161
|
data: [],
|
|
@@ -1117,12 +1163,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
1117
1163
|
});
|
|
1118
1164
|
case 41:
|
|
1119
1165
|
case "end":
|
|
1120
|
-
return
|
|
1166
|
+
return _context15.stop();
|
|
1121
1167
|
}
|
|
1122
|
-
},
|
|
1168
|
+
}, _callee15, null, [[16, 35]]);
|
|
1123
1169
|
}));
|
|
1124
|
-
return function (
|
|
1125
|
-
return
|
|
1170
|
+
return function (_x15) {
|
|
1171
|
+
return _ref38.apply(this, arguments);
|
|
1126
1172
|
};
|
|
1127
1173
|
}());
|
|
1128
1174
|
this.core = core;
|
|
@@ -1219,10 +1265,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1219
1265
|
}, {
|
|
1220
1266
|
key: "registerModuleWithRoutes",
|
|
1221
1267
|
value: (function () {
|
|
1222
|
-
var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1268
|
+
var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(module, options, moduleName) {
|
|
1223
1269
|
var routes;
|
|
1224
|
-
return _regeneratorRuntime().wrap(function
|
|
1225
|
-
while (1) switch (
|
|
1270
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1271
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1226
1272
|
case 0:
|
|
1227
1273
|
this.logInfo("\u5F00\u59CB\u6CE8\u518C\u6A21\u5757: ".concat(moduleName), {
|
|
1228
1274
|
moduleName: moduleName,
|
|
@@ -1230,7 +1276,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1230
1276
|
});
|
|
1231
1277
|
|
|
1232
1278
|
// 注册模块到 Core
|
|
1233
|
-
|
|
1279
|
+
_context16.next = 3;
|
|
1234
1280
|
return this.core.registerModule(module, options);
|
|
1235
1281
|
case 3:
|
|
1236
1282
|
console.log("[Server] \u2705 ".concat(moduleName, " \u6A21\u5757\u5DF2\u6CE8\u518C"));
|
|
@@ -1251,11 +1297,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1251
1297
|
}
|
|
1252
1298
|
case 6:
|
|
1253
1299
|
case "end":
|
|
1254
|
-
return
|
|
1300
|
+
return _context16.stop();
|
|
1255
1301
|
}
|
|
1256
|
-
},
|
|
1302
|
+
}, _callee16, this);
|
|
1257
1303
|
}));
|
|
1258
|
-
function registerModuleWithRoutes(
|
|
1304
|
+
function registerModuleWithRoutes(_x16, _x17, _x18) {
|
|
1259
1305
|
return _registerModuleWithRoutes.apply(this, arguments);
|
|
1260
1306
|
}
|
|
1261
1307
|
return registerModuleWithRoutes;
|
|
@@ -1268,10 +1314,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1268
1314
|
}, {
|
|
1269
1315
|
key: "registerModuleByName",
|
|
1270
1316
|
value: (function () {
|
|
1271
|
-
var _registerModuleByName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1317
|
+
var _registerModuleByName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(moduleConfig) {
|
|
1272
1318
|
var moduleName, shouldPreload, customConfig, registryConfig, ModuleClass, moduleInstance, moduleOptions;
|
|
1273
|
-
return _regeneratorRuntime().wrap(function
|
|
1274
|
-
while (1) switch (
|
|
1319
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1320
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1275
1321
|
case 0:
|
|
1276
1322
|
// 解析配置
|
|
1277
1323
|
moduleName = typeof moduleConfig === 'string' ? moduleConfig : moduleConfig.name;
|
|
@@ -1286,7 +1332,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1286
1332
|
// 查找模块配置
|
|
1287
1333
|
registryConfig = this.moduleRegistry[moduleName];
|
|
1288
1334
|
if (registryConfig) {
|
|
1289
|
-
|
|
1335
|
+
_context17.next = 8;
|
|
1290
1336
|
break;
|
|
1291
1337
|
}
|
|
1292
1338
|
this.logError("\u672A\u627E\u5230\u6A21\u5757\u914D\u7F6E: ".concat(moduleName), {
|
|
@@ -1300,7 +1346,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1300
1346
|
moduleOptions = _objectSpread({
|
|
1301
1347
|
store: _objectSpread({}, registryConfig.defaultStore)
|
|
1302
1348
|
}, customConfig); // 注册模块和路由
|
|
1303
|
-
|
|
1349
|
+
_context17.next = 13;
|
|
1304
1350
|
return this.registerModuleWithRoutes(moduleInstance, moduleOptions, moduleName.charAt(0).toUpperCase() + moduleName.slice(1));
|
|
1305
1351
|
case 13:
|
|
1306
1352
|
// 保存模块实例
|
|
@@ -1310,18 +1356,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
1310
1356
|
shouldPreload: shouldPreload,
|
|
1311
1357
|
version: registryConfig.version
|
|
1312
1358
|
});
|
|
1313
|
-
return
|
|
1359
|
+
return _context17.abrupt("return", {
|
|
1314
1360
|
module: moduleInstance,
|
|
1315
1361
|
config: registryConfig,
|
|
1316
1362
|
shouldPreload: shouldPreload
|
|
1317
1363
|
});
|
|
1318
1364
|
case 16:
|
|
1319
1365
|
case "end":
|
|
1320
|
-
return
|
|
1366
|
+
return _context17.stop();
|
|
1321
1367
|
}
|
|
1322
|
-
},
|
|
1368
|
+
}, _callee17, this);
|
|
1323
1369
|
}));
|
|
1324
|
-
function registerModuleByName(
|
|
1370
|
+
function registerModuleByName(_x19) {
|
|
1325
1371
|
return _registerModuleByName.apply(this, arguments);
|
|
1326
1372
|
}
|
|
1327
1373
|
return registerModuleByName;
|
|
@@ -1334,10 +1380,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1334
1380
|
}, {
|
|
1335
1381
|
key: "registerModules",
|
|
1336
1382
|
value: (function () {
|
|
1337
|
-
var _registerModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1383
|
+
var _registerModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(moduleConfigs) {
|
|
1338
1384
|
var configs, registeredModules, _iterator2, _step2, config, configName, result, errorMessage;
|
|
1339
|
-
return _regeneratorRuntime().wrap(function
|
|
1340
|
-
while (1) switch (
|
|
1385
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1386
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1341
1387
|
case 0:
|
|
1342
1388
|
console.log('[Server] 开始注册模块...');
|
|
1343
1389
|
|
|
@@ -1349,47 +1395,47 @@ var Server = /*#__PURE__*/function () {
|
|
|
1349
1395
|
});
|
|
1350
1396
|
registeredModules = [];
|
|
1351
1397
|
_iterator2 = _createForOfIteratorHelper(configs);
|
|
1352
|
-
|
|
1398
|
+
_context18.prev = 5;
|
|
1353
1399
|
_iterator2.s();
|
|
1354
1400
|
case 7:
|
|
1355
1401
|
if ((_step2 = _iterator2.n()).done) {
|
|
1356
|
-
|
|
1402
|
+
_context18.next = 25;
|
|
1357
1403
|
break;
|
|
1358
1404
|
}
|
|
1359
1405
|
config = _step2.value;
|
|
1360
1406
|
configName = typeof config === 'string' ? config : config.name;
|
|
1361
|
-
|
|
1362
|
-
|
|
1407
|
+
_context18.prev = 10;
|
|
1408
|
+
_context18.next = 13;
|
|
1363
1409
|
return this.registerModuleByName(config);
|
|
1364
1410
|
case 13:
|
|
1365
|
-
result =
|
|
1411
|
+
result = _context18.sent;
|
|
1366
1412
|
registeredModules.push(result);
|
|
1367
|
-
|
|
1413
|
+
_context18.next = 23;
|
|
1368
1414
|
break;
|
|
1369
1415
|
case 17:
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
errorMessage =
|
|
1416
|
+
_context18.prev = 17;
|
|
1417
|
+
_context18.t0 = _context18["catch"](10);
|
|
1418
|
+
errorMessage = _context18.t0 instanceof Error ? _context18.t0.message : String(_context18.t0);
|
|
1373
1419
|
this.logError("\u6A21\u5757\u6CE8\u518C\u5931\u8D25: ".concat(configName), {
|
|
1374
1420
|
moduleName: configName,
|
|
1375
1421
|
error: errorMessage
|
|
1376
1422
|
});
|
|
1377
|
-
console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:",
|
|
1378
|
-
throw
|
|
1423
|
+
console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:", _context18.t0);
|
|
1424
|
+
throw _context18.t0;
|
|
1379
1425
|
case 23:
|
|
1380
|
-
|
|
1426
|
+
_context18.next = 7;
|
|
1381
1427
|
break;
|
|
1382
1428
|
case 25:
|
|
1383
|
-
|
|
1429
|
+
_context18.next = 30;
|
|
1384
1430
|
break;
|
|
1385
1431
|
case 27:
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
_iterator2.e(
|
|
1432
|
+
_context18.prev = 27;
|
|
1433
|
+
_context18.t1 = _context18["catch"](5);
|
|
1434
|
+
_iterator2.e(_context18.t1);
|
|
1389
1435
|
case 30:
|
|
1390
|
-
|
|
1436
|
+
_context18.prev = 30;
|
|
1391
1437
|
_iterator2.f();
|
|
1392
|
-
return
|
|
1438
|
+
return _context18.finish(30);
|
|
1393
1439
|
case 33:
|
|
1394
1440
|
console.log('[Server] ✅ 所有模块注册完成');
|
|
1395
1441
|
this.logInfo('所有模块注册完成', {
|
|
@@ -1399,14 +1445,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
1399
1445
|
return m === null || m === void 0 || (_m$config = m.config) === null || _m$config === void 0 ? void 0 : _m$config.name;
|
|
1400
1446
|
})
|
|
1401
1447
|
});
|
|
1402
|
-
return
|
|
1448
|
+
return _context18.abrupt("return", registeredModules);
|
|
1403
1449
|
case 36:
|
|
1404
1450
|
case "end":
|
|
1405
|
-
return
|
|
1451
|
+
return _context18.stop();
|
|
1406
1452
|
}
|
|
1407
|
-
},
|
|
1453
|
+
}, _callee18, this, [[5, 27, 30, 33], [10, 17]]);
|
|
1408
1454
|
}));
|
|
1409
|
-
function registerModules(
|
|
1455
|
+
function registerModules(_x20) {
|
|
1410
1456
|
return _registerModules.apply(this, arguments);
|
|
1411
1457
|
}
|
|
1412
1458
|
return registerModules;
|
|
@@ -1419,10 +1465,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1419
1465
|
}, {
|
|
1420
1466
|
key: "preloadModulesData",
|
|
1421
1467
|
value: (function () {
|
|
1422
|
-
var _preloadModulesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1468
|
+
var _preloadModulesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(registeredModules, options) {
|
|
1423
1469
|
var modulesToPreload, preloadResults, _iterator3, _step3, _step3$value, module, config, shouldPreload, startTime, _options$onModuleLoad, _options$onModuleLoad2, duration, _duration, errorMessage, successCount, failCount;
|
|
1424
|
-
return _regeneratorRuntime().wrap(function
|
|
1425
|
-
while (1) switch (
|
|
1470
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1471
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1426
1472
|
case 0:
|
|
1427
1473
|
console.log('[Server] 开始预加载模块数据...');
|
|
1428
1474
|
modulesToPreload = registeredModules.filter(function (m) {
|
|
@@ -1435,16 +1481,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
1435
1481
|
});
|
|
1436
1482
|
preloadResults = [];
|
|
1437
1483
|
_iterator3 = _createForOfIteratorHelper(registeredModules);
|
|
1438
|
-
|
|
1484
|
+
_context19.prev = 5;
|
|
1439
1485
|
_iterator3.s();
|
|
1440
1486
|
case 7:
|
|
1441
1487
|
if ((_step3 = _iterator3.n()).done) {
|
|
1442
|
-
|
|
1488
|
+
_context19.next = 40;
|
|
1443
1489
|
break;
|
|
1444
1490
|
}
|
|
1445
1491
|
_step3$value = _step3.value, module = _step3$value.module, config = _step3$value.config, shouldPreload = _step3$value.shouldPreload;
|
|
1446
1492
|
if (shouldPreload) {
|
|
1447
|
-
|
|
1493
|
+
_context19.next = 13;
|
|
1448
1494
|
break;
|
|
1449
1495
|
}
|
|
1450
1496
|
console.log("[Server] \u23ED\uFE0F \u8DF3\u8FC7 ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D"));
|
|
@@ -1452,19 +1498,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
1452
1498
|
moduleName: config.name,
|
|
1453
1499
|
reason: 'shouldPreload=false'
|
|
1454
1500
|
});
|
|
1455
|
-
return
|
|
1501
|
+
return _context19.abrupt("continue", 38);
|
|
1456
1502
|
case 13:
|
|
1457
1503
|
if (!(typeof module.preload === 'function')) {
|
|
1458
|
-
|
|
1504
|
+
_context19.next = 36;
|
|
1459
1505
|
break;
|
|
1460
1506
|
}
|
|
1461
1507
|
startTime = Date.now();
|
|
1462
|
-
|
|
1508
|
+
_context19.prev = 15;
|
|
1463
1509
|
this.logInfo("\u5F00\u59CB\u9884\u52A0\u8F7D\u6A21\u5757: ".concat(config.name), {
|
|
1464
1510
|
moduleName: config.name
|
|
1465
1511
|
});
|
|
1466
1512
|
options === null || options === void 0 || (_options$onModuleLoad = options.onModuleLoad) === null || _options$onModuleLoad === void 0 || _options$onModuleLoad.call(options, config.name);
|
|
1467
|
-
|
|
1513
|
+
_context19.next = 20;
|
|
1468
1514
|
return module.preload();
|
|
1469
1515
|
case 20:
|
|
1470
1516
|
options === null || options === void 0 || (_options$onModuleLoad2 = options.onModuleLoadComplete) === null || _options$onModuleLoad2 === void 0 || _options$onModuleLoad2.call(options, config.name);
|
|
@@ -1478,14 +1524,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
1478
1524
|
name: config.name,
|
|
1479
1525
|
success: true
|
|
1480
1526
|
});
|
|
1481
|
-
|
|
1527
|
+
_context19.next = 34;
|
|
1482
1528
|
break;
|
|
1483
1529
|
case 27:
|
|
1484
|
-
|
|
1485
|
-
|
|
1530
|
+
_context19.prev = 27;
|
|
1531
|
+
_context19.t0 = _context19["catch"](15);
|
|
1486
1532
|
_duration = Date.now() - startTime;
|
|
1487
|
-
errorMessage =
|
|
1488
|
-
console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"),
|
|
1533
|
+
errorMessage = _context19.t0 instanceof Error ? _context19.t0.message : String(_context19.t0);
|
|
1534
|
+
console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"), _context19.t0);
|
|
1489
1535
|
this.logError("\u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25: ".concat(config.name), {
|
|
1490
1536
|
moduleName: config.name,
|
|
1491
1537
|
duration: "".concat(_duration, "ms"),
|
|
@@ -1497,7 +1543,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1497
1543
|
error: errorMessage
|
|
1498
1544
|
});
|
|
1499
1545
|
case 34:
|
|
1500
|
-
|
|
1546
|
+
_context19.next = 38;
|
|
1501
1547
|
break;
|
|
1502
1548
|
case 36:
|
|
1503
1549
|
console.log("[Server] \u26A0\uFE0F ".concat(config.name, " \u6A21\u5757\u672A\u5B9E\u73B0 preload() \u65B9\u6CD5"));
|
|
@@ -1505,19 +1551,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
1505
1551
|
moduleName: config.name
|
|
1506
1552
|
});
|
|
1507
1553
|
case 38:
|
|
1508
|
-
|
|
1554
|
+
_context19.next = 7;
|
|
1509
1555
|
break;
|
|
1510
1556
|
case 40:
|
|
1511
|
-
|
|
1557
|
+
_context19.next = 45;
|
|
1512
1558
|
break;
|
|
1513
1559
|
case 42:
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
_iterator3.e(
|
|
1560
|
+
_context19.prev = 42;
|
|
1561
|
+
_context19.t1 = _context19["catch"](5);
|
|
1562
|
+
_iterator3.e(_context19.t1);
|
|
1517
1563
|
case 45:
|
|
1518
|
-
|
|
1564
|
+
_context19.prev = 45;
|
|
1519
1565
|
_iterator3.f();
|
|
1520
|
-
return
|
|
1566
|
+
return _context19.finish(45);
|
|
1521
1567
|
case 48:
|
|
1522
1568
|
successCount = preloadResults.filter(function (r) {
|
|
1523
1569
|
return r.success;
|
|
@@ -1532,11 +1578,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1532
1578
|
});
|
|
1533
1579
|
case 52:
|
|
1534
1580
|
case "end":
|
|
1535
|
-
return
|
|
1581
|
+
return _context19.stop();
|
|
1536
1582
|
}
|
|
1537
|
-
},
|
|
1583
|
+
}, _callee19, this, [[5, 42, 45, 48], [15, 27]]);
|
|
1538
1584
|
}));
|
|
1539
|
-
function preloadModulesData(
|
|
1585
|
+
function preloadModulesData(_x21, _x22) {
|
|
1540
1586
|
return _preloadModulesData.apply(this, arguments);
|
|
1541
1587
|
}
|
|
1542
1588
|
return preloadModulesData;
|
|
@@ -1550,7 +1596,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1550
1596
|
}, {
|
|
1551
1597
|
key: "initialize",
|
|
1552
1598
|
value: (function () {
|
|
1553
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1599
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(moduleConfigs) {
|
|
1554
1600
|
var _moduleConfigs$length,
|
|
1555
1601
|
_this3 = this;
|
|
1556
1602
|
var autoPreload,
|
|
@@ -1558,12 +1604,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
1558
1604
|
startTime,
|
|
1559
1605
|
registeredModules,
|
|
1560
1606
|
duration,
|
|
1561
|
-
|
|
1562
|
-
return _regeneratorRuntime().wrap(function
|
|
1563
|
-
while (1) switch (
|
|
1607
|
+
_args20 = arguments;
|
|
1608
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1609
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1564
1610
|
case 0:
|
|
1565
|
-
autoPreload =
|
|
1566
|
-
options =
|
|
1611
|
+
autoPreload = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : true;
|
|
1612
|
+
options = _args20.length > 2 ? _args20[2] : undefined;
|
|
1567
1613
|
startTime = Date.now();
|
|
1568
1614
|
this.logInfo('Server 初始化开始', {
|
|
1569
1615
|
moduleConfigCount: (_moduleConfigs$length = moduleConfigs === null || moduleConfigs === void 0 ? void 0 : moduleConfigs.length) !== null && _moduleConfigs$length !== void 0 ? _moduleConfigs$length : 'all',
|
|
@@ -1575,25 +1621,25 @@ var Server = /*#__PURE__*/function () {
|
|
|
1575
1621
|
this.registerServerRoutes();
|
|
1576
1622
|
|
|
1577
1623
|
// 注册模块
|
|
1578
|
-
|
|
1624
|
+
_context20.next = 7;
|
|
1579
1625
|
return this.registerModules(moduleConfigs);
|
|
1580
1626
|
case 7:
|
|
1581
|
-
registeredModules =
|
|
1627
|
+
registeredModules = _context20.sent;
|
|
1582
1628
|
if (!autoPreload) {
|
|
1583
|
-
|
|
1629
|
+
_context20.next = 13;
|
|
1584
1630
|
break;
|
|
1585
1631
|
}
|
|
1586
|
-
|
|
1632
|
+
_context20.next = 11;
|
|
1587
1633
|
return this.preloadModulesData(registeredModules, options);
|
|
1588
1634
|
case 11:
|
|
1589
|
-
|
|
1635
|
+
_context20.next = 14;
|
|
1590
1636
|
break;
|
|
1591
1637
|
case 13:
|
|
1592
1638
|
this.logInfo('跳过自动预加载', {
|
|
1593
1639
|
autoPreload: autoPreload
|
|
1594
1640
|
});
|
|
1595
1641
|
case 14:
|
|
1596
|
-
|
|
1642
|
+
_context20.next = 16;
|
|
1597
1643
|
return this.setupProductsQuotationPriceBridge();
|
|
1598
1644
|
case 16:
|
|
1599
1645
|
// 监听 ProductsModule 同步完成事件,重新计算并推送查询结果
|
|
@@ -1619,14 +1665,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
1619
1665
|
duration: "".concat(duration, "ms"),
|
|
1620
1666
|
registeredModuleCount: registeredModules.length
|
|
1621
1667
|
});
|
|
1622
|
-
return
|
|
1668
|
+
return _context20.abrupt("return", registeredModules);
|
|
1623
1669
|
case 22:
|
|
1624
1670
|
case "end":
|
|
1625
|
-
return
|
|
1671
|
+
return _context20.stop();
|
|
1626
1672
|
}
|
|
1627
|
-
},
|
|
1673
|
+
}, _callee20, this);
|
|
1628
1674
|
}));
|
|
1629
|
-
function initialize(
|
|
1675
|
+
function initialize(_x23) {
|
|
1630
1676
|
return _initialize.apply(this, arguments);
|
|
1631
1677
|
}
|
|
1632
1678
|
return initialize;
|
|
@@ -1638,51 +1684,51 @@ var Server = /*#__PURE__*/function () {
|
|
|
1638
1684
|
}, {
|
|
1639
1685
|
key: "setupProductsQuotationPriceBridge",
|
|
1640
1686
|
value: (function () {
|
|
1641
|
-
var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1687
|
+
var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1642
1688
|
var _this$core$context, errorMessage;
|
|
1643
|
-
return _regeneratorRuntime().wrap(function
|
|
1644
|
-
while (1) switch (
|
|
1689
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1690
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1645
1691
|
case 0:
|
|
1646
1692
|
if (this.products) {
|
|
1647
|
-
|
|
1693
|
+
_context21.next = 3;
|
|
1648
1694
|
break;
|
|
1649
1695
|
}
|
|
1650
1696
|
this.logInfo('setupProductsQuotationPriceBridge: Products 模块未注册');
|
|
1651
|
-
return
|
|
1697
|
+
return _context21.abrupt("return");
|
|
1652
1698
|
case 3:
|
|
1653
1699
|
if (this.schedule) {
|
|
1654
|
-
|
|
1700
|
+
_context21.next = 6;
|
|
1655
1701
|
break;
|
|
1656
1702
|
}
|
|
1657
1703
|
this.logInfo('setupProductsQuotationPriceBridge: Schedule 模块未注册');
|
|
1658
|
-
return
|
|
1704
|
+
return _context21.abrupt("return");
|
|
1659
1705
|
case 6:
|
|
1660
|
-
|
|
1661
|
-
|
|
1706
|
+
_context21.prev = 6;
|
|
1707
|
+
_context21.next = 9;
|
|
1662
1708
|
return this.schedule.loadAllSchedule();
|
|
1663
1709
|
case 9:
|
|
1664
1710
|
this.products.clearPriceCache();
|
|
1665
|
-
|
|
1711
|
+
_context21.next = 12;
|
|
1666
1712
|
return this.products.setupQuotationPriceBridge({
|
|
1667
1713
|
scheduleModule: this.schedule,
|
|
1668
1714
|
channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel
|
|
1669
1715
|
});
|
|
1670
1716
|
case 12:
|
|
1671
1717
|
this.logInfo('Products 报价单价格桥接初始化完成');
|
|
1672
|
-
|
|
1718
|
+
_context21.next = 19;
|
|
1673
1719
|
break;
|
|
1674
1720
|
case 15:
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
errorMessage =
|
|
1721
|
+
_context21.prev = 15;
|
|
1722
|
+
_context21.t0 = _context21["catch"](6);
|
|
1723
|
+
errorMessage = _context21.t0 instanceof Error ? _context21.t0.message : String(_context21.t0);
|
|
1678
1724
|
this.logError('Products 报价单价格桥接初始化失败', {
|
|
1679
1725
|
error: errorMessage
|
|
1680
1726
|
});
|
|
1681
1727
|
case 19:
|
|
1682
1728
|
case "end":
|
|
1683
|
-
return
|
|
1729
|
+
return _context21.stop();
|
|
1684
1730
|
}
|
|
1685
|
-
},
|
|
1731
|
+
}, _callee21, this, [[6, 15]]);
|
|
1686
1732
|
}));
|
|
1687
1733
|
function setupProductsQuotationPriceBridge() {
|
|
1688
1734
|
return _setupProductsQuotationPriceBridge.apply(this, arguments);
|
|
@@ -1751,45 +1797,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
1751
1797
|
}, {
|
|
1752
1798
|
key: "refreshProductsInBackground",
|
|
1753
1799
|
value: (function () {
|
|
1754
|
-
var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1800
|
+
var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1755
1801
|
var startTime, duration, _duration2, errorMessage;
|
|
1756
|
-
return _regeneratorRuntime().wrap(function
|
|
1757
|
-
while (1) switch (
|
|
1802
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1803
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1758
1804
|
case 0:
|
|
1759
1805
|
if (this.products) {
|
|
1760
|
-
|
|
1806
|
+
_context22.next = 3;
|
|
1761
1807
|
break;
|
|
1762
1808
|
}
|
|
1763
1809
|
this.logWarning('refreshProductsInBackground: Products 模块未注册');
|
|
1764
|
-
return
|
|
1810
|
+
return _context22.abrupt("return");
|
|
1765
1811
|
case 3:
|
|
1766
1812
|
this.logInfo('refreshProductsInBackground 开始');
|
|
1767
1813
|
startTime = Date.now();
|
|
1768
|
-
|
|
1769
|
-
|
|
1814
|
+
_context22.prev = 5;
|
|
1815
|
+
_context22.next = 8;
|
|
1770
1816
|
return this.products.silentRefresh();
|
|
1771
1817
|
case 8:
|
|
1772
1818
|
duration = Date.now() - startTime;
|
|
1773
1819
|
this.logInfo('refreshProductsInBackground 完成', {
|
|
1774
1820
|
duration: "".concat(duration, "ms")
|
|
1775
1821
|
});
|
|
1776
|
-
|
|
1822
|
+
_context22.next = 18;
|
|
1777
1823
|
break;
|
|
1778
1824
|
case 12:
|
|
1779
|
-
|
|
1780
|
-
|
|
1825
|
+
_context22.prev = 12;
|
|
1826
|
+
_context22.t0 = _context22["catch"](5);
|
|
1781
1827
|
_duration2 = Date.now() - startTime;
|
|
1782
|
-
errorMessage =
|
|
1783
|
-
console.error('[Server] refreshProductsInBackground 失败:',
|
|
1828
|
+
errorMessage = _context22.t0 instanceof Error ? _context22.t0.message : String(_context22.t0);
|
|
1829
|
+
console.error('[Server] refreshProductsInBackground 失败:', _context22.t0);
|
|
1784
1830
|
this.logError('refreshProductsInBackground 失败', {
|
|
1785
1831
|
duration: "".concat(_duration2, "ms"),
|
|
1786
1832
|
error: errorMessage
|
|
1787
1833
|
});
|
|
1788
1834
|
case 18:
|
|
1789
1835
|
case "end":
|
|
1790
|
-
return
|
|
1836
|
+
return _context22.stop();
|
|
1791
1837
|
}
|
|
1792
|
-
},
|
|
1838
|
+
}, _callee22, this, [[5, 12]]);
|
|
1793
1839
|
}));
|
|
1794
1840
|
function refreshProductsInBackground() {
|
|
1795
1841
|
return _refreshProductsInBackground.apply(this, arguments);
|
|
@@ -1805,45 +1851,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
1805
1851
|
}, {
|
|
1806
1852
|
key: "refreshOrdersInBackground",
|
|
1807
1853
|
value: (function () {
|
|
1808
|
-
var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1854
|
+
var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
1809
1855
|
var startTime, duration, _duration3, errorMessage;
|
|
1810
|
-
return _regeneratorRuntime().wrap(function
|
|
1811
|
-
while (1) switch (
|
|
1856
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1857
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1812
1858
|
case 0:
|
|
1813
1859
|
if (this.order) {
|
|
1814
|
-
|
|
1860
|
+
_context23.next = 3;
|
|
1815
1861
|
break;
|
|
1816
1862
|
}
|
|
1817
1863
|
this.logWarning('refreshOrdersInBackground: Order 模块未注册');
|
|
1818
|
-
return
|
|
1864
|
+
return _context23.abrupt("return");
|
|
1819
1865
|
case 3:
|
|
1820
1866
|
this.logInfo('refreshOrdersInBackground 开始');
|
|
1821
1867
|
startTime = Date.now();
|
|
1822
|
-
|
|
1823
|
-
|
|
1868
|
+
_context23.prev = 5;
|
|
1869
|
+
_context23.next = 8;
|
|
1824
1870
|
return this.order.silentRefresh();
|
|
1825
1871
|
case 8:
|
|
1826
1872
|
duration = Date.now() - startTime;
|
|
1827
1873
|
this.logInfo('refreshOrdersInBackground 完成', {
|
|
1828
1874
|
duration: "".concat(duration, "ms")
|
|
1829
1875
|
});
|
|
1830
|
-
|
|
1876
|
+
_context23.next = 18;
|
|
1831
1877
|
break;
|
|
1832
1878
|
case 12:
|
|
1833
|
-
|
|
1834
|
-
|
|
1879
|
+
_context23.prev = 12;
|
|
1880
|
+
_context23.t0 = _context23["catch"](5);
|
|
1835
1881
|
_duration3 = Date.now() - startTime;
|
|
1836
|
-
errorMessage =
|
|
1837
|
-
console.error('[Server] refreshOrdersInBackground 失败:',
|
|
1882
|
+
errorMessage = _context23.t0 instanceof Error ? _context23.t0.message : String(_context23.t0);
|
|
1883
|
+
console.error('[Server] refreshOrdersInBackground 失败:', _context23.t0);
|
|
1838
1884
|
this.logError('refreshOrdersInBackground 失败', {
|
|
1839
1885
|
duration: "".concat(_duration3, "ms"),
|
|
1840
1886
|
error: errorMessage
|
|
1841
1887
|
});
|
|
1842
1888
|
case 18:
|
|
1843
1889
|
case "end":
|
|
1844
|
-
return
|
|
1890
|
+
return _context23.stop();
|
|
1845
1891
|
}
|
|
1846
|
-
},
|
|
1892
|
+
}, _callee23, this, [[5, 12]]);
|
|
1847
1893
|
}));
|
|
1848
1894
|
function refreshOrdersInBackground() {
|
|
1849
1895
|
return _refreshOrdersInBackground.apply(this, arguments);
|
|
@@ -1858,10 +1904,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1858
1904
|
}, {
|
|
1859
1905
|
key: "clearAllIndexDB",
|
|
1860
1906
|
value: (function () {
|
|
1861
|
-
var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1907
|
+
var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1862
1908
|
var clearTasks, moduleNames, errorMessage;
|
|
1863
|
-
return _regeneratorRuntime().wrap(function
|
|
1864
|
-
while (1) switch (
|
|
1909
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1910
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1865
1911
|
case 0:
|
|
1866
1912
|
console.log('[Server] 开始清空所有模块的IndexedDB缓存...');
|
|
1867
1913
|
this.logInfo('开始清空所有模块的 IndexedDB 缓存');
|
|
@@ -1896,41 +1942,41 @@ var Server = /*#__PURE__*/function () {
|
|
|
1896
1942
|
moduleNames.push('FloorPlan');
|
|
1897
1943
|
}
|
|
1898
1944
|
if (!(clearTasks.length === 0)) {
|
|
1899
|
-
|
|
1945
|
+
_context24.next = 15;
|
|
1900
1946
|
break;
|
|
1901
1947
|
}
|
|
1902
1948
|
console.warn('[Server] 没有找到已注册的模块,无需清空');
|
|
1903
1949
|
this.logWarning('没有找到已注册的模块,无需清空 IndexedDB');
|
|
1904
|
-
return
|
|
1950
|
+
return _context24.abrupt("return");
|
|
1905
1951
|
case 15:
|
|
1906
1952
|
this.logInfo('准备清空模块缓存', {
|
|
1907
1953
|
moduleNames: moduleNames
|
|
1908
1954
|
});
|
|
1909
|
-
|
|
1910
|
-
|
|
1955
|
+
_context24.prev = 16;
|
|
1956
|
+
_context24.next = 19;
|
|
1911
1957
|
return Promise.all(clearTasks);
|
|
1912
1958
|
case 19:
|
|
1913
1959
|
console.log("[Server] \u2705 \u5DF2\u6210\u529F\u6E05\u7A7A\u6240\u6709\u6A21\u5757\u7684IndexedDB\u7F13\u5B58: ".concat(moduleNames.join(', ')));
|
|
1914
1960
|
this.logInfo('成功清空所有模块的 IndexedDB 缓存', {
|
|
1915
1961
|
moduleNames: moduleNames
|
|
1916
1962
|
});
|
|
1917
|
-
|
|
1963
|
+
_context24.next = 29;
|
|
1918
1964
|
break;
|
|
1919
1965
|
case 23:
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
errorMessage =
|
|
1923
|
-
console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:',
|
|
1966
|
+
_context24.prev = 23;
|
|
1967
|
+
_context24.t0 = _context24["catch"](16);
|
|
1968
|
+
errorMessage = _context24.t0 instanceof Error ? _context24.t0.message : String(_context24.t0);
|
|
1969
|
+
console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context24.t0);
|
|
1924
1970
|
this.logError('清空 IndexedDB 缓存时发生错误', {
|
|
1925
1971
|
moduleNames: moduleNames,
|
|
1926
1972
|
error: errorMessage
|
|
1927
1973
|
});
|
|
1928
|
-
throw
|
|
1974
|
+
throw _context24.t0;
|
|
1929
1975
|
case 29:
|
|
1930
1976
|
case "end":
|
|
1931
|
-
return
|
|
1977
|
+
return _context24.stop();
|
|
1932
1978
|
}
|
|
1933
|
-
},
|
|
1979
|
+
}, _callee24, this, [[16, 23]]);
|
|
1934
1980
|
}));
|
|
1935
1981
|
function clearAllIndexDB() {
|
|
1936
1982
|
return _clearAllIndexDB.apply(this, arguments);
|
|
@@ -2005,10 +2051,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
2005
2051
|
}, {
|
|
2006
2052
|
key: "handleRoute",
|
|
2007
2053
|
value: (function () {
|
|
2008
|
-
var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2054
|
+
var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(method, path, params) {
|
|
2009
2055
|
var startTime, handler, result, duration, _duration4, errorMessage;
|
|
2010
|
-
return _regeneratorRuntime().wrap(function
|
|
2011
|
-
while (1) switch (
|
|
2056
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2057
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2012
2058
|
case 0:
|
|
2013
2059
|
startTime = Date.now();
|
|
2014
2060
|
this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5F00\u59CB: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
@@ -2019,7 +2065,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2019
2065
|
});
|
|
2020
2066
|
handler = this.getRouteHandler(method, path);
|
|
2021
2067
|
if (handler) {
|
|
2022
|
-
|
|
2068
|
+
_context25.next = 6;
|
|
2023
2069
|
break;
|
|
2024
2070
|
}
|
|
2025
2071
|
this.logError("\u8DEF\u7531\u672A\u627E\u5230: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
@@ -2028,13 +2074,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
2028
2074
|
});
|
|
2029
2075
|
throw new Error("Route not found: ".concat(method.toUpperCase(), " ").concat(path));
|
|
2030
2076
|
case 6:
|
|
2031
|
-
|
|
2032
|
-
|
|
2077
|
+
_context25.prev = 6;
|
|
2078
|
+
_context25.next = 9;
|
|
2033
2079
|
return handler(_objectSpread(_objectSpread({}, params), {}, {
|
|
2034
2080
|
path: path
|
|
2035
2081
|
}));
|
|
2036
2082
|
case 9:
|
|
2037
|
-
result =
|
|
2083
|
+
result = _context25.sent;
|
|
2038
2084
|
duration = Date.now() - startTime;
|
|
2039
2085
|
this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5B8C\u6210: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
2040
2086
|
method: method.toUpperCase(),
|
|
@@ -2043,12 +2089,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
2043
2089
|
resultCode: result === null || result === void 0 ? void 0 : result.code,
|
|
2044
2090
|
resultStatus: result === null || result === void 0 ? void 0 : result.status
|
|
2045
2091
|
});
|
|
2046
|
-
return
|
|
2092
|
+
return _context25.abrupt("return", result);
|
|
2047
2093
|
case 15:
|
|
2048
|
-
|
|
2049
|
-
|
|
2094
|
+
_context25.prev = 15;
|
|
2095
|
+
_context25.t0 = _context25["catch"](6);
|
|
2050
2096
|
_duration4 = Date.now() - startTime;
|
|
2051
|
-
errorMessage =
|
|
2097
|
+
errorMessage = _context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0);
|
|
2052
2098
|
this.logError("\u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
2053
2099
|
method: method.toUpperCase(),
|
|
2054
2100
|
path: path,
|
|
@@ -2056,15 +2102,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
2056
2102
|
error: errorMessage,
|
|
2057
2103
|
data: params.data
|
|
2058
2104
|
});
|
|
2059
|
-
console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path),
|
|
2060
|
-
throw
|
|
2105
|
+
console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), _context25.t0);
|
|
2106
|
+
throw _context25.t0;
|
|
2061
2107
|
case 22:
|
|
2062
2108
|
case "end":
|
|
2063
|
-
return
|
|
2109
|
+
return _context25.stop();
|
|
2064
2110
|
}
|
|
2065
|
-
},
|
|
2111
|
+
}, _callee25, this, [[6, 15]]);
|
|
2066
2112
|
}));
|
|
2067
|
-
function handleRoute(
|
|
2113
|
+
function handleRoute(_x24, _x25, _x26) {
|
|
2068
2114
|
return _handleRoute.apply(this, arguments);
|
|
2069
2115
|
}
|
|
2070
2116
|
return handleRoute;
|
|
@@ -2134,6 +2180,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
2134
2180
|
method: 'get',
|
|
2135
2181
|
path: '/update/localOrder',
|
|
2136
2182
|
handler: this.handleUpdateLocalOrder.bind(this)
|
|
2183
|
+
}, {
|
|
2184
|
+
method: 'get',
|
|
2185
|
+
path: '/shop/pay/custom-payment/all',
|
|
2186
|
+
handler: this.handlePaymentMethods.bind(this)
|
|
2137
2187
|
}, {
|
|
2138
2188
|
method: 'post',
|
|
2139
2189
|
path: '/shop/order/sales/checkout',
|
|
@@ -2153,13 +2203,74 @@ var Server = /*#__PURE__*/function () {
|
|
|
2153
2203
|
handler: this.handleFloorPlanGet.bind(this)
|
|
2154
2204
|
}]);
|
|
2155
2205
|
}
|
|
2156
|
-
|
|
2206
|
+
}, {
|
|
2207
|
+
key: "getPaymentRouteModule",
|
|
2208
|
+
value: function () {
|
|
2209
|
+
var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
2210
|
+
var _this5 = this;
|
|
2211
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2212
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2213
|
+
case 0:
|
|
2214
|
+
if (!this.payment) {
|
|
2215
|
+
_context27.next = 2;
|
|
2216
|
+
break;
|
|
2217
|
+
}
|
|
2218
|
+
return _context27.abrupt("return", this.payment);
|
|
2219
|
+
case 2:
|
|
2220
|
+
if (!this.paymentRouteModule) {
|
|
2221
|
+
_context27.next = 4;
|
|
2222
|
+
break;
|
|
2223
|
+
}
|
|
2224
|
+
return _context27.abrupt("return", this.paymentRouteModule);
|
|
2225
|
+
case 4:
|
|
2226
|
+
if (!this.paymentRouteModuleInFlight) {
|
|
2227
|
+
_context27.next = 6;
|
|
2228
|
+
break;
|
|
2229
|
+
}
|
|
2230
|
+
return _context27.abrupt("return", this.paymentRouteModuleInFlight);
|
|
2231
|
+
case 6:
|
|
2232
|
+
this.paymentRouteModuleInFlight = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
2233
|
+
var module;
|
|
2234
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2235
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2236
|
+
case 0:
|
|
2237
|
+
module = new PaymentServerModule('server_payment_route', '1.0.0');
|
|
2238
|
+
_context26.next = 3;
|
|
2239
|
+
return module.initialize(_this5.core, {
|
|
2240
|
+
store: {
|
|
2241
|
+
payMethods: []
|
|
2242
|
+
}
|
|
2243
|
+
});
|
|
2244
|
+
case 3:
|
|
2245
|
+
_this5.paymentRouteModule = module;
|
|
2246
|
+
return _context26.abrupt("return", module);
|
|
2247
|
+
case 5:
|
|
2248
|
+
case "end":
|
|
2249
|
+
return _context26.stop();
|
|
2250
|
+
}
|
|
2251
|
+
}, _callee26);
|
|
2252
|
+
}))().finally(function () {
|
|
2253
|
+
_this5.paymentRouteModuleInFlight = undefined;
|
|
2254
|
+
});
|
|
2255
|
+
return _context27.abrupt("return", this.paymentRouteModuleInFlight);
|
|
2256
|
+
case 8:
|
|
2257
|
+
case "end":
|
|
2258
|
+
return _context27.stop();
|
|
2259
|
+
}
|
|
2260
|
+
}, _callee27, this);
|
|
2261
|
+
}));
|
|
2262
|
+
function getPaymentRouteModule() {
|
|
2263
|
+
return _getPaymentRouteModule.apply(this, arguments);
|
|
2264
|
+
}
|
|
2265
|
+
return getPaymentRouteModule;
|
|
2266
|
+
}()
|
|
2267
|
+
}, {
|
|
2268
|
+
key: "removeProductQuerySubscriber",
|
|
2269
|
+
value:
|
|
2157
2270
|
/**
|
|
2158
2271
|
* 根据 subscriberId 移除商品查询订阅者
|
|
2159
2272
|
*/
|
|
2160
|
-
|
|
2161
|
-
key: "removeProductQuerySubscriber",
|
|
2162
|
-
value: function removeProductQuerySubscriber(subscriberId) {
|
|
2273
|
+
function removeProductQuerySubscriber(subscriberId) {
|
|
2163
2274
|
if (subscriberId) {
|
|
2164
2275
|
this.productQuerySubscribers.delete(subscriberId);
|
|
2165
2276
|
this.logInfo('removeProductQuerySubscriber: 已移除订阅者', {
|
|
@@ -2283,11 +2394,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2283
2394
|
}, {
|
|
2284
2395
|
key: "stableSerialize",
|
|
2285
2396
|
value: function stableSerialize(value) {
|
|
2286
|
-
var
|
|
2397
|
+
var _this6 = this;
|
|
2287
2398
|
if (value === null || value === undefined) return 'null';
|
|
2288
2399
|
if (Array.isArray(value)) {
|
|
2289
2400
|
return "[".concat(value.map(function (item) {
|
|
2290
|
-
return
|
|
2401
|
+
return _this6.stableSerialize(item);
|
|
2291
2402
|
}).join(','), "]");
|
|
2292
2403
|
}
|
|
2293
2404
|
if (_typeof(value) === 'object') {
|
|
@@ -2296,7 +2407,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2296
2407
|
return obj[k] !== undefined;
|
|
2297
2408
|
}).sort();
|
|
2298
2409
|
return "{".concat(keys.map(function (k) {
|
|
2299
|
-
return "".concat(JSON.stringify(k), ":").concat(
|
|
2410
|
+
return "".concat(JSON.stringify(k), ":").concat(_this6.stableSerialize(obj[k]));
|
|
2300
2411
|
}).join(','), "}");
|
|
2301
2412
|
}
|
|
2302
2413
|
return JSON.stringify(value);
|
|
@@ -2561,18 +2672,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
2561
2672
|
}, {
|
|
2562
2673
|
key: "fetchOrderListFromAPI",
|
|
2563
2674
|
value: (function () {
|
|
2564
|
-
var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2675
|
+
var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(data) {
|
|
2565
2676
|
var _this$app4;
|
|
2566
2677
|
var _response$data3, response, payload, list, count, errorMessage;
|
|
2567
|
-
return _regeneratorRuntime().wrap(function
|
|
2568
|
-
while (1) switch (
|
|
2678
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2679
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2569
2680
|
case 0:
|
|
2570
2681
|
if ((_this$app4 = this.app) !== null && _this$app4 !== void 0 && _this$app4.request) {
|
|
2571
|
-
|
|
2682
|
+
_context28.next = 3;
|
|
2572
2683
|
break;
|
|
2573
2684
|
}
|
|
2574
2685
|
this.logError('fetchOrderListFromAPI: app.request 不可用');
|
|
2575
|
-
return
|
|
2686
|
+
return _context28.abrupt("return", {
|
|
2576
2687
|
code: 500,
|
|
2577
2688
|
message: 'app.request 不可用',
|
|
2578
2689
|
data: {
|
|
@@ -2582,17 +2693,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
2582
2693
|
status: false
|
|
2583
2694
|
});
|
|
2584
2695
|
case 3:
|
|
2585
|
-
|
|
2586
|
-
|
|
2696
|
+
_context28.prev = 3;
|
|
2697
|
+
_context28.next = 6;
|
|
2587
2698
|
return this.app.request.post('/shop/order/v2/list', data, {
|
|
2588
2699
|
isShopApi: true
|
|
2589
2700
|
});
|
|
2590
2701
|
case 6:
|
|
2591
|
-
response =
|
|
2702
|
+
response = _context28.sent;
|
|
2592
2703
|
payload = (_response$data3 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data3 !== void 0 ? _response$data3 : response;
|
|
2593
2704
|
list = Array.isArray(payload === null || payload === void 0 ? void 0 : payload.list) ? payload.list : [];
|
|
2594
2705
|
count = typeof (payload === null || payload === void 0 ? void 0 : payload.count) === 'number' ? payload.count : list.length;
|
|
2595
|
-
return
|
|
2706
|
+
return _context28.abrupt("return", {
|
|
2596
2707
|
code: 200,
|
|
2597
2708
|
data: _objectSpread(_objectSpread({}, payload), {}, {
|
|
2598
2709
|
list: list,
|
|
@@ -2602,13 +2713,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
2602
2713
|
status: true
|
|
2603
2714
|
});
|
|
2604
2715
|
case 13:
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
errorMessage =
|
|
2716
|
+
_context28.prev = 13;
|
|
2717
|
+
_context28.t0 = _context28["catch"](3);
|
|
2718
|
+
errorMessage = _context28.t0 instanceof Error ? _context28.t0.message : String(_context28.t0);
|
|
2608
2719
|
this.logError('fetchOrderListFromAPI: 请求失败', {
|
|
2609
2720
|
error: errorMessage
|
|
2610
2721
|
});
|
|
2611
|
-
return
|
|
2722
|
+
return _context28.abrupt("return", {
|
|
2612
2723
|
code: 500,
|
|
2613
2724
|
message: errorMessage,
|
|
2614
2725
|
data: {
|
|
@@ -2619,11 +2730,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2619
2730
|
});
|
|
2620
2731
|
case 18:
|
|
2621
2732
|
case "end":
|
|
2622
|
-
return
|
|
2733
|
+
return _context28.stop();
|
|
2623
2734
|
}
|
|
2624
|
-
},
|
|
2735
|
+
}, _callee28, this, [[3, 13]]);
|
|
2625
2736
|
}));
|
|
2626
|
-
function fetchOrderListFromAPI(
|
|
2737
|
+
function fetchOrderListFromAPI(_x27) {
|
|
2627
2738
|
return _fetchOrderListFromAPI.apply(this, arguments);
|
|
2628
2739
|
}
|
|
2629
2740
|
return fetchOrderListFromAPI;
|
|
@@ -2635,17 +2746,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
2635
2746
|
}, {
|
|
2636
2747
|
key: "fetchBookingListFromAPI",
|
|
2637
2748
|
value: (function () {
|
|
2638
|
-
var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2749
|
+
var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(data) {
|
|
2639
2750
|
var memoryCacheEnabled, withFields, requestPayload, cacheKey, cached, rawList, bookingResult, _bookingResult$list, errorMessage;
|
|
2640
|
-
return _regeneratorRuntime().wrap(function
|
|
2641
|
-
while (1) switch (
|
|
2751
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2752
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2642
2753
|
case 0:
|
|
2643
2754
|
if (this.order) {
|
|
2644
|
-
|
|
2755
|
+
_context29.next = 3;
|
|
2645
2756
|
break;
|
|
2646
2757
|
}
|
|
2647
2758
|
this.logError('fetchBookingListFromAPI: Order 模块不可用');
|
|
2648
|
-
return
|
|
2759
|
+
return _context29.abrupt("return", {
|
|
2649
2760
|
code: 500,
|
|
2650
2761
|
message: 'Order 模块不可用',
|
|
2651
2762
|
data: {
|
|
@@ -2655,18 +2766,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
2655
2766
|
status: false
|
|
2656
2767
|
});
|
|
2657
2768
|
case 3:
|
|
2658
|
-
|
|
2769
|
+
_context29.prev = 3;
|
|
2659
2770
|
memoryCacheEnabled = this.isBookingRemoteMemoryCacheEnabled(data);
|
|
2660
2771
|
withFields = this.resolveBookingSalesWith(data);
|
|
2661
2772
|
requestPayload = this.normalizeBookingRemoteQueryPayload(data, withFields);
|
|
2662
2773
|
cacheKey = this.buildBookingRemoteCacheKey(requestPayload);
|
|
2663
2774
|
if (!memoryCacheEnabled) {
|
|
2664
|
-
|
|
2775
|
+
_context29.next = 13;
|
|
2665
2776
|
break;
|
|
2666
2777
|
}
|
|
2667
2778
|
cached = this.readBookingRemoteCache(cacheKey);
|
|
2668
2779
|
if (!cached) {
|
|
2669
|
-
|
|
2780
|
+
_context29.next = 13;
|
|
2670
2781
|
break;
|
|
2671
2782
|
}
|
|
2672
2783
|
this.logInfo('fetchBookingListFromAPI: 命中内存缓存', {
|
|
@@ -2674,14 +2785,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
2674
2785
|
listCount: cached.bookingResult.count,
|
|
2675
2786
|
withFields: cached.withFields
|
|
2676
2787
|
});
|
|
2677
|
-
return
|
|
2788
|
+
return _context29.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
|
|
2678
2789
|
cache_hit: true
|
|
2679
2790
|
}));
|
|
2680
2791
|
case 13:
|
|
2681
|
-
|
|
2792
|
+
_context29.next = 15;
|
|
2682
2793
|
return this.order.fetchOrdersBySSE(requestPayload);
|
|
2683
2794
|
case 15:
|
|
2684
|
-
rawList =
|
|
2795
|
+
rawList = _context29.sent;
|
|
2685
2796
|
bookingResult = sortBookings(filterBookingsFromOrders(rawList, data), data); // DEBUG: 挂到 window 上方便排查 SSE → 日历数据丢失问题
|
|
2686
2797
|
if (typeof globalThis !== 'undefined') {
|
|
2687
2798
|
globalThis.__SSE_BOOKING_DEBUG__ = {
|
|
@@ -2728,15 +2839,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
2728
2839
|
cacheKey: cacheKey,
|
|
2729
2840
|
withFields: withFields
|
|
2730
2841
|
});
|
|
2731
|
-
return
|
|
2842
|
+
return _context29.abrupt("return", this.buildBookingResponse(bookingResult));
|
|
2732
2843
|
case 23:
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
errorMessage =
|
|
2844
|
+
_context29.prev = 23;
|
|
2845
|
+
_context29.t0 = _context29["catch"](3);
|
|
2846
|
+
errorMessage = _context29.t0 instanceof Error ? _context29.t0.message : String(_context29.t0);
|
|
2736
2847
|
this.logError('fetchBookingListFromAPI: SSE 请求失败', {
|
|
2737
2848
|
error: errorMessage
|
|
2738
2849
|
});
|
|
2739
|
-
return
|
|
2850
|
+
return _context29.abrupt("return", {
|
|
2740
2851
|
code: 500,
|
|
2741
2852
|
message: errorMessage,
|
|
2742
2853
|
data: {
|
|
@@ -2747,11 +2858,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2747
2858
|
});
|
|
2748
2859
|
case 28:
|
|
2749
2860
|
case "end":
|
|
2750
|
-
return
|
|
2861
|
+
return _context29.stop();
|
|
2751
2862
|
}
|
|
2752
|
-
},
|
|
2863
|
+
}, _callee29, this, [[3, 23]]);
|
|
2753
2864
|
}));
|
|
2754
|
-
function fetchBookingListFromAPI(
|
|
2865
|
+
function fetchBookingListFromAPI(_x28) {
|
|
2755
2866
|
return _fetchBookingListFromAPI.apply(this, arguments);
|
|
2756
2867
|
}
|
|
2757
2868
|
return fetchBookingListFromAPI;
|
|
@@ -2759,11 +2870,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2759
2870
|
}, {
|
|
2760
2871
|
key: "handleOrderCheckoutSubmit",
|
|
2761
2872
|
value: function () {
|
|
2762
|
-
var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2873
|
+
var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
2763
2874
|
var _this$app5;
|
|
2764
2875
|
var backendPath, data, title, response, fresh, syncedOrder, errorMessage, backendError;
|
|
2765
|
-
return _regeneratorRuntime().wrap(function
|
|
2766
|
-
while (1) switch (
|
|
2876
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2877
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2767
2878
|
case 0:
|
|
2768
2879
|
backendPath = params.backendPath, data = params.data, title = params.title;
|
|
2769
2880
|
this.logInfo("".concat(title, ": \u5F00\u59CB\u5904\u7406"), {
|
|
@@ -2773,34 +2884,34 @@ var Server = /*#__PURE__*/function () {
|
|
|
2773
2884
|
order_number: data === null || data === void 0 ? void 0 : data.order_number
|
|
2774
2885
|
});
|
|
2775
2886
|
if ((_this$app5 = this.app) !== null && _this$app5 !== void 0 && _this$app5.request) {
|
|
2776
|
-
|
|
2887
|
+
_context30.next = 5;
|
|
2777
2888
|
break;
|
|
2778
2889
|
}
|
|
2779
2890
|
this.logError("".concat(title, ": app.request \u4E0D\u53EF\u7528"));
|
|
2780
|
-
return
|
|
2891
|
+
return _context30.abrupt("return", this.handlePendingSyncCheckoutOrder({
|
|
2781
2892
|
backendPath: backendPath,
|
|
2782
2893
|
data: data,
|
|
2783
2894
|
title: title,
|
|
2784
2895
|
reason: 'app.request 不可用'
|
|
2785
2896
|
}));
|
|
2786
2897
|
case 5:
|
|
2787
|
-
|
|
2788
|
-
|
|
2898
|
+
_context30.prev = 5;
|
|
2899
|
+
_context30.next = 8;
|
|
2789
2900
|
return this.app.request.post(backendPath, data, {
|
|
2790
2901
|
isShopApi: true,
|
|
2791
2902
|
customToast: function customToast() {}
|
|
2792
2903
|
});
|
|
2793
2904
|
case 8:
|
|
2794
|
-
response =
|
|
2905
|
+
response = _context30.sent;
|
|
2795
2906
|
fresh = this.extractOrderDataFromCheckoutResponse(response);
|
|
2796
2907
|
if (!(fresh && this.order)) {
|
|
2797
|
-
|
|
2908
|
+
_context30.next = 17;
|
|
2798
2909
|
break;
|
|
2799
2910
|
}
|
|
2800
2911
|
syncedOrder = _objectSpread(_objectSpread({}, fresh), {}, {
|
|
2801
2912
|
need_sync: 0
|
|
2802
2913
|
});
|
|
2803
|
-
|
|
2914
|
+
_context30.next = 14;
|
|
2804
2915
|
return this.order.upsertOrdersFromRemote([syncedOrder]);
|
|
2805
2916
|
case 14:
|
|
2806
2917
|
this.logInfo("".concat(title, ": \u8BA2\u5355\u5DF2\u540C\u6B65\u5230\u672C\u5730"), {
|
|
@@ -2808,7 +2919,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2808
2919
|
external_sale_number: fresh.external_sale_number,
|
|
2809
2920
|
order_number: fresh.order_number
|
|
2810
2921
|
});
|
|
2811
|
-
|
|
2922
|
+
_context30.next = 18;
|
|
2812
2923
|
break;
|
|
2813
2924
|
case 17:
|
|
2814
2925
|
this.logWarning("".concat(title, ": checkout \u8FD4\u56DE\u672A\u5305\u542B\u53EF\u540C\u6B65\u8BA2\u5355"), {
|
|
@@ -2816,23 +2927,23 @@ var Server = /*#__PURE__*/function () {
|
|
|
2816
2927
|
backendPath: backendPath
|
|
2817
2928
|
});
|
|
2818
2929
|
case 18:
|
|
2819
|
-
return
|
|
2930
|
+
return _context30.abrupt("return", this.normalizeCheckoutResponse(response));
|
|
2820
2931
|
case 21:
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
errorMessage =
|
|
2932
|
+
_context30.prev = 21;
|
|
2933
|
+
_context30.t0 = _context30["catch"](5);
|
|
2934
|
+
errorMessage = _context30.t0 instanceof Error ? _context30.t0.message : String(_context30.t0);
|
|
2824
2935
|
this.logError("".concat(title, ": \u8BF7\u6C42\u5931\u8D25"), {
|
|
2825
2936
|
backendPath: backendPath,
|
|
2826
2937
|
error: errorMessage
|
|
2827
2938
|
});
|
|
2828
|
-
backendError = this.extractBackendErrorResponse(
|
|
2939
|
+
backendError = this.extractBackendErrorResponse(_context30.t0);
|
|
2829
2940
|
if (!backendError) {
|
|
2830
|
-
|
|
2941
|
+
_context30.next = 28;
|
|
2831
2942
|
break;
|
|
2832
2943
|
}
|
|
2833
|
-
return
|
|
2944
|
+
return _context30.abrupt("return", backendError);
|
|
2834
2945
|
case 28:
|
|
2835
|
-
return
|
|
2946
|
+
return _context30.abrupt("return", this.handlePendingSyncCheckoutOrder({
|
|
2836
2947
|
backendPath: backendPath,
|
|
2837
2948
|
data: data,
|
|
2838
2949
|
title: title,
|
|
@@ -2840,11 +2951,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2840
2951
|
}));
|
|
2841
2952
|
case 29:
|
|
2842
2953
|
case "end":
|
|
2843
|
-
return
|
|
2954
|
+
return _context30.stop();
|
|
2844
2955
|
}
|
|
2845
|
-
},
|
|
2956
|
+
}, _callee30, this, [[5, 21]]);
|
|
2846
2957
|
}));
|
|
2847
|
-
function handleOrderCheckoutSubmit(
|
|
2958
|
+
function handleOrderCheckoutSubmit(_x29) {
|
|
2848
2959
|
return _handleOrderCheckoutSubmit.apply(this, arguments);
|
|
2849
2960
|
}
|
|
2850
2961
|
return handleOrderCheckoutSubmit;
|
|
@@ -2852,22 +2963,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
2852
2963
|
}, {
|
|
2853
2964
|
key: "handlePendingSyncCheckoutOrder",
|
|
2854
2965
|
value: function () {
|
|
2855
|
-
var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2966
|
+
var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
2856
2967
|
var backendPath, data, title, reason, pendingOrder, errorMessage;
|
|
2857
|
-
return _regeneratorRuntime().wrap(function
|
|
2858
|
-
while (1) switch (
|
|
2968
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2969
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2859
2970
|
case 0:
|
|
2860
2971
|
backendPath = params.backendPath, data = params.data, title = params.title, reason = params.reason;
|
|
2861
2972
|
pendingOrder = this.buildPendingSyncCheckoutOrder(data);
|
|
2862
2973
|
if (pendingOrder) {
|
|
2863
|
-
|
|
2974
|
+
_context31.next = 5;
|
|
2864
2975
|
break;
|
|
2865
2976
|
}
|
|
2866
2977
|
this.logError("".concat(title, ": checkout \u5931\u8D25\u4E14\u8BA2\u5355\u7F3A\u5C11\u672C\u5730\u5B58\u50A8\u6807\u8BC6"), {
|
|
2867
2978
|
backendPath: backendPath,
|
|
2868
2979
|
reason: reason
|
|
2869
2980
|
});
|
|
2870
|
-
return
|
|
2981
|
+
return _context31.abrupt("return", {
|
|
2871
2982
|
code: 500,
|
|
2872
2983
|
status: false,
|
|
2873
2984
|
message: '订单缺少本地存储标识,无法写入待同步队列',
|
|
@@ -2875,22 +2986,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
2875
2986
|
});
|
|
2876
2987
|
case 5:
|
|
2877
2988
|
if (!(!this.order || typeof this.order.upsertPendingSyncOrders !== 'function')) {
|
|
2878
|
-
|
|
2989
|
+
_context31.next = 8;
|
|
2879
2990
|
break;
|
|
2880
2991
|
}
|
|
2881
2992
|
this.logError("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u5F85\u540C\u6B65\u5199\u5165"), {
|
|
2882
2993
|
backendPath: backendPath,
|
|
2883
2994
|
reason: reason
|
|
2884
2995
|
});
|
|
2885
|
-
return
|
|
2996
|
+
return _context31.abrupt("return", {
|
|
2886
2997
|
code: 500,
|
|
2887
2998
|
status: false,
|
|
2888
2999
|
message: 'Order 模块不支持本地待同步写入',
|
|
2889
3000
|
data: null
|
|
2890
3001
|
});
|
|
2891
3002
|
case 8:
|
|
2892
|
-
|
|
2893
|
-
|
|
3003
|
+
_context31.prev = 8;
|
|
3004
|
+
_context31.next = 11;
|
|
2894
3005
|
return this.order.upsertPendingSyncOrders([pendingOrder]);
|
|
2895
3006
|
case 11:
|
|
2896
3007
|
this.logWarning("".concat(title, ": \u540E\u7AEF\u672A\u660E\u786E\u62A5\u9519\uFF0C\u8BA2\u5355\u5DF2\u5199\u5165\u672C\u5730\u5F85\u540C\u6B65"), {
|
|
@@ -2900,22 +3011,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
2900
3011
|
external_sale_number: pendingOrder.external_sale_number,
|
|
2901
3012
|
order_number: pendingOrder.order_number
|
|
2902
3013
|
});
|
|
2903
|
-
return
|
|
3014
|
+
return _context31.abrupt("return", {
|
|
2904
3015
|
code: 200,
|
|
2905
3016
|
status: true,
|
|
2906
3017
|
message: '',
|
|
2907
3018
|
data: pendingOrder
|
|
2908
3019
|
});
|
|
2909
3020
|
case 15:
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
errorMessage =
|
|
3021
|
+
_context31.prev = 15;
|
|
3022
|
+
_context31.t0 = _context31["catch"](8);
|
|
3023
|
+
errorMessage = _context31.t0 instanceof Error ? _context31.t0.message : String(_context31.t0);
|
|
2913
3024
|
this.logError("".concat(title, ": \u5199\u5165\u672C\u5730\u5F85\u540C\u6B65\u8BA2\u5355\u5931\u8D25"), {
|
|
2914
3025
|
backendPath: backendPath,
|
|
2915
3026
|
reason: reason,
|
|
2916
3027
|
error: errorMessage
|
|
2917
3028
|
});
|
|
2918
|
-
return
|
|
3029
|
+
return _context31.abrupt("return", {
|
|
2919
3030
|
code: 500,
|
|
2920
3031
|
status: false,
|
|
2921
3032
|
message: errorMessage,
|
|
@@ -2923,11 +3034,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2923
3034
|
});
|
|
2924
3035
|
case 20:
|
|
2925
3036
|
case "end":
|
|
2926
|
-
return
|
|
3037
|
+
return _context31.stop();
|
|
2927
3038
|
}
|
|
2928
|
-
},
|
|
3039
|
+
}, _callee31, this, [[8, 15]]);
|
|
2929
3040
|
}));
|
|
2930
|
-
function handlePendingSyncCheckoutOrder(
|
|
3041
|
+
function handlePendingSyncCheckoutOrder(_x30) {
|
|
2931
3042
|
return _handlePendingSyncCheckoutOrder.apply(this, arguments);
|
|
2932
3043
|
}
|
|
2933
3044
|
return handlePendingSyncCheckoutOrder;
|
|
@@ -2999,22 +3110,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
2999
3110
|
}, {
|
|
3000
3111
|
key: "handleUpdateLocalOrdersBatch",
|
|
3001
3112
|
value: (function () {
|
|
3002
|
-
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3113
|
+
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(orderIds) {
|
|
3003
3114
|
var _this$app6;
|
|
3004
3115
|
var existedBefore, _iterator11, _step11, id, fetched, message, fetchedMap, _iterator12, _step12, order, oid, freshOrders, succeedIds, failed, _iterator13, _step13, _id, fresh, _message, overwritten, inserted;
|
|
3005
|
-
return _regeneratorRuntime().wrap(function
|
|
3006
|
-
while (1) switch (
|
|
3116
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3117
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3007
3118
|
case 0:
|
|
3008
3119
|
this.logInfo('handleUpdateLocalOrdersBatch: 开始处理', {
|
|
3009
3120
|
count: orderIds.length,
|
|
3010
3121
|
orderIds: orderIds
|
|
3011
3122
|
});
|
|
3012
3123
|
if (this.order) {
|
|
3013
|
-
|
|
3124
|
+
_context32.next = 4;
|
|
3014
3125
|
break;
|
|
3015
3126
|
}
|
|
3016
3127
|
this.logError('handleUpdateLocalOrdersBatch: Order 模块未注册');
|
|
3017
|
-
return
|
|
3128
|
+
return _context32.abrupt("return", {
|
|
3018
3129
|
code: 500,
|
|
3019
3130
|
status: false,
|
|
3020
3131
|
message: 'Order 模块未注册',
|
|
@@ -3022,11 +3133,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3022
3133
|
});
|
|
3023
3134
|
case 4:
|
|
3024
3135
|
if ((_this$app6 = this.app) !== null && _this$app6 !== void 0 && _this$app6.request) {
|
|
3025
|
-
|
|
3136
|
+
_context32.next = 7;
|
|
3026
3137
|
break;
|
|
3027
3138
|
}
|
|
3028
3139
|
this.logError('handleUpdateLocalOrdersBatch: app.request 不可用');
|
|
3029
|
-
return
|
|
3140
|
+
return _context32.abrupt("return", {
|
|
3030
3141
|
code: 500,
|
|
3031
3142
|
status: false,
|
|
3032
3143
|
message: 'app.request 不可用',
|
|
@@ -3049,21 +3160,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
3049
3160
|
_iterator11.f();
|
|
3050
3161
|
}
|
|
3051
3162
|
fetched = [];
|
|
3052
|
-
|
|
3053
|
-
|
|
3163
|
+
_context32.prev = 11;
|
|
3164
|
+
_context32.next = 14;
|
|
3054
3165
|
return this.order.fetchOrdersByHttp(orderIds);
|
|
3055
3166
|
case 14:
|
|
3056
|
-
fetched =
|
|
3057
|
-
|
|
3167
|
+
fetched = _context32.sent;
|
|
3168
|
+
_context32.next = 22;
|
|
3058
3169
|
break;
|
|
3059
3170
|
case 17:
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
message =
|
|
3171
|
+
_context32.prev = 17;
|
|
3172
|
+
_context32.t0 = _context32["catch"](11);
|
|
3173
|
+
message = _context32.t0 instanceof Error ? _context32.t0.message : String(_context32.t0);
|
|
3063
3174
|
this.logError('handleUpdateLocalOrdersBatch: 批量拉取失败', {
|
|
3064
3175
|
message: message
|
|
3065
3176
|
});
|
|
3066
|
-
return
|
|
3177
|
+
return _context32.abrupt("return", {
|
|
3067
3178
|
code: 500,
|
|
3068
3179
|
status: false,
|
|
3069
3180
|
message: message,
|
|
@@ -3073,36 +3184,36 @@ var Server = /*#__PURE__*/function () {
|
|
|
3073
3184
|
// 按返回结果中的 order_id 建索引,未命中即视为单笔失败
|
|
3074
3185
|
fetchedMap = new Map();
|
|
3075
3186
|
_iterator12 = _createForOfIteratorHelper(fetched);
|
|
3076
|
-
|
|
3187
|
+
_context32.prev = 24;
|
|
3077
3188
|
_iterator12.s();
|
|
3078
3189
|
case 26:
|
|
3079
3190
|
if ((_step12 = _iterator12.n()).done) {
|
|
3080
|
-
|
|
3191
|
+
_context32.next = 34;
|
|
3081
3192
|
break;
|
|
3082
3193
|
}
|
|
3083
3194
|
order = _step12.value;
|
|
3084
3195
|
oid = order === null || order === void 0 ? void 0 : order.order_id;
|
|
3085
3196
|
if (!(oid === undefined || oid === null)) {
|
|
3086
|
-
|
|
3197
|
+
_context32.next = 31;
|
|
3087
3198
|
break;
|
|
3088
3199
|
}
|
|
3089
|
-
return
|
|
3200
|
+
return _context32.abrupt("continue", 32);
|
|
3090
3201
|
case 31:
|
|
3091
3202
|
fetchedMap.set(String(oid), order);
|
|
3092
3203
|
case 32:
|
|
3093
|
-
|
|
3204
|
+
_context32.next = 26;
|
|
3094
3205
|
break;
|
|
3095
3206
|
case 34:
|
|
3096
|
-
|
|
3207
|
+
_context32.next = 39;
|
|
3097
3208
|
break;
|
|
3098
3209
|
case 36:
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
_iterator12.e(
|
|
3210
|
+
_context32.prev = 36;
|
|
3211
|
+
_context32.t1 = _context32["catch"](24);
|
|
3212
|
+
_iterator12.e(_context32.t1);
|
|
3102
3213
|
case 39:
|
|
3103
|
-
|
|
3214
|
+
_context32.prev = 39;
|
|
3104
3215
|
_iterator12.f();
|
|
3105
|
-
return
|
|
3216
|
+
return _context32.finish(39);
|
|
3106
3217
|
case 42:
|
|
3107
3218
|
freshOrders = [];
|
|
3108
3219
|
succeedIds = [];
|
|
@@ -3128,23 +3239,23 @@ var Server = /*#__PURE__*/function () {
|
|
|
3128
3239
|
_iterator13.f();
|
|
3129
3240
|
}
|
|
3130
3241
|
if (!(freshOrders.length > 0)) {
|
|
3131
|
-
|
|
3242
|
+
_context32.next = 58;
|
|
3132
3243
|
break;
|
|
3133
3244
|
}
|
|
3134
|
-
|
|
3135
|
-
|
|
3245
|
+
_context32.prev = 48;
|
|
3246
|
+
_context32.next = 51;
|
|
3136
3247
|
return this.order.upsertOrdersFromRemote(freshOrders);
|
|
3137
3248
|
case 51:
|
|
3138
|
-
|
|
3249
|
+
_context32.next = 58;
|
|
3139
3250
|
break;
|
|
3140
3251
|
case 53:
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
_message =
|
|
3252
|
+
_context32.prev = 53;
|
|
3253
|
+
_context32.t2 = _context32["catch"](48);
|
|
3254
|
+
_message = _context32.t2 instanceof Error ? _context32.t2.message : String(_context32.t2);
|
|
3144
3255
|
this.logError('handleUpdateLocalOrdersBatch: 合并写入失败', {
|
|
3145
3256
|
message: _message
|
|
3146
3257
|
});
|
|
3147
|
-
return
|
|
3258
|
+
return _context32.abrupt("return", {
|
|
3148
3259
|
code: 500,
|
|
3149
3260
|
status: false,
|
|
3150
3261
|
message: _message,
|
|
@@ -3163,7 +3274,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3163
3274
|
insertedCount: inserted.length,
|
|
3164
3275
|
failedCount: failed.length
|
|
3165
3276
|
});
|
|
3166
|
-
return
|
|
3277
|
+
return _context32.abrupt("return", {
|
|
3167
3278
|
code: 200,
|
|
3168
3279
|
status: true,
|
|
3169
3280
|
message: '',
|
|
@@ -3175,11 +3286,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3175
3286
|
});
|
|
3176
3287
|
case 62:
|
|
3177
3288
|
case "end":
|
|
3178
|
-
return
|
|
3289
|
+
return _context32.stop();
|
|
3179
3290
|
}
|
|
3180
|
-
},
|
|
3291
|
+
}, _callee32, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
|
|
3181
3292
|
}));
|
|
3182
|
-
function handleUpdateLocalOrdersBatch(
|
|
3293
|
+
function handleUpdateLocalOrdersBatch(_x31) {
|
|
3183
3294
|
return _handleUpdateLocalOrdersBatch.apply(this, arguments);
|
|
3184
3295
|
}
|
|
3185
3296
|
return handleUpdateLocalOrdersBatch;
|
|
@@ -3285,10 +3396,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3285
3396
|
value: function extractBackendErrorResponse(error) {
|
|
3286
3397
|
var _error$response,
|
|
3287
3398
|
_error$response2,
|
|
3288
|
-
|
|
3399
|
+
_this7 = this;
|
|
3289
3400
|
var candidates = [error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data, error === null || error === void 0 ? void 0 : error.data, error === null || error === void 0 || (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.body, error === null || error === void 0 ? void 0 : error.body];
|
|
3290
3401
|
return candidates.find(function (candidate) {
|
|
3291
|
-
return
|
|
3402
|
+
return _this7.isExplicitBackendErrorResponse(candidate);
|
|
3292
3403
|
}) || null;
|
|
3293
3404
|
}
|
|
3294
3405
|
}, {
|
|
@@ -3407,16 +3518,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
3407
3518
|
}, {
|
|
3408
3519
|
key: "recomputeAndNotifyFloorPlanQuery",
|
|
3409
3520
|
value: (function () {
|
|
3410
|
-
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3521
|
+
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
3411
3522
|
var _iterator15, _step15, _step15$value, subscriberId, sub, result, errorMessage;
|
|
3412
|
-
return _regeneratorRuntime().wrap(function
|
|
3413
|
-
while (1) switch (
|
|
3523
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3524
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3414
3525
|
case 0:
|
|
3415
3526
|
if (!(this.floorPlanQuerySubscribers.size === 0)) {
|
|
3416
|
-
|
|
3527
|
+
_context33.next = 2;
|
|
3417
3528
|
break;
|
|
3418
3529
|
}
|
|
3419
|
-
return
|
|
3530
|
+
return _context33.abrupt("return");
|
|
3420
3531
|
case 2:
|
|
3421
3532
|
this.logInfo('recomputeAndNotifyFloorPlanQuery: 开始推送', {
|
|
3422
3533
|
subscriberCount: this.floorPlanQuerySubscribers.size
|
|
@@ -3446,9 +3557,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3446
3557
|
}
|
|
3447
3558
|
case 5:
|
|
3448
3559
|
case "end":
|
|
3449
|
-
return
|
|
3560
|
+
return _context33.stop();
|
|
3450
3561
|
}
|
|
3451
|
-
},
|
|
3562
|
+
}, _callee33, this);
|
|
3452
3563
|
}));
|
|
3453
3564
|
function recomputeAndNotifyFloorPlanQuery() {
|
|
3454
3565
|
return _recomputeAndNotifyFloorPlanQuery.apply(this, arguments);
|
|
@@ -3478,21 +3589,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
3478
3589
|
* filter 逻辑暂为 mock,仅记录参数
|
|
3479
3590
|
*/
|
|
3480
3591
|
function () {
|
|
3481
|
-
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3592
|
+
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(data) {
|
|
3482
3593
|
var rawList, result;
|
|
3483
|
-
return _regeneratorRuntime().wrap(function
|
|
3484
|
-
while (1) switch (
|
|
3594
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3595
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3485
3596
|
case 0:
|
|
3486
3597
|
this.logInfo('computeOrderQueryResult: 开始过滤', {
|
|
3487
3598
|
data: data
|
|
3488
3599
|
});
|
|
3489
3600
|
console.log('[Server] computeOrderQueryResult', data);
|
|
3490
3601
|
if (this.order) {
|
|
3491
|
-
|
|
3602
|
+
_context34.next = 5;
|
|
3492
3603
|
break;
|
|
3493
3604
|
}
|
|
3494
3605
|
this.logError('computeOrderQueryResult: Order 模块未注册');
|
|
3495
|
-
return
|
|
3606
|
+
return _context34.abrupt("return", {
|
|
3496
3607
|
code: 500,
|
|
3497
3608
|
message: 'Order 模块未注册',
|
|
3498
3609
|
data: {
|
|
@@ -3516,7 +3627,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3516
3627
|
skip: result.skip,
|
|
3517
3628
|
rejected: result.rejected
|
|
3518
3629
|
});
|
|
3519
|
-
return
|
|
3630
|
+
return _context34.abrupt("return", {
|
|
3520
3631
|
code: 200,
|
|
3521
3632
|
data: result,
|
|
3522
3633
|
message: '',
|
|
@@ -3524,11 +3635,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3524
3635
|
});
|
|
3525
3636
|
case 10:
|
|
3526
3637
|
case "end":
|
|
3527
|
-
return
|
|
3638
|
+
return _context34.stop();
|
|
3528
3639
|
}
|
|
3529
|
-
},
|
|
3640
|
+
}, _callee34, this);
|
|
3530
3641
|
}));
|
|
3531
|
-
function computeOrderQueryResult(
|
|
3642
|
+
function computeOrderQueryResult(_x32) {
|
|
3532
3643
|
return _computeOrderQueryResult.apply(this, arguments);
|
|
3533
3644
|
}
|
|
3534
3645
|
return computeOrderQueryResult;
|
|
@@ -3541,17 +3652,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
3541
3652
|
}, {
|
|
3542
3653
|
key: "computeBookingQueryResult",
|
|
3543
3654
|
value: (function () {
|
|
3544
|
-
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3655
|
+
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(data) {
|
|
3545
3656
|
var rawOrders, result;
|
|
3546
|
-
return _regeneratorRuntime().wrap(function
|
|
3547
|
-
while (1) switch (
|
|
3657
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3658
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3548
3659
|
case 0:
|
|
3549
3660
|
if (this.order) {
|
|
3550
|
-
|
|
3661
|
+
_context35.next = 3;
|
|
3551
3662
|
break;
|
|
3552
3663
|
}
|
|
3553
3664
|
this.logError('computeBookingQueryResult: Order 模块未注册');
|
|
3554
|
-
return
|
|
3665
|
+
return _context35.abrupt("return", {
|
|
3555
3666
|
code: 500,
|
|
3556
3667
|
message: 'Order 模块未注册',
|
|
3557
3668
|
data: {
|
|
@@ -3570,7 +3681,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3570
3681
|
size: result.size,
|
|
3571
3682
|
skip: result.skip
|
|
3572
3683
|
});
|
|
3573
|
-
return
|
|
3684
|
+
return _context35.abrupt("return", {
|
|
3574
3685
|
code: 200,
|
|
3575
3686
|
data: result,
|
|
3576
3687
|
message: '',
|
|
@@ -3578,11 +3689,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3578
3689
|
});
|
|
3579
3690
|
case 8:
|
|
3580
3691
|
case "end":
|
|
3581
|
-
return
|
|
3692
|
+
return _context35.stop();
|
|
3582
3693
|
}
|
|
3583
|
-
},
|
|
3694
|
+
}, _callee35, this);
|
|
3584
3695
|
}));
|
|
3585
|
-
function computeBookingQueryResult(
|
|
3696
|
+
function computeBookingQueryResult(_x33) {
|
|
3586
3697
|
return _computeBookingQueryResult.apply(this, arguments);
|
|
3587
3698
|
}
|
|
3588
3699
|
return computeBookingQueryResult;
|
|
@@ -3598,12 +3709,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
3598
3709
|
}, {
|
|
3599
3710
|
key: "computeProductQueryResult",
|
|
3600
3711
|
value: (function () {
|
|
3601
|
-
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3712
|
+
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(context, options) {
|
|
3602
3713
|
var _menu_list_ids$length3,
|
|
3603
|
-
|
|
3714
|
+
_this8 = this;
|
|
3604
3715
|
var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, product_id, queryIds, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, activeMenuList, tMenu, menuList, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tSort;
|
|
3605
|
-
return _regeneratorRuntime().wrap(function
|
|
3606
|
-
while (1) switch (
|
|
3716
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3717
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3607
3718
|
case 0:
|
|
3608
3719
|
tTotal = performance.now();
|
|
3609
3720
|
menu_list_ids = context.menu_list_ids, ids = context.ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime, customer_id = context.customer_id, product_id = context.product_id;
|
|
@@ -3622,11 +3733,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3622
3733
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3623
3734
|
});
|
|
3624
3735
|
if (this.products) {
|
|
3625
|
-
|
|
3736
|
+
_context36.next = 7;
|
|
3626
3737
|
break;
|
|
3627
3738
|
}
|
|
3628
3739
|
this.logError('computeProductQueryResult: Products 模块未注册');
|
|
3629
|
-
return
|
|
3740
|
+
return _context36.abrupt("return", {
|
|
3630
3741
|
message: 'Products 模块未注册',
|
|
3631
3742
|
data: {
|
|
3632
3743
|
list: [],
|
|
@@ -3635,12 +3746,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
3635
3746
|
});
|
|
3636
3747
|
case 7:
|
|
3637
3748
|
if (!(queryIds.length > 0)) {
|
|
3638
|
-
|
|
3749
|
+
_context36.next = 18;
|
|
3639
3750
|
break;
|
|
3640
3751
|
}
|
|
3641
3752
|
uniqueIds = Array.from(new Set(queryIds));
|
|
3642
3753
|
_tPrice = performance.now();
|
|
3643
|
-
|
|
3754
|
+
_context36.next = 12;
|
|
3644
3755
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
3645
3756
|
scheduleModule: this.getSchedule(),
|
|
3646
3757
|
schedule_datetime: schedule_datetime,
|
|
@@ -3650,7 +3761,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3650
3761
|
productIds: uniqueIds
|
|
3651
3762
|
});
|
|
3652
3763
|
case 12:
|
|
3653
|
-
productsWithPrice =
|
|
3764
|
+
productsWithPrice = _context36.sent;
|
|
3654
3765
|
perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
|
|
3655
3766
|
count: productsWithPrice.length,
|
|
3656
3767
|
ids: uniqueIds
|
|
@@ -3669,7 +3780,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3669
3780
|
ids: uniqueIds,
|
|
3670
3781
|
count: _filteredProducts.length
|
|
3671
3782
|
});
|
|
3672
|
-
return
|
|
3783
|
+
return _context36.abrupt("return", {
|
|
3673
3784
|
code: 200,
|
|
3674
3785
|
data: {
|
|
3675
3786
|
list: _filteredProducts,
|
|
@@ -3680,19 +3791,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
3680
3791
|
});
|
|
3681
3792
|
case 18:
|
|
3682
3793
|
if (!(product_id != null && Number.isFinite(Number(product_id)))) {
|
|
3683
|
-
|
|
3794
|
+
_context36.next = 30;
|
|
3684
3795
|
break;
|
|
3685
3796
|
}
|
|
3686
3797
|
pid = Number(product_id);
|
|
3687
3798
|
_tPrice2 = performance.now();
|
|
3688
|
-
|
|
3799
|
+
_context36.next = 23;
|
|
3689
3800
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
3690
3801
|
scheduleModule: this.getSchedule()
|
|
3691
3802
|
}, {
|
|
3692
3803
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3693
3804
|
});
|
|
3694
3805
|
case 23:
|
|
3695
|
-
allProductsWithPrice =
|
|
3806
|
+
allProductsWithPrice = _context36.sent;
|
|
3696
3807
|
perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
|
|
3697
3808
|
count: allProductsWithPrice.length,
|
|
3698
3809
|
productId: pid
|
|
@@ -3712,7 +3823,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3712
3823
|
productId: pid,
|
|
3713
3824
|
found: !!item
|
|
3714
3825
|
});
|
|
3715
|
-
return
|
|
3826
|
+
return _context36.abrupt("return", {
|
|
3716
3827
|
code: 200,
|
|
3717
3828
|
data: item,
|
|
3718
3829
|
message: item ? '' : '商品不存在或未发布',
|
|
@@ -3720,11 +3831,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3720
3831
|
});
|
|
3721
3832
|
case 30:
|
|
3722
3833
|
if (this.menu) {
|
|
3723
|
-
|
|
3834
|
+
_context36.next = 33;
|
|
3724
3835
|
break;
|
|
3725
3836
|
}
|
|
3726
3837
|
this.logError('computeProductQueryResult: Menu 模块未注册');
|
|
3727
|
-
return
|
|
3838
|
+
return _context36.abrupt("return", {
|
|
3728
3839
|
message: 'Menu 模块未注册',
|
|
3729
3840
|
data: {
|
|
3730
3841
|
list: [],
|
|
@@ -3733,11 +3844,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3733
3844
|
});
|
|
3734
3845
|
case 33:
|
|
3735
3846
|
if (this.schedule) {
|
|
3736
|
-
|
|
3847
|
+
_context36.next = 36;
|
|
3737
3848
|
break;
|
|
3738
3849
|
}
|
|
3739
3850
|
this.logError('computeProductQueryResult: Schedule 模块未注册');
|
|
3740
|
-
return
|
|
3851
|
+
return _context36.abrupt("return", {
|
|
3741
3852
|
message: 'Schedule 模块未注册',
|
|
3742
3853
|
data: {
|
|
3743
3854
|
list: [],
|
|
@@ -3750,8 +3861,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
3750
3861
|
tMenu = performance.now();
|
|
3751
3862
|
menuList = this.menu.getMenuByIds(menu_list_ids);
|
|
3752
3863
|
activeMenuList = menuList.filter(function (menu) {
|
|
3753
|
-
var
|
|
3754
|
-
return ((
|
|
3864
|
+
var _this8$schedule;
|
|
3865
|
+
return ((_this8$schedule = _this8.schedule) === null || _this8$schedule === void 0 ? void 0 : _this8$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
|
|
3755
3866
|
});
|
|
3756
3867
|
perfMark('computeQuery.filterActiveMenu', performance.now() - tMenu, {
|
|
3757
3868
|
totalMenu: menuList.length,
|
|
@@ -3768,10 +3879,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3768
3879
|
});
|
|
3769
3880
|
tPrice = performance.now();
|
|
3770
3881
|
if (!(scopedProductIds.length > 0)) {
|
|
3771
|
-
|
|
3882
|
+
_context36.next = 49;
|
|
3772
3883
|
break;
|
|
3773
3884
|
}
|
|
3774
|
-
|
|
3885
|
+
_context36.next = 46;
|
|
3775
3886
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
3776
3887
|
scheduleModule: this.getSchedule(),
|
|
3777
3888
|
schedule_datetime: schedule_datetime,
|
|
@@ -3781,13 +3892,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
3781
3892
|
productIds: productScope.isAllProducts ? undefined : scopedProductIds
|
|
3782
3893
|
});
|
|
3783
3894
|
case 46:
|
|
3784
|
-
|
|
3785
|
-
|
|
3895
|
+
_context36.t0 = _context36.sent;
|
|
3896
|
+
_context36.next = 50;
|
|
3786
3897
|
break;
|
|
3787
3898
|
case 49:
|
|
3788
|
-
|
|
3899
|
+
_context36.t0 = [];
|
|
3789
3900
|
case 50:
|
|
3790
|
-
filteredProducts =
|
|
3901
|
+
filteredProducts = _context36.t0;
|
|
3791
3902
|
perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
|
|
3792
3903
|
count: filteredProducts.length,
|
|
3793
3904
|
scopedProductCount: scopedProductIds.length
|
|
@@ -3820,7 +3931,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3820
3931
|
filteredCount: filteredProducts.length,
|
|
3821
3932
|
activeMenuCount: activeMenuList.length
|
|
3822
3933
|
});
|
|
3823
|
-
return
|
|
3934
|
+
return _context36.abrupt("return", {
|
|
3824
3935
|
code: 200,
|
|
3825
3936
|
data: {
|
|
3826
3937
|
list: filteredProducts,
|
|
@@ -3831,11 +3942,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3831
3942
|
});
|
|
3832
3943
|
case 62:
|
|
3833
3944
|
case "end":
|
|
3834
|
-
return
|
|
3945
|
+
return _context36.stop();
|
|
3835
3946
|
}
|
|
3836
|
-
},
|
|
3947
|
+
}, _callee36, this);
|
|
3837
3948
|
}));
|
|
3838
|
-
function computeProductQueryResult(
|
|
3949
|
+
function computeProductQueryResult(_x34, _x35) {
|
|
3839
3950
|
return _computeProductQueryResult.apply(this, arguments);
|
|
3840
3951
|
}
|
|
3841
3952
|
return computeProductQueryResult;
|
|
@@ -3850,72 +3961,72 @@ var Server = /*#__PURE__*/function () {
|
|
|
3850
3961
|
}, {
|
|
3851
3962
|
key: "recomputeAndNotifyProductQuery",
|
|
3852
3963
|
value: (function () {
|
|
3853
|
-
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3964
|
+
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(options) {
|
|
3854
3965
|
var _iterator16, _step16, _step16$value, subscriberId, subscriber, result, errorMessage;
|
|
3855
|
-
return _regeneratorRuntime().wrap(function
|
|
3856
|
-
while (1) switch (
|
|
3966
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3967
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3857
3968
|
case 0:
|
|
3858
3969
|
if (!(this.productQuerySubscribers.size === 0)) {
|
|
3859
|
-
|
|
3970
|
+
_context37.next = 2;
|
|
3860
3971
|
break;
|
|
3861
3972
|
}
|
|
3862
|
-
return
|
|
3973
|
+
return _context37.abrupt("return");
|
|
3863
3974
|
case 2:
|
|
3864
3975
|
this.logInfo('recomputeAndNotifyProductQuery: 开始推送', {
|
|
3865
3976
|
subscriberCount: this.productQuerySubscribers.size,
|
|
3866
3977
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3867
3978
|
});
|
|
3868
3979
|
_iterator16 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
|
|
3869
|
-
|
|
3980
|
+
_context37.prev = 4;
|
|
3870
3981
|
_iterator16.s();
|
|
3871
3982
|
case 6:
|
|
3872
3983
|
if ((_step16 = _iterator16.n()).done) {
|
|
3873
|
-
|
|
3984
|
+
_context37.next = 22;
|
|
3874
3985
|
break;
|
|
3875
3986
|
}
|
|
3876
3987
|
_step16$value = _slicedToArray(_step16.value, 2), subscriberId = _step16$value[0], subscriber = _step16$value[1];
|
|
3877
|
-
|
|
3878
|
-
|
|
3988
|
+
_context37.prev = 8;
|
|
3989
|
+
_context37.next = 11;
|
|
3879
3990
|
return this.computeProductQueryResult(subscriber.context, {
|
|
3880
3991
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3881
3992
|
});
|
|
3882
3993
|
case 11:
|
|
3883
|
-
result =
|
|
3994
|
+
result = _context37.sent;
|
|
3884
3995
|
subscriber.callback(result);
|
|
3885
3996
|
this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
|
|
3886
3997
|
subscriberId: subscriberId
|
|
3887
3998
|
});
|
|
3888
|
-
|
|
3999
|
+
_context37.next = 20;
|
|
3889
4000
|
break;
|
|
3890
4001
|
case 16:
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
errorMessage =
|
|
4002
|
+
_context37.prev = 16;
|
|
4003
|
+
_context37.t0 = _context37["catch"](8);
|
|
4004
|
+
errorMessage = _context37.t0 instanceof Error ? _context37.t0.message : String(_context37.t0);
|
|
3894
4005
|
this.logError('recomputeAndNotifyProductQuery: 推送失败', {
|
|
3895
4006
|
subscriberId: subscriberId,
|
|
3896
4007
|
error: errorMessage
|
|
3897
4008
|
});
|
|
3898
4009
|
case 20:
|
|
3899
|
-
|
|
4010
|
+
_context37.next = 6;
|
|
3900
4011
|
break;
|
|
3901
4012
|
case 22:
|
|
3902
|
-
|
|
4013
|
+
_context37.next = 27;
|
|
3903
4014
|
break;
|
|
3904
4015
|
case 24:
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
_iterator16.e(
|
|
4016
|
+
_context37.prev = 24;
|
|
4017
|
+
_context37.t1 = _context37["catch"](4);
|
|
4018
|
+
_iterator16.e(_context37.t1);
|
|
3908
4019
|
case 27:
|
|
3909
|
-
|
|
4020
|
+
_context37.prev = 27;
|
|
3910
4021
|
_iterator16.f();
|
|
3911
|
-
return
|
|
4022
|
+
return _context37.finish(27);
|
|
3912
4023
|
case 30:
|
|
3913
4024
|
case "end":
|
|
3914
|
-
return
|
|
4025
|
+
return _context37.stop();
|
|
3915
4026
|
}
|
|
3916
|
-
},
|
|
4027
|
+
}, _callee37, this, [[4, 24, 27, 30], [8, 16]]);
|
|
3917
4028
|
}));
|
|
3918
|
-
function recomputeAndNotifyProductQuery(
|
|
4029
|
+
function recomputeAndNotifyProductQuery(_x36) {
|
|
3919
4030
|
return _recomputeAndNotifyProductQuery.apply(this, arguments);
|
|
3920
4031
|
}
|
|
3921
4032
|
return recomputeAndNotifyProductQuery;
|
|
@@ -3927,16 +4038,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
3927
4038
|
}, {
|
|
3928
4039
|
key: "recomputeAndNotifyOrderQuery",
|
|
3929
4040
|
value: (function () {
|
|
3930
|
-
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4041
|
+
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3931
4042
|
var notifyStartAt, _iterator17, _step17, _step17$value, subscriberId, subscriber, computeStartAt, result, computeEndAt, callbackStartAt, callbackEndAt, errorMessage, notifyEndAt;
|
|
3932
|
-
return _regeneratorRuntime().wrap(function
|
|
3933
|
-
while (1) switch (
|
|
4043
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
4044
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3934
4045
|
case 0:
|
|
3935
4046
|
if (!(this.orderQuerySubscribers.size === 0)) {
|
|
3936
|
-
|
|
4047
|
+
_context38.next = 2;
|
|
3937
4048
|
break;
|
|
3938
4049
|
}
|
|
3939
|
-
return
|
|
4050
|
+
return _context38.abrupt("return");
|
|
3940
4051
|
case 2:
|
|
3941
4052
|
notifyStartAt = Date.now();
|
|
3942
4053
|
this.logInfo('recomputeAndNotifyOrderQuery: 开始推送', {
|
|
@@ -3944,20 +4055,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
3944
4055
|
notifyStartAt: new Date(notifyStartAt).toISOString()
|
|
3945
4056
|
});
|
|
3946
4057
|
_iterator17 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
|
|
3947
|
-
|
|
4058
|
+
_context38.prev = 5;
|
|
3948
4059
|
_iterator17.s();
|
|
3949
4060
|
case 7:
|
|
3950
4061
|
if ((_step17 = _iterator17.n()).done) {
|
|
3951
|
-
|
|
4062
|
+
_context38.next = 27;
|
|
3952
4063
|
break;
|
|
3953
4064
|
}
|
|
3954
4065
|
_step17$value = _slicedToArray(_step17.value, 2), subscriberId = _step17$value[0], subscriber = _step17$value[1];
|
|
3955
|
-
|
|
4066
|
+
_context38.prev = 9;
|
|
3956
4067
|
computeStartAt = Date.now();
|
|
3957
|
-
|
|
4068
|
+
_context38.next = 13;
|
|
3958
4069
|
return this.computeOrderQueryResult(subscriber.context);
|
|
3959
4070
|
case 13:
|
|
3960
|
-
result =
|
|
4071
|
+
result = _context38.sent;
|
|
3961
4072
|
computeEndAt = Date.now();
|
|
3962
4073
|
callbackStartAt = Date.now();
|
|
3963
4074
|
subscriber.callback(result);
|
|
@@ -3968,30 +4079,30 @@ var Server = /*#__PURE__*/function () {
|
|
|
3968
4079
|
callbackDurationMs: callbackEndAt - callbackStartAt,
|
|
3969
4080
|
totalDurationMs: callbackEndAt - computeStartAt
|
|
3970
4081
|
});
|
|
3971
|
-
|
|
4082
|
+
_context38.next = 25;
|
|
3972
4083
|
break;
|
|
3973
4084
|
case 21:
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
errorMessage =
|
|
4085
|
+
_context38.prev = 21;
|
|
4086
|
+
_context38.t0 = _context38["catch"](9);
|
|
4087
|
+
errorMessage = _context38.t0 instanceof Error ? _context38.t0.message : String(_context38.t0);
|
|
3977
4088
|
this.logError('recomputeAndNotifyOrderQuery: 推送失败', {
|
|
3978
4089
|
subscriberId: subscriberId,
|
|
3979
4090
|
error: errorMessage
|
|
3980
4091
|
});
|
|
3981
4092
|
case 25:
|
|
3982
|
-
|
|
4093
|
+
_context38.next = 7;
|
|
3983
4094
|
break;
|
|
3984
4095
|
case 27:
|
|
3985
|
-
|
|
4096
|
+
_context38.next = 32;
|
|
3986
4097
|
break;
|
|
3987
4098
|
case 29:
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
_iterator17.e(
|
|
4099
|
+
_context38.prev = 29;
|
|
4100
|
+
_context38.t1 = _context38["catch"](5);
|
|
4101
|
+
_iterator17.e(_context38.t1);
|
|
3991
4102
|
case 32:
|
|
3992
|
-
|
|
4103
|
+
_context38.prev = 32;
|
|
3993
4104
|
_iterator17.f();
|
|
3994
|
-
return
|
|
4105
|
+
return _context38.finish(32);
|
|
3995
4106
|
case 35:
|
|
3996
4107
|
notifyEndAt = Date.now();
|
|
3997
4108
|
this.logInfo('recomputeAndNotifyOrderQuery: 推送完成', {
|
|
@@ -4000,9 +4111,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
4000
4111
|
});
|
|
4001
4112
|
case 37:
|
|
4002
4113
|
case "end":
|
|
4003
|
-
return
|
|
4114
|
+
return _context38.stop();
|
|
4004
4115
|
}
|
|
4005
|
-
},
|
|
4116
|
+
}, _callee38, this, [[5, 29, 32, 35], [9, 21]]);
|
|
4006
4117
|
}));
|
|
4007
4118
|
function recomputeAndNotifyOrderQuery() {
|
|
4008
4119
|
return _recomputeAndNotifyOrderQuery.apply(this, arguments);
|
|
@@ -4016,67 +4127,67 @@ var Server = /*#__PURE__*/function () {
|
|
|
4016
4127
|
}, {
|
|
4017
4128
|
key: "recomputeAndNotifyBookingQuery",
|
|
4018
4129
|
value: (function () {
|
|
4019
|
-
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4130
|
+
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
4020
4131
|
var _iterator18, _step18, _step18$value, subscriberId, subscriber, result, errorMessage;
|
|
4021
|
-
return _regeneratorRuntime().wrap(function
|
|
4022
|
-
while (1) switch (
|
|
4132
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
4133
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
4023
4134
|
case 0:
|
|
4024
4135
|
if (!(this.bookingQuerySubscribers.size === 0)) {
|
|
4025
|
-
|
|
4136
|
+
_context39.next = 2;
|
|
4026
4137
|
break;
|
|
4027
4138
|
}
|
|
4028
|
-
return
|
|
4139
|
+
return _context39.abrupt("return");
|
|
4029
4140
|
case 2:
|
|
4030
4141
|
this.logInfo('recomputeAndNotifyBookingQuery: 开始推送', {
|
|
4031
4142
|
subscriberCount: this.bookingQuerySubscribers.size
|
|
4032
4143
|
});
|
|
4033
4144
|
_iterator18 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
|
|
4034
|
-
|
|
4145
|
+
_context39.prev = 4;
|
|
4035
4146
|
_iterator18.s();
|
|
4036
4147
|
case 6:
|
|
4037
4148
|
if ((_step18 = _iterator18.n()).done) {
|
|
4038
|
-
|
|
4149
|
+
_context39.next = 22;
|
|
4039
4150
|
break;
|
|
4040
4151
|
}
|
|
4041
4152
|
_step18$value = _slicedToArray(_step18.value, 2), subscriberId = _step18$value[0], subscriber = _step18$value[1];
|
|
4042
|
-
|
|
4043
|
-
|
|
4153
|
+
_context39.prev = 8;
|
|
4154
|
+
_context39.next = 11;
|
|
4044
4155
|
return this.computeBookingQueryResult(subscriber.context);
|
|
4045
4156
|
case 11:
|
|
4046
|
-
result =
|
|
4157
|
+
result = _context39.sent;
|
|
4047
4158
|
subscriber.callback(result);
|
|
4048
4159
|
this.logInfo('recomputeAndNotifyBookingQuery: 已推送', {
|
|
4049
4160
|
subscriberId: subscriberId
|
|
4050
4161
|
});
|
|
4051
|
-
|
|
4162
|
+
_context39.next = 20;
|
|
4052
4163
|
break;
|
|
4053
4164
|
case 16:
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
errorMessage =
|
|
4165
|
+
_context39.prev = 16;
|
|
4166
|
+
_context39.t0 = _context39["catch"](8);
|
|
4167
|
+
errorMessage = _context39.t0 instanceof Error ? _context39.t0.message : String(_context39.t0);
|
|
4057
4168
|
this.logError('recomputeAndNotifyBookingQuery: 推送失败', {
|
|
4058
4169
|
subscriberId: subscriberId,
|
|
4059
4170
|
error: errorMessage
|
|
4060
4171
|
});
|
|
4061
4172
|
case 20:
|
|
4062
|
-
|
|
4173
|
+
_context39.next = 6;
|
|
4063
4174
|
break;
|
|
4064
4175
|
case 22:
|
|
4065
|
-
|
|
4176
|
+
_context39.next = 27;
|
|
4066
4177
|
break;
|
|
4067
4178
|
case 24:
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
_iterator18.e(
|
|
4179
|
+
_context39.prev = 24;
|
|
4180
|
+
_context39.t1 = _context39["catch"](4);
|
|
4181
|
+
_iterator18.e(_context39.t1);
|
|
4071
4182
|
case 27:
|
|
4072
|
-
|
|
4183
|
+
_context39.prev = 27;
|
|
4073
4184
|
_iterator18.f();
|
|
4074
|
-
return
|
|
4185
|
+
return _context39.finish(27);
|
|
4075
4186
|
case 30:
|
|
4076
4187
|
case "end":
|
|
4077
|
-
return
|
|
4188
|
+
return _context39.stop();
|
|
4078
4189
|
}
|
|
4079
|
-
},
|
|
4190
|
+
}, _callee39, this, [[4, 24, 27, 30], [8, 16]]);
|
|
4080
4191
|
}));
|
|
4081
4192
|
function recomputeAndNotifyBookingQuery() {
|
|
4082
4193
|
return _recomputeAndNotifyBookingQuery.apply(this, arguments);
|