@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.
Files changed (39) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/Order/index.js +9 -3
  3. package/dist/modules/Payment/index.d.ts +0 -13
  4. package/dist/modules/Payment/index.js +449 -833
  5. package/dist/plugins/request.d.ts +1 -0
  6. package/dist/server/index.d.ts +6 -0
  7. package/dist/server/index.js +730 -619
  8. package/dist/server/modules/index.d.ts +2 -0
  9. package/dist/server/modules/index.js +2 -0
  10. package/dist/server/modules/payment/index.d.ts +28 -0
  11. package/dist/server/modules/payment/index.js +305 -0
  12. package/dist/server/modules/payment/types.d.ts +9 -0
  13. package/dist/server/modules/payment/types.js +1 -0
  14. package/dist/solution/BaseSales/index.d.ts +6 -1
  15. package/dist/solution/BaseSales/index.js +67 -18
  16. package/dist/solution/BookingTicket/index.js +1 -1
  17. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +51 -52
  18. package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  19. package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
  20. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  21. package/lib/modules/Order/index.js +5 -1
  22. package/lib/modules/Payment/index.d.ts +0 -13
  23. package/lib/modules/Payment/index.js +6 -149
  24. package/lib/plugins/request.d.ts +1 -0
  25. package/lib/server/index.d.ts +6 -0
  26. package/lib/server/index.js +46 -0
  27. package/lib/server/modules/index.d.ts +2 -0
  28. package/lib/server/modules/index.js +3 -0
  29. package/lib/server/modules/payment/index.d.ts +28 -0
  30. package/lib/server/modules/payment/index.js +192 -0
  31. package/lib/server/modules/payment/types.d.ts +9 -0
  32. package/lib/server/modules/payment/types.js +17 -0
  33. package/lib/solution/BaseSales/index.d.ts +6 -1
  34. package/lib/solution/BaseSales/index.js +51 -5
  35. package/lib/solution/BookingTicket/index.js +1 -1
  36. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +1 -2
  37. package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  38. package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
  39. package/package.json +1 -1
@@ -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 _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
171
- var url, method, data, config, menu_list_ids, schedule_datetime, schedule_date, customer_id, ids, _ref3, callback, subscriberId;
172
- return _regeneratorRuntime().wrap(function _callee$(_context) {
173
- while (1) switch (_context.prev = _context.next) {
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 = _ref.url, method = _ref.method, data = _ref.data, config = _ref.config;
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
- _ref3 = config || {}, callback = _ref3.callback, subscriberId = _ref3.subscriberId;
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 _context.abrupt("return", _this.computeProductQueryResult({
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 _context.stop();
259
+ return _context2.stop();
214
260
  }
215
- }, _callee);
261
+ }, _callee2);
216
262
  }));
217
- return function (_x) {
218
- return _ref2.apply(this, arguments);
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 _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref4) {
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 _callee2$(_context2) {
229
- while (1) switch (_context2.prev = _context2.next) {
274
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
275
+ while (1) switch (_context3.prev = _context3.next) {
230
276
  case 0:
231
- path = _ref4.path, method = _ref4.method, data = _ref4.data, url = _ref4.url;
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
- _context2.next = 8;
283
+ _context3.next = 8;
238
284
  break;
239
285
  }
240
286
  _this.logWarning('handleProductQueryById: 无效的商品 id', {
241
287
  path: pathname
242
288
  });
243
- return _context2.abrupt("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
- _context2.next = 13;
301
+ _context3.next = 13;
256
302
  break;
257
303
  }
258
304
  _this.logWarning('handleProductQueryById: 缺少 schedule_date', {
259
305
  productId: productId
260
306
  });
261
- return _context2.abrupt("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 _context2.abrupt("return", _this.computeProductQueryResult({
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 _context2.stop();
329
+ return _context3.stop();
284
330
  }
285
- }, _callee2);
331
+ }, _callee3);
286
332
  }));
287
- return function (_x2) {
288
- return _ref5.apply(this, arguments);
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 _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref6) {
296
- var data, _ref8, subscriberId;
297
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
298
- while (1) switch (_context3.prev = _context3.next) {
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 = _ref6.data;
301
- _ref8 = data || {}, subscriberId = _ref8.subscriberId;
346
+ data = _ref8.data;
347
+ _ref10 = data || {}, subscriberId = _ref10.subscriberId;
302
348
  _this.removeProductQuerySubscriber(subscriberId);
303
- return _context3.abrupt("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 _context3.stop();
356
+ return _context4.stop();
311
357
  }
312
- }, _callee3);
358
+ }, _callee4);
313
359
  }));
314
- return function (_x3) {
315
- return _ref7.apply(this, arguments);
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 _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref9) {
324
- var url, method, data, config, queryPayload, _ref11, callback, subscriberId, useLocal;
325
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
326
- while (1) switch (_context4.prev = _context4.next) {
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 = _ref9.url, method = _ref9.method, data = _ref9.data, config = _ref9.config;
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
- _ref11 = config || {}, callback = _ref11.callback, subscriberId = _ref11.subscriberId;
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
- _context4.next = 9;
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 _context4.abrupt("return", _this.computeOrderQueryResult(queryPayload));
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 _context4.abrupt("return", _this.fetchOrderListFromAPI(queryPayload));
406
+ return _context5.abrupt("return", _this.fetchOrderListFromAPI(queryPayload));
361
407
  case 11:
362
408
  case "end":
363
- return _context4.stop();
409
+ return _context5.stop();
364
410
  }
365
- }, _callee4);
411
+ }, _callee5);
366
412
  }));
367
- return function (_x4) {
368
- return _ref10.apply(this, arguments);
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 _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref12) {
376
- var data, _ref14, subscriberId;
377
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
378
- while (1) switch (_context5.prev = _context5.next) {
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 = _ref12.data;
381
- _ref14 = data || {}, subscriberId = _ref14.subscriberId;
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 _context5.abrupt("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 _context5.stop();
442
+ return _context6.stop();
397
443
  }
398
- }, _callee5);
444
+ }, _callee6);
399
445
  }));
400
- return function (_x5) {
401
- return _ref13.apply(this, arguments);
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 _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref15) {
415
- var url, method, data, config, queryPayload, _ref17, callback, subscriberId, useLocal, withFields, requestPayload, cacheKey;
416
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
417
- while (1) switch (_context6.prev = _context6.next) {
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 = _ref15.url, method = _ref15.method, data = _ref15.data, config = _ref15.config;
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
- _ref17 = config || {}, callback = _ref17.callback, subscriberId = _ref17.subscriberId;
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
- _context6.next = 12;
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 _context6.abrupt("return", _this.computeBookingQueryResult(queryPayload));
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 _context6.abrupt("return", _this.fetchBookingListFromAPI(queryPayload));
517
+ return _context7.abrupt("return", _this.fetchBookingListFromAPI(queryPayload));
472
518
  case 16:
473
519
  case "end":
474
- return _context6.stop();
520
+ return _context7.stop();
475
521
  }
476
- }, _callee6);
522
+ }, _callee7);
477
523
  }));
