@pisell/pisellos 2.2.207 → 2.2.208

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.
@@ -3534,10 +3534,41 @@ var Server = /*#__PURE__*/function () {
3534
3534
  };
3535
3535
  }
3536
3536
  }, {
3537
- key: "resolveCheckoutTaskDeviceId",
3538
- value: function resolveCheckoutTaskDeviceId(_data) {
3539
- return this.getAppData('device_id') || 0;
3540
- }
3537
+ key: "getShortNumberOrDeviceId",
3538
+ value: function () {
3539
+ var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
3540
+ var getAsyncIotDeviceInfo, res;
3541
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3542
+ while (1) switch (_context37.prev = _context37.next) {
3543
+ case 0:
3544
+ debugger;
3545
+ getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
3546
+ if (!getAsyncIotDeviceInfo) {
3547
+ _context37.next = 8;
3548
+ break;
3549
+ }
3550
+ _context37.next = 5;
3551
+ return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
3552
+ case 5:
3553
+ res = _context37.sent;
3554
+ if (!res.short_number) {
3555
+ _context37.next = 8;
3556
+ break;
3557
+ }
3558
+ return _context37.abrupt("return", res.short_number);
3559
+ case 8:
3560
+ return _context37.abrupt("return", this.getAppData('device_id') || 0);
3561
+ case 9:
3562
+ case "end":
3563
+ return _context37.stop();
3564
+ }
3565
+ }, _callee37, this);
3566
+ }));
3567
+ function getShortNumberOrDeviceId() {
3568
+ return _getShortNumberOrDeviceId.apply(this, arguments);
3569
+ }
3570
+ return getShortNumberOrDeviceId;
3571
+ }()
3541
3572
  }, {
3542
3573
  key: "buildCheckoutTaskIdempotencyKey",
3543
3574
  value: function buildCheckoutTaskIdempotencyKey(data) {
@@ -3548,79 +3579,79 @@ var Server = /*#__PURE__*/function () {
3548
3579
  }, {
3549
3580
  key: "ensureCheckoutOrderNumbers",
3550
3581
  value: function () {
3551
- var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(data, title) {
3582
+ var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(data, title) {
3552
3583
  var next, needsShopOrderNumber, needsShopFullOrderNumber, idGenerator;
3553
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3554
- while (1) switch (_context37.prev = _context37.next) {
3584
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3585
+ while (1) switch (_context38.prev = _context38.next) {
3555
3586
  case 0:
3556
3587
  if (!(!data || _typeof(data) !== 'object')) {
3557
- _context37.next = 2;
3588
+ _context38.next = 2;
3558
3589
  break;
3559
3590
  }
3560
- return _context37.abrupt("return", data);
3591
+ return _context38.abrupt("return", data);
3561
3592
  case 2:
3562
3593
  next = _objectSpread({}, data);
3563
3594
  needsShopOrderNumber = next.shop_order_number === undefined || next.shop_order_number === null || next.shop_order_number === '';
3564
3595
  needsShopFullOrderNumber = next.shop_full_order_number === undefined || next.shop_full_order_number === null || next.shop_full_order_number === '';
3565
3596
  if (!(!needsShopOrderNumber && !needsShopFullOrderNumber)) {
3566
- _context37.next = 7;
3597
+ _context38.next = 7;
3567
3598
  break;
3568
3599
  }
3569
- return _context37.abrupt("return", next);
3600
+ return _context38.abrupt("return", next);
3570
3601
  case 7:
3571
3602
  idGenerator = this.getIdGeneratorPlugin();
3572
3603
  if (idGenerator) {
3573
- _context37.next = 11;
3604
+ _context38.next = 11;
3574
3605
  break;
3575
3606
  }
3576
3607
  this.logWarning("".concat(title, ": idGenerator \u63D2\u4EF6\u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u751F\u6210\u8BA2\u5355\u53F7"), {
3577
3608
  needsShopOrderNumber: needsShopOrderNumber,
3578
3609
  needsShopFullOrderNumber: needsShopFullOrderNumber
3579
3610
  });
3580
- return _context37.abrupt("return", next);
3611
+ return _context38.abrupt("return", next);
3581
3612
  case 11:
3582
- _context37.prev = 11;
3613
+ _context38.prev = 11;
3583
3614
  if (!(needsShopOrderNumber && idGenerator.generateShopOrderNumber)) {
3584
- _context37.next = 16;
3615
+ _context38.next = 16;
3585
3616
  break;
3586
3617
  }
3587
- _context37.next = 15;
3618
+ _context38.next = 15;
3588
3619
  return idGenerator.generateShopOrderNumber({
3589
3620
  biz: next.business_code || 'ticket'
3590
3621
  });
3591
3622
  case 15:
3592
- next.shop_order_number = _context37.sent;
3623
+ next.shop_order_number = _context38.sent;
3593
3624
  case 16:
3594
3625
  if (!(needsShopFullOrderNumber && idGenerator.generateReceiptId)) {
3595
- _context37.next = 20;
3626
+ _context38.next = 20;
3596
3627
  break;
3597
3628
  }
3598
- _context37.next = 19;
3629
+ _context38.next = 19;
3599
3630
  return idGenerator.generateReceiptId({
3600
3631
  biz: next.business_code || 'ticket'
3601
3632
  });
3602
3633
  case 19:
3603
- next.shop_full_order_number = _context37.sent;
3634
+ next.shop_full_order_number = _context38.sent;
3604
3635
  case 20:
3605
3636
  this.logInfo("".concat(title, ": checkout \u8BA2\u5355\u53F7\u5DF2\u51C6\u5907"), {
3606
3637
  shop_order_number: next.shop_order_number,
3607
3638
  shop_full_order_number: next.shop_full_order_number
3608
3639
  });
3609
- _context37.next = 26;
3640
+ _context38.next = 26;
3610
3641
  break;
3611
3642
  case 23:
3612
- _context37.prev = 23;
3613
- _context37.t0 = _context37["catch"](11);
3643
+ _context38.prev = 23;
3644
+ _context38.t0 = _context38["catch"](11);
3614
3645
  this.logError("".concat(title, ": \u751F\u6210 checkout \u8BA2\u5355\u53F7\u5931\u8D25"), {
3615
- error: _context37.t0 instanceof Error ? _context37.t0.message : String(_context37.t0)
3646
+ error: _context38.t0 instanceof Error ? _context38.t0.message : String(_context38.t0)
3616
3647
  });
3617
3648
  case 26:
3618
- return _context37.abrupt("return", next);
3649
+ return _context38.abrupt("return", next);
3619
3650
  case 27:
3620
3651
  case "end":
3621
- return _context37.stop();
3652
+ return _context38.stop();
3622
3653
  }
3623
- }, _callee37, this, [[11, 23]]);
3654
+ }, _callee38, this, [[11, 23]]);
3624
3655
  }));
