@pisell/pisellos 2.2.207 → 2.2.209

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