478
- return function (_x6) {
479
- return _ref16.apply(this, arguments);
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 _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref18) {
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 _callee7$(_context7) {
491
- while (1) switch (_context7.prev = _context7.next) {
536
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
537
+ while (1) switch (_context8.prev = _context8.next) {
492
538
  case 0:
493
- url = _ref18.url, method = _ref18.method, data = _ref18.data, config = _ref18.config;
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 _context7.abrupt("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 _context7.stop();
559
+ return _context8.stop();
514
560
  }
515
- }, _callee7);
561
+ }, _callee8);
516
562
  }));
517
- return function (_x7) {
518
- return _ref19.apply(this, arguments);
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 _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref20) {
537
- var _ref22, _this$app;
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 _callee8$(_context8) {
540
- while (1) switch (_context8.prev = _context8.next) {
585
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
586
+ while (1) switch (_context9.prev = _context9.next) {
541
587
  case 0:
542
- url = _ref20.url, data = _ref20.data;
588
+ url = _ref22.url, data = _ref22.data;
543
589
  batchIds = _this.parseOrderIdsParam(url, data);
544
590
  if (!(batchIds.length > 0)) {
545
- _context8.next = 4;
591
+ _context9.next = 4;
546
592
  break;
547
593
  }
548
- return _context8.abrupt("return", _this.handleUpdateLocalOrdersBatch(batchIds));
594
+ return _context9.abrupt("return", _this.handleUpdateLocalOrdersBatch(batchIds));
549
595
  case 4:
550
- rawOrderId = (_ref22 = data && _typeof(data) === 'object' ? data.order_id : undefined) !== null && _ref22 !== void 0 ? _ref22 : _this.extractQueryParam(url, 'order_id');
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
- _context8.next = 10;
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 _context8.abrupt("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
- _context8.next = 13;
618
+ _context9.next = 13;
573
619
  break;
574
620
  }
575
621
  _this.logError('handleUpdateLocalOrder: Order 模块未注册');
576
- return _context8.abrupt("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
- _context8.next = 16;
630
+ _context9.next = 16;
585
631
  break;
586
632
  }
587
633
  _this.logError('handleUpdateLocalOrder: app.request 不可用');
588
- return _context8.abrupt("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
- _context8.prev = 17;
597
- _context8.next = 20;
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 = _context8.sent;
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
- _context8.next = 25;
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 _context8.abrupt("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
- _context8.next = 33;
667
+ _context9.next = 33;
622
668
  break;
623
669
  }
624
- _context8.next = 29;
670
+ _context9.next = 29;
625
671
  return _this.order.overwriteExistingOrder(fresh);
626
672
  case 29:
627
- _yield$_this$order$ov = _context8.sent;
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 _context8.abrupt("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
- _context8.next = 35;
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 _context8.abrupt("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
- _context8.prev = 39;
662
- _context8.t0 = _context8["catch"](17);
663
- errorMessage = _context8.t0 instanceof Error ? _context8.t0.message : String(_context8.t0);
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 _context8.abrupt("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 _context8.stop();
723
+ return _context9.stop();
678
724
  }
679
- }, _callee8, null, [[17, 39]]);
725
+ }, _callee9, null, [[17, 39]]);
680
726
  }));
681
- return function (_x8) {
682
- return _ref21.apply(this, arguments);
727
+ return function (_x9) {
728
+ return _ref23.apply(this, arguments);
683
729
  };
684
730
  }());
685
731
  _defineProperty(this, "handleOrderSalesCheckout", /*#__PURE__*/function () {
686
- var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref23) {
732
+ var _ref26 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref25) {
687
733
  var data;
688
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
689
- while (1) switch (_context9.prev = _context9.next) {
734
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
735
+ while (1) switch (_context10.prev = _context10.next) {
690
736
  case 0:
691
- data = _ref23.data;
692
- return _context9.abrupt("return", _this.handleOrderCheckoutSubmit({
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 _context9.stop();
745
+ return _context10.stop();
700
746
  }
701
- }, _callee9);
747
+ }, _callee10);
702
748
  }));
703
- return function (_x9) {
704
- return _ref24.apply(this, arguments);
749
+ return function (_x10) {
750
+ return _ref26.apply(this, arguments);
705
751
  };
706
752
  }());
707
753
  _defineProperty(this, "handleOrderCheckout", /*#__PURE__*/function () {
708
- var _ref26 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref25) {
754
+ var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref27) {
709
755
  var data;
710
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
711
- while (1) switch (_context10.prev = _context10.next) {
756
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
757
+ while (1) switch (_context11.prev = _context11.next) {
712
758
  case 0:
713
- data = _ref25.data;
714
- return _context10.abrupt("return", _this.handleOrderCheckoutSubmit({
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 _context10.stop();
767
+ return _context11.stop();
722
768
  }
723
- }, _callee10);
769
+ }, _callee11);
724
770
  }));
725
- return function (_x10) {
726
- return _ref26.apply(this, arguments);
771
+ return function (_x11) {
772
+ return _ref28.apply(this, arguments);
727
773
  };
728
774
  }());