3625
3656
  function ensureCheckoutOrderNumbers(_x40, _x41) {
3626
3657
  return _ensureCheckoutOrderNumbers.apply(this, arguments);
@@ -3630,24 +3661,27 @@ var Server = /*#__PURE__*/function () {
3630
3661
  }, {
3631
3662
  key: "dispatchCheckoutSyncTask",
3632
3663
  value: function () {
3633
- var _dispatchCheckoutSyncTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
3664
+ var _dispatchCheckoutSyncTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
3634
3665
  var deviceTask, debugDeviceId, debugIdempotencyKey, _params$data, _params$data2, _params$data3, result;
3635
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3636
- while (1) switch (_context38.prev = _context38.next) {
3666
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3667
+ while (1) switch (_context39.prev = _context39.next) {
3637
3668
  case 0:
3638
3669
  this.registerDeviceTaskActions();
3639
3670
  deviceTask = this.getDeviceTaskPlugin();
3640
- debugDeviceId = this.resolveCheckoutTaskDeviceId(params.data);
3671
+ _context39.next = 4;
3672
+ return this.getShortNumberOrDeviceId();
3673
+ case 4:
3674
+ debugDeviceId = _context39.sent;
3641
3675
  debugIdempotencyKey = this.buildCheckoutTaskIdempotencyKey(params.data);
3642
3676
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
3643
- _context38.next = 7;
3677
+ _context39.next = 9;
3644
3678
  break;
3645
3679
  }
3646
3680
  this.logError("".concat(params.title, ": deviceTask.dispatch \u4E0D\u53EF\u7528"));
3647
- return _context38.abrupt("return");
3648
- case 7:
3649
- _context38.prev = 7;
3650
- _context38.next = 10;
3681
+ return _context39.abrupt("return");
3682
+ case 9:
3683
+ _context39.prev = 9;
3684
+ _context39.next = 12;
3651
3685
  return deviceTask.dispatch({
3652
3686
  action: 'sync_sales',
3653
3687
  device_id: debugDeviceId,
@@ -3663,26 +3697,26 @@ var Server = /*#__PURE__*/function () {
3663
3697
  source_type: 'order',
3664
3698
  source_id: ((_params$data = params.data) === null || _params$data === void 0 ? void 0 : _params$data.order_id) || ((_params$data2 = params.data) === null || _params$data2 === void 0 ? void 0 : _params$data2.external_sale_number) || ((_params$data3 = params.data) === null || _params$data3 === void 0 ? void 0 : _params$data3.shop_order_number)
3665
3699
  });
3666
- case 10:
3667
- result = _context38.sent;
3700
+ case 12:
3701
+ result = _context39.sent;
3668
3702
  this.logInfo("".concat(params.title, ": sync_sales \u4EFB\u52A1\u5DF2\u6D3E\u53D1"), {
3669
3703
  uuid: result === null || result === void 0 ? void 0 : result.uuid,
3670
3704
  status: result === null || result === void 0 ? void 0 : result.status,
3671
3705
  reused: result === null || result === void 0 ? void 0 : result.reused
3672
3706
  });
3673
- _context38.next = 17;
3707
+ _context39.next = 19;
3674
3708
  break;
3675
- case 14:
3676
- _context38.prev = 14;
3677
- _context38.t0 = _context38["catch"](7);
3709
+ case 16:
3710
+ _context39.prev = 16;
3711
+ _context39.t0 = _context39["catch"](9);
3678
3712
  this.logError("".concat(params.title, ": \u6D3E\u53D1 sync_sales \u4EFB\u52A1\u5931\u8D25"), {
3679
- error: _context38.t0 instanceof Error ? _context38.t0.message : String(_context38.t0)
3713
+ error: _context39.t0 instanceof Error ? _context39.t0.message : String(_context39.t0)
3680
3714
  });
3681
- case 17:
3715
+ case 19:
3682
3716
  case "end":
3683
- return _context38.stop();
3717
+ return _context39.stop();
3684
3718
  }
3685
- }, _callee38, this, [[7, 14]]);
3719
+ }, _callee39, this, [[9, 16]]);
3686
3720
  }));
3687
3721
  function dispatchCheckoutSyncTask(_x42) {
3688
3722
  return _dispatchCheckoutSyncTask.apply(this, arguments);
@@ -3692,25 +3726,29 @@ var Server = /*#__PURE__*/function () {
3692
3726
  }, {
3693
3727
  key: "dispatchPrintOtherReceiptTask",
3694
3728
  value: function () {
3695
- var _dispatchPrintOtherReceiptTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
3696
- var deviceTask, _params$deviceId, _params$syncedOrder, _params$syncedOrder2, _params$syncedOrder3, printIdentity;
3697
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3698
- while (1) switch (_context39.prev = _context39.next) {
3729
+ var _dispatchPrintOtherReceiptTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
3730
+ var deviceTask, _params$deviceId, _params$syncedOrder, _params$syncedOrder2, _params$syncedOrder3, printIdentity, deviceId;
3731
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3732
+ while (1) switch (_context40.prev = _context40.next) {
3699
3733
  case 0:
3700
3734
  deviceTask = this.getDeviceTaskPlugin();
3701
3735
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
3702
- _context39.next = 4;
3736
+ _context40.next = 4;
3703
3737
  break;
3704
3738
  }
3705
3739
  this.logWarning('dispatchPrintOtherReceiptTask: deviceTask.dispatch 不可用');
3706
- return _context39.abrupt("return");
3740
+ return _context40.abrupt("return");
3707
3741
  case 4:
3708
- _context39.prev = 4;
3742
+ _context40.prev = 4;
3709
3743
  printIdentity = this.getPrintOrderIdentity(params.syncedOrder);
3710
- _context39.next = 8;
3744
+ _context40.next = 8;
3745
+ return this.getShortNumberOrDeviceId();
3746
+ case 8:
3747
+ deviceId = _context40.sent;
3748
+ _context40.next = 11;
3711
3749
  return deviceTask.dispatch({
3712
3750
  action: 'print_all',
3713
- device_id: (_params$deviceId = params.deviceId) !== null && _params$deviceId !== void 0 ? _params$deviceId : this.resolveCheckoutTaskDeviceId(params.checkoutData),
3751
+ device_id: (_params$deviceId = params.deviceId) !== null && _params$deviceId !== void 0 ? _params$deviceId : deviceId,
3714
3752
  payload: {
3715
3753
  type: params.receiptOnly ? '0' : '99',
3716
3754
  data: params.receiptOnly ? {
@@ -3731,20 +3769,20 @@ var Server = /*#__PURE__*/function () {
3731
3769
  source_type: 'order',
3732
3770
  source_id: printIdentity
3733
3771
  });
3734
- case 8:
3735
- _context39.next = 13;
3772
+ case 11:
3773
+ _context40.next = 16;
3736
3774
  break;
3737
- case 10:
3738
- _context39.prev = 10;
3739
- _context39.t0 = _context39["catch"](4);
3775
+ case 13:
3776
+ _context40.prev = 13;
3777
+ _context40.t0 = _context40["catch"](4);
3740
3778
  this.logError('dispatchPrintOtherReceiptTask: 派发失败', {
3741
- error: _context39.t0 instanceof Error ? _context39.t0.message : String(_context39.t0)
3779
+ error: _context40.t0 instanceof Error ? _context40.t0.message : String(_context40.t0)
3742
3780
  });
3743
- case 13:
3781
+ case 16:
3744
3782
  case "end":
3745
- return _context39.stop();
3783
+ return _context40.stop();
3746
3784
  }
3747
- }, _callee39, this, [[4, 10]]);
3785
+ }, _callee40, this, [[4, 13]]);
3748
3786
  }));
