@pisell/pisellos 2.2.131 → 2.2.132

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.
@@ -213,23 +213,66 @@ var Server = /*#__PURE__*/function () {
213
213
  };
214
214
  }());
215
215
  /**
216
- * 取消商品查询订阅(HTTP 路由入口)
216
+ * 按商品 id 查询单条(GET /shop/product/query/:productId)
217
+ * schedule_date 必填:query 或 data;schedule_datetime 可选。不走订阅。
217
218
  */
218
- _defineProperty(this, "handleUnsubscribeProductQuery", /*#__PURE__*/function () {
219
+ _defineProperty(this, "handleProductQueryById", /*#__PURE__*/function () {
219
220
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref4) {
220
- var data, _ref6, subscriberId;
221
+ var path, method, data, url, pathname, idMatch, productId, scheduleDateFromData, schedule_date, scheduleDtFromData, scheduleDtFromUrl, scheduleDatetime;
221
222
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
222
223
  while (1) switch (_context2.prev = _context2.next) {
223
224
  case 0:
224
- data = _ref4.data;
225
- _ref6 = data || {}, subscriberId = _ref6.subscriberId;
226
- _this.removeProductQuerySubscriber(subscriberId);
225
+ path = _ref4.path, method = _ref4.method, data = _ref4.data, url = _ref4.url;
226
+ pathname = _this.parseRequestPath(url || '', path);
227
+ idMatch = pathname.match(/^\/shop\/product\/query\/(\d+)$/);
228
+ productId = idMatch ? Number(idMatch[1]) : NaN;
229
+ console.log('[Server] handleProductQueryById:', pathname, method, data);
230
+ if (Number.isFinite(productId)) {
231
+ _context2.next = 8;
232
+ break;
233
+ }
234
+ _this.logWarning('handleProductQueryById: 无效的商品 id', {
235
+ path: pathname
236
+ });
227
237
  return _context2.abrupt("return", {
228
- code: 200,
229
- message: 'ok',
230
- status: true
238
+ code: 400,
239
+ message: '无效的商品路径',
240
+ status: false,
241
+ data: {
242
+ item: null
243
+ }
231
244
  });
232
- case 4:
245
+ case 8:
246
+ scheduleDateFromData = data && _typeof(data) === 'object' && typeof data.schedule_date === 'string' ? data.schedule_date.trim() : '';
247
+ schedule_date = scheduleDateFromData || (_this.extractQueryParam(url || '', 'schedule_date') || '').trim() || dayjs().format('YYYY-MM-DD');
248
+ if (schedule_date) {
249
+ _context2.next = 13;
250
+ break;
251
+ }
252
+ _this.logWarning('handleProductQueryById: 缺少 schedule_date', {
253
+ productId: productId
254
+ });
255
+ return _context2.abrupt("return", {
256
+ code: 400,
257
+ message: 'schedule_date 为必填(query 或 data)',
258
+ status: false,
259
+ data: null
260
+ });
261
+ case 13:
262
+ scheduleDtFromData = data && _typeof(data) === 'object' && typeof data.schedule_datetime === 'string' ? data.schedule_datetime.trim() : '';
263
+ scheduleDtFromUrl = (_this.extractQueryParam(url || '', 'schedule_datetime') || '').trim();
264
+ scheduleDatetime = scheduleDtFromData || scheduleDtFromUrl || "".concat(schedule_date, "T00:00:00");
265
+ _this.logInfo('handleProductQueryById: 开始', {
266
+ productId: productId,
267
+ schedule_date: schedule_date,
268
+ schedule_datetime: scheduleDatetime
269
+ });
270
+ return _context2.abrupt("return", _this.computeProductQueryResult({
271
+ schedule_date: schedule_date,
272
+ schedule_datetime: scheduleDatetime,
273
+ product_id: productId
274
+ }));
275
+ case 18:
233
276
  case "end":
234
277
  return _context2.stop();
235
278
  }
@@ -239,27 +282,54 @@ var Server = /*#__PURE__*/function () {
239
282
  return _ref5.apply(this, arguments);
240
283
  };
241
284
  }());
285
+ /**
286
+ * 取消商品查询订阅(HTTP 路由入口)
287
+ */
288
+ _defineProperty(this, "handleUnsubscribeProductQuery", /*#__PURE__*/function () {
289
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref6) {
290
+ var data, _ref8, subscriberId;
291
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
292
+ while (1) switch (_context3.prev = _context3.next) {
293
+ case 0:
294
+ data = _ref6.data;
295
+ _ref8 = data || {}, subscriberId = _ref8.subscriberId;
296
+ _this.removeProductQuerySubscriber(subscriberId);
297
+ return _context3.abrupt("return", {
298
+ code: 200,
299
+ message: 'ok',
300
+ status: true
301
+ });
302
+ case 4:
303
+ case "end":
304
+ return _context3.stop();
305
+ }
306
+ }, _callee3);
307
+ }));
308
+ return function (_x3) {
309
+ return _ref7.apply(this, arguments);
310
+ };
311
+ }());
242
312
  /**
243
313
  * 处理订单列表查询
244
314
  * 存储订阅者信息,本地计算结果;数据变更时通过 callback 推送
245
315
  */
246
316
  _defineProperty(this, "handleOrderList", /*#__PURE__*/function () {
247
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref7) {
248
- var url, method, data, config, queryPayload, _ref9, callback, subscriberId, useLocal;
249
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
250
- while (1) switch (_context3.prev = _context3.next) {
317
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref9) {
318
+ var url, method, data, config, queryPayload, _ref11, callback, subscriberId, useLocal;
319
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
320
+ while (1) switch (_context4.prev = _context4.next) {
251
321
  case 0:
252
- url = _ref7.url, method = _ref7.method, data = _ref7.data, config = _ref7.config;
322
+ url = _ref9.url, method = _ref9.method, data = _ref9.data, config = _ref9.config;
253
323
  console.log('[Server] handleOrderList:', url, method, data, config);
254
324
  queryPayload = data && _typeof(data) === 'object' ? _objectSpread({}, data) : {};
255
- _ref9 = config || {}, callback = _ref9.callback, subscriberId = _ref9.subscriberId;
325
+ _ref11 = config || {}, callback = _ref11.callback, subscriberId = _ref11.subscriberId;
256
326
  useLocal = _this.shouldUseLocalOrderQuery(queryPayload);
257
327
  _this.logInfo('handleOrderList: 开始处理订单列表请求', {
258
328
  data: queryPayload,
259
329
  useLocal: useLocal
260
330
  });
261
331
  if (!useLocal) {
262
- _context3.next = 9;
332
+ _context4.next = 9;
263
333
  break;
264
334
  }
265
335
  if (subscriberId && typeof callback === 'function') {
@@ -272,7 +342,7 @@ var Server = /*#__PURE__*/function () {
272
342
  totalSubscribers: _this.orderQuerySubscribers.size
273
343
  });
274
344
  }
275
- return _context3.abrupt("return", _this.computeOrderQueryResult(queryPayload));
345
+ return _context4.abrupt("return", _this.computeOrderQueryResult(queryPayload));
276
346
  case 9:
277
347
  if (subscriberId) {
278
348
  _this.orderQuerySubscribers.delete(subscriberId);
@@ -281,28 +351,28 @@ var Server = /*#__PURE__*/function () {
281
351
  remaining: _this.orderQuerySubscribers.size
282
352
  });
283
353
  }
284
- return _context3.abrupt("return", _this.fetchOrderListFromAPI(queryPayload));
354
+ return _context4.abrupt("return", _this.fetchOrderListFromAPI(queryPayload));
285
355
  case 11:
286
356
  case "end":
287
- return _context3.stop();
357
+ return _context4.stop();
288
358
  }
289
- }, _callee3);
359
+ }, _callee4);
290
360
  }));
291
- return function (_x3) {
292
- return _ref8.apply(this, arguments);
361
+ return function (_x4) {
362
+ return _ref10.apply(this, arguments);
293
363
  };
294
364
  }());
295
365
  /**
296
366
  * 取消订单列表查询订阅(HTTP 路由入口)
297
367
  */
298
368
  _defineProperty(this, "handleUnsubscribeOrderQuery", /*#__PURE__*/function () {
299
- var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref10) {
300
- var data, _ref12, subscriberId;
301
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
302
- while (1) switch (_context4.prev = _context4.next) {
369
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref12) {
370
+ var data, _ref14, subscriberId;
371
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
372
+ while (1) switch (_context5.prev = _context5.next) {
303
373
  case 0:
304
- data = _ref10.data;
305
- _ref12 = data || {}, subscriberId = _ref12.subscriberId;
374
+ data = _ref12.data;
375
+ _ref14 = data || {}, subscriberId = _ref14.subscriberId;
306
376
  if (subscriberId) {
307
377
  _this.orderQuerySubscribers.delete(subscriberId);
308
378
  _this.logInfo('handleUnsubscribeOrderQuery: 已移除订阅者', {
@@ -310,19 +380,19 @@ var Server = /*#__PURE__*/function () {
310
380
  remaining: _this.orderQuerySubscribers.size
311
381
  });
312
382
  }
313
- return _context4.abrupt("return", {
383
+ return _context5.abrupt("return", {
314
384
  code: 200,
315
385
  message: 'ok',
316
386
  status: true
317
387
  });
318
388
  case 4:
319
389
  case "end":
320
- return _context4.stop();
390
+ return _context5.stop();
321
391
  }
322
- }, _callee4);
392
+ }, _callee5);
323
393
  }));
324
- return function (_x4) {
325
- return _ref11.apply(this, arguments);
394
+ return function (_x5) {
395
+ return _ref13.apply(this, arguments);
326
396
  };
327
397
  }());
328
398
  /**
@@ -335,22 +405,22 @@ var Server = /*#__PURE__*/function () {
335
405
  * 今天:注册订阅者 + 本地数据筛选;非今天:清理订阅者 + 走真实 API
336
406
  */
337
407
  _defineProperty(this, "handleBookingList", /*#__PURE__*/function () {
338
- var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref13) {
339
- var url, method, data, config, queryPayload, _ref15, callback, subscriberId, useLocal, withFields, requestPayload, cacheKey;
340
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
341
- while (1) switch (_context5.prev = _context5.next) {
408
+ var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref15) {
409
+ var url, method, data, config, queryPayload, _ref17, callback, subscriberId, useLocal, withFields, requestPayload, cacheKey;
410
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
411
+ while (1) switch (_context6.prev = _context6.next) {
342
412
  case 0:
343
- url = _ref13.url, method = _ref13.method, data = _ref13.data, config = _ref13.config;
413
+ url = _ref15.url, method = _ref15.method, data = _ref15.data, config = _ref15.config;
344
414
  console.log('[Server] handleBookingList:', url, method, data, config);
345
415
  queryPayload = data && _typeof(data) === 'object' ? _objectSpread({}, data) : {};
346
- _ref15 = config || {}, callback = _ref15.callback, subscriberId = _ref15.subscriberId;
416
+ _ref17 = config || {}, callback = _ref17.callback, subscriberId = _ref17.subscriberId;
347
417
  useLocal = _this.shouldUseLocalBookingQuery(queryPayload);
348
418
  _this.logInfo('handleBookingList: 开始处理预约列表请求', {
349
419
  data: queryPayload,
350
420
  useLocal: useLocal
351
421
  });
352
422
  if (!useLocal) {
353
- _context5.next = 12;
423
+ _context6.next = 12;
354
424
  break;
355
425
  }
356
426
  if (subscriberId) {
@@ -366,7 +436,7 @@ var Server = /*#__PURE__*/function () {
366
436
  totalSubscribers: _this.bookingQuerySubscribers.size
367
437
  });
368
438
  }
369
- return _context5.abrupt("return", _this.computeBookingQueryResult(queryPayload));
439
+ return _context6.abrupt("return", _this.computeBookingQueryResult(queryPayload));
370
440
  case 12:
371
441
  if (subscriberId) {
372
442
  _this.bookingQuerySubscribers.delete(subscriberId);
@@ -392,15 +462,15 @@ var Server = /*#__PURE__*/function () {
392
462
  remaining: _this.bookingQuerySubscribers.size
393
463
  });
394
464
  }
395
- return _context5.abrupt("return", _this.fetchBookingListFromAPI(queryPayload));
465
+ return _context6.abrupt("return", _this.fetchBookingListFromAPI(queryPayload));
396
466
  case 16:
397
467
  case "end":
398
- return _context5.stop();
468
+ return _context6.stop();
399
469
  }
400
- }, _callee5);
470
+ }, _callee6);
401
471
  }));