729
775
  _defineProperty(this, "handleOrderSalesDetail", /*#__PURE__*/function () {
730
- var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref27) {
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 _callee11$(_context11) {
734
- while (1) switch (_context11.prev = _context11.next) {
779
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
780
+ while (1) switch (_context12.prev = _context12.next) {
735
781
  case 0:
736
- url = _ref27.url, data = _ref27.data, path = _ref27.path;
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
- _context11.next = 7;
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 _context11.abrupt("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
- _context11.next = 10;
806
+ _context12.next = 10;
761
807
  break;
762
808
  }
763
809
  _this.logError('handleOrderSalesDetail: Order 模块未注册');
764
- return _context11.abrupt("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
- _context11.next = 17;
818
+ _context12.next = 17;
773
819
  break;
774
820
  }
775
- _context11.next = 13;
821
+ _context12.next = 13;
776
822
  return _this.order.getLocalOrderByLookup(lookup);
777
823
  case 13:
778
- localOrder = _context11.sent;
824
+ localOrder = _context12.sent;
779
825
  if (!localOrder) {
780
- _context11.next = 17;
826
+ _context12.next = 17;
781
827
  break;
782
828
  }
783
829
  _this.logInfo('handleOrderSalesDetail: 命中本地订单', {
784
830
  lookup: lookup
785
831
  });
786
- return _context11.abrupt("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
- _context11.next = 20;
840
+ _context12.next = 20;
795
841
  break;
796
842
  }
797
843
  _this.logError('handleOrderSalesDetail: app.request 不可用');
798
- return _context11.abrupt("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
- _context11.prev = 21;
807
- _context11.next = 24;
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 = _context11.sent;
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
- _context11.next = 29;
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 _context11.abrupt("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
- _context11.next = 31;
878
+ _context12.next = 31;
833
879
  return _this.order.upsertOrdersFromRemote([fresh]);
834
880
  case 31:
835
- _context11.next = 33;
881
+ _context12.next = 33;
836
882
  return _this.order.getLocalOrderByLookup(lookup);
837
883
  case 33:
838
- savedOrder = _context11.sent;
884
+ savedOrder = _context12.sent;
839
885
  if (savedOrder) {
840
- _context11.next = 37;
886
+ _context12.next = 37;
841
887
  break;
842
888
  }
843
889
  _this.logError('handleOrderSalesDetail: 订单写入后回读失败', {
844
890
  lookup: lookup
845
891
  });
846
- return _context11.abrupt("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 _context11.abrupt("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
- _context11.prev = 41;
864
- _context11.t0 = _context11["catch"](21);
865
- errorMessage = _context11.t0 instanceof Error ? _context11.t0.message : String(_context11.t0);
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 _context11.abrupt("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 _context11.stop();
925
+ return _context12.stop();
880
926
  }
881
- }, _callee11, null, [[21, 41]]);
927
+ }, _callee12, null, [[21, 41]]);
882
928
  }));
883
- return function (_x11) {
884
- return _ref28.apply(this, arguments);
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 _ref30 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref29) {
892
- var url, data, config, routePath, base, path, _subscriberId, _ref31, callback, subscriberId, ctx;
893
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
894
- while (1) switch (_context12.prev = _context12.next) {
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 = _ref29.url, data = _ref29.data, config = _ref29.config, routePath = _ref29.path;
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
- _context12.next = 7;
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 _context12.abrupt("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
- _ref31 = config || {}, callback = _ref31.callback, subscriberId = _ref31.subscriberId;
963
+ _ref33 = config || {}, callback = _ref33.callback, subscriberId = _ref33.subscriberId;
918
964
  ctx = _this.resolveFloorPlanQueryContext(path, base);
919
965
  if (ctx) {
920
- _context12.next = 11;
966
+ _context13.next = 11;
921
967
  break;
922
968
  }
923
- return _context12.abrupt("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 _context12.abrupt("return", _this.computeFloorPlanQueryResult(ctx));
987
+ return _context13.abrupt("return", _this.computeFloorPlanQueryResult(ctx));
942
988
  case 13:
943
989
  case "end":
944
- return _context12.stop();
990
+ return _context13.stop();
945
991
  }
946
- }, _callee12);
992
+ }, _callee13);
947
993
  }));
948
- return function (_x12) {
949
- return _ref30.apply(this, arguments);
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 _ref33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_ref32) {
957
- var data, _ref34, subscriberId;
958
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
959
- while (1) switch (_context13.prev = _context13.next) {
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 = _ref32.data;
962
- _ref34 = data || {}, subscriberId = _ref34.subscriberId;
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 _context13.abrupt("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 _context13.stop();
1025
+ return _context14.stop();
980
1026
  }
981
- }, _callee13);
1027
+ }, _callee14);
982
1028
  }));
983
- return function (_x13) {
984
- return _ref33.apply(this, arguments);
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 _ref36 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(_ref35) {
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 _callee14$(_context14) {
996
- while (1) switch (_context14.prev = _context14.next) {
1041
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1042
+ while (1) switch (_context15.prev = _context15.next) {
997
1043
  case 0:
998
- url = _ref35.url, method = _ref35.method, data = _ref35.data, config = _ref35.config;
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
- _context14.next = 8;
1054
+ _context15.next = 8;
1009
1055
  break;
1010
1056
  }
1011
1057
  console.error('[Server] Menu 模块未注册');
1012
1058
  _this.logError('handleGetScheduleTimePoints: Menu 模块未注册');
1013
- return _context14.abrupt("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
- _context14.next = 12;
1067
+ _context15.next = 12;
1022
1068
  break;
1023
1069
  }
1024
1070
  console.error('[Server] Schedule 模块未注册');
1025
1071
  _this.logError('handleGetScheduleTimePoints: Schedule 模块未注册');
1026
- return _context14.abrupt("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
- _context14.next = 16;
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 _context14.abrupt("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
- _context14.prev = 16;
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
- _context14.next = 26;
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 _context14.abrupt("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 _context14.abrupt("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
- _context14.prev = 35;
1105
- _context14.t0 = _context14["catch"](16);
1106
- errorMessage = _context14.t0 instanceof Error ? _context14.t0.message : '未知错误';
1107
- console.error('[Server] 获取日程时间点失败:', _context14.t0);
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 _context14.abrupt("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 _context14.stop();
1166
+ return _context15.stop();
1121
1167
  }
1122
- }, _callee14, null, [[16, 35]]);
1168
+ }, _callee15, null, [[16, 35]]);
1123
1169
  }));
1124
- return function (_x14) {
1125
- return _ref36.apply(this, arguments);
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 _callee15(module, options, moduleName) {
1268
+ var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(module, options, moduleName) {
1223
1269
  var routes;
1224
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1225
- while (1) switch (_context15.prev = _context15.next) {
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
- _context15.next = 3;
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 _context15.stop();
1300
+ return _context16.stop();
1255
1301
  }
1256
- }, _callee15, this);
1302
+ }, _callee16, this);
1257
1303
  }));
1258
- function registerModuleWithRoutes(_x15, _x16, _x17) {
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 _callee16(moduleConfig) {
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 _callee16$(_context16) {
1274
- while (1) switch (_context16.prev = _context16.next) {
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
- _context16.next = 8;
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
- _context16.next = 13;
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 _context16.abrupt("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 _context16.stop();
1366
+ return _context17.stop();
1321
1367
  }
1322
- }, _callee16, this);
1368
+ }, _callee17, this);
1323
1369
  }));