3749
3787
  function dispatchPrintOtherReceiptTask(_x43) {
3750
3788
  return _dispatchPrintOtherReceiptTask.apply(this, arguments);
@@ -3766,37 +3804,37 @@ var Server = /*#__PURE__*/function () {
3766
3804
  }, {
3767
3805
  key: "dispatchLocalReceiptPrint",
3768
3806
  value: function () {
3769
- var _dispatchLocalReceiptPrint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
3807
+ var _dispatchLocalReceiptPrint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
3770
3808
  var _payment_info;
3771
3809
  var printableOrder;
3772
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3773
- while (1) switch (_context40.prev = _context40.next) {
3810
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3811
+ while (1) switch (_context41.prev = _context41.next) {
3774
3812
  case 0:
3775
3813
  if (!(params.requireFullyPaid && !this.isSalesOrderFullyPaid(params.order))) {
3776
- _context40.next = 2;
3814
+ _context41.next = 2;
3777
3815
  break;
3778
3816
  }
3779
- return _context40.abrupt("return", {
3817
+ return _context41.abrupt("return", {
3780
3818
  printed: false,
3781
3819
  order: params.order
3782
3820
  });
3783
3821
  case 2:
3784
- _context40.next = 4;
3822
+ _context41.next = 4;
3785
3823
  return this.withLocalSmallTicketData(params.order, {
3786
3824
  requireFullyPaid: params.requireFullyPaid
3787
3825
  });
3788
3826
  case 4:
3789
- printableOrder = _context40.sent;
3827
+ printableOrder = _context41.sent;
3790
3828
  if (hasSmallTicketData((_payment_info = printableOrder.payment_info) === null || _payment_info === void 0 ? void 0 : _payment_info.small_ticket_data)) {
3791
- _context40.next = 7;
3829
+ _context41.next = 7;
3792
3830
  break;
3793
3831
  }
3794
- return _context40.abrupt("return", {
3832
+ return _context41.abrupt("return", {
3795
3833
  printed: false,
3796
3834
  order: printableOrder
3797
3835
  });
3798
3836
  case 7:
3799
- _context40.next = 9;
3837
+ _context41.next = 9;
3800
3838
  return this.dispatchPrintOtherReceiptTask({
3801
3839
  checkoutData: params.checkoutData,
3802
3840
  syncedOrder: printableOrder,
@@ -3804,15 +3842,15 @@ var Server = /*#__PURE__*/function () {
3804
3842
  receiptOnly: true
3805
3843
  });
3806
3844
  case 9:
3807
- return _context40.abrupt("return", {
3845
+ return _context41.abrupt("return", {
3808
3846
  printed: true,
3809
3847
  order: printableOrder
3810
3848
  });
3811
3849
  case 10:
3812
3850
  case "end":
3813
- return _context40.stop();
3851
+ return _context41.stop();
3814
3852
  }
3815
- }, _callee40, this);
3853
+ }, _callee41, this);
3816
3854
  }));
3817
3855
  function dispatchLocalReceiptPrint(_x44) {
3818
3856
  return _dispatchLocalReceiptPrint.apply(this, arguments);
@@ -3822,10 +3860,10 @@ var Server = /*#__PURE__*/function () {
3822
3860
  }, {
3823
3861
  key: "handleOrderCheckoutSubmit",
3824
3862
  value: function () {
3825
- var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
3863
+ var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
3826
3864
  var backendPath, data, title, checkoutData, pendingResult, pendingOrder;
3827
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3828
- while (1) switch (_context41.prev = _context41.next) {
3865
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3866
+ while (1) switch (_context42.prev = _context42.next) {
3829
3867
  case 0:
3830
3868
  backendPath = params.backendPath, data = params.data, title = params.title;
3831
3869
  this.logInfo("".concat(title, ": \u5F00\u59CB\u5904\u7406"), {
@@ -3834,11 +3872,11 @@ var Server = /*#__PURE__*/function () {
3834
3872
  external_sale_number: data === null || data === void 0 ? void 0 : data.external_sale_number,
3835
3873
  order_number: data === null || data === void 0 ? void 0 : data.order_number
3836
3874
  });
3837
- _context41.next = 4;
3875
+ _context42.next = 4;
3838
3876
  return this.ensureCheckoutOrderNumbers(data, title);
3839
3877
  case 4:
3840
- checkoutData = _context41.sent;
3841
- _context41.next = 7;
3878
+ checkoutData = _context42.sent;
3879
+ _context42.next = 7;
3842
3880
  return this.handlePendingSyncCheckoutOrder({
3843
3881
  backendPath: backendPath,
3844
3882
  data: checkoutData,
@@ -3846,17 +3884,17 @@ var Server = /*#__PURE__*/function () {
3846
3884
  reason: 'checkout 已转入设备任务同步'
3847
3885
  });
3848
3886
  case 7:
3849
- pendingResult = _context41.sent;
3887
+ pendingResult = _context42.sent;
3850
3888
  if (!((pendingResult === null || pendingResult === void 0 ? void 0 : pendingResult.status) === true)) {
3851
- _context41.next = 15;
3889
+ _context42.next = 15;
3852
3890
  break;
3853
3891
  }
3854
3892
  pendingOrder = pendingResult.data;
3855
3893
  if (!(pendingOrder && this.shouldBuildSmallTicketData(checkoutData) && this.isSalesOrderFullyPaid(pendingOrder))) {
3856
- _context41.next = 13;
3894
+ _context42.next = 13;
3857
3895
  break;
3858
3896
  }
3859
- _context41.next = 13;
3897
+ _context42.next = 13;
3860
3898
  return this.dispatchLocalReceiptPrint({
3861
3899
  checkoutData: checkoutData,
3862
3900
  order: pendingOrder,
@@ -3864,19 +3902,19 @@ var Server = /*#__PURE__*/function () {
3864
3902
  requireFullyPaid: true
3865
3903
  });
3866
3904
  case 13:
3867
- _context41.next = 15;
3905
+ _context42.next = 15;
3868
3906
  return this.dispatchCheckoutSyncTask({
3869
3907
  backendPath: backendPath,
3870
3908
  data: checkoutData,
3871
3909
  title: title
3872
3910
  });
3873
3911
  case 15:
3874
- return _context41.abrupt("return", pendingResult);
3912
+ return _context42.abrupt("return", pendingResult);
3875
3913
  case 16:
3876
3914
  case "end":
3877
- return _context41.stop();
3915
+ return _context42.stop();
3878
3916
  }
3879
- }, _callee41, this);
3917
+ }, _callee42, this);
3880
3918
  }));
3881
3919
  function handleOrderCheckoutSubmit(_x45) {
3882
3920
  return _handleOrderCheckoutSubmit.apply(this, arguments);
@@ -3886,25 +3924,25 @@ var Server = /*#__PURE__*/function () {
3886
3924
  }, {
3887
3925
  key: "handlePendingSyncCheckoutOrder",
3888
3926
  value: function () {
3889
- var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
3927
+ var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
3890
3928
  var backendPath, data, title, reason, pendingOrder, errorMessage;
3891
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3892
- while (1) switch (_context42.prev = _context42.next) {
3929
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3930
+ while (1) switch (_context43.prev = _context43.next) {
3893
3931
  case 0:
3894
3932
  backendPath = params.backendPath, data = params.data, title = params.title, reason = params.reason;
3895
- _context42.next = 3;
3933
+ _context43.next = 3;
3896
3934
  return this.buildPendingSyncCheckoutOrder(data);
3897
3935
  case 3:
3898
- pendingOrder = _context42.sent;
3936
+ pendingOrder = _context43.sent;
3899
3937
  if (pendingOrder) {
3900
- _context42.next = 7;
3938
+ _context43.next = 7;
3901
3939
  break;
3902
3940
  }
3903
3941
  this.logError("".concat(title, ": checkout \u5931\u8D25\u4E14\u8BA2\u5355\u7F3A\u5C11\u672C\u5730\u5B58\u50A8\u6807\u8BC6"), {
3904
3942
  backendPath: backendPath,
3905
3943
  reason: reason
3906
3944
  });
3907
- return _context42.abrupt("return", {
3945
+ return _context43.abrupt("return", {
3908
3946
  code: 500,
3909
3947
  status: false,
3910
3948
  message: '订单缺少本地存储标识,无法写入待同步队列',
@@ -3912,22 +3950,22 @@ var Server = /*#__PURE__*/function () {
3912
3950
  });
3913
3951
  case 7:
3914
3952
  if (!(!this.order || typeof this.order.upsertPendingSyncOrders !== 'function')) {
3915
- _context42.next = 10;
3953
+ _context43.next = 10;
3916
3954
  break;
3917
3955
  }
3918
3956
  this.logError("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u5F85\u540C\u6B65\u5199\u5165"), {
3919
3957
  backendPath: backendPath,
3920
3958
  reason: reason
3921
3959
  });
3922
- return _context42.abrupt("return", {
3960
+ return _context43.abrupt("return", {
3923
3961
  code: 500,
3924
3962
  status: false,
3925
3963
  message: 'Order 模块不支持本地待同步写入',
3926
3964
  data: null
3927
3965
  });
3928
3966
  case 10:
3929
- _context42.prev = 10;
3930
- _context42.next = 13;
3967
+ _context43.prev = 10;
3968
+ _context43.next = 13;
3931
3969
  return this.order.upsertPendingSyncOrders([pendingOrder]);
3932
3970
  case 13:
3933
3971
  this.logWarning("".concat(title, ": \u8BA2\u5355\u5DF2\u5199\u5165\u672C\u5730\u5F85\u540C\u6B65"), {
@@ -3937,22 +3975,22 @@ var Server = /*#__PURE__*/function () {
3937
3975
  external_sale_number: pendingOrder.external_sale_number,
3938
3976
  order_number: pendingOrder.order_number
3939
3977
  });
3940
- return _context42.abrupt("return", {
3978
+ return _context43.abrupt("return", {
3941
3979
  code: 200,
3942
3980
  status: true,
3943
3981
  message: '',
3944
3982
  data: pendingOrder
3945
3983
  });
3946
3984
  case 17:
3947
- _context42.prev = 17;
3948
- _context42.t0 = _context42["catch"](10);
3949
- errorMessage = _context42.t0 instanceof Error ? _context42.t0.message : String(_context42.t0);
3985
+ _context43.prev = 17;
3986
+ _context43.t0 = _context43["catch"](10);
3987
+ errorMessage = _context43.t0 instanceof Error ? _context43.t0.message : String(_context43.t0);
3950
3988
  this.logError("".concat(title, ": \u5199\u5165\u672C\u5730\u5F85\u540C\u6B65\u8BA2\u5355\u5931\u8D25"), {
3951
3989
  backendPath: backendPath,
3952
3990
  reason: reason,
3953
3991
  error: errorMessage
3954
3992
  });
3955
- return _context42.abrupt("return", {
3993
+ return _context43.abrupt("return", {
3956
3994
  code: 500,
3957
3995
  status: false,
3958
3996
  message: errorMessage,
@@ -3960,9 +3998,9 @@ var Server = /*#__PURE__*/function () {
3960
3998
  });
3961
3999
  case 22:
3962
4000
  case "end":
3963
- return _context42.stop();
4001
+ return _context43.stop();
3964
4002
  }
3965
- }, _callee42, this, [[10, 17]]);
4003
+ }, _callee43, this, [[10, 17]]);
3966
4004
  }));
3967
4005
  function handlePendingSyncCheckoutOrder(_x46) {
3968
4006
  return _handlePendingSyncCheckoutOrder.apply(this, arguments);
@@ -3972,34 +4010,34 @@ var Server = /*#__PURE__*/function () {
3972
4010
  }, {
3973
4011
  key: "buildPendingSyncCheckoutOrder",
3974
4012
  value: function () {
3975
- var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(data) {
4013
+ var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(data) {
3976
4014
  var hasStorageKey;
3977
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3978
- while (1) switch (_context43.prev = _context43.next) {
4015
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4016
+ while (1) switch (_context44.prev = _context44.next) {
3979
4017
  case 0:
3980
4018
  if (!(!data || _typeof(data) !== 'object')) {
3981
- _context43.next = 2;
4019
+ _context44.next = 2;
3982
4020
  break;
3983
4021
  }
3984
- return _context43.abrupt("return", null);
4022
+ return _context44.abrupt("return", null);
3985
4023
  case 2:
3986
4024
  hasStorageKey = data.external_sale_number !== undefined && data.external_sale_number !== null && data.external_sale_number !== '' ? true : data.order_id !== undefined && data.order_id !== null && data.order_id !== '';
3987
4025
  if (hasStorageKey) {
3988
- _context43.next = 5;
4026
+ _context44.next = 5;
3989
4027
  break;
3990
4028
  }
3991
- return _context43.abrupt("return", null);
4029
+ return _context44.abrupt("return", null);
3992
4030
  case 5:
3993
- return _context43.abrupt("return", this.withLocalSmallTicketData(_objectSpread(_objectSpread({}, data), {}, {
4031
+ return _context44.abrupt("return", this.withLocalSmallTicketData(_objectSpread(_objectSpread({}, data), {}, {
3994
4032
  need_sync: 1
3995
4033
  }), {
3996
4034
  requireFullyPaid: true
3997
4035
  }));
3998
4036
  case 6:
3999
4037
  case "end":
4000
- return _context43.stop();
4038
+ return _context44.stop();
4001
4039
  }
4002
- }, _callee43, this);
4040
+ }, _callee44, this);
4003
4041
  }));
4004
4042
  function buildPendingSyncCheckoutOrder(_x47) {
4005
4043
  return _buildPendingSyncCheckoutOrder.apply(this, arguments);
@@ -4069,12 +4107,12 @@ var Server = /*#__PURE__*/function () {
4069
4107
  }, {
4070
4108
  key: "buildSmallTicketProductMap",
4071
4109
  value: function () {
4072
- var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(order) {
4110
+ var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(order) {
4073
4111
  var _this$products,
4074
4112
  _this11 = this;
4075
4113
  var products, productIds, entries;
4076
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
4077
- while (1) switch (_context45.prev = _context45.next) {
4114
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
4115
+ while (1) switch (_context46.prev = _context46.next) {
4078
4116
  case 0:
4079
4117
  products = Array.isArray(order === null || order === void 0 ? void 0 : order.products) ? order.products : [];
4080
4118
  productIds = Array.from(new Set(products.map(function (product) {
@@ -4084,45 +4122,45 @@ var Server = /*#__PURE__*/function () {
4084
4122
  return id !== undefined && id !== null && id !== '';
4085
4123
  })));
4086
4124
  if (!(!productIds.length || typeof ((_this$products = this.products) === null || _this$products === void 0 ? void 0 : _this$products.getProductById) !== 'function')) {
4087
- _context45.next = 4;
4125
+ _context46.next = 4;
4088
4126
  break;
4089
4127
  }
4090
- return _context45.abrupt("return", {});
4128
+ return _context46.abrupt("return", {});
4091
4129
  case 4:
4092
- _context45.next = 6;
4130
+ _context46.next = 6;
4093
4131
  return Promise.all(productIds.map( /*#__PURE__*/function () {
4094
- var _ref53 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(id) {
4132
+ var _ref53 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(id) {
4095
4133
  var _this11$products, _this11$products$getP, product;
4096
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4097
- while (1) switch (_context44.prev = _context44.next) {
4134
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
4135
+ while (1) switch (_context45.prev = _context45.next) {
4098
4136
  case 0:
4099
- _context44.prev = 0;
4100
- _context44.next = 3;
4137
+ _context45.prev = 0;
4138
+ _context45.next = 3;
4101
4139
  return (_this11$products = _this11.products) === null || _this11$products === void 0 || (_this11$products$getP = _this11$products.getProductById) === null || _this11$products$getP === void 0 ? void 0 : _this11$products$getP.call(_this11$products, Number(id));
4102
4140
  case 3:
4103
- product = _context44.sent;
4104
- return _context44.abrupt("return", product ? [String(id), product] : null);
4141
+ product = _context45.sent;
4142
+ return _context45.abrupt("return", product ? [String(id), product] : null);
4105
4143
  case 7:
4106
- _context44.prev = 7;
4107
- _context44.t0 = _context44["catch"](0);
4144
+ _context45.prev = 7;
4145
+ _context45.t0 = _context45["catch"](0);
4108
4146
  _this11.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
4109
4147
  product_id: id,
4110
- error: _context44.t0 instanceof Error ? _context44.t0.message : String(_context44.t0)
4148
+ error: _context45.t0 instanceof Error ? _context45.t0.message : String(_context45.t0)
4111
4149
  });
4112
- return _context44.abrupt("return", null);
4150
+ return _context45.abrupt("return", null);
4113
4151
  case 11:
4114
4152
  case "end":
4115
- return _context44.stop();
4153
+ return _context45.stop();
4116
4154
  }
4117
- }, _callee44, null, [[0, 7]]);
4155
+ }, _callee45, null, [[0, 7]]);
4118
4156
  }));
4119
4157
  return function (_x49) {
4120
4158
  return _ref53.apply(this, arguments);
4121
4159
  };
4122
4160
  }()));
4123
4161
  case 6:
4124
- entries = _context45.sent;
4125
- return _context45.abrupt("return", entries.reduce(function (map, entry) {
4162
+ entries = _context46.sent;
4163
+ return _context46.abrupt("return", entries.reduce(function (map, entry) {
4126
4164
  if (!entry) return map;
4127
4165
  var _entry = _slicedToArray(entry, 2),
4128
4166
  id = _entry[0],
@@ -4132,9 +4170,9 @@ var Server = /*#__PURE__*/function () {
4132
4170
  }, {}));
4133
4171
  case 8:
4134
4172
  case "end":
4135
- return _context45.stop();
4173
+ return _context46.stop();
4136
4174
  }
4137
- }, _callee45, this);
4175
+ }, _callee46, this);
4138
4176
  }));
4139
4177
  function buildSmallTicketProductMap(_x48) {
4140
4178
  return _buildSmallTicketProductMap.apply(this, arguments);
@@ -4144,50 +4182,50 @@ var Server = /*#__PURE__*/function () {
4144
4182
  }, {
4145
4183
  key: "withLocalSmallTicketData",
4146
4184
  value: function () {
4147
- var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(order, options) {
4185
+ var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(order, options) {
4148
4186
  var productMap, smallTicketData;
4149
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
4150
- while (1) switch (_context46.prev = _context46.next) {
4187
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
4188
+ while (1) switch (_context47.prev = _context47.next) {
4151
4189
  case 0:
4152
4190
  if (this.shouldBuildSmallTicketData(order)) {
4153
- _context46.next = 2;
4191
+ _context47.next = 2;
4154
4192
  break;
4155
4193
  }
4156
- return _context46.abrupt("return", order);
4194
+ return _context47.abrupt("return", order);
4157
4195
  case 2:
4158
4196
  if (!(options !== null && options !== void 0 && options.requireFullyPaid && !this.isSalesOrderFullyPaid(order))) {
4159
- _context46.next = 4;
4197
+ _context47.next = 4;
4160
4198
  break;
4161
4199
  }
4162
- return _context46.abrupt("return", order);
4200
+ return _context47.abrupt("return", order);
4163
4201
  case 4:
4164
- _context46.prev = 4;
4165
- _context46.next = 7;
4202
+ _context47.prev = 4;
4203
+ _context47.next = 7;
4166
4204
  return this.buildSmallTicketProductMap(order);
4167
4205
  case 7:
4168
- productMap = _context46.sent;
4206
+ productMap = _context47.sent;
4169
4207
  smallTicketData = buildSmallTicketData({
4170
4208
  order: order,
4171
4209
  shopInfo: this.getSmallTicketShopInfo(),
4172
4210
  productMap: productMap
4173
4211
  });
4174
- return _context46.abrupt("return", _objectSpread(_objectSpread({}, order), {}, {
4212
+ return _context47.abrupt("return", _objectSpread(_objectSpread({}, order), {}, {
4175
4213
  payment_info: _objectSpread(_objectSpread({}, order.payment_info || {}), {}, {
4176
4214
  small_ticket_data: smallTicketData
4177
4215
  })
4178
4216
  }));
4179
4217
  case 12:
4180
- _context46.prev = 12;
4181
- _context46.t0 = _context46["catch"](4);
4218
+ _context47.prev = 12;
4219
+ _context47.t0 = _context47["catch"](4);
4182
4220
  this.logError('withLocalSmallTicketData: 生成本地小票数据失败', {
4183
- error: _context46.t0 instanceof Error ? _context46.t0.message : String(_context46.t0)
4221
+ error: _context47.t0 instanceof Error ? _context47.t0.message : String(_context47.t0)
4184
4222
  });
4185
- return _context46.abrupt("return", order);
4223
+ return _context47.abrupt("return", order);
4186
4224
  case 16:
4187
4225
  case "end":
4188
- return _context46.stop();
4226
+ return _context47.stop();
4189
4227
  }
4190
- }, _callee46, this, [[4, 12]]);
4228
+ }, _callee47, this, [[4, 12]]);
4191
4229
  }));
4192
4230
  function withLocalSmallTicketData(_x50, _x51) {
4193
4231
  return _withLocalSmallTicketData.apply(this, arguments);
@@ -4251,22 +4289,22 @@ var Server = /*#__PURE__*/function () {
4251
4289
  }, {
4252
4290
  key: "handleUpdateLocalOrdersBatch",
4253
4291
  value: (function () {
4254
- var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(orderIds) {
4292
+ var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(orderIds) {
4255
4293
  var _this$app13;
4256
4294
  var existedBefore, _iterator12, _step12, id, fetched, message, fetchedMap, _iterator13, _step13, order, oid, freshOrders, succeedIds, failed, _iterator14, _step14, _id, fresh, _message2, overwritten, inserted;
4257
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
4258
- while (1) switch (_context47.prev = _context47.next) {
4295
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
4296
+ while (1) switch (_context48.prev = _context48.next) {
4259
4297
  case 0:
4260
4298
  this.logInfo('handleUpdateLocalOrdersBatch: 开始处理', {
4261
4299
  count: orderIds.length,
4262
4300
  orderIds: orderIds
4263
4301
  });
4264
4302
  if (this.order) {
4265
- _context47.next = 4;
4303
+ _context48.next = 4;
4266
4304
  break;
4267
4305
  }
4268
4306
  this.logError('handleUpdateLocalOrdersBatch: Order 模块未注册');
4269
- return _context47.abrupt("return", {
4307
+ return _context48.abrupt("return", {
4270
4308
  code: 500,
4271
4309
  status: false,
4272
4310
  message: 'Order 模块未注册',
@@ -4274,11 +4312,11 @@ var Server = /*#__PURE__*/function () {
4274
4312
  });
4275
4313
  case 4:
4276
4314
  if ((_this$app13 = this.app) !== null && _this$app13 !== void 0 && _this$app13.request) {
4277
- _context47.next = 7;
4315
+ _context48.next = 7;
4278
4316
  break;
4279
4317
  }
4280
4318
  this.logError('handleUpdateLocalOrdersBatch: app.request 不可用');
4281
- return _context47.abrupt("return", {
4319
+ return _context48.abrupt("return", {
4282
4320
  code: 500,
4283
4321
  status: false,
4284
4322
  message: 'app.request 不可用',
@@ -4301,21 +4339,21 @@ var Server = /*#__PURE__*/function () {
4301
4339
  _iterator12.f();
4302
4340
  }
4303
4341
  fetched = [];
4304
- _context47.prev = 11;
4305
- _context47.next = 14;
4342
+ _context48.prev = 11;
4343
+ _context48.next = 14;
4306
4344
  return this.order.fetchOrdersByHttp(orderIds);
4307
4345
  case 14:
4308
- fetched = _context47.sent;
4309
- _context47.next = 22;
4346
+ fetched = _context48.sent;
4347
+ _context48.next = 22;
4310
4348
  break;
4311
4349
  case 17:
4312
- _context47.prev = 17;
4313
- _context47.t0 = _context47["catch"](11);
4314
- message = _context47.t0 instanceof Error ? _context47.t0.message : String(_context47.t0);
4350
+ _context48.prev = 17;
4351
+ _context48.t0 = _context48["catch"](11);
4352
+ message = _context48.t0 instanceof Error ? _context48.t0.message : String(_context48.t0);
4315
4353
  this.logError('handleUpdateLocalOrdersBatch: 批量拉取失败', {
4316
4354
  message: message
4317
4355
  });
4318
- return _context47.abrupt("return", {
4356
+ return _context48.abrupt("return", {
4319
4357
  code: 500,
4320
4358
  status: false,
4321
4359
  message: message,
@@ -4325,36 +4363,36 @@ var Server = /*#__PURE__*/function () {
4325
4363
  // 按返回结果中的 order_id 建索引,未命中即视为单笔失败
4326
4364
  fetchedMap = new Map();
4327
4365
  _iterator13 = _createForOfIteratorHelper(fetched);
4328
- _context47.prev = 24;
4366
+ _context48.prev = 24;
4329
4367
  _iterator13.s();
4330
4368
  case 26:
4331
4369
  if ((_step13 = _iterator13.n()).done) {
4332
- _context47.next = 34;
4370
+ _context48.next = 34;
4333
4371
  break;
4334
4372
  }
4335
4373
  order = _step13.value;
4336
4374
  oid = order === null || order === void 0 ? void 0 : order.order_id;
4337
4375
  if (!(oid === undefined || oid === null)) {
4338
- _context47.next = 31;
4376
+ _context48.next = 31;
4339
4377
  break;
4340
4378
  }
4341
- return _context47.abrupt("continue", 32);
4379
+ return _context48.abrupt("continue", 32);
4342
4380
  case 31:
4343
4381
  fetchedMap.set(String(oid), order);
4344
4382
  case 32:
4345
- _context47.next = 26;
4383
+ _context48.next = 26;
4346
4384
  break;
4347
4385
  case 34:
4348
- _context47.next = 39;
4386
+ _context48.next = 39;
4349
4387
  break;
4350
4388
  case 36:
4351
- _context47.prev = 36;
4352
- _context47.t1 = _context47["catch"](24);
4353
- _iterator13.e(_context47.t1);
4389
+ _context48.prev = 36;
4390
+ _context48.t1 = _context48["catch"](24);
4391
+ _iterator13.e(_context48.t1);
4354
4392
  case 39:
4355
- _context47.prev = 39;
4393
+ _context48.prev = 39;
4356
4394
  _iterator13.f();
4357
- return _context47.finish(39);
4395
+ return _context48.finish(39);
4358
4396
  case 42:
4359
4397
  freshOrders = [];
4360
4398
  succeedIds = [];
@@ -4380,23 +4418,23 @@ var Server = /*#__PURE__*/function () {
4380
4418
  _iterator14.f();
4381
4419
  }
4382
4420
  if (!(freshOrders.length > 0)) {
4383
- _context47.next = 58;
4421
+ _context48.next = 58;
4384
4422
  break;
4385
4423
  }
4386
- _context47.prev = 48;
4387
- _context47.next = 51;
4424
+ _context48.prev = 48;
4425
+ _context48.next = 51;
4388
4426
  return this.order.upsertOrdersFromRemote(freshOrders);
4389
4427
  case 51:
4390
- _context47.next = 58;
4428
+ _context48.next = 58;
4391
4429
  break;
4392
4430
  case 53:
4393
- _context47.prev = 53;
4394
- _context47.t2 = _context47["catch"](48);
4395
- _message2 = _context47.t2 instanceof Error ? _context47.t2.message : String(_context47.t2);
4431
+ _context48.prev = 53;
4432
+ _context48.t2 = _context48["catch"](48);
4433
+ _message2 = _context48.t2 instanceof Error ? _context48.t2.message : String(_context48.t2);
4396
4434
  this.logError('handleUpdateLocalOrdersBatch: 合并写入失败', {
4397
4435
  message: _message2
4398
4436
  });
4399
- return _context47.abrupt("return", {
4437
+ return _context48.abrupt("return", {
4400
4438
  code: 500,
4401
4439
  status: false,
4402
4440
  message: _message2,
@@ -4415,7 +4453,7 @@ var Server = /*#__PURE__*/function () {
4415
4453
  insertedCount: inserted.length,
4416
4454
  failedCount: failed.length
4417
4455
  });
4418
- return _context47.abrupt("return", {
4456
+ return _context48.abrupt("return", {
4419
4457
  code: 200,
4420
4458
  status: true,
4421
4459
  message: '',
@@ -4427,9 +4465,9 @@ var Server = /*#__PURE__*/function () {
4427
4465
  });
4428
4466
  case 62:
4429
4467
  case "end":
4430
- return _context47.stop();
4468
+ return _context48.stop();
4431
4469
  }
4432
- }, _callee47, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
4470
+ }, _callee48, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
4433
4471
  }));
4434
4472
  function handleUpdateLocalOrdersBatch(_x52) {
4435
4473
  return _handleUpdateLocalOrdersBatch.apply(this, arguments);
@@ -4668,16 +4706,16 @@ var Server = /*#__PURE__*/function () {
4668
4706
  }, {
4669
4707
  key: "recomputeAndNotifyFloorPlanQuery",
4670
4708
  value: (function () {
4671
- var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48() {
4709
+ var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49() {
4672
4710
  var _iterator16, _step16, _step16$value, subscriberId, sub, result, errorMessage;
4673
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
4674
- while (1) switch (_context48.prev = _context48.next) {
4711
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
4712
+ while (1) switch (_context49.prev = _context49.next) {
4675
4713
  case 0:
4676
4714
  if (!(this.floorPlanQuerySubscribers.size === 0)) {
4677
- _context48.next = 2;
4715
+ _context49.next = 2;
4678
4716
  break;
4679
4717
  }
4680
- return _context48.abrupt("return");
4718
+ return _context49.abrupt("return");
4681
4719
  case 2:
4682
4720
  this.logInfo('recomputeAndNotifyFloorPlanQuery: 开始推送', {
4683
4721
  subscriberCount: this.floorPlanQuerySubscribers.size
@@ -4707,9 +4745,9 @@ var Server = /*#__PURE__*/function () {
4707
4745
  }
4708
4746
  case 5:
4709
4747
  case "end":
4710
- return _context48.stop();
4748
+ return _context49.stop();
4711
4749
  }
4712
- }, _callee48, this);
4750
+ }, _callee49, this);
4713
4751
  }));
4714
4752
  function recomputeAndNotifyFloorPlanQuery() {
4715
4753
  return _recomputeAndNotifyFloorPlanQuery.apply(this, arguments);
@@ -4739,21 +4777,21 @@ var Server = /*#__PURE__*/function () {
4739
4777
  * filter 逻辑暂为 mock,仅记录参数
4740
4778
  */
4741
4779
  function () {
4742
- var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(data) {
4780
+ var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(data) {
4743
4781
  var rawList, result;
4744
- return _regeneratorRuntime().wrap(function _callee49$(_context49) {
4745
- while (1) switch (_context49.prev = _context49.next) {
4782
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
4783
+ while (1) switch (_context50.prev = _context50.next) {
4746
4784
  case 0:
4747
4785
  this.logInfo('computeOrderQueryResult: 开始过滤', {
4748
4786
  data: data
4749
4787
  });
4750
4788
  console.log('[Server] computeOrderQueryResult', data);
4751
4789
  if (this.order) {
4752
- _context49.next = 5;
4790
+ _context50.next = 5;
4753
4791
  break;
4754
4792
  }
4755
4793
  this.logError('computeOrderQueryResult: Order 模块未注册');
4756
- return _context49.abrupt("return", {
4794
+ return _context50.abrupt("return", {
4757
4795
  code: 500,
4758
4796
  message: 'Order 模块未注册',
4759
4797
  data: {
@@ -4777,7 +4815,7 @@ var Server = /*#__PURE__*/function () {
4777
4815
  skip: result.skip,
4778
4816
  rejected: result.rejected
4779
4817
  });
4780
- return _context49.abrupt("return", {
4818
+ return _context50.abrupt("return", {
4781
4819
  code: 200,
4782
4820
  data: result,
4783
4821
  message: '',
@@ -4785,9 +4823,9 @@ var Server = /*#__PURE__*/function () {
4785
4823
  });
4786
4824
  case 10:
4787
4825
  case "end":
4788
- return _context49.stop();
4826
+ return _context50.stop();
4789
4827
  }
4790
- }, _callee49, this);
4828
+ }, _callee50, this);
4791
4829
  }));
4792
4830
  function computeOrderQueryResult(_x53) {
4793
4831
  return _computeOrderQueryResult.apply(this, arguments);
@@ -4802,17 +4840,17 @@ var Server = /*#__PURE__*/function () {
4802
4840
  }, {
4803
4841
  key: "computeBookingQueryResult",
4804
4842
  value: (function () {
4805
- var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(data) {
4843
+ var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(data) {
4806
4844
  var rawOrders, result;
4807
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
4808
- while (1) switch (_context50.prev = _context50.next) {
4845
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
4846
+ while (1) switch (_context51.prev = _context51.next) {
4809
4847
  case 0:
4810
4848
  if (this.order) {
4811
- _context50.next = 3;
4849
+ _context51.next = 3;
4812
4850
  break;
4813
4851
  }
4814
4852
  this.logError('computeBookingQueryResult: Order 模块未注册');
4815
- return _context50.abrupt("return", {
4853
+ return _context51.abrupt("return", {
4816
4854
  code: 500,
4817
4855
  message: 'Order 模块未注册',
4818
4856
  data: {
@@ -4831,7 +4869,7 @@ var Server = /*#__PURE__*/function () {
4831
4869
  size: result.size,
4832
4870
  skip: result.skip
4833
4871
  });
4834
- return _context50.abrupt("return", {
4872
+ return _context51.abrupt("return", {
4835
4873
  code: 200,
4836
4874
  data: result,
4837
4875
  message: '',
@@ -4839,9 +4877,9 @@ var Server = /*#__PURE__*/function () {
4839
4877
  });
4840
4878
  case 8:
4841
4879
  case "end":
4842
- return _context50.stop();
4880
+ return _context51.stop();
4843
4881
  }
4844
- }, _callee50, this);
4882
+ }, _callee51, this);
4845
4883
  }));
4846
4884
  function computeBookingQueryResult(_x54) {
4847
4885
  return _computeBookingQueryResult.apply(this, arguments);
@@ -4859,12 +4897,12 @@ var Server = /*#__PURE__*/function () {
4859
4897
  }, {
4860
4898
  key: "computeProductQueryResult",
4861
4899
  value: (function () {
4862
- var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(context, options) {
4900
+ var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(context, options) {
4863
4901
  var _menu_list_ids$length3,
4864
4902
  _this13 = this;
4865
4903
  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;
4866
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
4867
- while (1) switch (_context51.prev = _context51.next) {
4904
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
4905
+ while (1) switch (_context52.prev = _context52.next) {
4868
4906
  case 0:
4869
4907
  tTotal = performance.now();
4870
4908
  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;
@@ -4883,11 +4921,11 @@ var Server = /*#__PURE__*/function () {
4883
4921
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
4884
4922
  });
4885
4923
  if (this.products) {
4886
- _context51.next = 7;
4924
+ _context52.next = 7;
4887
4925
  break;
4888
4926
  }
4889
4927
  this.logError('computeProductQueryResult: Products 模块未注册');
4890
- return _context51.abrupt("return", {
4928
+ return _context52.abrupt("return", {
4891
4929
  message: 'Products 模块未注册',
4892
4930
  data: {
4893
4931
  list: [],
@@ -4896,12 +4934,12 @@ var Server = /*#__PURE__*/function () {
4896
4934
  });
4897
4935
  case 7:
4898
4936
  if (!(queryIds.length > 0)) {
4899
- _context51.next = 18;
4937
+ _context52.next = 18;
4900
4938
  break;
4901
4939
  }
4902
4940
  uniqueIds = Array.from(new Set(queryIds));
4903
4941
  _tPrice = performance.now();
4904
- _context51.next = 12;
4942
+ _context52.next = 12;
4905
4943
  return this.products.getProductsWithPrice(schedule_date, {
4906
4944
  scheduleModule: this.getSchedule(),
4907
4945
  schedule_datetime: schedule_datetime,
@@ -4911,7 +4949,7 @@ var Server = /*#__PURE__*/function () {
4911
4949
  productIds: uniqueIds
4912
4950
  });
4913
4951
  case 12:
4914
- productsWithPrice = _context51.sent;
4952
+ productsWithPrice = _context52.sent;
4915
4953
  perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
4916
4954
  count: productsWithPrice.length,
4917
4955
  ids: uniqueIds
@@ -4930,7 +4968,7 @@ var Server = /*#__PURE__*/function () {
4930
4968
  ids: uniqueIds,
4931
4969
  count: _filteredProducts.length
4932
4970
  });
4933
- return _context51.abrupt("return", {
4971
+ return _context52.abrupt("return", {
4934
4972
  code: 200,
4935
4973
  data: {
4936
4974
  list: _filteredProducts,
@@ -4941,19 +4979,19 @@ var Server = /*#__PURE__*/function () {
4941
4979
  });
4942
4980
  case 18:
4943
4981
  if (!(product_id != null && Number.isFinite(Number(product_id)))) {
4944
- _context51.next = 30;
4982
+ _context52.next = 30;
4945
4983
  break;
4946
4984
  }
4947
4985
  pid = Number(product_id);
4948
4986
  _tPrice2 = performance.now();
4949
- _context51.next = 23;
4987
+ _context52.next = 23;
4950
4988
  return this.products.getProductsWithPrice(schedule_date, {
4951
4989
  scheduleModule: this.getSchedule()
4952
4990
  }, {
4953
4991
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
4954
4992
  });
4955
4993
  case 23:
4956
- allProductsWithPrice = _context51.sent;
4994
+ allProductsWithPrice = _context52.sent;
4957
4995
  perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
4958
4996
  count: allProductsWithPrice.length,
4959
4997
  productId: pid
@@ -4973,7 +5011,7 @@ var Server = /*#__PURE__*/function () {
4973
5011
  productId: pid,
4974
5012
  found: !!item
4975
5013
  });
4976
- return _context51.abrupt("return", {
5014
+ return _context52.abrupt("return", {
4977
5015
  code: 200,
4978
5016
  data: item,
4979
5017
  message: item ? '' : '商品不存在或未发布',
@@ -4981,11 +5019,11 @@ var Server = /*#__PURE__*/function () {
4981
5019
  });
4982
5020
  case 30:
4983
5021
  if (this.menu) {
4984
- _context51.next = 33;
5022
+ _context52.next = 33;
4985
5023
  break;
4986
5024
  }
4987
5025
  this.logError('computeProductQueryResult: Menu 模块未注册');
4988
- return _context51.abrupt("return", {
5026
+ return _context52.abrupt("return", {
4989
5027
  message: 'Menu 模块未注册',
4990
5028
  data: {
4991
5029
  list: [],
@@ -4994,11 +5032,11 @@ var Server = /*#__PURE__*/function () {
4994
5032
  });
4995
5033
  case 33:
4996
5034
  if (this.schedule) {
4997
- _context51.next = 36;
5035
+ _context52.next = 36;
4998
5036
  break;
4999
5037
  }
5000
5038
  this.logError('computeProductQueryResult: Schedule 模块未注册');
5001
- return _context51.abrupt("return", {
5039
+ return _context52.abrupt("return", {
5002
5040
  message: 'Schedule 模块未注册',
5003
5041
  data: {
5004
5042
  list: [],
@@ -5029,10 +5067,10 @@ var Server = /*#__PURE__*/function () {
5029
5067
  });
5030
5068
  tPrice = performance.now();
5031
5069
  if (!(scopedProductIds.length > 0)) {
5032
- _context51.next = 49;
5070
+ _context52.next = 49;
5033
5071
  break;
5034
5072
  }
5035
- _context51.next = 46;
5073
+ _context52.next = 46;
5036
5074
  return this.products.getProductsWithPrice(schedule_date, {
5037
5075
  scheduleModule: this.getSchedule(),
5038
5076
  schedule_datetime: schedule_datetime,
@@ -5042,13 +5080,13 @@ var Server = /*#__PURE__*/function () {
5042
5080
  productIds: productScope.isAllProducts ? undefined : scopedProductIds
5043
5081
  });
5044
5082
  case 46:
5045
- _context51.t0 = _context51.sent;
5046
- _context51.next = 50;
5083
+ _context52.t0 = _context52.sent;
5084
+ _context52.next = 50;
5047
5085
  break;
5048
5086
  case 49:
5049
- _context51.t0 = [];
5087
+ _context52.t0 = [];
5050
5088
  case 50:
5051
- filteredProducts = _context51.t0;
5089
+ filteredProducts = _context52.t0;
5052
5090
  perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
5053
5091
  count: filteredProducts.length,
5054
5092
  scopedProductCount: scopedProductIds.length
@@ -5081,7 +5119,7 @@ var Server = /*#__PURE__*/function () {
5081
5119
  filteredCount: filteredProducts.length,
5082
5120
  activeMenuCount: activeMenuList.length
5083
5121
  });
5084
- return _context51.abrupt("return", {
5122
+ return _context52.abrupt("return", {
5085
5123
  code: 200,
5086
5124
  data: {
5087
5125
  list: filteredProducts,
@@ -5092,9 +5130,9 @@ var Server = /*#__PURE__*/function () {
5092
5130
  });
5093
5131
  case 62:
5094
5132
  case "end":
5095
- return _context51.stop();
5133
+ return _context52.stop();
5096
5134
  }
5097
- }, _callee51, this);
5135
+ }, _callee52, this);
5098
5136
  }));
5099
5137
  function computeProductQueryResult(_x55, _x56) {
5100
5138
  return _computeProductQueryResult.apply(this, arguments);
@@ -5111,70 +5149,70 @@ var Server = /*#__PURE__*/function () {
5111
5149
  }, {
5112
5150
  key: "recomputeAndNotifyProductQuery",
5113
5151
  value: (function () {
5114
- var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(options) {
5152
+ var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(options) {
5115
5153
  var _iterator17, _step17, _step17$value, subscriberId, subscriber, result, errorMessage;
5116
- return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5117
- while (1) switch (_context52.prev = _context52.next) {
5154
+ return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5155
+ while (1) switch (_context53.prev = _context53.next) {
5118
5156
  case 0:
5119
5157
  if (!(this.productQuerySubscribers.size === 0)) {
5120
- _context52.next = 2;
5158
+ _context53.next = 2;
5121
5159
  break;
5122
5160
  }
5123
- return _context52.abrupt("return");
5161
+ return _context53.abrupt("return");
5124
5162
  case 2:
5125
5163
  this.logInfo('recomputeAndNotifyProductQuery: 开始推送', {
5126
5164
  subscriberCount: this.productQuerySubscribers.size,
5127
5165
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
5128
5166
  });
5129
5167
  _iterator17 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
5130
- _context52.prev = 4;
5168
+ _context53.prev = 4;
5131
5169
  _iterator17.s();
5132
5170
  case 6:
5133
5171
  if ((_step17 = _iterator17.n()).done) {
5134
- _context52.next = 22;
5172
+ _context53.next = 22;
5135
5173
  break;
5136
5174
  }
5137
5175
  _step17$value = _slicedToArray(_step17.value, 2), subscriberId = _step17$value[0], subscriber = _step17$value[1];
5138
- _context52.prev = 8;
5139
- _context52.next = 11;
5176
+ _context53.prev = 8;
5177
+ _context53.next = 11;
5140
5178
  return this.computeProductQueryResult(subscriber.context, {
5141
5179
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
5142
5180
  });
5143
5181
  case 11:
5144
- result = _context52.sent;
5182
+ result = _context53.sent;
5145
5183
  subscriber.callback(result);
5146
5184
  this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
5147
5185
  subscriberId: subscriberId
5148
5186
  });
5149
- _context52.next = 20;
5187
+ _context53.next = 20;
5150
5188
  break;
5151
5189
  case 16:
5152
- _context52.prev = 16;
5153
- _context52.t0 = _context52["catch"](8);
5154
- errorMessage = _context52.t0 instanceof Error ? _context52.t0.message : String(_context52.t0);
5190
+ _context53.prev = 16;
5191
+ _context53.t0 = _context53["catch"](8);
5192
+ errorMessage = _context53.t0 instanceof Error ? _context53.t0.message : String(_context53.t0);
5155
5193
  this.logError('recomputeAndNotifyProductQuery: 推送失败', {
5156
5194
  subscriberId: subscriberId,
5157
5195
  error: errorMessage
5158
5196
  });
5159
5197
  case 20:
5160
- _context52.next = 6;
5198
+ _context53.next = 6;
5161
5199
  break;
5162
5200
  case 22:
5163
- _context52.next = 27;
5201
+ _context53.next = 27;
5164
5202
  break;
5165
5203
  case 24:
5166
- _context52.prev = 24;
5167
- _context52.t1 = _context52["catch"](4);
5168
- _iterator17.e(_context52.t1);
5204
+ _context53.prev = 24;
5205
+ _context53.t1 = _context53["catch"](4);
5206
+ _iterator17.e(_context53.t1);
5169
5207
  case 27:
5170
- _context52.prev = 27;
5208
+ _context53.prev = 27;
5171
5209
  _iterator17.f();
5172
- return _context52.finish(27);
5210
+ return _context53.finish(27);
5173
5211
  case 30:
5174
5212
  case "end":
5175
- return _context52.stop();
5213
+ return _context53.stop();
5176
5214
  }
5177
- }, _callee52, this, [[4, 24, 27, 30], [8, 16]]);
5215
+ }, _callee53, this, [[4, 24, 27, 30], [8, 16]]);
5178
5216
  }));
5179
5217
  function recomputeAndNotifyProductQuery(_x57) {
5180
5218
  return _recomputeAndNotifyProductQuery.apply(this, arguments);
@@ -5188,16 +5226,16 @@ var Server = /*#__PURE__*/function () {
5188
5226
  }, {
5189
5227
  key: "recomputeAndNotifyOrderQuery",
5190
5228
  value: (function () {
5191
- var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53() {
5229
+ var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54() {
5192
5230
  var notifyStartAt, _iterator18, _step18, _step18$value, subscriberId, subscriber, computeStartAt, result, computeEndAt, callbackStartAt, callbackEndAt, errorMessage, notifyEndAt;
5193
- return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5194
- while (1) switch (_context53.prev = _context53.next) {
5231
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5232
+ while (1) switch (_context54.prev = _context54.next) {
5195
5233
  case 0:
5196
5234
  if (!(this.orderQuerySubscribers.size === 0)) {
5197
- _context53.next = 2;
5235
+ _context54.next = 2;
5198
5236
  break;
5199
5237
  }
5200
- return _context53.abrupt("return");
5238
+ return _context54.abrupt("return");
5201
5239
  case 2:
5202
5240
  notifyStartAt = Date.now();
5203
5241
  this.logInfo('recomputeAndNotifyOrderQuery: 开始推送', {
@@ -5205,20 +5243,20 @@ var Server = /*#__PURE__*/function () {
5205
5243
  notifyStartAt: new Date(notifyStartAt).toISOString()
5206
5244
  });
5207
5245
  _iterator18 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
5208
- _context53.prev = 5;
5246
+ _context54.prev = 5;
5209
5247
  _iterator18.s();
5210
5248
  case 7:
5211
5249
  if ((_step18 = _iterator18.n()).done) {
5212
- _context53.next = 27;
5250
+ _context54.next = 27;
5213
5251
  break;
5214
5252
  }
5215
5253
  _step18$value = _slicedToArray(_step18.value, 2), subscriberId = _step18$value[0], subscriber = _step18$value[1];
5216
- _context53.prev = 9;
5254
+ _context54.prev = 9;
5217
5255
  computeStartAt = Date.now();
5218
- _context53.next = 13;
5256
+ _context54.next = 13;
5219
5257
  return this.computeOrderQueryResult(subscriber.context);
5220
5258
  case 13:
5221
- result = _context53.sent;
5259
+ result = _context54.sent;
5222
5260
  computeEndAt = Date.now();
5223
5261
  callbackStartAt = Date.now();
5224
5262
  subscriber.callback(result);
@@ -5229,30 +5267,30 @@ var Server = /*#__PURE__*/function () {
5229
5267
  callbackDurationMs: callbackEndAt - callbackStartAt,
5230
5268
  totalDurationMs: callbackEndAt - computeStartAt
5231
5269
  });
5232
- _context53.next = 25;
5270
+ _context54.next = 25;
5233
5271
  break;
5234
5272
  case 21:
5235
- _context53.prev = 21;
5236
- _context53.t0 = _context53["catch"](9);
5237
- errorMessage = _context53.t0 instanceof Error ? _context53.t0.message : String(_context53.t0);
5273
+ _context54.prev = 21;
5274
+ _context54.t0 = _context54["catch"](9);
5275
+ errorMessage = _context54.t0 instanceof Error ? _context54.t0.message : String(_context54.t0);
5238
5276
  this.logError('recomputeAndNotifyOrderQuery: 推送失败', {
5239
5277
  subscriberId: subscriberId,
5240
5278
  error: errorMessage
5241
5279
  });
5242
5280
  case 25:
5243
- _context53.next = 7;
5281
+ _context54.next = 7;
5244
5282
  break;
5245
5283
  case 27:
5246
- _context53.next = 32;
5284
+ _context54.next = 32;
5247
5285
  break;
5248
5286
  case 29:
5249
- _context53.prev = 29;
5250
- _context53.t1 = _context53["catch"](5);
5251
- _iterator18.e(_context53.t1);
5287
+ _context54.prev = 29;
5288
+ _context54.t1 = _context54["catch"](5);
5289
+ _iterator18.e(_context54.t1);
5252
5290
  case 32:
5253
- _context53.prev = 32;
5291
+ _context54.prev = 32;
5254
5292
  _iterator18.f();
5255
- return _context53.finish(32);
5293
+ return _context54.finish(32);
5256
5294
  case 35:
5257
5295
  notifyEndAt = Date.now();
5258
5296
  this.logInfo('recomputeAndNotifyOrderQuery: 推送完成', {
@@ -5261,9 +5299,9 @@ var Server = /*#__PURE__*/function () {
5261
5299
  });
5262
5300
  case 37:
5263
5301
  case "end":
5264
- return _context53.stop();
5302
+ return _context54.stop();
5265
5303
  }
5266
- }, _callee53, this, [[5, 29, 32, 35], [9, 21]]);
5304
+ }, _callee54, this, [[5, 29, 32, 35], [9, 21]]);
5267
5305
  }));
5268
5306
  function recomputeAndNotifyOrderQuery() {
5269
5307
  return _recomputeAndNotifyOrderQuery.apply(this, arguments);
@@ -5401,67 +5439,67 @@ var Server = /*#__PURE__*/function () {
5401
5439
  }, {
5402
5440
  key: "recomputeAndNotifyBookingQuery",
5403
5441
  value: (function () {
5404
- var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54() {
5442
+ var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55() {
5405
5443
  var _iterator20, _step20, _step20$value, subscriberId, subscriber, result, errorMessage;
5406
- return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5407
- while (1) switch (_context54.prev = _context54.next) {
5444
+ return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5445
+ while (1) switch (_context55.prev = _context55.next) {
5408
5446
  case 0:
5409
5447
  if (!(this.bookingQuerySubscribers.size === 0)) {
5410
- _context54.next = 2;
5448
+ _context55.next = 2;
5411
5449
  break;
5412
5450
  }
5413
- return _context54.abrupt("return");
5451
+ return _context55.abrupt("return");
5414
5452
  case 2:
5415
5453
  this.logInfo('recomputeAndNotifyBookingQuery: 开始推送', {
5416
5454
  subscriberCount: this.bookingQuerySubscribers.size
5417
5455
  });
5418
5456
  _iterator20 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
5419
- _context54.prev = 4;
5457
+ _context55.prev = 4;
5420
5458
  _iterator20.s();
5421
5459
  case 6:
5422
5460
  if ((_step20 = _iterator20.n()).done) {
5423
- _context54.next = 22;
5461
+ _context55.next = 22;
5424
5462
  break;
5425
5463
  }
5426
5464
  _step20$value = _slicedToArray(_step20.value, 2), subscriberId = _step20$value[0], subscriber = _step20$value[1];
5427
- _context54.prev = 8;
5428
- _context54.next = 11;
5465
+ _context55.prev = 8;
5466
+ _context55.next = 11;
5429
5467
  return this.computeBookingQueryResult(subscriber.context);
5430
5468
  case 11:
5431
- result = _context54.sent;
5469
+ result = _context55.sent;
5432
5470
  subscriber.callback(result);
5433
5471
  this.logInfo('recomputeAndNotifyBookingQuery: 已推送', {
5434
5472
  subscriberId: subscriberId
5435
5473
  });
5436
- _context54.next = 20;
5474
+ _context55.next = 20;
5437
5475
  break;
5438
5476
  case 16:
5439
- _context54.prev = 16;
5440
- _context54.t0 = _context54["catch"](8);
5441
- errorMessage = _context54.t0 instanceof Error ? _context54.t0.message : String(_context54.t0);
5477
+ _context55.prev = 16;
5478
+ _context55.t0 = _context55["catch"](8);
5479
+ errorMessage = _context55.t0 instanceof Error ? _context55.t0.message : String(_context55.t0);
5442
5480
  this.logError('recomputeAndNotifyBookingQuery: 推送失败', {
5443
5481
  subscriberId: subscriberId,
5444
5482
  error: errorMessage
5445
5483
  });
5446
5484
  case 20:
5447
- _context54.next = 6;
5485
+ _context55.next = 6;
5448
5486
  break;
5449
5487
  case 22:
5450
- _context54.next = 27;
5488
+ _context55.next = 27;
5451
5489
  break;
5452
5490
  case 24:
5453
- _context54.prev = 24;
5454
- _context54.t1 = _context54["catch"](4);
5455
- _iterator20.e(_context54.t1);
5491
+ _context55.prev = 24;
5492
+ _context55.t1 = _context55["catch"](4);
5493
+ _iterator20.e(_context55.t1);
5456
5494
  case 27:
5457
- _context54.prev = 27;
5495
+ _context55.prev = 27;
5458
5496
  _iterator20.f();
5459
- return _context54.finish(27);
5497
+ return _context55.finish(27);
5460
5498
  case 30:
5461
5499
  case "end":
5462
- return _context54.stop();
5500
+ return _context55.stop();
5463
5501
  }
5464
- }, _callee54, this, [[4, 24, 27, 30], [8, 16]]);
5502
+ }, _callee55, this, [[4, 24, 27, 30], [8, 16]]);
5465
5503
  }));
5466
5504
  function recomputeAndNotifyBookingQuery() {
5467
5505
  return _recomputeAndNotifyBookingQuery.apply(this, arguments);