402
- return function (_x5) {
403
- return _ref14.apply(this, arguments);
472
+ return function (_x6) {
473
+ return _ref16.apply(this, arguments);
404
474
  };
405
475
  }());
406
476
  /**
@@ -408,13 +478,13 @@ var Server = /*#__PURE__*/function () {
408
478
  * 转发到资源模块去
409
479
  */
410
480
  _defineProperty(this, "handleResourceList", /*#__PURE__*/function () {
411
- var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref16) {
481
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref18) {
412
482
  var _this$resource;
413
483
  var url, method, data, config, list;
414
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
415
- while (1) switch (_context6.prev = _context6.next) {
484
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
485
+ while (1) switch (_context7.prev = _context7.next) {
416
486
  case 0:
417
- url = _ref16.url, method = _ref16.method, data = _ref16.data, config = _ref16.config;
487
+ url = _ref18.url, method = _ref18.method, data = _ref18.data, config = _ref18.config;
418
488
  console.log('[Server] handleResourceList:', url, method, data, config);
419
489
  list = (_this$resource = _this.resource) === null || _this$resource === void 0 ? void 0 : _this$resource.getResources({
420
490
  skip: (data === null || data === void 0 ? void 0 : data.skip) || 1,
@@ -423,7 +493,7 @@ var Server = /*#__PURE__*/function () {
423
493
  _this.logInfo('Server 劫持 Resource 接口:handleResourceList: 资源列表查询结果', {
424
494
  list: list
425
495
  });
426
- return _context6.abrupt("return", {
496
+ return _context7.abrupt("return", {
427
497
  code: 200,
428
498
  data: {
429
499
  list: list,
@@ -434,12 +504,12 @@ var Server = /*#__PURE__*/function () {
434
504
  });
435
505
  case 5:
436
506
  case "end":
437
- return _context6.stop();
507
+ return _context7.stop();
438
508
  }
439
- }, _callee6);
509
+ }, _callee7);
440
510
  }));
441
- return function (_x6) {
442
- return _ref17.apply(this, arguments);
511
+ return function (_x7) {
512
+ return _ref19.apply(this, arguments);
443
513
  };
444
514
  }());
445
515
  /**
@@ -449,28 +519,28 @@ var Server = /*#__PURE__*/function () {
449
519
  * - 监听级联:onOrdersChanged 触发订单/预约/bookingRemoteCache 三路订阅者推送
450
520
  */
451
521
  _defineProperty(this, "handleUpdateLocalOrder", /*#__PURE__*/function () {
452
- var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref18) {
453
- var _ref20, _this$app;
522
+ var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref20) {
523
+ var _ref22, _this$app;
454
524
  var url, data, rawOrderId, orderId, backendPath, _response$data, response, fresh, exists, _yield$_this$order$ov, overwritten, errorMessage;
455
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
456
- while (1) switch (_context7.prev = _context7.next) {
525
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
526
+ while (1) switch (_context8.prev = _context8.next) {
457
527
  case 0:
458
- url = _ref18.url, data = _ref18.data;
459
- rawOrderId = (_ref20 = data && _typeof(data) === 'object' ? data.order_id : undefined) !== null && _ref20 !== void 0 ? _ref20 : _this.extractQueryParam(url, 'order_id');
528
+ url = _ref20.url, data = _ref20.data;
529
+ rawOrderId = (_ref22 = data && _typeof(data) === 'object' ? data.order_id : undefined) !== null && _ref22 !== void 0 ? _ref22 : _this.extractQueryParam(url, 'order_id');
460
530
  orderId = rawOrderId === undefined || rawOrderId === null || rawOrderId === '' ? null : String(rawOrderId).trim();
461
531
  _this.logInfo('handleUpdateLocalOrder: 开始处理', {
462
532
  url: url,
463
533
  orderId: orderId
464
534
  });
465
535
  if (orderId) {
466
- _context7.next = 7;
536
+ _context8.next = 7;
467
537
  break;
468
538
  }
469
539
  _this.logWarning('handleUpdateLocalOrder: order_id 缺失', {
470
540
  url: url,
471
541
  data: data
472
542
  });
473
- return _context7.abrupt("return", {
543
+ return _context8.abrupt("return", {
474
544
  code: 400,
475
545
  status: false,
476
546
  message: 'order_id 缺失',
@@ -478,11 +548,11 @@ var Server = /*#__PURE__*/function () {
478
548
  });
479
549
  case 7:
480
550
  if (_this.order) {
481
- _context7.next = 10;
551
+ _context8.next = 10;
482
552
  break;
483
553
  }
484
554
  _this.logError('handleUpdateLocalOrder: Order 模块未注册');
485
- return _context7.abrupt("return", {
555
+ return _context8.abrupt("return", {
486
556
  code: 500,
487
557
  status: false,
488
558
  message: 'Order 模块未注册',
@@ -490,11 +560,11 @@ var Server = /*#__PURE__*/function () {
490
560
  });
491
561
  case 10:
492
562
  if ((_this$app = _this.app) !== null && _this$app !== void 0 && _this$app.request) {
493
- _context7.next = 13;
563
+ _context8.next = 13;
494
564
  break;
495
565
  }
496
566
  _this.logError('handleUpdateLocalOrder: app.request 不可用');
497
- return _context7.abrupt("return", {
567
+ return _context8.abrupt("return", {
498
568
  code: 500,
499
569
  status: false,
500
570
  message: 'app.request 不可用',
@@ -502,23 +572,23 @@ var Server = /*#__PURE__*/function () {
502
572
  });
503
573
  case 13:
504
574
  backendPath = "/shop/order/sales/".concat(encodeURIComponent(orderId), "?with%5B%5D=all");
505
- _context7.prev = 14;
506
- _context7.next = 17;
575
+ _context8.prev = 14;
576
+ _context8.next = 17;
507
577
  return _this.app.request.get(backendPath, undefined, {
508
578
  isShopApi: true
509
579
  });
510
580
  case 17:
511
- response = _context7.sent;
581
+ response = _context8.sent;
512
582
  fresh = (_response$data = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data !== void 0 ? _response$data : response;
513
583
  if (!(!fresh || _typeof(fresh) !== 'object' || fresh.order_id == null)) {
514
- _context7.next = 22;
584
+ _context8.next = 22;
515
585
  break;
516
586
  }
517
587
  _this.logError('handleUpdateLocalOrder: 后端返回订单为空', {
518
588
  orderId: orderId,
519
589
  backendPath: backendPath
520
590
  });
521
- return _context7.abrupt("return", {
591
+ return _context8.abrupt("return", {
522
592
  code: 500,
523
593
  status: false,
524
594
  message: '后端返回订单为空',
@@ -527,19 +597,19 @@ var Server = /*#__PURE__*/function () {
527
597
  case 22:
528
598
  exists = !!_this.order.getOrderByOrderId(orderId);
529
599
  if (!exists) {
530
- _context7.next = 30;
600
+ _context8.next = 30;
531
601
  break;
532
602
  }
533
- _context7.next = 26;
603
+ _context8.next = 26;
534
604
  return _this.order.overwriteExistingOrder(fresh);
535
605
  case 26:
536
- _yield$_this$order$ov = _context7.sent;
606
+ _yield$_this$order$ov = _context8.sent;
537
607
  overwritten = _yield$_this$order$ov.overwritten;
538
608
  _this.logInfo('handleUpdateLocalOrder: 覆盖完成', {
539
609
  orderId: orderId,
540
610
  overwritten: overwritten
541
611
  });
542
- return _context7.abrupt("return", {
612
+ return _context8.abrupt("return", {
543
613
  code: 200,
544
614
  status: true,
545
615
  message: '',
@@ -550,13 +620,13 @@ var Server = /*#__PURE__*/function () {
550
620
  }
551
621
  });
552
622
  case 30:
553
- _context7.next = 32;
623
+ _context8.next = 32;
554
624
  return _this.order.upsertOrdersFromRemote([fresh]);
555
625
  case 32:
556
626
  _this.logInfo('handleUpdateLocalOrder: 本地合并新订单完成', {
557
627
  orderId: orderId
558
628
  });
559
- return _context7.abrupt("return", {
629
+ return _context8.abrupt("return", {
560
630
  code: 200,
561
631
  status: true,
562
632
  message: '',
@@ -567,15 +637,15 @@ var Server = /*#__PURE__*/function () {
567
637
  }
568
638
  });
569
639
  case 36:
570
- _context7.prev = 36;
571
- _context7.t0 = _context7["catch"](14);
572
- errorMessage = _context7.t0 instanceof Error ? _context7.t0.message : String(_context7.t0);
640
+ _context8.prev = 36;
641
+ _context8.t0 = _context8["catch"](14);
642
+ errorMessage = _context8.t0 instanceof Error ? _context8.t0.message : String(_context8.t0);
573
643
  _this.logError('handleUpdateLocalOrder: 请求失败', {
574
644
  orderId: orderId,
575
645
  backendPath: backendPath,
576
646
  error: errorMessage
577
647
  });
578
- return _context7.abrupt("return", {
648
+ return _context8.abrupt("return", {
579
649
  code: 500,
580
650
  status: false,
581
651
  message: errorMessage,
@@ -583,28 +653,28 @@ var Server = /*#__PURE__*/function () {
583
653
  });
584
654
  case 41:
585
655
  case "end":
586
- return _context7.stop();
656
+ return _context8.stop();
587
657
  }
588
- }, _callee7, null, [[14, 36]]);
658
+ }, _callee8, null, [[14, 36]]);
589
659
  }));
590
- return function (_x7) {
591
- return _ref19.apply(this, arguments);
660
+ return function (_x8) {
661
+ return _ref21.apply(this, arguments);
592
662
  };
593
663
  }());
594
664
  /**
595
665
  * GET /shop/schedule/floor-plan* 前缀路由:读本地 store;支持 subscriberId + callback 订阅更新
596
666
  */
597
667
  _defineProperty(this, "handleFloorPlanGet", /*#__PURE__*/function () {
598
- var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref21) {
599
- var url, data, config, routePath, base, path, _subscriberId, _ref23, callback, subscriberId, ctx;
600
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
601
- while (1) switch (_context8.prev = _context8.next) {
668
+ var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref23) {
669
+ var url, data, config, routePath, base, path, _subscriberId, _ref25, callback, subscriberId, ctx;
670
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
671
+ while (1) switch (_context9.prev = _context9.next) {
602
672
  case 0:
603
- url = _ref21.url, data = _ref21.data, config = _ref21.config, routePath = _ref21.path;
673
+ url = _ref23.url, data = _ref23.data, config = _ref23.config, routePath = _ref23.path;
604
674
  base = '/shop/schedule/floor-plan';
605
675
  path = _this.parseRequestPath(url, routePath);
606
676
  if (!(path === "".concat(base, "/unsubscribe"))) {
607
- _context8.next = 7;
677
+ _context9.next = 7;
608
678
  break;
609
679
  }
610
680
  _subscriberId = data === null || data === void 0 ? void 0 : data.subscriberId;
@@ -615,19 +685,19 @@ var Server = /*#__PURE__*/function () {
615
685
  remaining: _this.floorPlanQuerySubscribers.size
616
686
  });
617
687
  }
618
- return _context8.abrupt("return", {
688
+ return _context9.abrupt("return", {
619
689
  code: 200,
620
690
  message: 'ok',
621
691
  status: true
622
692
  });
623
693
  case 7:
624
- _ref23 = config || {}, callback = _ref23.callback, subscriberId = _ref23.subscriberId;
694
+ _ref25 = config || {}, callback = _ref25.callback, subscriberId = _ref25.subscriberId;
625
695
  ctx = _this.resolveFloorPlanQueryContext(path, base);
626
696
  if (ctx) {
627
- _context8.next = 11;
697
+ _context9.next = 11;
628
698
  break;
629
699
  }
630
- return _context8.abrupt("return", {
700
+ return _context9.abrupt("return", {
631
701
  status: false,
632
702
  code: 404,
633
703
  message: 'Not Found',
@@ -645,28 +715,28 @@ var Server = /*#__PURE__*/function () {
645
715
  total: _this.floorPlanQuerySubscribers.size
646
716
  });
647
717
  }
648
- return _context8.abrupt("return", _this.computeFloorPlanQueryResult(ctx));
718
+ return _context9.abrupt("return", _this.computeFloorPlanQueryResult(ctx));
649
719
  case 13:
650
720
  case "end":
651
- return _context8.stop();
721
+ return _context9.stop();
652
722
  }
653
- }, _callee8);
723
+ }, _callee9);
654
724
  }));
655
- return function (_x8) {
656
- return _ref22.apply(this, arguments);
725
+ return function (_x9) {
726
+ return _ref24.apply(this, arguments);
657
727
  };
658
728
  }());
659
729
  /**
660
730
  * 取消预约列表查询订阅(HTTP 路由入口)
661
731
  */
662
732
  _defineProperty(this, "handleUnsubscribeBookingQuery", /*#__PURE__*/function () {
663
- var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref24) {
664
- var data, _ref26, subscriberId;
665
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
666
- while (1) switch (_context9.prev = _context9.next) {
733
+ var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref26) {
734
+ var data, _ref28, subscriberId;
735
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
736
+ while (1) switch (_context10.prev = _context10.next) {
667
737
  case 0:
668
- data = _ref24.data;
669
- _ref26 = data || {}, subscriberId = _ref26.subscriberId;
738
+ data = _ref26.data;
739
+ _ref28 = data || {}, subscriberId = _ref28.subscriberId;
670
740
  if (subscriberId) {
671
741
  _this.bookingQuerySubscribers.delete(subscriberId);
672
742
  _this.bookingRemoteQuerySubscribers.delete(subscriberId);
@@ -676,19 +746,19 @@ var Server = /*#__PURE__*/function () {
676
746
  remainingRemote: _this.bookingRemoteQuerySubscribers.size
677
747
  });
678
748
  }
679
- return _context9.abrupt("return", {
749
+ return _context10.abrupt("return", {
680
750
  code: 200,
681
751
  message: 'ok',
682
752
  status: true
683
753
  });
684
754
  case 4:
685
755
  case "end":
686
- return _context9.stop();
756
+ return _context10.stop();
687
757
  }
688
- }, _callee9);
758
+ }, _callee10);
689
759
  }));
690
- return function (_x9) {
691
- return _ref25.apply(this, arguments);
760
+ return function (_x10) {
761
+ return _ref27.apply(this, arguments);
692
762
  };
693
763
  }());
694
764
  /**
@@ -696,13 +766,13 @@ var Server = /*#__PURE__*/function () {
696
766
  * 通过餐牌ID列表获取所有相关日程的时间段点
697
767
  */
698
768
  _defineProperty(this, "handleGetScheduleTimePoints", /*#__PURE__*/function () {
699
- var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref27) {
769
+ var _ref30 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref29) {
700
770
  var _menu_list_ids$length;
701
771
  var url, method, data, config, menu_list_ids, _menu_list_ids$length2, menuList, scheduleIds, scheduleList, timePoints, errorMessage;
702
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
703
- while (1) switch (_context10.prev = _context10.next) {
772
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
773
+ while (1) switch (_context11.prev = _context11.next) {
704
774
  case 0:
705
- url = _ref27.url, method = _ref27.method, data = _ref27.data, config = _ref27.config;
775
+ url = _ref29.url, method = _ref29.method, data = _ref29.data, config = _ref29.config;
706
776
  console.log('[Server] handleGetScheduleTimePoints:', url, method, data, config);
707
777
  menu_list_ids = data.menu_list_ids;
708
778
  _this.logInfo('handleGetScheduleTimePoints 开始处理', {
@@ -712,12 +782,12 @@ var Server = /*#__PURE__*/function () {
712
782
 
713
783
  // 检查必要的模块是否已注册
714
784
  if (_this.menu) {
715
- _context10.next = 8;
785
+ _context11.next = 8;
716
786
  break;
717
787
  }
718
788
  console.error('[Server] Menu 模块未注册');
719
789
  _this.logError('handleGetScheduleTimePoints: Menu 模块未注册');
720
- return _context10.abrupt("return", {
790
+ return _context11.abrupt("return", {
721
791
  code: 500,
722
792
  message: 'Menu 模块未注册',
723
793
  data: [],
@@ -725,12 +795,12 @@ var Server = /*#__PURE__*/function () {
725
795
  });
726
796
  case 8:
727
797
  if (_this.schedule) {
728
- _context10.next = 12;
798
+ _context11.next = 12;
729
799
  break;
730
800
  }
731
801
  console.error('[Server] Schedule 模块未注册');
732
802
  _this.logError('handleGetScheduleTimePoints: Schedule 模块未注册');
733
- return _context10.abrupt("return", {
803
+ return _context11.abrupt("return", {
734
804
  code: 500,
735
805
  message: 'Schedule 模块未注册',
736
806
  data: [],
@@ -738,7 +808,7 @@ var Server = /*#__PURE__*/function () {
738
808
  });
739
809
  case 12:
740
810
  if (!(!menu_list_ids || !Array.isArray(menu_list_ids) || menu_list_ids.length === 0)) {
741
- _context10.next = 16;
811
+ _context11.next = 16;
742
812
  break;
743
813
  }
744
814
  console.error('[Server] menu_list_ids 参数无效');
@@ -746,14 +816,14 @@ var Server = /*#__PURE__*/function () {
746
816
  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,
747
817
  menu_list_ids: menu_list_ids
748
818
  });
749
- return _context10.abrupt("return", {
819
+ return _context11.abrupt("return", {
750
820
  code: 400,
751
821
  message: 'menu_list_ids 参数无效',
752
822
  data: [],
753
823
  status: false
754
824
  });
755
825
  case 16:
756
- _context10.prev = 16;
826
+ _context11.prev = 16;
757
827
  // 1. 获取餐牌列表
758
828
  menuList = _this.menu.getMenuByIds(menu_list_ids);
759
829
  console.log("[Server] \u627E\u5230 ".concat(menuList.length, " \u4E2A\u9910\u724C"));
@@ -771,13 +841,13 @@ var Server = /*#__PURE__*/function () {
771
841
  scheduleCount: scheduleIds.length
772
842
  });
773
843
  if (!(scheduleIds.length === 0)) {
774
- _context10.next = 26;
844
+ _context11.next = 26;
775
845
  break;
776
846
  }
777
847
  _this.logInfo('handleGetScheduleTimePoints: 没有找到相关日程', {
778
848
  menuListIdsCount: menu_list_ids.length
779
849
  });
780
- return _context10.abrupt("return", {
850
+ return _context11.abrupt("return", {
781
851
  code: 200,
782
852
  message: '没有找到相关日程',
783
853
  data: [],
@@ -801,22 +871,22 @@ var Server = /*#__PURE__*/function () {
801
871
  scheduleCount: scheduleList.length,
802
872
  timePointCount: timePoints.length
803
873
  });
804
- return _context10.abrupt("return", {
874
+ return _context11.abrupt("return", {
805
875
  code: 200,
806
876
  message: '获取成功',
807
877
  data: timePoints,
808
878
  status: true
809
879
  });
810
880
  case 35:
811
- _context10.prev = 35;
812
- _context10.t0 = _context10["catch"](16);
813
- errorMessage = _context10.t0 instanceof Error ? _context10.t0.message : '未知错误';
814
- console.error('[Server] 获取日程时间点失败:', _context10.t0);
881
+ _context11.prev = 35;
882
+ _context11.t0 = _context11["catch"](16);
883
+ errorMessage = _context11.t0 instanceof Error ? _context11.t0.message : '未知错误';
884
+ console.error('[Server] 获取日程时间点失败:', _context11.t0);
815
885
  _this.logError('handleGetScheduleTimePoints: 获取日程时间点失败', {
816
886
  menuListIdsCount: menu_list_ids.length,
817
887
  error: errorMessage
818
888
  });
819
- return _context10.abrupt("return", {
889
+ return _context11.abrupt("return", {
820
890
  code: 500,
821
891
  message: "\u83B7\u53D6\u5931\u8D25: ".concat(errorMessage),
822
892
  data: [],
@@ -824,12 +894,12 @@ var Server = /*#__PURE__*/function () {
824
894
  });
825
895
  case 41:
826
896
  case "end":
827
- return _context10.stop();
897
+ return _context11.stop();
828
898
  }
829
- }, _callee10, null, [[16, 35]]);
899
+ }, _callee11, null, [[16, 35]]);
830
900
  }));
831
- return function (_x10) {
832
- return _ref28.apply(this, arguments);
901
+ return function (_x11) {
902
+ return _ref30.apply(this, arguments);
833
903
  };
834
904
  }());
835
905
  this.core = core;
@@ -926,10 +996,10 @@ var Server = /*#__PURE__*/function () {
926
996
  }, {
927
997
  key: "registerModuleWithRoutes",
928
998
  value: (function () {
929
- var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(module, options, moduleName) {
999
+ var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(module, options, moduleName) {
930
1000
  var routes;
931
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
932
- while (1) switch (_context11.prev = _context11.next) {
1001
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1002
+ while (1) switch (_context12.prev = _context12.next) {
933
1003
  case 0:
934
1004
  this.logInfo("\u5F00\u59CB\u6CE8\u518C\u6A21\u5757: ".concat(moduleName), {
935
1005
  moduleName: moduleName,
@@ -937,7 +1007,7 @@ var Server = /*#__PURE__*/function () {
937
1007
  });
938
1008
 
939
1009
  // 注册模块到 Core
940
- _context11.next = 3;
1010
+ _context12.next = 3;
941
1011
  return this.core.registerModule(module, options);
942
1012
  case 3:
943
1013
  console.log("[Server] \u2705 ".concat(moduleName, " \u6A21\u5757\u5DF2\u6CE8\u518C"));
@@ -958,11 +1028,11 @@ var Server = /*#__PURE__*/function () {
958
1028
  }
959
1029
  case 6:
960
1030
  case "end":
961
- return _context11.stop();
1031
+ return _context12.stop();
962
1032
  }
963
- }, _callee11, this);
1033
+ }, _callee12, this);
964
1034
  }));
965
- function registerModuleWithRoutes(_x11, _x12, _x13) {
1035
+ function registerModuleWithRoutes(_x12, _x13, _x14) {
966
1036
  return _registerModuleWithRoutes.apply(this, arguments);
967
1037
  }
968
1038
  return registerModuleWithRoutes;
@@ -975,10 +1045,10 @@ var Server = /*#__PURE__*/function () {
975
1045
  }, {
976
1046
  key: "registerModuleByName",
977
1047
  value: (function () {
978
- var _registerModuleByName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(moduleConfig) {
1048
+ var _registerModuleByName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(moduleConfig) {
979
1049
  var moduleName, shouldPreload, customConfig, registryConfig, ModuleClass, moduleInstance, moduleOptions;
980
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
981
- while (1) switch (_context12.prev = _context12.next) {
1050
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1051
+ while (1) switch (_context13.prev = _context13.next) {
982
1052
  case 0:
983
1053
  // 解析配置
984
1054
  moduleName = typeof moduleConfig === 'string' ? moduleConfig : moduleConfig.name;
@@ -993,7 +1063,7 @@ var Server = /*#__PURE__*/function () {
993
1063
  // 查找模块配置
994
1064
  registryConfig = this.moduleRegistry[moduleName];
995
1065
  if (registryConfig) {
996
- _context12.next = 8;
1066
+ _context13.next = 8;
997
1067
  break;
998
1068
  }
999
1069
  this.logError("\u672A\u627E\u5230\u6A21\u5757\u914D\u7F6E: ".concat(moduleName), {
@@ -1007,7 +1077,7 @@ var Server = /*#__PURE__*/function () {
1007
1077
  moduleOptions = _objectSpread({
1008
1078
  store: _objectSpread({}, registryConfig.defaultStore)
1009
1079
  }, customConfig); // 注册模块和路由
1010
- _context12.next = 13;
1080
+ _context13.next = 13;
1011
1081
  return this.registerModuleWithRoutes(moduleInstance, moduleOptions, moduleName.charAt(0).toUpperCase() + moduleName.slice(1));
1012
1082
  case 13:
1013
1083
  // 保存模块实例
@@ -1017,18 +1087,18 @@ var Server = /*#__PURE__*/function () {
1017
1087
  shouldPreload: shouldPreload,
1018
1088
  version: registryConfig.version
1019
1089
  });
1020
- return _context12.abrupt("return", {
1090
+ return _context13.abrupt("return", {
1021
1091
  module: moduleInstance,
1022
1092
  config: registryConfig,
1023
1093
  shouldPreload: shouldPreload
1024
1094
  });
1025
1095
  case 16:
1026
1096
  case "end":
1027
- return _context12.stop();
1097
+ return _context13.stop();
1028
1098
  }
1029
- }, _callee12, this);
1099
+ }, _callee13, this);
1030
1100
  }));
1031
- function registerModuleByName(_x14) {
1101
+ function registerModuleByName(_x15) {
1032
1102
  return _registerModuleByName.apply(this, arguments);
1033
1103
  }
1034
1104
  return registerModuleByName;
@@ -1041,10 +1111,10 @@ var Server = /*#__PURE__*/function () {
1041
1111
  }, {
1042
1112
  key: "registerModules",
1043
1113
  value: (function () {
1044
- var _registerModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(moduleConfigs) {
1114
+ var _registerModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(moduleConfigs) {
1045
1115
  var configs, registeredModules, _iterator2, _step2, config, configName, result, errorMessage;
1046
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1047
- while (1) switch (_context13.prev = _context13.next) {
1116
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1117
+ while (1) switch (_context14.prev = _context14.next) {
1048
1118
  case 0:
1049
1119
  console.log('[Server] 开始注册模块...');
1050
1120
 
@@ -1056,47 +1126,47 @@ var Server = /*#__PURE__*/function () {
1056
1126
  });
1057
1127
  registeredModules = [];
1058
1128
  _iterator2 = _createForOfIteratorHelper(configs);
1059
- _context13.prev = 5;
1129
+ _context14.prev = 5;
1060
1130
  _iterator2.s();
1061
1131
  case 7:
1062
1132
  if ((_step2 = _iterator2.n()).done) {
1063
- _context13.next = 25;
1133
+ _context14.next = 25;
1064
1134
  break;
1065
1135
  }
1066
1136
  config = _step2.value;
1067
1137
  configName = typeof config === 'string' ? config : config.name;
1068
- _context13.prev = 10;
1069
- _context13.next = 13;
1138
+ _context14.prev = 10;
1139
+ _context14.next = 13;
1070
1140
  return this.registerModuleByName(config);
1071
1141
  case 13:
1072
- result = _context13.sent;
1142
+ result = _context14.sent;
1073
1143
  registeredModules.push(result);
1074
- _context13.next = 23;
1144
+ _context14.next = 23;
1075
1145
  break;
1076
1146
  case 17:
1077
- _context13.prev = 17;
1078
- _context13.t0 = _context13["catch"](10);
1079
- errorMessage = _context13.t0 instanceof Error ? _context13.t0.message : String(_context13.t0);
1147
+ _context14.prev = 17;
1148
+ _context14.t0 = _context14["catch"](10);
1149
+ errorMessage = _context14.t0 instanceof Error ? _context14.t0.message : String(_context14.t0);
1080
1150
  this.logError("\u6A21\u5757\u6CE8\u518C\u5931\u8D25: ".concat(configName), {
1081
1151
  moduleName: configName,
1082
1152
  error: errorMessage
1083
1153
  });
1084
- console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:", _context13.t0);
1085
- throw _context13.t0;
1154
+ console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:", _context14.t0);
1155
+ throw _context14.t0;
1086
1156
  case 23:
1087
- _context13.next = 7;
1157
+ _context14.next = 7;
1088
1158
  break;
1089
1159
  case 25:
1090
- _context13.next = 30;
1160
+ _context14.next = 30;
1091
1161
  break;
1092
1162
  case 27:
1093
- _context13.prev = 27;
1094
- _context13.t1 = _context13["catch"](5);
1095
- _iterator2.e(_context13.t1);
1163
+ _context14.prev = 27;
1164
+ _context14.t1 = _context14["catch"](5);
1165
+ _iterator2.e(_context14.t1);
1096
1166
  case 30:
1097
- _context13.prev = 30;
1167
+ _context14.prev = 30;
1098
1168
  _iterator2.f();
1099
- return _context13.finish(30);
1169
+ return _context14.finish(30);
1100
1170
  case 33:
1101
1171
  console.log('[Server] ✅ 所有模块注册完成');
1102
1172
  this.logInfo('所有模块注册完成', {
@@ -1106,14 +1176,14 @@ var Server = /*#__PURE__*/function () {
1106
1176
  return m === null || m === void 0 || (_m$config = m.config) === null || _m$config === void 0 ? void 0 : _m$config.name;
1107
1177
  })
1108
1178
  });
1109
- return _context13.abrupt("return", registeredModules);
1179
+ return _context14.abrupt("return", registeredModules);
1110
1180
  case 36:
1111
1181
  case "end":
1112
- return _context13.stop();
1182
+ return _context14.stop();
1113
1183
  }
1114
- }, _callee13, this, [[5, 27, 30, 33], [10, 17]]);
1184
+ }, _callee14, this, [[5, 27, 30, 33], [10, 17]]);
1115
1185
  }));
1116
- function registerModules(_x15) {
1186
+ function registerModules(_x16) {
1117
1187
  return _registerModules.apply(this, arguments);
1118
1188
  }
1119
1189
  return registerModules;
@@ -1126,10 +1196,10 @@ var Server = /*#__PURE__*/function () {
1126
1196
  }, {
1127
1197
  key: "preloadModulesData",
1128
1198
  value: (function () {
1129
- var _preloadModulesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(registeredModules, options) {
1199
+ var _preloadModulesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(registeredModules, options) {
1130
1200
  var modulesToPreload, preloadResults, _iterator3, _step3, _step3$value, module, config, shouldPreload, startTime, _options$onModuleLoad, _options$onModuleLoad2, duration, _duration, errorMessage, successCount, failCount;
1131
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1132
- while (1) switch (_context14.prev = _context14.next) {
1201
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1202
+ while (1) switch (_context15.prev = _context15.next) {
1133
1203
  case 0:
1134
1204
  console.log('[Server] 开始预加载模块数据...');
1135
1205
  modulesToPreload = registeredModules.filter(function (m) {
@@ -1142,16 +1212,16 @@ var Server = /*#__PURE__*/function () {
1142
1212
  });
1143
1213
  preloadResults = [];
1144
1214
  _iterator3 = _createForOfIteratorHelper(registeredModules);
1145
- _context14.prev = 5;
1215
+ _context15.prev = 5;
1146
1216
  _iterator3.s();
1147
1217
  case 7:
1148
1218
  if ((_step3 = _iterator3.n()).done) {
1149
- _context14.next = 40;
1219
+ _context15.next = 40;
1150
1220
  break;
1151
1221
  }
1152
1222
  _step3$value = _step3.value, module = _step3$value.module, config = _step3$value.config, shouldPreload = _step3$value.shouldPreload;
1153
1223
  if (shouldPreload) {
1154
- _context14.next = 13;
1224
+ _context15.next = 13;
1155
1225
  break;
1156
1226
  }
1157
1227
  console.log("[Server] \u23ED\uFE0F \u8DF3\u8FC7 ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D"));
@@ -1159,19 +1229,19 @@ var Server = /*#__PURE__*/function () {
1159
1229
  moduleName: config.name,
1160
1230
  reason: 'shouldPreload=false'
1161
1231
  });
1162
- return _context14.abrupt("continue", 38);
1232
+ return _context15.abrupt("continue", 38);
1163
1233
  case 13:
1164
1234
  if (!(typeof module.preload === 'function')) {
1165
- _context14.next = 36;
1235
+ _context15.next = 36;
1166
1236
  break;
1167
1237
  }
1168
1238
  startTime = Date.now();
1169
- _context14.prev = 15;
1239
+ _context15.prev = 15;
1170
1240
  this.logInfo("\u5F00\u59CB\u9884\u52A0\u8F7D\u6A21\u5757: ".concat(config.name), {
1171
1241
  moduleName: config.name
1172
1242
  });
1173
1243
  options === null || options === void 0 || (_options$onModuleLoad = options.onModuleLoad) === null || _options$onModuleLoad === void 0 || _options$onModuleLoad.call(options, config.name);
1174
- _context14.next = 20;
1244
+ _context15.next = 20;
1175
1245
  return module.preload();
1176
1246
  case 20:
1177
1247
  options === null || options === void 0 || (_options$onModuleLoad2 = options.onModuleLoadComplete) === null || _options$onModuleLoad2 === void 0 || _options$onModuleLoad2.call(options, config.name);
@@ -1185,14 +1255,14 @@ var Server = /*#__PURE__*/function () {
1185
1255
  name: config.name,
1186
1256
  success: true
1187
1257
  });
1188
- _context14.next = 34;
1258
+ _context15.next = 34;
1189
1259
  break;
1190
1260
  case 27:
1191
- _context14.prev = 27;
1192
- _context14.t0 = _context14["catch"](15);
1261
+ _context15.prev = 27;
1262
+ _context15.t0 = _context15["catch"](15);
1193
1263
  _duration = Date.now() - startTime;
1194
- errorMessage = _context14.t0 instanceof Error ? _context14.t0.message : String(_context14.t0);
1195
- console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"), _context14.t0);
1264
+ errorMessage = _context15.t0 instanceof Error ? _context15.t0.message : String(_context15.t0);
1265
+ console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"), _context15.t0);
1196
1266
  this.logError("\u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25: ".concat(config.name), {
1197
1267
  moduleName: config.name,
1198
1268
  duration: "".concat(_duration, "ms"),
@@ -1204,7 +1274,7 @@ var Server = /*#__PURE__*/function () {
1204
1274
  error: errorMessage
1205
1275
  });
1206
1276
  case 34:
1207
- _context14.next = 38;
1277
+ _context15.next = 38;
1208
1278
  break;
1209
1279
  case 36:
1210
1280
  console.log("[Server] \u26A0\uFE0F ".concat(config.name, " \u6A21\u5757\u672A\u5B9E\u73B0 preload() \u65B9\u6CD5"));
@@ -1212,19 +1282,19 @@ var Server = /*#__PURE__*/function () {
1212
1282
  moduleName: config.name
1213
1283
  });
1214
1284
  case 38:
1215
- _context14.next = 7;
1285
+ _context15.next = 7;
1216
1286
  break;
1217
1287
  case 40:
1218
- _context14.next = 45;
1288
+ _context15.next = 45;
1219
1289
  break;
1220
1290
  case 42:
1221
- _context14.prev = 42;
1222
- _context14.t1 = _context14["catch"](5);
1223
- _iterator3.e(_context14.t1);
1291
+ _context15.prev = 42;
1292
+ _context15.t1 = _context15["catch"](5);
1293
+ _iterator3.e(_context15.t1);
1224
1294
  case 45:
1225
- _context14.prev = 45;
1295
+ _context15.prev = 45;
1226
1296
  _iterator3.f();
1227
- return _context14.finish(45);
1297
+ return _context15.finish(45);
1228
1298
  case 48:
1229
1299
  successCount = preloadResults.filter(function (r) {
1230
1300
  return r.success;
@@ -1239,11 +1309,11 @@ var Server = /*#__PURE__*/function () {
1239
1309
  });
1240
1310
  case 52:
1241
1311
  case "end":
1242
- return _context14.stop();
1312
+ return _context15.stop();
1243
1313
  }
1244
- }, _callee14, this, [[5, 42, 45, 48], [15, 27]]);
1314
+ }, _callee15, this, [[5, 42, 45, 48], [15, 27]]);
1245
1315
  }));
1246
- function preloadModulesData(_x16, _x17) {
1316
+ function preloadModulesData(_x17, _x18) {
1247
1317
  return _preloadModulesData.apply(this, arguments);
1248
1318
  }
1249
1319
  return preloadModulesData;
@@ -1257,7 +1327,7 @@ var Server = /*#__PURE__*/function () {
1257
1327
  }, {
1258
1328
  key: "initialize",
1259
1329
  value: (function () {
1260
- var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(moduleConfigs) {
1330
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(moduleConfigs) {
1261
1331
  var _moduleConfigs$length,
1262
1332
  _this3 = this;
1263
1333
  var autoPreload,
@@ -1265,12 +1335,12 @@ var Server = /*#__PURE__*/function () {
1265
1335
  startTime,
1266
1336
  registeredModules,
1267
1337
  duration,
1268
- _args15 = arguments;
1269
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1270
- while (1) switch (_context15.prev = _context15.next) {
1338
+ _args16 = arguments;
1339
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1340
+ while (1) switch (_context16.prev = _context16.next) {
1271
1341
  case 0:
1272
- autoPreload = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : true;
1273
- options = _args15.length > 2 ? _args15[2] : undefined;
1342
+ autoPreload = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : true;
1343
+ options = _args16.length > 2 ? _args16[2] : undefined;
1274
1344
  startTime = Date.now();
1275
1345
  this.logInfo('Server 初始化开始', {
1276
1346
  moduleConfigCount: (_moduleConfigs$length = moduleConfigs === null || moduleConfigs === void 0 ? void 0 : moduleConfigs.length) !== null && _moduleConfigs$length !== void 0 ? _moduleConfigs$length : 'all',
@@ -1282,18 +1352,18 @@ var Server = /*#__PURE__*/function () {
1282
1352
  this.registerServerRoutes();
1283
1353
 
1284
1354
  // 注册模块
1285
- _context15.next = 7;
1355
+ _context16.next = 7;
1286
1356
  return this.registerModules(moduleConfigs);
1287
1357
  case 7:
1288
- registeredModules = _context15.sent;
1358
+ registeredModules = _context16.sent;
1289
1359
  if (!autoPreload) {
1290
- _context15.next = 13;
1360
+ _context16.next = 13;
1291
1361
  break;
1292
1362
  }
1293
- _context15.next = 11;
1363
+ _context16.next = 11;
1294
1364
  return this.preloadModulesData(registeredModules, options);
1295
1365
  case 11:
1296
- _context15.next = 14;
1366
+ _context16.next = 14;
1297
1367
  break;
1298
1368
  case 13:
1299
1369
  this.logInfo('跳过自动预加载', {
@@ -1323,14 +1393,14 @@ var Server = /*#__PURE__*/function () {
1323
1393
  duration: "".concat(duration, "ms"),
1324
1394
  registeredModuleCount: registeredModules.length
1325
1395
  });
1326
- return _context15.abrupt("return", registeredModules);
1396
+ return _context16.abrupt("return", registeredModules);
1327
1397
  case 20:
1328
1398
  case "end":
1329
- return _context15.stop();
1399
+ return _context16.stop();
1330
1400
  }
1331
- }, _callee15, this);
1401
+ }, _callee16, this);
1332
1402
  }));
1333
- function initialize(_x18) {
1403
+ function initialize(_x19) {
1334
1404
  return _initialize.apply(this, arguments);
1335
1405
  }
1336
1406
  return initialize;
@@ -1397,45 +1467,45 @@ var Server = /*#__PURE__*/function () {
1397
1467
  }, {
1398
1468
  key: "refreshProductsInBackground",
1399
1469
  value: (function () {
1400
- var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1470
+ var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1401
1471
  var startTime, duration, _duration2, errorMessage;
1402
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1403
- while (1) switch (_context16.prev = _context16.next) {
1472
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1473
+ while (1) switch (_context17.prev = _context17.next) {
1404
1474
  case 0:
1405
1475
  if (this.products) {
1406
- _context16.next = 3;
1476
+ _context17.next = 3;
1407
1477
  break;
1408
1478
  }
1409
1479
  this.logWarning('refreshProductsInBackground: Products 模块未注册');
1410
- return _context16.abrupt("return");
1480
+ return _context17.abrupt("return");
1411
1481
  case 3:
1412
1482
  this.logInfo('refreshProductsInBackground 开始');
1413
1483
  startTime = Date.now();
1414
- _context16.prev = 5;
1415
- _context16.next = 8;
1484
+ _context17.prev = 5;
1485
+ _context17.next = 8;
1416
1486
  return this.products.silentRefresh();
1417
1487
  case 8:
1418
1488
  duration = Date.now() - startTime;
1419
1489
  this.logInfo('refreshProductsInBackground 完成', {
1420
1490
  duration: "".concat(duration, "ms")
1421
1491
  });
1422
- _context16.next = 18;
1492
+ _context17.next = 18;
1423
1493
  break;
1424
1494
  case 12:
1425
- _context16.prev = 12;
1426
- _context16.t0 = _context16["catch"](5);
1495
+ _context17.prev = 12;
1496
+ _context17.t0 = _context17["catch"](5);
1427
1497
  _duration2 = Date.now() - startTime;
1428
- errorMessage = _context16.t0 instanceof Error ? _context16.t0.message : String(_context16.t0);
1429
- console.error('[Server] refreshProductsInBackground 失败:', _context16.t0);
1498
+ errorMessage = _context17.t0 instanceof Error ? _context17.t0.message : String(_context17.t0);
1499
+ console.error('[Server] refreshProductsInBackground 失败:', _context17.t0);
1430
1500
  this.logError('refreshProductsInBackground 失败', {
1431
1501
  duration: "".concat(_duration2, "ms"),
1432
1502
  error: errorMessage
1433
1503
  });
1434
1504
  case 18:
1435
1505
  case "end":
1436
- return _context16.stop();
1506
+ return _context17.stop();
1437
1507
  }
1438
- }, _callee16, this, [[5, 12]]);
1508
+ }, _callee17, this, [[5, 12]]);
1439
1509
  }));
1440
1510
  function refreshProductsInBackground() {
1441
1511
  return _refreshProductsInBackground.apply(this, arguments);
@@ -1450,10 +1520,10 @@ var Server = /*#__PURE__*/function () {
1450
1520
  }, {
1451
1521
  key: "clearAllIndexDB",
1452
1522
  value: (function () {
1453
- var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1523
+ var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1454
1524
  var clearTasks, moduleNames, errorMessage;
1455
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1456
- while (1) switch (_context17.prev = _context17.next) {
1525
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1526
+ while (1) switch (_context18.prev = _context18.next) {
1457
1527
  case 0:
1458
1528
  console.log('[Server] 开始清空所有模块的IndexedDB缓存...');
1459
1529
  this.logInfo('开始清空所有模块的 IndexedDB 缓存');
@@ -1488,41 +1558,41 @@ var Server = /*#__PURE__*/function () {
1488
1558
  moduleNames.push('FloorPlan');
1489
1559
  }
1490
1560
  if (!(clearTasks.length === 0)) {
1491
- _context17.next = 15;
1561
+ _context18.next = 15;
1492
1562
  break;
1493
1563
  }
1494
1564
  console.warn('[Server] 没有找到已注册的模块,无需清空');
1495
1565
  this.logWarning('没有找到已注册的模块,无需清空 IndexedDB');
1496
- return _context17.abrupt("return");
1566
+ return _context18.abrupt("return");
1497
1567
  case 15:
1498
1568
  this.logInfo('准备清空模块缓存', {
1499
1569
  moduleNames: moduleNames
1500
1570
  });
1501
- _context17.prev = 16;
1502
- _context17.next = 19;
1571
+ _context18.prev = 16;
1572
+ _context18.next = 19;
1503
1573
  return Promise.all(clearTasks);
1504
1574
  case 19:
1505
1575
  console.log("[Server] \u2705 \u5DF2\u6210\u529F\u6E05\u7A7A\u6240\u6709\u6A21\u5757\u7684IndexedDB\u7F13\u5B58: ".concat(moduleNames.join(', ')));
1506
1576
  this.logInfo('成功清空所有模块的 IndexedDB 缓存', {
1507
1577
  moduleNames: moduleNames
1508
1578
  });
1509
- _context17.next = 29;
1579
+ _context18.next = 29;
1510
1580
  break;
1511
1581
  case 23:
1512
- _context17.prev = 23;
1513
- _context17.t0 = _context17["catch"](16);
1514
- errorMessage = _context17.t0 instanceof Error ? _context17.t0.message : String(_context17.t0);
1515
- console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context17.t0);
1582
+ _context18.prev = 23;
1583
+ _context18.t0 = _context18["catch"](16);
1584
+ errorMessage = _context18.t0 instanceof Error ? _context18.t0.message : String(_context18.t0);
1585
+ console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context18.t0);
1516
1586
  this.logError('清空 IndexedDB 缓存时发生错误', {
1517
1587
  moduleNames: moduleNames,
1518
1588
  error: errorMessage
1519
1589
  });
1520
- throw _context17.t0;
1590
+ throw _context18.t0;
1521
1591
  case 29:
1522
1592
  case "end":
1523
- return _context17.stop();
1593
+ return _context18.stop();
1524
1594
  }
1525
- }, _callee17, this, [[16, 23]]);
1595
+ }, _callee18, this, [[16, 23]]);
1526
1596
  }));
1527
1597
  function clearAllIndexDB() {
1528
1598
  return _clearAllIndexDB.apply(this, arguments);
@@ -1552,6 +1622,10 @@ var Server = /*#__PURE__*/function () {
1552
1622
  if (exact) {
1553
1623
  return exact;
1554
1624
  }
1625
+ // GET /shop/product/query/:productId(纯数字 id),与 POST /shop/product/query、unsubscribe 区分
1626
+ if (method === 'get' && /^\/shop\/product\/query\/\d+$/.test(path)) {
1627
+ return this.handleProductQueryById;
1628
+ }
1555
1629
  if (method === 'get' && this.prefixRouterGet.length > 0) {
1556
1630
  var _iterator4 = _createForOfIteratorHelper(this.prefixRouterGet),
1557
1631
  _step4;
@@ -1593,10 +1667,10 @@ var Server = /*#__PURE__*/function () {
1593
1667
  }, {
1594
1668
  key: "handleRoute",
1595
1669
  value: (function () {
1596
- var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(method, path, params) {
1670
+ var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(method, path, params) {
1597
1671
  var startTime, handler, result, duration, _duration3, errorMessage;
1598
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1599
- while (1) switch (_context18.prev = _context18.next) {
1672
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1673
+ while (1) switch (_context19.prev = _context19.next) {
1600
1674
  case 0:
1601
1675
  startTime = Date.now();
1602
1676
  this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5F00\u59CB: ".concat(method.toUpperCase(), " ").concat(path), {
@@ -1607,7 +1681,7 @@ var Server = /*#__PURE__*/function () {
1607
1681
  });
1608
1682
  handler = this.getRouteHandler(method, path);
1609
1683
  if (handler) {
1610
- _context18.next = 6;
1684
+ _context19.next = 6;
1611
1685
  break;
1612
1686
  }
1613
1687
  this.logError("\u8DEF\u7531\u672A\u627E\u5230: ".concat(method.toUpperCase(), " ").concat(path), {
@@ -1616,13 +1690,13 @@ var Server = /*#__PURE__*/function () {
1616
1690
  });
1617
1691
  throw new Error("Route not found: ".concat(method.toUpperCase(), " ").concat(path));
1618
1692
  case 6:
1619
- _context18.prev = 6;
1620
- _context18.next = 9;
1693
+ _context19.prev = 6;
1694
+ _context19.next = 9;
1621
1695
  return handler(_objectSpread(_objectSpread({}, params), {}, {
1622
1696
  path: path
1623
1697
  }));
1624
1698
  case 9:
1625
- result = _context18.sent;
1699
+ result = _context19.sent;
1626
1700
  duration = Date.now() - startTime;
1627
1701
  this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5B8C\u6210: ".concat(method.toUpperCase(), " ").concat(path), {
1628
1702
  method: method.toUpperCase(),
@@ -1631,12 +1705,12 @@ var Server = /*#__PURE__*/function () {
1631
1705
  resultCode: result === null || result === void 0 ? void 0 : result.code,
1632
1706
  resultStatus: result === null || result === void 0 ? void 0 : result.status
1633
1707
  });
1634
- return _context18.abrupt("return", result);
1708
+ return _context19.abrupt("return", result);
1635
1709
  case 15:
1636
- _context18.prev = 15;
1637
- _context18.t0 = _context18["catch"](6);
1710
+ _context19.prev = 15;
1711
+ _context19.t0 = _context19["catch"](6);
1638
1712
  _duration3 = Date.now() - startTime;
1639
- errorMessage = _context18.t0 instanceof Error ? _context18.t0.message : String(_context18.t0);
1713
+ errorMessage = _context19.t0 instanceof Error ? _context19.t0.message : String(_context19.t0);
1640
1714
  this.logError("\u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), {
1641
1715
  method: method.toUpperCase(),
1642
1716
  path: path,
@@ -1644,15 +1718,15 @@ var Server = /*#__PURE__*/function () {
1644
1718
  error: errorMessage,
1645
1719
  data: params.data
1646
1720
  });
1647
- console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), _context18.t0);
1648
- throw _context18.t0;
1721
+ console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), _context19.t0);
1722
+ throw _context19.t0;
1649
1723
  case 22:
1650
1724
  case "end":
1651
- return _context18.stop();
1725
+ return _context19.stop();
1652
1726
  }
1653
- }, _callee18, this, [[6, 15]]);
1727
+ }, _callee19, this, [[6, 15]]);
1654
1728
  }));
1655
- function handleRoute(_x19, _x20, _x21) {
1729
+ function handleRoute(_x20, _x21, _x22) {
1656
1730
  return _handleRoute.apply(this, arguments);
1657
1731
  }
1658
1732
  return handleRoute;
@@ -2137,18 +2211,18 @@ var Server = /*#__PURE__*/function () {
2137
2211
  }, {
2138
2212
  key: "fetchOrderListFromAPI",
2139
2213
  value: (function () {
2140
- var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(data) {
2214
+ var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(data) {
2141
2215
  var _this$app3;
2142
2216
  var _response$data2, response, payload, list, count, errorMessage;
2143
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2144
- while (1) switch (_context19.prev = _context19.next) {
2217
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2218
+ while (1) switch (_context20.prev = _context20.next) {
2145
2219
  case 0:
2146
2220
  if ((_this$app3 = this.app) !== null && _this$app3 !== void 0 && _this$app3.request) {
2147
- _context19.next = 3;
2221
+ _context20.next = 3;
2148
2222
  break;
2149
2223
  }
2150
2224
  this.logError('fetchOrderListFromAPI: app.request 不可用');
2151
- return _context19.abrupt("return", {
2225
+ return _context20.abrupt("return", {
2152
2226
  code: 500,
2153
2227
  message: 'app.request 不可用',
2154
2228
  data: {
@@ -2158,17 +2232,17 @@ var Server = /*#__PURE__*/function () {
2158
2232
  status: false
2159
2233
  });
2160
2234
  case 3:
2161
- _context19.prev = 3;
2162
- _context19.next = 6;
2235
+ _context20.prev = 3;
2236
+ _context20.next = 6;
2163
2237
  return this.app.request.post('/shop/order/v2/list', data, {
2164
2238
  isShopApi: true
2165
2239
  });
2166
2240
  case 6:
2167
- response = _context19.sent;
2241
+ response = _context20.sent;
2168
2242
  payload = (_response$data2 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data2 !== void 0 ? _response$data2 : response;
2169
2243
  list = Array.isArray(payload === null || payload === void 0 ? void 0 : payload.list) ? payload.list : [];
2170
2244
  count = typeof (payload === null || payload === void 0 ? void 0 : payload.count) === 'number' ? payload.count : list.length;
2171
- return _context19.abrupt("return", {
2245
+ return _context20.abrupt("return", {
2172
2246
  code: 200,
2173
2247
  data: _objectSpread(_objectSpread({}, payload), {}, {
2174
2248
  list: list,
@@ -2178,13 +2252,13 @@ var Server = /*#__PURE__*/function () {
2178
2252
  status: true
2179
2253
  });
2180
2254
  case 13:
2181
- _context19.prev = 13;
2182
- _context19.t0 = _context19["catch"](3);
2183
- errorMessage = _context19.t0 instanceof Error ? _context19.t0.message : String(_context19.t0);
2255
+ _context20.prev = 13;
2256
+ _context20.t0 = _context20["catch"](3);
2257
+ errorMessage = _context20.t0 instanceof Error ? _context20.t0.message : String(_context20.t0);
2184
2258
  this.logError('fetchOrderListFromAPI: 请求失败', {
2185
2259
  error: errorMessage
2186
2260
  });
2187
- return _context19.abrupt("return", {
2261
+ return _context20.abrupt("return", {
2188
2262
  code: 500,
2189
2263
  message: errorMessage,
2190
2264
  data: {
@@ -2195,11 +2269,11 @@ var Server = /*#__PURE__*/function () {
2195
2269
  });
2196
2270
  case 18:
2197
2271
  case "end":
2198
- return _context19.stop();
2272
+ return _context20.stop();
2199
2273
  }
2200
- }, _callee19, this, [[3, 13]]);
2274
+ }, _callee20, this, [[3, 13]]);
2201
2275
  }));
2202
- function fetchOrderListFromAPI(_x22) {
2276
+ function fetchOrderListFromAPI(_x23) {
2203
2277
  return _fetchOrderListFromAPI.apply(this, arguments);
2204
2278
  }
2205
2279
  return fetchOrderListFromAPI;
@@ -2211,17 +2285,17 @@ var Server = /*#__PURE__*/function () {
2211
2285
  }, {
2212
2286
  key: "fetchBookingListFromAPI",
2213
2287
  value: (function () {
2214
- var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(data) {
2288
+ var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(data) {
2215
2289
  var memoryCacheEnabled, withFields, requestPayload, cacheKey, cached, rawList, bookingResult, _bookingResult$list, errorMessage;
2216
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2217
- while (1) switch (_context20.prev = _context20.next) {
2290
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2291
+ while (1) switch (_context21.prev = _context21.next) {
2218
2292
  case 0:
2219
2293
  if (this.order) {
2220
- _context20.next = 3;
2294
+ _context21.next = 3;
2221
2295
  break;
2222
2296
  }
2223
2297
  this.logError('fetchBookingListFromAPI: Order 模块不可用');
2224
- return _context20.abrupt("return", {
2298
+ return _context21.abrupt("return", {
2225
2299
  code: 500,
2226
2300
  message: 'Order 模块不可用',
2227
2301
  data: {
@@ -2231,18 +2305,18 @@ var Server = /*#__PURE__*/function () {
2231
2305
  status: false
2232
2306
  });
2233
2307
  case 3:
2234
- _context20.prev = 3;
2308
+ _context21.prev = 3;
2235
2309
  memoryCacheEnabled = this.isBookingRemoteMemoryCacheEnabled(data);
2236
2310
  withFields = this.resolveBookingSalesWith(data);
2237
2311
  requestPayload = this.normalizeBookingRemoteQueryPayload(data, withFields);
2238
2312
  cacheKey = this.buildBookingRemoteCacheKey(requestPayload);
2239
2313
  if (!memoryCacheEnabled) {
2240
- _context20.next = 13;
2314
+ _context21.next = 13;
2241
2315
  break;
2242
2316
  }
2243
2317
  cached = this.readBookingRemoteCache(cacheKey);
2244
2318
  if (!cached) {
2245
- _context20.next = 13;
2319
+ _context21.next = 13;
2246
2320
  break;
2247
2321
  }
2248
2322
  this.logInfo('fetchBookingListFromAPI: 命中内存缓存', {
@@ -2250,14 +2324,14 @@ var Server = /*#__PURE__*/function () {
2250
2324
  listCount: cached.bookingResult.count,
2251
2325
  withFields: cached.withFields
2252
2326
  });
2253
- return _context20.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
2327
+ return _context21.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
2254
2328
  cache_hit: true
2255
2329
  }));
2256
2330
  case 13:
2257
- _context20.next = 15;
2331
+ _context21.next = 15;
2258
2332
  return this.order.fetchOrdersBySSE(requestPayload);
2259
2333
  case 15:
2260
- rawList = _context20.sent;
2334
+ rawList = _context21.sent;
2261
2335
  bookingResult = sortBookings(filterBookingsFromOrders(rawList, data), data); // DEBUG: 挂到 window 上方便排查 SSE → 日历数据丢失问题
2262
2336
  if (typeof globalThis !== 'undefined') {
2263
2337
  globalThis.__SSE_BOOKING_DEBUG__ = {
@@ -2304,15 +2378,15 @@ var Server = /*#__PURE__*/function () {
2304
2378
  cacheKey: cacheKey,
2305
2379
  withFields: withFields
2306
2380
  });
2307
- return _context20.abrupt("return", this.buildBookingResponse(bookingResult));
2381
+ return _context21.abrupt("return", this.buildBookingResponse(bookingResult));
2308
2382
  case 23:
2309
- _context20.prev = 23;
2310
- _context20.t0 = _context20["catch"](3);
2311
- errorMessage = _context20.t0 instanceof Error ? _context20.t0.message : String(_context20.t0);
2383
+ _context21.prev = 23;
2384
+ _context21.t0 = _context21["catch"](3);
2385
+ errorMessage = _context21.t0 instanceof Error ? _context21.t0.message : String(_context21.t0);
2312
2386
  this.logError('fetchBookingListFromAPI: SSE 请求失败', {
2313
2387
  error: errorMessage
2314
2388
  });
2315
- return _context20.abrupt("return", {
2389
+ return _context21.abrupt("return", {
2316
2390
  code: 500,
2317
2391
  message: errorMessage,
2318
2392
  data: {
@@ -2323,11 +2397,11 @@ var Server = /*#__PURE__*/function () {
2323
2397
  });
2324
2398
  case 28:
2325
2399
  case "end":
2326
- return _context20.stop();
2400
+ return _context21.stop();
2327
2401
  }
2328
- }, _callee20, this, [[3, 23]]);
2402
+ }, _callee21, this, [[3, 23]]);
2329
2403
  }));
2330
- function fetchBookingListFromAPI(_x23) {
2404
+ function fetchBookingListFromAPI(_x24) {
2331
2405
  return _fetchBookingListFromAPI.apply(this, arguments);
2332
2406
  }
2333
2407
  return fetchBookingListFromAPI;
@@ -2485,16 +2559,16 @@ var Server = /*#__PURE__*/function () {
2485
2559
  }, {
2486
2560
  key: "recomputeAndNotifyFloorPlanQuery",
2487
2561
  value: (function () {
2488
- var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2562
+ var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2489
2563
  var _iterator12, _step12, _step12$value, subscriberId, sub, result, errorMessage;
2490
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2491
- while (1) switch (_context21.prev = _context21.next) {
2564
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2565
+ while (1) switch (_context22.prev = _context22.next) {
2492
2566
  case 0:
2493
2567
  if (!(this.floorPlanQuerySubscribers.size === 0)) {
2494
- _context21.next = 2;
2568
+ _context22.next = 2;
2495
2569
  break;
2496
2570
  }
2497
- return _context21.abrupt("return");
2571
+ return _context22.abrupt("return");
2498
2572
  case 2:
2499
2573
  this.logInfo('recomputeAndNotifyFloorPlanQuery: 开始推送', {
2500
2574
  subscriberCount: this.floorPlanQuerySubscribers.size
@@ -2524,9 +2598,9 @@ var Server = /*#__PURE__*/function () {
2524
2598
  }
2525
2599
  case 5:
2526
2600
  case "end":
2527
- return _context21.stop();
2601
+ return _context22.stop();
2528
2602
  }
2529
- }, _callee21, this);
2603
+ }, _callee22, this);
2530
2604
  }));
2531
2605
  function recomputeAndNotifyFloorPlanQuery() {
2532
2606
  return _recomputeAndNotifyFloorPlanQuery.apply(this, arguments);
@@ -2556,21 +2630,21 @@ var Server = /*#__PURE__*/function () {
2556
2630
  * filter 逻辑暂为 mock,仅记录参数
2557
2631
  */
2558
2632
  function () {
2559
- var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(data) {
2633
+ var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(data) {
2560
2634
  var rawList, result;
2561
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2562
- while (1) switch (_context22.prev = _context22.next) {
2635
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2636
+ while (1) switch (_context23.prev = _context23.next) {
2563
2637
  case 0:
2564
2638
  this.logInfo('computeOrderQueryResult: 开始过滤', {
2565
2639
  data: data
2566
2640
  });
2567
2641
  console.log('[Server] computeOrderQueryResult', data);
2568
2642
  if (this.order) {
2569
- _context22.next = 5;
2643
+ _context23.next = 5;
2570
2644
  break;
2571
2645
  }
2572
2646
  this.logError('computeOrderQueryResult: Order 模块未注册');
2573
- return _context22.abrupt("return", {
2647
+ return _context23.abrupt("return", {
2574
2648
  code: 500,
2575
2649
  message: 'Order 模块未注册',
2576
2650
  data: {
@@ -2593,7 +2667,7 @@ var Server = /*#__PURE__*/function () {
2593
2667
  size: result.size,
2594
2668
  skip: result.skip
2595
2669
  });
2596
- return _context22.abrupt("return", {
2670
+ return _context23.abrupt("return", {
2597
2671
  code: 200,
2598
2672
  data: result,
2599
2673
  message: '',
@@ -2601,11 +2675,11 @@ var Server = /*#__PURE__*/function () {
2601
2675
  });
2602
2676
  case 10:
2603
2677
  case "end":
2604
- return _context22.stop();
2678
+ return _context23.stop();
2605
2679
  }
2606
- }, _callee22, this);
2680
+ }, _callee23, this);
2607
2681
  }));
2608
- function computeOrderQueryResult(_x24) {
2682
+ function computeOrderQueryResult(_x25) {
2609
2683
  return _computeOrderQueryResult.apply(this, arguments);
2610
2684
  }
2611
2685
  return computeOrderQueryResult;
@@ -2618,17 +2692,17 @@ var Server = /*#__PURE__*/function () {
2618
2692
  }, {
2619
2693
  key: "computeBookingQueryResult",
2620
2694
  value: (function () {
2621
- var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(data) {
2695
+ var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(data) {
2622
2696
  var rawOrders, result;
2623
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2624
- while (1) switch (_context23.prev = _context23.next) {
2697
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2698
+ while (1) switch (_context24.prev = _context24.next) {
2625
2699
  case 0:
2626
2700
  if (this.order) {
2627
- _context23.next = 3;
2701
+ _context24.next = 3;
2628
2702
  break;
2629
2703
  }
2630
2704
  this.logError('computeBookingQueryResult: Order 模块未注册');
2631
- return _context23.abrupt("return", {
2705
+ return _context24.abrupt("return", {
2632
2706
  code: 500,
2633
2707
  message: 'Order 模块未注册',
2634
2708
  data: {
@@ -2647,7 +2721,7 @@ var Server = /*#__PURE__*/function () {
2647
2721
  size: result.size,
2648
2722
  skip: result.skip
2649
2723
  });
2650
- return _context23.abrupt("return", {
2724
+ return _context24.abrupt("return", {
2651
2725
  code: 200,
2652
2726
  data: result,
2653
2727
  message: '',
@@ -2655,11 +2729,11 @@ var Server = /*#__PURE__*/function () {
2655
2729
  });
2656
2730
  case 8:
2657
2731
  case "end":
2658
- return _context23.stop();
2732
+ return _context24.stop();
2659
2733
  }
2660
- }, _callee23, this);
2734
+ }, _callee24, this);
2661
2735
  }));
2662
- function computeBookingQueryResult(_x25) {
2736
+ function computeBookingQueryResult(_x26) {
2663
2737
  return _computeBookingQueryResult.apply(this, arguments);
2664
2738
  }
2665
2739
  return computeBookingQueryResult;
@@ -2675,61 +2749,101 @@ var Server = /*#__PURE__*/function () {
2675
2749
  }, {
2676
2750
  key: "computeProductQueryResult",
2677
2751
  value: (function () {
2678
- var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(context, options) {
2752
+ var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(context, options) {
2679
2753
  var _menu_list_ids$length3,
2680
2754
  _this6 = this;
2681
- var tTotal, menu_list_ids, schedule_date, schedule_datetime, activeMenuList, tMenu, menuList, tPrice, allProductsWithPrice, tFilter, filteredProducts, tStatus, beforeStatusCount, tSort;
2682
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2683
- while (1) switch (_context24.prev = _context24.next) {
2755
+ var tTotal, menu_list_ids, schedule_date, schedule_datetime, product_id, _published$find, pid, _tPrice, _allProductsWithPrice, published, item, activeMenuList, tMenu, menuList, tPrice, allProductsWithPrice, tFilter, filteredProducts, tStatus, beforeStatusCount, tSort;
2756
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2757
+ while (1) switch (_context25.prev = _context25.next) {
2684
2758
  case 0:
2685
2759
  tTotal = performance.now();
2686
- menu_list_ids = context.menu_list_ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime;
2687
- debugger;
2760
+ menu_list_ids = context.menu_list_ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime, product_id = context.product_id;
2688
2761
  this.logInfo('computeProductQueryResult 开始', {
2689
2762
  menuListIdsCount: (_menu_list_ids$length3 = menu_list_ids === null || menu_list_ids === void 0 ? void 0 : menu_list_ids.length) !== null && _menu_list_ids$length3 !== void 0 ? _menu_list_ids$length3 : 0,
2690
2763
  schedule_datetime: schedule_datetime,
2691
2764
  schedule_date: schedule_date,
2765
+ product_id: product_id,
2692
2766
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
2693
2767
  });
2694
2768
  if (this.products) {
2695
- _context24.next = 7;
2769
+ _context25.next = 6;
2696
2770
  break;
2697
2771
  }
2698
2772
  this.logError('computeProductQueryResult: Products 模块未注册');
2699
- return _context24.abrupt("return", {
2773
+ return _context25.abrupt("return", {
2700
2774
  message: 'Products 模块未注册',
2701
2775
  data: {
2702
2776
  list: [],
2703
2777
  count: 0
2704
2778
  }
2705
2779
  });
2706
- case 7:
2780
+ case 6:
2781
+ if (!(product_id != null && Number.isFinite(Number(product_id)))) {
2782
+ _context25.next = 18;
2783
+ break;
2784
+ }
2785
+ pid = Number(product_id);
2786
+ _tPrice = performance.now();
2787
+ _context25.next = 11;
2788
+ return this.products.getProductsWithPrice(schedule_date, {
2789
+ scheduleModule: this.getSchedule()
2790
+ }, {
2791
+ changedIds: options === null || options === void 0 ? void 0 : options.changedIds
2792
+ });
2793
+ case 11:
2794
+ _allProductsWithPrice = _context25.sent;
2795
+ perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice, {
2796
+ count: _allProductsWithPrice.length,
2797
+ productId: pid
2798
+ });
2799
+ published = _allProductsWithPrice.filter(function (p) {
2800
+ return ((p === null || p === void 0 ? void 0 : p.status) || 'published') === 'published';
2801
+ });
2802
+ item = (_published$find = published.find(function (p) {
2803
+ return Number(p.id) === pid;
2804
+ })) !== null && _published$find !== void 0 ? _published$find : null;
2805
+ perfMark('computeProductQueryResult', performance.now() - tTotal, {
2806
+ mode: 'single',
2807
+ productId: pid,
2808
+ found: !!item
2809
+ });
2810
+ this.logInfo('computeProductQueryResult 完成(单商品)', {
2811
+ productId: pid,
2812
+ found: !!item
2813
+ });
2814
+ return _context25.abrupt("return", {
2815
+ code: 200,
2816
+ data: item,
2817
+ message: item ? '' : '商品不存在或未发布',
2818
+ status: true
2819
+ });
2820
+ case 18:
2707
2821
  if (this.menu) {
2708
- _context24.next = 10;
2822
+ _context25.next = 21;
2709
2823
  break;
2710
2824
  }
2711
2825
  this.logError('computeProductQueryResult: Menu 模块未注册');
2712
- return _context24.abrupt("return", {
2826
+ return _context25.abrupt("return", {
2713
2827
  message: 'Menu 模块未注册',
2714
2828
  data: {
2715
2829
  list: [],
2716
2830
  count: 0
2717
2831
  }
2718
2832
  });
2719
- case 10:
2833
+ case 21:
2720
2834
  if (this.schedule) {
2721
- _context24.next = 13;
2835
+ _context25.next = 24;
2722
2836
  break;
2723
2837
  }
2724
2838
  this.logError('computeProductQueryResult: Schedule 模块未注册');
2725
- return _context24.abrupt("return", {
2839
+ return _context25.abrupt("return", {
2726
2840
  message: 'Schedule 模块未注册',
2727
2841
  data: {
2728
2842
  list: [],
2729
2843
  count: 0
2730
2844
  }
2731
2845
  });
2732
- case 13:
2846
+ case 24:
2733
2847
  activeMenuList = [];
2734
2848
  if (menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0) {
2735
2849
  tMenu = performance.now();
@@ -2744,14 +2858,14 @@ var Server = /*#__PURE__*/function () {
2744
2858
  });
2745
2859
  }
2746
2860
  tPrice = performance.now();
2747
- _context24.next = 18;
2861
+ _context25.next = 29;
2748
2862
  return this.products.getProductsWithPrice(schedule_date, {
2749
2863
  scheduleModule: this.getSchedule()
2750
2864
  }, {
2751
2865
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
2752
2866
  });
2753
- case 18:
2754
- allProductsWithPrice = _context24.sent;
2867
+ case 29:
2868
+ allProductsWithPrice = _context25.sent;
2755
2869
  perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
2756
2870
  count: allProductsWithPrice.length
2757
2871
  });
@@ -2789,7 +2903,7 @@ var Server = /*#__PURE__*/function () {
2789
2903
  filteredCount: filteredProducts.length,
2790
2904
  activeMenuCount: activeMenuList.length
2791
2905
  });
2792
- return _context24.abrupt("return", {
2906
+ return _context25.abrupt("return", {
2793
2907
  code: 200,
2794
2908
  data: {
2795
2909
  list: filteredProducts,
@@ -2798,13 +2912,13 @@ var Server = /*#__PURE__*/function () {
2798
2912
  message: '',
2799
2913
  status: true
2800
2914
  });
2801
- case 33:
2915
+ case 44:
2802
2916
  case "end":
2803
- return _context24.stop();
2917
+ return _context25.stop();
2804
2918
  }
2805
- }, _callee24, this);
2919
+ }, _callee25, this);
2806
2920
  }));
2807
- function computeProductQueryResult(_x26, _x27) {
2921
+ function computeProductQueryResult(_x27, _x28) {
2808
2922
  return _computeProductQueryResult.apply(this, arguments);
2809
2923
  }
2810
2924
  return computeProductQueryResult;
@@ -2819,72 +2933,72 @@ var Server = /*#__PURE__*/function () {
2819
2933
  }, {
2820
2934
  key: "recomputeAndNotifyProductQuery",
2821
2935
  value: (function () {
2822
- var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(options) {
2936
+ var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(options) {
2823
2937
  var _iterator13, _step13, _step13$value, subscriberId, subscriber, result, errorMessage;
2824
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2825
- while (1) switch (_context25.prev = _context25.next) {
2938
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2939
+ while (1) switch (_context26.prev = _context26.next) {
2826
2940
  case 0:
2827
2941
  if (!(this.productQuerySubscribers.size === 0)) {
2828
- _context25.next = 2;
2942
+ _context26.next = 2;
2829
2943
  break;
2830
2944
  }
2831
- return _context25.abrupt("return");
2945
+ return _context26.abrupt("return");
2832
2946
  case 2:
2833
2947
  this.logInfo('recomputeAndNotifyProductQuery: 开始推送', {
2834
2948
  subscriberCount: this.productQuerySubscribers.size,
2835
2949
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
2836
2950
  });
2837
2951
  _iterator13 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
2838
- _context25.prev = 4;
2952
+ _context26.prev = 4;
2839
2953
  _iterator13.s();
2840
2954
  case 6:
2841
2955
  if ((_step13 = _iterator13.n()).done) {
2842
- _context25.next = 22;
2956
+ _context26.next = 22;
2843
2957
  break;
2844
2958
  }
2845
2959
  _step13$value = _slicedToArray(_step13.value, 2), subscriberId = _step13$value[0], subscriber = _step13$value[1];
2846
- _context25.prev = 8;
2847
- _context25.next = 11;
2960
+ _context26.prev = 8;
2961
+ _context26.next = 11;
2848
2962
  return this.computeProductQueryResult(subscriber.context, {
2849
2963
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
2850
2964
  });
2851
2965
  case 11:
2852
- result = _context25.sent;
2966
+ result = _context26.sent;
2853
2967
  subscriber.callback(result);
2854
2968
  this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
2855
2969
  subscriberId: subscriberId
2856
2970
  });
2857
- _context25.next = 20;
2971
+ _context26.next = 20;
2858
2972
  break;
2859
2973
  case 16:
2860
- _context25.prev = 16;
2861
- _context25.t0 = _context25["catch"](8);
2862
- errorMessage = _context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0);
2974
+ _context26.prev = 16;
2975
+ _context26.t0 = _context26["catch"](8);
2976
+ errorMessage = _context26.t0 instanceof Error ? _context26.t0.message : String(_context26.t0);
2863
2977
  this.logError('recomputeAndNotifyProductQuery: 推送失败', {
2864
2978
  subscriberId: subscriberId,
2865
2979
  error: errorMessage
2866
2980
  });
2867
2981
  case 20:
2868
- _context25.next = 6;
2982
+ _context26.next = 6;
2869
2983
  break;
2870
2984
  case 22:
2871
- _context25.next = 27;
2985
+ _context26.next = 27;
2872
2986
  break;
2873
2987
  case 24:
2874
- _context25.prev = 24;
2875
- _context25.t1 = _context25["catch"](4);
2876
- _iterator13.e(_context25.t1);
2988
+ _context26.prev = 24;
2989
+ _context26.t1 = _context26["catch"](4);
2990
+ _iterator13.e(_context26.t1);
2877
2991
  case 27:
2878
- _context25.prev = 27;
2992
+ _context26.prev = 27;
2879
2993
  _iterator13.f();
2880
- return _context25.finish(27);
2994
+ return _context26.finish(27);
2881
2995
  case 30:
2882
2996
  case "end":
2883
- return _context25.stop();
2997
+ return _context26.stop();
2884
2998
  }
2885
- }, _callee25, this, [[4, 24, 27, 30], [8, 16]]);
2999
+ }, _callee26, this, [[4, 24, 27, 30], [8, 16]]);
2886
3000
  }));
2887
- function recomputeAndNotifyProductQuery(_x28) {
3001
+ function recomputeAndNotifyProductQuery(_x29) {
2888
3002
  return _recomputeAndNotifyProductQuery.apply(this, arguments);
2889
3003
  }
2890
3004
  return recomputeAndNotifyProductQuery;
@@ -2896,16 +3010,16 @@ var Server = /*#__PURE__*/function () {
2896
3010
  }, {
2897
3011
  key: "recomputeAndNotifyOrderQuery",
2898
3012
  value: (function () {
2899
- var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
3013
+ var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
2900
3014
  var notifyStartAt, _iterator14, _step14, _step14$value, subscriberId, subscriber, computeStartAt, result, computeEndAt, callbackStartAt, callbackEndAt, errorMessage, notifyEndAt;
2901
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2902
- while (1) switch (_context26.prev = _context26.next) {
3015
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3016
+ while (1) switch (_context27.prev = _context27.next) {
2903
3017
  case 0:
2904
3018
  if (!(this.orderQuerySubscribers.size === 0)) {
2905
- _context26.next = 2;
3019
+ _context27.next = 2;
2906
3020
  break;
2907
3021
  }
2908
- return _context26.abrupt("return");
3022
+ return _context27.abrupt("return");
2909
3023
  case 2:
2910
3024
  notifyStartAt = Date.now();
2911
3025
  this.logInfo('recomputeAndNotifyOrderQuery: 开始推送', {
@@ -2913,20 +3027,20 @@ var Server = /*#__PURE__*/function () {
2913
3027
  notifyStartAt: new Date(notifyStartAt).toISOString()
2914
3028
  });
2915
3029
  _iterator14 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
2916
- _context26.prev = 5;
3030
+ _context27.prev = 5;
2917
3031
  _iterator14.s();
2918
3032
  case 7:
2919
3033
  if ((_step14 = _iterator14.n()).done) {
2920
- _context26.next = 27;
3034
+ _context27.next = 27;
2921
3035
  break;
2922
3036
  }
2923
3037
  _step14$value = _slicedToArray(_step14.value, 2), subscriberId = _step14$value[0], subscriber = _step14$value[1];
2924
- _context26.prev = 9;
3038
+ _context27.prev = 9;
2925
3039
  computeStartAt = Date.now();
2926
- _context26.next = 13;
3040
+ _context27.next = 13;
2927
3041
  return this.computeOrderQueryResult(subscriber.context);
2928
3042
  case 13:
2929
- result = _context26.sent;
3043
+ result = _context27.sent;
2930
3044
  computeEndAt = Date.now();
2931
3045
  callbackStartAt = Date.now();
2932
3046
  subscriber.callback(result);
@@ -2937,30 +3051,30 @@ var Server = /*#__PURE__*/function () {
2937
3051
  callbackDurationMs: callbackEndAt - callbackStartAt,
2938
3052
  totalDurationMs: callbackEndAt - computeStartAt
2939
3053
  });
2940
- _context26.next = 25;
3054
+ _context27.next = 25;
2941
3055
  break;
2942
3056
  case 21:
2943
- _context26.prev = 21;
2944
- _context26.t0 = _context26["catch"](9);
2945
- errorMessage = _context26.t0 instanceof Error ? _context26.t0.message : String(_context26.t0);
3057
+ _context27.prev = 21;
3058
+ _context27.t0 = _context27["catch"](9);
3059
+ errorMessage = _context27.t0 instanceof Error ? _context27.t0.message : String(_context27.t0);
2946
3060
  this.logError('recomputeAndNotifyOrderQuery: 推送失败', {
2947
3061
  subscriberId: subscriberId,
2948
3062
  error: errorMessage
2949
3063
  });
2950
3064
  case 25:
2951
- _context26.next = 7;
3065
+ _context27.next = 7;
2952
3066
  break;
2953
3067
  case 27:
2954
- _context26.next = 32;
3068
+ _context27.next = 32;
2955
3069
  break;
2956
3070
  case 29:
2957
- _context26.prev = 29;
2958
- _context26.t1 = _context26["catch"](5);
2959
- _iterator14.e(_context26.t1);
3071
+ _context27.prev = 29;
3072
+ _context27.t1 = _context27["catch"](5);
3073
+ _iterator14.e(_context27.t1);
2960
3074
  case 32:
2961
- _context26.prev = 32;
3075
+ _context27.prev = 32;
2962
3076
  _iterator14.f();
2963
- return _context26.finish(32);
3077
+ return _context27.finish(32);
2964
3078
  case 35:
2965
3079
  notifyEndAt = Date.now();
2966
3080
  this.logInfo('recomputeAndNotifyOrderQuery: 推送完成', {
@@ -2969,9 +3083,9 @@ var Server = /*#__PURE__*/function () {
2969
3083
  });
2970
3084
  case 37:
2971
3085
  case "end":
2972
- return _context26.stop();
3086
+ return _context27.stop();
2973
3087
  }
2974
- }, _callee26, this, [[5, 29, 32, 35], [9, 21]]);
3088
+ }, _callee27, this, [[5, 29, 32, 35], [9, 21]]);
2975
3089
  }));
2976
3090
  function recomputeAndNotifyOrderQuery() {
2977
3091
  return _recomputeAndNotifyOrderQuery.apply(this, arguments);
@@ -2985,67 +3099,67 @@ var Server = /*#__PURE__*/function () {
2985
3099
  }, {
2986
3100
  key: "recomputeAndNotifyBookingQuery",
2987
3101
  value: (function () {
2988
- var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
3102
+ var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2989
3103
  var _iterator15, _step15, _step15$value, subscriberId, subscriber, result, errorMessage;
2990
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2991
- while (1) switch (_context27.prev = _context27.next) {
3104
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3105
+ while (1) switch (_context28.prev = _context28.next) {
2992
3106
  case 0:
2993
3107
  if (!(this.bookingQuerySubscribers.size === 0)) {
2994
- _context27.next = 2;
3108
+ _context28.next = 2;
2995
3109
  break;
2996
3110
  }
2997
- return _context27.abrupt("return");
3111
+ return _context28.abrupt("return");
2998
3112
  case 2:
2999
3113
  this.logInfo('recomputeAndNotifyBookingQuery: 开始推送', {
3000
3114
  subscriberCount: this.bookingQuerySubscribers.size
3001
3115
  });
3002
3116
  _iterator15 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
3003
- _context27.prev = 4;
3117
+ _context28.prev = 4;
3004
3118
  _iterator15.s();
3005
3119
  case 6:
3006
3120
  if ((_step15 = _iterator15.n()).done) {
3007
- _context27.next = 22;
3121
+ _context28.next = 22;
3008
3122
  break;
3009
3123
  }
3010
3124
  _step15$value = _slicedToArray(_step15.value, 2), subscriberId = _step15$value[0], subscriber = _step15$value[1];
3011
- _context27.prev = 8;
3012
- _context27.next = 11;
3125
+ _context28.prev = 8;
3126
+ _context28.next = 11;
3013
3127
  return this.computeBookingQueryResult(subscriber.context);
3014
3128
  case 11:
3015
- result = _context27.sent;
3129
+ result = _context28.sent;
3016
3130
  subscriber.callback(result);
3017
3131
  this.logInfo('recomputeAndNotifyBookingQuery: 已推送', {
3018
3132
  subscriberId: subscriberId
3019
3133
  });
3020
- _context27.next = 20;
3134
+ _context28.next = 20;
3021
3135
  break;
3022
3136
  case 16:
3023
- _context27.prev = 16;
3024
- _context27.t0 = _context27["catch"](8);
3025
- errorMessage = _context27.t0 instanceof Error ? _context27.t0.message : String(_context27.t0);
3137
+ _context28.prev = 16;
3138
+ _context28.t0 = _context28["catch"](8);
3139
+ errorMessage = _context28.t0 instanceof Error ? _context28.t0.message : String(_context28.t0);
3026
3140
  this.logError('recomputeAndNotifyBookingQuery: 推送失败', {
3027
3141
  subscriberId: subscriberId,
3028
3142
  error: errorMessage
3029
3143
  });
3030
3144
  case 20:
3031
- _context27.next = 6;
3145
+ _context28.next = 6;
3032
3146
  break;
3033
3147
  case 22:
3034
- _context27.next = 27;
3148
+ _context28.next = 27;
3035
3149
  break;
3036
3150
  case 24:
3037
- _context27.prev = 24;
3038
- _context27.t1 = _context27["catch"](4);
3039
- _iterator15.e(_context27.t1);
3151
+ _context28.prev = 24;
3152
+ _context28.t1 = _context28["catch"](4);
3153
+ _iterator15.e(_context28.t1);
3040
3154
  case 27:
3041
- _context27.prev = 27;
3155
+ _context28.prev = 27;
3042
3156
  _iterator15.f();
3043
- return _context27.finish(27);
3157
+ return _context28.finish(27);
3044
3158
  case 30:
3045
3159
  case "end":
3046
- return _context27.stop();
3160
+ return _context28.stop();
3047
3161
  }
3048
- }, _callee27, this, [[4, 24, 27, 30], [8, 16]]);
3162
+ }, _callee28, this, [[4, 24, 27, 30], [8, 16]]);
3049
3163
  }));
3050
3164
  function recomputeAndNotifyBookingQuery() {
3051
3165
  return _recomputeAndNotifyBookingQuery.apply(this, arguments);