1324
- function registerModuleByName(_x18) {
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 _callee17(moduleConfigs) {
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 _callee17$(_context17) {
1340
- while (1) switch (_context17.prev = _context17.next) {
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
- _context17.prev = 5;
1398
+ _context18.prev = 5;
1353
1399
  _iterator2.s();
1354
1400
  case 7:
1355
1401
  if ((_step2 = _iterator2.n()).done) {
1356
- _context17.next = 25;
1402
+ _context18.next = 25;
1357
1403
  break;
1358
1404
  }
1359
1405
  config = _step2.value;
1360
1406
  configName = typeof config === 'string' ? config : config.name;
1361
- _context17.prev = 10;
1362
- _context17.next = 13;
1407
+ _context18.prev = 10;
1408
+ _context18.next = 13;
1363
1409
  return this.registerModuleByName(config);
1364
1410
  case 13:
1365
- result = _context17.sent;
1411
+ result = _context18.sent;
1366
1412
  registeredModules.push(result);
1367
- _context17.next = 23;
1413
+ _context18.next = 23;
1368
1414
  break;
1369
1415
  case 17:
1370
- _context17.prev = 17;
1371
- _context17.t0 = _context17["catch"](10);
1372
- errorMessage = _context17.t0 instanceof Error ? _context17.t0.message : String(_context17.t0);
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:", _context17.t0);
1378
- throw _context17.t0;
1423
+ console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:", _context18.t0);
1424
+ throw _context18.t0;
1379
1425
  case 23:
1380
- _context17.next = 7;
1426
+ _context18.next = 7;
1381
1427
  break;
1382
1428
  case 25:
1383
- _context17.next = 30;
1429
+ _context18.next = 30;
1384
1430
  break;
1385
1431
  case 27:
1386
- _context17.prev = 27;
1387
- _context17.t1 = _context17["catch"](5);
1388
- _iterator2.e(_context17.t1);
1432
+ _context18.prev = 27;
1433
+ _context18.t1 = _context18["catch"](5);
1434
+ _iterator2.e(_context18.t1);
1389
1435
  case 30:
1390
- _context17.prev = 30;
1436
+ _context18.prev = 30;
1391
1437
  _iterator2.f();
1392
- return _context17.finish(30);
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 _context17.abrupt("return", registeredModules);
1448
+ return _context18.abrupt("return", registeredModules);
1403
1449
  case 36:
1404
1450
  case "end":
1405
- return _context17.stop();
1451
+ return _context18.stop();
1406
1452
  }
1407
- }, _callee17, this, [[5, 27, 30, 33], [10, 17]]);
1453
+ }, _callee18, this, [[5, 27, 30, 33], [10, 17]]);
1408
1454
  }));
1409
- function registerModules(_x19) {
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 _callee18(registeredModules, options) {
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 _callee18$(_context18) {
1425
- while (1) switch (_context18.prev = _context18.next) {
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
- _context18.prev = 5;
1484
+ _context19.prev = 5;
1439
1485
  _iterator3.s();
1440
1486
  case 7:
1441
1487
  if ((_step3 = _iterator3.n()).done) {
1442
- _context18.next = 40;
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
- _context18.next = 13;
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 _context18.abrupt("continue", 38);
1501
+ return _context19.abrupt("continue", 38);
1456
1502
  case 13:
1457
1503
  if (!(typeof module.preload === 'function')) {
1458
- _context18.next = 36;
1504
+ _context19.next = 36;
1459
1505
  break;
1460
1506
  }
1461
1507
  startTime = Date.now();
1462
- _context18.prev = 15;
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
- _context18.next = 20;
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
- _context18.next = 34;
1527
+ _context19.next = 34;
1482
1528
  break;
1483
1529
  case 27:
1484
- _context18.prev = 27;
1485
- _context18.t0 = _context18["catch"](15);
1530
+ _context19.prev = 27;
1531
+ _context19.t0 = _context19["catch"](15);
1486
1532
  _duration = Date.now() - startTime;
1487
- errorMessage = _context18.t0 instanceof Error ? _context18.t0.message : String(_context18.t0);
1488
- console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"), _context18.t0);
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
- _context18.next = 38;
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
- _context18.next = 7;
1554
+ _context19.next = 7;
1509
1555
  break;
1510
1556
  case 40:
1511
- _context18.next = 45;
1557
+ _context19.next = 45;
1512
1558
  break;
1513
1559
  case 42:
1514
- _context18.prev = 42;
1515
- _context18.t1 = _context18["catch"](5);
1516
- _iterator3.e(_context18.t1);
1560
+ _context19.prev = 42;
1561
+ _context19.t1 = _context19["catch"](5);
1562
+ _iterator3.e(_context19.t1);
1517
1563
  case 45:
1518
- _context18.prev = 45;
1564
+ _context19.prev = 45;
1519
1565
  _iterator3.f();
1520
- return _context18.finish(45);
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 _context18.stop();
1581
+ return _context19.stop();
1536
1582
  }
1537
- }, _callee18, this, [[5, 42, 45, 48], [15, 27]]);
1583
+ }, _callee19, this, [[5, 42, 45, 48], [15, 27]]);
1538
1584
  }));
1539
- function preloadModulesData(_x20, _x21) {
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 _callee19(moduleConfigs) {
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
- _args19 = arguments;
1562
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1563
- while (1) switch (_context19.prev = _context19.next) {
1607
+ _args20 = arguments;
1608
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1609
+ while (1) switch (_context20.prev = _context20.next) {
1564
1610
  case 0:
1565
- autoPreload = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : true;
1566
- options = _args19.length > 2 ? _args19[2] : undefined;
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
- _context19.next = 7;
1624
+ _context20.next = 7;
1579
1625
  return this.registerModules(moduleConfigs);
1580
1626
  case 7:
1581
- registeredModules = _context19.sent;
1627
+ registeredModules = _context20.sent;
1582
1628
  if (!autoPreload) {
1583
- _context19.next = 13;
1629
+ _context20.next = 13;
1584
1630
  break;
1585
1631
  }
1586
- _context19.next = 11;
1632
+ _context20.next = 11;
1587
1633
  return this.preloadModulesData(registeredModules, options);
1588
1634
  case 11:
1589
- _context19.next = 14;
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
- _context19.next = 16;
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 _context19.abrupt("return", registeredModules);
1668
+ return _context20.abrupt("return", registeredModules);
1623
1669
  case 22:
1624
1670
  case "end":
1625
- return _context19.stop();
1671
+ return _context20.stop();
1626
1672
  }
1627
- }, _callee19, this);
1673
+ }, _callee20, this);
1628
1674
  }));
1629
- function initialize(_x22) {
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 _callee20() {
1687
+ var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1642
1688
  var _this$core$context, errorMessage;
1643
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1644
- while (1) switch (_context20.prev = _context20.next) {
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
- _context20.next = 3;
1693
+ _context21.next = 3;
1648
1694
  break;
1649
1695
  }
1650
1696
  this.logInfo('setupProductsQuotationPriceBridge: Products 模块未注册');
1651
- return _context20.abrupt("return");
1697
+ return _context21.abrupt("return");
1652
1698
  case 3:
1653
1699
  if (this.schedule) {
1654
- _context20.next = 6;
1700
+ _context21.next = 6;
1655
1701
  break;
1656
1702
  }
1657
1703
  this.logInfo('setupProductsQuotationPriceBridge: Schedule 模块未注册');
1658
- return _context20.abrupt("return");
1704
+ return _context21.abrupt("return");
1659
1705
  case 6:
1660
- _context20.prev = 6;
1661
- _context20.next = 9;
1706
+ _context21.prev = 6;
1707
+ _context21.next = 9;
1662
1708
  return this.schedule.loadAllSchedule();
1663
1709
  case 9:
1664
1710
  this.products.clearPriceCache();
1665
- _context20.next = 12;
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
- _context20.next = 19;
1718
+ _context21.next = 19;
1673
1719
  break;
1674
1720
  case 15:
1675
- _context20.prev = 15;
1676
- _context20.t0 = _context20["catch"](6);
1677
- errorMessage = _context20.t0 instanceof Error ? _context20.t0.message : String(_context20.t0);
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 _context20.stop();
1729
+ return _context21.stop();
1684
1730
  }
1685
- }, _callee20, this, [[6, 15]]);
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 _callee21() {
1800
+ var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1755
1801
  var startTime, duration, _duration2, errorMessage;
1756
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1757
- while (1) switch (_context21.prev = _context21.next) {
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
- _context21.next = 3;
1806
+ _context22.next = 3;
1761
1807
  break;
1762
1808
  }
1763
1809
  this.logWarning('refreshProductsInBackground: Products 模块未注册');
1764
- return _context21.abrupt("return");
1810
+ return _context22.abrupt("return");
1765
1811
  case 3:
1766
1812
  this.logInfo('refreshProductsInBackground 开始');
1767
1813
  startTime = Date.now();
1768
- _context21.prev = 5;
1769
- _context21.next = 8;
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
- _context21.next = 18;
1822
+ _context22.next = 18;
1777
1823
  break;
1778
1824
  case 12:
1779
- _context21.prev = 12;
1780
- _context21.t0 = _context21["catch"](5);
1825
+ _context22.prev = 12;
1826
+ _context22.t0 = _context22["catch"](5);
1781
1827
  _duration2 = Date.now() - startTime;
1782
- errorMessage = _context21.t0 instanceof Error ? _context21.t0.message : String(_context21.t0);
1783
- console.error('[Server] refreshProductsInBackground 失败:', _context21.t0);
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 _context21.stop();
1836
+ return _context22.stop();
1791
1837
  }
1792
- }, _callee21, this, [[5, 12]]);
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 _callee22() {
1854
+ var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1809
1855
  var startTime, duration, _duration3, errorMessage;
1810
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1811
- while (1) switch (_context22.prev = _context22.next) {
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
- _context22.next = 3;
1860
+ _context23.next = 3;
1815
1861
  break;
1816
1862
  }
1817
1863
  this.logWarning('refreshOrdersInBackground: Order 模块未注册');
1818
- return _context22.abrupt("return");
1864
+ return _context23.abrupt("return");
1819
1865
  case 3:
1820
1866
  this.logInfo('refreshOrdersInBackground 开始');
1821
1867
  startTime = Date.now();
1822
- _context22.prev = 5;
1823
- _context22.next = 8;
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
- _context22.next = 18;
1876
+ _context23.next = 18;
1831
1877
  break;
1832
1878
  case 12:
1833
- _context22.prev = 12;
1834
- _context22.t0 = _context22["catch"](5);
1879
+ _context23.prev = 12;
1880
+ _context23.t0 = _context23["catch"](5);
1835
1881
  _duration3 = Date.now() - startTime;
1836
- errorMessage = _context22.t0 instanceof Error ? _context22.t0.message : String(_context22.t0);
1837
- console.error('[Server] refreshOrdersInBackground 失败:', _context22.t0);
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 _context22.stop();
1890
+ return _context23.stop();
1845
1891
  }
1846
- }, _callee22, this, [[5, 12]]);
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 _callee23() {
1907
+ var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1862
1908
  var clearTasks, moduleNames, errorMessage;
1863
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1864
- while (1) switch (_context23.prev = _context23.next) {
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
- _context23.next = 15;
1945
+ _context24.next = 15;
1900
1946
  break;
1901
1947
  }
1902
1948
  console.warn('[Server] 没有找到已注册的模块,无需清空');
1903
1949
  this.logWarning('没有找到已注册的模块,无需清空 IndexedDB');
1904
- return _context23.abrupt("return");
1950
+ return _context24.abrupt("return");
1905
1951
  case 15:
1906
1952
  this.logInfo('准备清空模块缓存', {
1907
1953
  moduleNames: moduleNames
1908
1954
  });
1909
- _context23.prev = 16;
1910
- _context23.next = 19;
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
- _context23.next = 29;
1963
+ _context24.next = 29;
1918
1964
  break;
1919
1965
  case 23:
1920
- _context23.prev = 23;
1921
- _context23.t0 = _context23["catch"](16);
1922
- errorMessage = _context23.t0 instanceof Error ? _context23.t0.message : String(_context23.t0);
1923
- console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context23.t0);
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 _context23.t0;
1974
+ throw _context24.t0;
1929
1975
  case 29:
1930
1976
  case "end":
1931
- return _context23.stop();
1977
+ return _context24.stop();
1932
1978
  }
1933
- }, _callee23, this, [[16, 23]]);
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 _callee24(method, path, params) {
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 _callee24$(_context24) {
2011
- while (1) switch (_context24.prev = _context24.next) {
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
- _context24.next = 6;
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
- _context24.prev = 6;
2032
- _context24.next = 9;
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 = _context24.sent;
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 _context24.abrupt("return", result);
2092
+ return _context25.abrupt("return", result);
2047
2093
  case 15:
2048
- _context24.prev = 15;
2049
- _context24.t0 = _context24["catch"](6);
2094
+ _context25.prev = 15;
2095
+ _context25.t0 = _context25["catch"](6);
2050
2096
  _duration4 = Date.now() - startTime;
2051
- errorMessage = _context24.t0 instanceof Error ? _context24.t0.message : String(_context24.t0);
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), _context24.t0);
2060
- throw _context24.t0;
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 _context24.stop();
2109
+ return _context25.stop();
2064
2110
  }
2065
- }, _callee24, this, [[6, 15]]);
2111
+ }, _callee25, this, [[6, 15]]);
2066
2112
  }));
2067
- function handleRoute(_x23, _x24, _x25) {
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 _this5 = this;
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 _this5.stableSerialize(item);
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(_this5.stableSerialize(obj[k]));
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 _callee25(data) {
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 _callee25$(_context25) {
2568
- while (1) switch (_context25.prev = _context25.next) {
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
- _context25.next = 3;
2682
+ _context28.next = 3;
2572
2683
  break;
2573
2684
  }
2574
2685
  this.logError('fetchOrderListFromAPI: app.request 不可用');
2575
- return _context25.abrupt("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
- _context25.prev = 3;
2586
- _context25.next = 6;
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 = _context25.sent;
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 _context25.abrupt("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
- _context25.prev = 13;
2606
- _context25.t0 = _context25["catch"](3);
2607
- errorMessage = _context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0);
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 _context25.abrupt("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 _context25.stop();
2733
+ return _context28.stop();
2623
2734
  }
2624
- }, _callee25, this, [[3, 13]]);
2735
+ }, _callee28, this, [[3, 13]]);
2625
2736
  }));
2626
- function fetchOrderListFromAPI(_x26) {
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 _callee26(data) {
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 _callee26$(_context26) {
2641
- while (1) switch (_context26.prev = _context26.next) {
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
- _context26.next = 3;
2755
+ _context29.next = 3;
2645
2756
  break;
2646
2757
  }
2647
2758
  this.logError('fetchBookingListFromAPI: Order 模块不可用');
2648
- return _context26.abrupt("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
- _context26.prev = 3;
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
- _context26.next = 13;
2775
+ _context29.next = 13;
2665
2776
  break;
2666
2777
  }
2667
2778
  cached = this.readBookingRemoteCache(cacheKey);
2668
2779
  if (!cached) {
2669
- _context26.next = 13;
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 _context26.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
2788
+ return _context29.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
2678
2789
  cache_hit: true
2679
2790
  }));
2680
2791
  case 13:
2681
- _context26.next = 15;
2792
+ _context29.next = 15;
2682
2793
  return this.order.fetchOrdersBySSE(requestPayload);
2683
2794
  case 15:
2684
- rawList = _context26.sent;
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 _context26.abrupt("return", this.buildBookingResponse(bookingResult));
2842
+ return _context29.abrupt("return", this.buildBookingResponse(bookingResult));
2732
2843
  case 23:
2733
- _context26.prev = 23;
2734
- _context26.t0 = _context26["catch"](3);
2735
- errorMessage = _context26.t0 instanceof Error ? _context26.t0.message : String(_context26.t0);
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 _context26.abrupt("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 _context26.stop();
2861
+ return _context29.stop();
2751
2862
  }
2752
- }, _callee26, this, [[3, 23]]);
2863
+ }, _callee29, this, [[3, 23]]);
2753
2864
  }));
2754
- function fetchBookingListFromAPI(_x27) {
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 _callee27(params) {
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 _callee27$(_context27) {
2766
- while (1) switch (_context27.prev = _context27.next) {
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
- _context27.next = 5;
2887
+ _context30.next = 5;
2777
2888
  break;
2778
2889
  }
2779
2890
  this.logError("".concat(title, ": app.request \u4E0D\u53EF\u7528"));
2780
- return _context27.abrupt("return", this.handlePendingSyncCheckoutOrder({
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
- _context27.prev = 5;
2788
- _context27.next = 8;
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 = _context27.sent;
2905
+ response = _context30.sent;
2795
2906
  fresh = this.extractOrderDataFromCheckoutResponse(response);
2796
2907
  if (!(fresh && this.order)) {
2797
- _context27.next = 17;
2908
+ _context30.next = 17;
2798
2909
  break;
2799
2910
  }
2800
2911
  syncedOrder = _objectSpread(_objectSpread({}, fresh), {}, {
2801
2912
  need_sync: 0
2802
2913
  });
2803
- _context27.next = 14;
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
- _context27.next = 18;
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 _context27.abrupt("return", this.normalizeCheckoutResponse(response));
2930
+ return _context30.abrupt("return", this.normalizeCheckoutResponse(response));
2820
2931
  case 21:
2821
- _context27.prev = 21;
2822
- _context27.t0 = _context27["catch"](5);
2823
- errorMessage = _context27.t0 instanceof Error ? _context27.t0.message : String(_context27.t0);
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(_context27.t0);
2939
+ backendError = this.extractBackendErrorResponse(_context30.t0);
2829
2940
  if (!backendError) {
2830
- _context27.next = 28;
2941
+ _context30.next = 28;
2831
2942
  break;
2832
2943
  }
2833
- return _context27.abrupt("return", backendError);
2944
+ return _context30.abrupt("return", backendError);
2834
2945
  case 28:
2835
- return _context27.abrupt("return", this.handlePendingSyncCheckoutOrder({
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 _context27.stop();
2954
+ return _context30.stop();
2844
2955
  }
2845
- }, _callee27, this, [[5, 21]]);
2956
+ }, _callee30, this, [[5, 21]]);
2846
2957
  }));
2847
- function handleOrderCheckoutSubmit(_x28) {
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 _callee28(params) {
2966
+ var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
2856
2967
  var backendPath, data, title, reason, pendingOrder, errorMessage;
2857
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2858
- while (1) switch (_context28.prev = _context28.next) {
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
- _context28.next = 5;
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 _context28.abrupt("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
- _context28.next = 8;
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 _context28.abrupt("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
- _context28.prev = 8;
2893
- _context28.next = 11;
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 _context28.abrupt("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
- _context28.prev = 15;
2911
- _context28.t0 = _context28["catch"](8);
2912
- errorMessage = _context28.t0 instanceof Error ? _context28.t0.message : String(_context28.t0);
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 _context28.abrupt("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 _context28.stop();
3037
+ return _context31.stop();
2927
3038
  }
2928
- }, _callee28, this, [[8, 15]]);
3039
+ }, _callee31, this, [[8, 15]]);
2929
3040
  }));
2930
- function handlePendingSyncCheckoutOrder(_x29) {
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 _callee29(orderIds) {
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 _callee29$(_context29) {
3006
- while (1) switch (_context29.prev = _context29.next) {
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
- _context29.next = 4;
3124
+ _context32.next = 4;
3014
3125
  break;
3015
3126
  }
3016
3127
  this.logError('handleUpdateLocalOrdersBatch: Order 模块未注册');
3017
- return _context29.abrupt("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
- _context29.next = 7;
3136
+ _context32.next = 7;
3026
3137
  break;
3027
3138
  }
3028
3139
  this.logError('handleUpdateLocalOrdersBatch: app.request 不可用');
3029
- return _context29.abrupt("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
- _context29.prev = 11;
3053
- _context29.next = 14;
3163
+ _context32.prev = 11;
3164
+ _context32.next = 14;
3054
3165
  return this.order.fetchOrdersByHttp(orderIds);
3055
3166
  case 14:
3056
- fetched = _context29.sent;
3057
- _context29.next = 22;
3167
+ fetched = _context32.sent;
3168
+ _context32.next = 22;
3058
3169
  break;
3059
3170
  case 17:
3060
- _context29.prev = 17;
3061
- _context29.t0 = _context29["catch"](11);
3062
- message = _context29.t0 instanceof Error ? _context29.t0.message : String(_context29.t0);
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 _context29.abrupt("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
- _context29.prev = 24;
3187
+ _context32.prev = 24;
3077
3188
  _iterator12.s();
3078
3189
  case 26:
3079
3190
  if ((_step12 = _iterator12.n()).done) {
3080
- _context29.next = 34;
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
- _context29.next = 31;
3197
+ _context32.next = 31;
3087
3198
  break;
3088
3199
  }
3089
- return _context29.abrupt("continue", 32);
3200
+ return _context32.abrupt("continue", 32);
3090
3201
  case 31:
3091
3202
  fetchedMap.set(String(oid), order);
3092
3203
  case 32:
3093
- _context29.next = 26;
3204
+ _context32.next = 26;
3094
3205
  break;
3095
3206
  case 34:
3096
- _context29.next = 39;
3207
+ _context32.next = 39;
3097
3208
  break;
3098
3209
  case 36:
3099
- _context29.prev = 36;
3100
- _context29.t1 = _context29["catch"](24);
3101
- _iterator12.e(_context29.t1);
3210
+ _context32.prev = 36;
3211
+ _context32.t1 = _context32["catch"](24);
3212
+ _iterator12.e(_context32.t1);
3102
3213
  case 39:
3103
- _context29.prev = 39;
3214
+ _context32.prev = 39;
3104
3215
  _iterator12.f();
3105
- return _context29.finish(39);
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
- _context29.next = 58;
3242
+ _context32.next = 58;
3132
3243
  break;
3133
3244
  }
3134
- _context29.prev = 48;
3135
- _context29.next = 51;
3245
+ _context32.prev = 48;
3246
+ _context32.next = 51;
3136
3247
  return this.order.upsertOrdersFromRemote(freshOrders);
3137
3248
  case 51:
3138
- _context29.next = 58;
3249
+ _context32.next = 58;
3139
3250
  break;
3140
3251
  case 53:
3141
- _context29.prev = 53;
3142
- _context29.t2 = _context29["catch"](48);
3143
- _message = _context29.t2 instanceof Error ? _context29.t2.message : String(_context29.t2);
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 _context29.abrupt("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 _context29.abrupt("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 _context29.stop();
3289
+ return _context32.stop();
3179
3290
  }
3180
- }, _callee29, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
3291
+ }, _callee32, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
3181
3292
  }));
3182
- function handleUpdateLocalOrdersBatch(_x30) {
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
- _this6 = this;
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 _this6.isExplicitBackendErrorResponse(candidate);
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 _callee30() {
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 _callee30$(_context30) {
3413
- while (1) switch (_context30.prev = _context30.next) {
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
- _context30.next = 2;
3527
+ _context33.next = 2;
3417
3528
  break;
3418
3529
  }
3419
- return _context30.abrupt("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 _context30.stop();
3560
+ return _context33.stop();
3450
3561
  }
3451
- }, _callee30, this);
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 _callee31(data) {
3592
+ var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(data) {
3482
3593
  var rawList, result;
3483
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
3484
- while (1) switch (_context31.prev = _context31.next) {
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
- _context31.next = 5;
3602
+ _context34.next = 5;
3492
3603
  break;
3493
3604
  }
3494
3605
  this.logError('computeOrderQueryResult: Order 模块未注册');
3495
- return _context31.abrupt("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 _context31.abrupt("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 _context31.stop();
3638
+ return _context34.stop();
3528
3639
  }
3529
- }, _callee31, this);
3640
+ }, _callee34, this);
3530
3641
  }));
3531
- function computeOrderQueryResult(_x31) {
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 _callee32(data) {
3655
+ var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(data) {
3545
3656
  var rawOrders, result;
3546
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
3547
- while (1) switch (_context32.prev = _context32.next) {
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
- _context32.next = 3;
3661
+ _context35.next = 3;
3551
3662
  break;
3552
3663
  }
3553
3664
  this.logError('computeBookingQueryResult: Order 模块未注册');
3554
- return _context32.abrupt("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 _context32.abrupt("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 _context32.stop();
3692
+ return _context35.stop();
3582
3693
  }
3583
- }, _callee32, this);
3694
+ }, _callee35, this);
3584
3695
  }));
3585
- function computeBookingQueryResult(_x32) {
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 _callee33(context, options) {
3712
+ var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(context, options) {
3602
3713
  var _menu_list_ids$length3,
3603
- _this7 = this;
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 _callee33$(_context33) {
3606
- while (1) switch (_context33.prev = _context33.next) {
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
- _context33.next = 7;
3736
+ _context36.next = 7;
3626
3737
  break;
3627
3738
  }
3628
3739
  this.logError('computeProductQueryResult: Products 模块未注册');
3629
- return _context33.abrupt("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
- _context33.next = 18;
3749
+ _context36.next = 18;
3639
3750
  break;
3640
3751
  }
3641
3752
  uniqueIds = Array.from(new Set(queryIds));
3642
3753
  _tPrice = performance.now();
3643
- _context33.next = 12;
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 = _context33.sent;
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 _context33.abrupt("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
- _context33.next = 30;
3794
+ _context36.next = 30;
3684
3795
  break;
3685
3796
  }
3686
3797
  pid = Number(product_id);
3687
3798
  _tPrice2 = performance.now();
3688
- _context33.next = 23;
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 = _context33.sent;
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 _context33.abrupt("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
- _context33.next = 33;
3834
+ _context36.next = 33;
3724
3835
  break;
3725
3836
  }
3726
3837
  this.logError('computeProductQueryResult: Menu 模块未注册');
3727
- return _context33.abrupt("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
- _context33.next = 36;
3847
+ _context36.next = 36;
3737
3848
  break;
3738
3849
  }
3739
3850
  this.logError('computeProductQueryResult: Schedule 模块未注册');
3740
- return _context33.abrupt("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 _this7$schedule;
3754
- return ((_this7$schedule = _this7.schedule) === null || _this7$schedule === void 0 ? void 0 : _this7$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
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
- _context33.next = 49;
3882
+ _context36.next = 49;
3772
3883
  break;
3773
3884
  }
3774
- _context33.next = 46;
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
- _context33.t0 = _context33.sent;
3785
- _context33.next = 50;
3895
+ _context36.t0 = _context36.sent;
3896
+ _context36.next = 50;
3786
3897
  break;
3787
3898
  case 49:
3788
- _context33.t0 = [];
3899
+ _context36.t0 = [];
3789
3900
  case 50:
3790
- filteredProducts = _context33.t0;
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 _context33.abrupt("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 _context33.stop();
3945
+ return _context36.stop();
3835
3946
  }
3836
- }, _callee33, this);
3947
+ }, _callee36, this);
3837
3948
  }));
3838
- function computeProductQueryResult(_x33, _x34) {
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 _callee34(options) {
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 _callee34$(_context34) {
3856
- while (1) switch (_context34.prev = _context34.next) {
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
- _context34.next = 2;
3970
+ _context37.next = 2;
3860
3971
  break;
3861
3972
  }
3862
- return _context34.abrupt("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
- _context34.prev = 4;
3980
+ _context37.prev = 4;
3870
3981
  _iterator16.s();
3871
3982
  case 6:
3872
3983
  if ((_step16 = _iterator16.n()).done) {
3873
- _context34.next = 22;
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
- _context34.prev = 8;
3878
- _context34.next = 11;
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 = _context34.sent;
3994
+ result = _context37.sent;
3884
3995
  subscriber.callback(result);
3885
3996
  this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
3886
3997
  subscriberId: subscriberId
3887
3998
  });
3888
- _context34.next = 20;
3999
+ _context37.next = 20;
3889
4000
  break;
3890
4001
  case 16:
3891
- _context34.prev = 16;
3892
- _context34.t0 = _context34["catch"](8);
3893
- errorMessage = _context34.t0 instanceof Error ? _context34.t0.message : String(_context34.t0);
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
- _context34.next = 6;
4010
+ _context37.next = 6;
3900
4011
  break;
3901
4012
  case 22:
3902
- _context34.next = 27;
4013
+ _context37.next = 27;
3903
4014
  break;
3904
4015
  case 24:
3905
- _context34.prev = 24;
3906
- _context34.t1 = _context34["catch"](4);
3907
- _iterator16.e(_context34.t1);
4016
+ _context37.prev = 24;
4017
+ _context37.t1 = _context37["catch"](4);
4018
+ _iterator16.e(_context37.t1);
3908
4019
  case 27:
3909
- _context34.prev = 27;
4020
+ _context37.prev = 27;
3910
4021
  _iterator16.f();
3911
- return _context34.finish(27);
4022
+ return _context37.finish(27);
3912
4023
  case 30:
3913
4024
  case "end":
3914
- return _context34.stop();
4025
+ return _context37.stop();
3915
4026
  }
3916
- }, _callee34, this, [[4, 24, 27, 30], [8, 16]]);
4027
+ }, _callee37, this, [[4, 24, 27, 30], [8, 16]]);
3917
4028
  }));
3918
- function recomputeAndNotifyProductQuery(_x35) {
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 _callee35() {
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 _callee35$(_context35) {
3933
- while (1) switch (_context35.prev = _context35.next) {
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
- _context35.next = 2;
4047
+ _context38.next = 2;
3937
4048
  break;
3938
4049
  }
3939
- return _context35.abrupt("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
- _context35.prev = 5;
4058
+ _context38.prev = 5;
3948
4059
  _iterator17.s();
3949
4060
  case 7:
3950
4061
  if ((_step17 = _iterator17.n()).done) {
3951
- _context35.next = 27;
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
- _context35.prev = 9;
4066
+ _context38.prev = 9;
3956
4067
  computeStartAt = Date.now();
3957
- _context35.next = 13;
4068
+ _context38.next = 13;
3958
4069
  return this.computeOrderQueryResult(subscriber.context);
3959
4070
  case 13:
3960
- result = _context35.sent;
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
- _context35.next = 25;
4082
+ _context38.next = 25;
3972
4083
  break;
3973
4084
  case 21:
3974
- _context35.prev = 21;
3975
- _context35.t0 = _context35["catch"](9);
3976
- errorMessage = _context35.t0 instanceof Error ? _context35.t0.message : String(_context35.t0);
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
- _context35.next = 7;
4093
+ _context38.next = 7;
3983
4094
  break;
3984
4095
  case 27:
3985
- _context35.next = 32;
4096
+ _context38.next = 32;
3986
4097
  break;
3987
4098
  case 29:
3988
- _context35.prev = 29;
3989
- _context35.t1 = _context35["catch"](5);
3990
- _iterator17.e(_context35.t1);
4099
+ _context38.prev = 29;
4100
+ _context38.t1 = _context38["catch"](5);
4101
+ _iterator17.e(_context38.t1);
3991
4102
  case 32:
3992
- _context35.prev = 32;
4103
+ _context38.prev = 32;
3993
4104
  _iterator17.f();
3994
- return _context35.finish(32);
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 _context35.stop();
4114
+ return _context38.stop();
4004
4115
  }
4005
- }, _callee35, this, [[5, 29, 32, 35], [9, 21]]);
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 _callee36() {
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 _callee36$(_context36) {
4022
- while (1) switch (_context36.prev = _context36.next) {
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
- _context36.next = 2;
4136
+ _context39.next = 2;
4026
4137
  break;
4027
4138
  }
4028
- return _context36.abrupt("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
- _context36.prev = 4;
4145
+ _context39.prev = 4;
4035
4146
  _iterator18.s();
4036
4147
  case 6:
4037
4148
  if ((_step18 = _iterator18.n()).done) {
4038
- _context36.next = 22;
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
- _context36.prev = 8;
4043
- _context36.next = 11;
4153
+ _context39.prev = 8;
4154
+ _context39.next = 11;
4044
4155
  return this.computeBookingQueryResult(subscriber.context);
4045
4156
  case 11:
4046
- result = _context36.sent;
4157
+ result = _context39.sent;
4047
4158
  subscriber.callback(result);
4048
4159
  this.logInfo('recomputeAndNotifyBookingQuery: 已推送', {
4049
4160
  subscriberId: subscriberId
4050
4161
  });
4051
- _context36.next = 20;
4162
+ _context39.next = 20;
4052
4163
  break;
4053
4164
  case 16:
4054
- _context36.prev = 16;
4055
- _context36.t0 = _context36["catch"](8);
4056
- errorMessage = _context36.t0 instanceof Error ? _context36.t0.message : String(_context36.t0);
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
- _context36.next = 6;
4173
+ _context39.next = 6;
4063
4174
  break;
4064
4175
  case 22:
4065
- _context36.next = 27;
4176
+ _context39.next = 27;
4066
4177
  break;
4067
4178
  case 24:
4068
- _context36.prev = 24;
4069
- _context36.t1 = _context36["catch"](4);
4070
- _iterator18.e(_context36.t1);
4179
+ _context39.prev = 24;
4180
+ _context39.t1 = _context39["catch"](4);
4181
+ _iterator18.e(_context39.t1);
4071
4182
  case 27:
4072
- _context36.prev = 27;
4183
+ _context39.prev = 27;
4073
4184
  _iterator18.f();
4074
- return _context36.finish(27);
4185
+ return _context39.finish(27);
4075
4186
  case 30:
4076
4187
  case "end":
4077
- return _context36.stop();
4188
+ return _context39.stop();
4078
4189
  }
4079
- }, _callee36, this, [[4, 24, 27, 30], [8, 16]]);
4190
+ }, _callee39, this, [[4, 24, 27, 30], [8, 16]]);
4080
4191
  }));
4081
4192
  function recomputeAndNotifyBookingQuery() {
4082
4193
  return _recomputeAndNotifyBookingQuery.apply(this, arguments);