@pisell/pisellos 2.3.73 → 2.3.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/core/index.d.ts +7 -0
  2. package/dist/core/index.js +109 -65
  3. package/dist/modules/Order/index.d.ts +1 -1
  4. package/dist/modules/Quotation/index.d.ts +6 -0
  5. package/dist/modules/Quotation/index.js +75 -19
  6. package/dist/plugins/request.d.ts +1 -0
  7. package/dist/server/index.d.ts +8 -2
  8. package/dist/server/index.js +206 -140
  9. package/dist/server/modules/floor-plan/index.d.ts +4 -0
  10. package/dist/server/modules/floor-plan/index.js +240 -98
  11. package/dist/server/modules/menu/index.js +48 -23
  12. package/dist/server/modules/order/index.d.ts +17 -7
  13. package/dist/server/modules/order/index.js +419 -207
  14. package/dist/server/modules/products/index.d.ts +8 -2
  15. package/dist/server/modules/products/index.js +167 -75
  16. package/dist/server/modules/resource/index.js +21 -13
  17. package/dist/solution/BookingByStep/index.d.ts +1 -1
  18. package/lib/core/index.d.ts +7 -0
  19. package/lib/core/index.js +20 -2
  20. package/lib/modules/Order/index.d.ts +1 -1
  21. package/lib/modules/Quotation/index.d.ts +6 -0
  22. package/lib/modules/Quotation/index.js +49 -5
  23. package/lib/plugins/request.d.ts +1 -0
  24. package/lib/server/index.d.ts +8 -2
  25. package/lib/server/index.js +52 -17
  26. package/lib/server/modules/floor-plan/index.d.ts +4 -0
  27. package/lib/server/modules/floor-plan/index.js +54 -6
  28. package/lib/server/modules/menu/index.js +31 -5
  29. package/lib/server/modules/order/index.d.ts +17 -7
  30. package/lib/server/modules/order/index.js +197 -40
  31. package/lib/server/modules/products/index.d.ts +8 -2
  32. package/lib/server/modules/products/index.js +97 -24
  33. package/lib/server/modules/resource/index.js +7 -2
  34. package/lib/solution/BookingByStep/index.d.ts +1 -1
  35. package/package.json +1 -1
@@ -103,6 +103,8 @@ var Server = /*#__PURE__*/function () {
103
103
  _defineProperty(this, "productQueryScheduleTimers", new Map());
104
104
  /** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
105
105
  _defineProperty(this, "menuScheduleRefreshInFlight", null);
106
+ /** 启动阶段模块预加载任务;预渲染商品查询复用该任务,避免缓存尚未 ready 时误触发远端自愈。 */
107
+ _defineProperty(this, "startupModulePreloadInFlight", null);
106
108
  _defineProperty(this, "lastMenuScheduleRefreshAt", 0);
107
109
  _defineProperty(this, "MENU_SCHEDULE_REFRESH_COOLDOWN_MS", 30 * 1000);
108
110
  // ---- 订单 / 预约列表查询订阅者 ----
@@ -2266,6 +2268,7 @@ var Server = /*#__PURE__*/function () {
2266
2268
  options,
2267
2269
  startTime,
2268
2270
  registeredModules,
2271
+ preloadTask,
2269
2272
  duration,
2270
2273
  _args29 = arguments;
2271
2274
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
@@ -2290,22 +2293,31 @@ var Server = /*#__PURE__*/function () {
2290
2293
  case 8:
2291
2294
  registeredModules = _context29.sent;
2292
2295
  if (!autoPreload) {
2293
- _context29.next = 14;
2296
+ _context29.next = 20;
2294
2297
  break;
2295
2298
  }
2296
- _context29.next = 12;
2297
- return this.preloadModulesData(registeredModules, options);
2298
- case 12:
2299
+ preloadTask = this.preloadModulesData(registeredModules, options);
2300
+ this.startupModulePreloadInFlight = preloadTask;
2301
+ _context29.prev = 12;
2299
2302
  _context29.next = 15;
2303
+ return preloadTask;
2304
+ case 15:
2305
+ _context29.prev = 15;
2306
+ if (this.startupModulePreloadInFlight === preloadTask) {
2307
+ this.startupModulePreloadInFlight = null;
2308
+ }
2309
+ return _context29.finish(15);
2310
+ case 18:
2311
+ _context29.next = 21;
2300
2312
  break;
2301
- case 14:
2313
+ case 20:
2302
2314
  this.logInfo('跳过自动预加载', {
2303
2315
  autoPreload: autoPreload
2304
2316
  });
2305
- case 15:
2306
- _context29.next = 17;
2317
+ case 21:
2318
+ _context29.next = 23;
2307
2319
  return this.setupProductsQuotationPriceBridge();
2308
- case 17:
2320
+ case 23:
2309
2321
  // 监听 ProductsModule 同步完成事件,重新计算并推送查询结果
2310
2322
  this.core.effects.on(ProductsHooks.onProductsSyncCompleted, function (payload) {
2311
2323
  _this3.recomputeAndNotifyProductQuery({
@@ -2331,11 +2343,11 @@ var Server = /*#__PURE__*/function () {
2331
2343
  registeredModuleCount: registeredModules.length
2332
2344
  });
2333
2345
  return _context29.abrupt("return", registeredModules);
2334
- case 23:
2346
+ case 29:
2335
2347
  case "end":
2336
2348
  return _context29.stop();
2337
2349
  }
2338
- }, _callee29, this);
2350
+ }, _callee29, this, [[12,, 15, 18]]);
2339
2351
  }));
2340
2352
  function initialize(_x32) {
2341
2353
  return _initialize.apply(this, arguments);
@@ -2717,6 +2729,7 @@ var Server = /*#__PURE__*/function () {
2717
2729
  key: "setupProductsQuotationPriceBridge",
2718
2730
  value: (function () {
2719
2731
  var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
2732
+ var _this5 = this;
2720
2733
  var _this$core$context, errorMessage;
2721
2734
  return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2722
2735
  while (1) switch (_context33.prev = _context33.next) {
@@ -2736,31 +2749,42 @@ var Server = /*#__PURE__*/function () {
2736
2749
  return _context33.abrupt("return");
2737
2750
  case 6:
2738
2751
  _context33.prev = 6;
2739
- _context33.next = 9;
2740
- return this.schedule.loadAllSchedule();
2741
- case 9:
2742
2752
  this.products.clearPriceCache();
2743
- _context33.next = 12;
2753
+ _context33.next = 10;
2744
2754
  return this.products.setupQuotationPriceBridge({
2745
2755
  scheduleModule: this.schedule,
2746
- channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel
2756
+ channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel,
2757
+ onQuotationUpdated: function onQuotationUpdated() {
2758
+ void _this5.recomputeAndNotifyProductQuery();
2759
+ }
2760
+ });
2761
+ case 10:
2762
+ // Schedule 已在模块 preload 阶段加载完成。价格桥接先使用本地数据,
2763
+ // 远端刷新转为后台校准,避免二次启动重复阻塞请求。
2764
+ void this.schedule.loadAllSchedule().then(function () {
2765
+ var _this5$products;
2766
+ (_this5$products = _this5.products) === null || _this5$products === void 0 || _this5$products.clearPriceCache();
2767
+ void _this5.recomputeAndNotifyProductQuery();
2768
+ }).catch(function (error) {
2769
+ _this5.logWarning('Products 报价单价格桥接后台刷新 Schedule 失败,继续使用本地数据', {
2770
+ error: error instanceof Error ? error.message : String(error)
2771
+ });
2747
2772
  });
2748
- case 12:
2749
2773
  this.logInfo('Products 报价单价格桥接初始化完成');
2750
- _context33.next = 19;
2774
+ _context33.next = 18;
2751
2775
  break;
2752
- case 15:
2753
- _context33.prev = 15;
2776
+ case 14:
2777
+ _context33.prev = 14;
2754
2778
  _context33.t0 = _context33["catch"](6);
2755
2779
  errorMessage = _context33.t0 instanceof Error ? _context33.t0.message : String(_context33.t0);
2756
2780
  this.logError('Products 报价单价格桥接初始化失败', {
2757
2781
  error: errorMessage
2758
2782
  });
2759
- case 19:
2783
+ case 18:
2760
2784
  case "end":
2761
2785
  return _context33.stop();
2762
2786
  }
2763
- }, _callee33, this, [[6, 15]]);
2787
+ }, _callee33, this, [[6, 14]]);
2764
2788
  }));
2765
2789
  function setupProductsQuotationPriceBridge() {
2766
2790
  return _setupProductsQuotationPriceBridge.apply(this, arguments);
@@ -2830,44 +2854,58 @@ var Server = /*#__PURE__*/function () {
2830
2854
  key: "refreshProductsInBackground",
2831
2855
  value: (function () {
2832
2856
  var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
2833
- var startTime, duration, _duration2, errorMessage;
2857
+ var options,
2858
+ trigger,
2859
+ startTime,
2860
+ duration,
2861
+ _duration2,
2862
+ errorMessage,
2863
+ _args34 = arguments;
2834
2864
  return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2835
2865
  while (1) switch (_context34.prev = _context34.next) {
2836
2866
  case 0:
2867
+ options = _args34.length > 0 && _args34[0] !== undefined ? _args34[0] : {};
2837
2868
  if (this.products) {
2838
- _context34.next = 3;
2869
+ _context34.next = 4;
2839
2870
  break;
2840
2871
  }
2841
2872
  this.logWarning('refreshProductsInBackground: Products 模块未注册');
2842
2873
  return _context34.abrupt("return");
2843
- case 3:
2844
- this.logInfo('refreshProductsInBackground 开始');
2874
+ case 4:
2875
+ trigger = options.trigger || 'background';
2876
+ this.logInfo('refreshProductsInBackground 开始', {
2877
+ trigger: trigger
2878
+ });
2845
2879
  startTime = Date.now();
2846
- _context34.prev = 5;
2847
- _context34.next = 8;
2848
- return this.products.silentRefresh();
2849
- case 8:
2880
+ _context34.prev = 7;
2881
+ _context34.next = 10;
2882
+ return this.products.silentRefresh({
2883
+ trigger: trigger
2884
+ });
2885
+ case 10:
2850
2886
  duration = Date.now() - startTime;
2851
2887
  this.logInfo('refreshProductsInBackground 完成', {
2888
+ trigger: trigger,
2852
2889
  duration: "".concat(duration, "ms")
2853
2890
  });
2854
- _context34.next = 18;
2891
+ _context34.next = 20;
2855
2892
  break;
2856
- case 12:
2857
- _context34.prev = 12;
2858
- _context34.t0 = _context34["catch"](5);
2893
+ case 14:
2894
+ _context34.prev = 14;
2895
+ _context34.t0 = _context34["catch"](7);
2859
2896
  _duration2 = Date.now() - startTime;
2860
2897
  errorMessage = _context34.t0 instanceof Error ? _context34.t0.message : String(_context34.t0);
2861
2898
  console.error('[Server] refreshProductsInBackground 失败:', _context34.t0);
2862
2899
  this.logError('refreshProductsInBackground 失败', {
2900
+ trigger: trigger,
2863
2901
  duration: "".concat(_duration2, "ms"),
2864
2902
  error: errorMessage
2865
2903
  });
2866
- case 18:
2904
+ case 20:
2867
2905
  case "end":
2868
2906
  return _context34.stop();
2869
2907
  }
2870
- }, _callee34, this, [[5, 12]]);
2908
+ }, _callee34, this, [[7, 14]]);
2871
2909
  }));
2872
2910
  function refreshProductsInBackground() {
2873
2911
  return _refreshProductsInBackground.apply(this, arguments);
@@ -2884,44 +2922,58 @@ var Server = /*#__PURE__*/function () {
2884
2922
  key: "refreshOrdersInBackground",
2885
2923
  value: (function () {
2886
2924
  var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
2887
- var startTime, duration, _duration3, errorMessage;
2925
+ var options,
2926
+ trigger,
2927
+ startTime,
2928
+ duration,
2929
+ _duration3,
2930
+ errorMessage,
2931
+ _args35 = arguments;
2888
2932
  return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2889
2933
  while (1) switch (_context35.prev = _context35.next) {
2890
2934
  case 0:
2935
+ options = _args35.length > 0 && _args35[0] !== undefined ? _args35[0] : {};
2891
2936
  if (this.order) {
2892
- _context35.next = 3;
2937
+ _context35.next = 4;
2893
2938
  break;
2894
2939
  }
2895
2940
  this.logWarning('refreshOrdersInBackground: Order 模块未注册');
2896
2941
  return _context35.abrupt("return");
2897
- case 3:
2898
- this.logInfo('refreshOrdersInBackground 开始');
2942
+ case 4:
2943
+ trigger = options.trigger || 'background';
2944
+ this.logInfo('refreshOrdersInBackground 开始', {
2945
+ trigger: trigger
2946
+ });
2899
2947
  startTime = Date.now();
2900
- _context35.prev = 5;
2901
- _context35.next = 8;
2902
- return this.order.silentRefresh();
2903
- case 8:
2948
+ _context35.prev = 7;
2949
+ _context35.next = 10;
2950
+ return this.order.silentRefresh({
2951
+ trigger: trigger
2952
+ });
2953
+ case 10:
2904
2954
  duration = Date.now() - startTime;
2905
2955
  this.logInfo('refreshOrdersInBackground 完成', {
2956
+ trigger: trigger,
2906
2957
  duration: "".concat(duration, "ms")
2907
2958
  });
2908
- _context35.next = 18;
2959
+ _context35.next = 20;
2909
2960
  break;
2910
- case 12:
2911
- _context35.prev = 12;
2912
- _context35.t0 = _context35["catch"](5);
2961
+ case 14:
2962
+ _context35.prev = 14;
2963
+ _context35.t0 = _context35["catch"](7);
2913
2964
  _duration3 = Date.now() - startTime;
2914
2965
  errorMessage = _context35.t0 instanceof Error ? _context35.t0.message : String(_context35.t0);
2915
2966
  console.error('[Server] refreshOrdersInBackground 失败:', _context35.t0);
2916
2967
  this.logError('refreshOrdersInBackground 失败', {
2968
+ trigger: trigger,
2917
2969
  duration: "".concat(_duration3, "ms"),
2918
2970
  error: errorMessage
2919
2971
  });
2920
- case 18:
2972
+ case 20:
2921
2973
  case "end":
2922
2974
  return _context35.stop();
2923
2975
  }
2924
- }, _callee35, this, [[5, 12]]);
2976
+ }, _callee35, this, [[7, 14]]);
2925
2977
  }));
2926
2978
  function refreshOrdersInBackground() {
2927
2979
  return _refreshOrdersInBackground.apply(this, arguments);
@@ -3235,10 +3287,10 @@ var Server = /*#__PURE__*/function () {
3235
3287
  }, {
3236
3288
  key: "getAllRoutes",
3237
3289
  value: function getAllRoutes() {
3238
- var _this5 = this;
3290
+ var _this6 = this;
3239
3291
  var routes = [];
3240
3292
  ['get', 'post', 'put', 'remove'].forEach(function (method) {
3241
- Object.keys(_this5.router[method]).forEach(function (path) {
3293
+ Object.keys(_this6.router[method]).forEach(function (path) {
3242
3294
  routes.push({
3243
3295
  method: method,
3244
3296
  path: path
@@ -3368,7 +3420,7 @@ var Server = /*#__PURE__*/function () {
3368
3420
  key: "getPaymentRouteModule",
3369
3421
  value: function () {
3370
3422
  var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
3371
- var _this6 = this;
3423
+ var _this7 = this;
3372
3424
  return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3373
3425
  while (1) switch (_context40.prev = _context40.next) {
3374
3426
  case 0:
@@ -3397,13 +3449,13 @@ var Server = /*#__PURE__*/function () {
3397
3449
  case 0:
3398
3450
  module = new PaymentServerModule('server_payment_route', '1.0.0');
3399
3451
  _context39.next = 3;
3400
- return module.initialize(_this6.core, {
3452
+ return module.initialize(_this7.core, {
3401
3453
  store: {
3402
3454
  payMethods: []
3403
3455
  }
3404
3456
  });
3405
3457
  case 3:
3406
- _this6.paymentRouteModule = module;
3458
+ _this7.paymentRouteModule = module;
3407
3459
  return _context39.abrupt("return", module);
3408
3460
  case 5:
3409
3461
  case "end":
@@ -3411,7 +3463,7 @@ var Server = /*#__PURE__*/function () {
3411
3463
  }
3412
3464
  }, _callee39);
3413
3465
  }))().finally(function () {
3414
- _this6.paymentRouteModuleInFlight = undefined;
3466
+ _this7.paymentRouteModuleInFlight = undefined;
3415
3467
  });
3416
3468
  return _context40.abrupt("return", this.paymentRouteModuleInFlight);
3417
3469
  case 8:
@@ -3587,7 +3639,7 @@ var Server = /*#__PURE__*/function () {
3587
3639
  }, {
3588
3640
  key: "scheduleSubscriberTimePointReloads",
3589
3641
  value: function scheduleSubscriberTimePointReloads(subscriberId, timePoints) {
3590
- var _this7 = this;
3642
+ var _this8 = this;
3591
3643
  var subscriber = this.productQuerySubscribers.get(subscriberId);
3592
3644
  if (!subscriber || !timePoints.length) return;
3593
3645
  var scheduleDate = subscriber.context.schedule_date || dayjs().format('YYYY-MM-DD');
@@ -3608,7 +3660,7 @@ var Server = /*#__PURE__*/function () {
3608
3660
  setInterval(function () {
3609
3661
  var currentTime = dayjs().format('hh:mm');
3610
3662
  if (timePoints.includes(currentTime)) {
3611
- _this7.onScheduleTimePointTimerFire(subscriberId);
3663
+ _this8.onScheduleTimePointTimerFire(subscriberId);
3612
3664
  }
3613
3665
  }, 60000);
3614
3666
  if (timerIds.length > 0) {
@@ -3777,7 +3829,7 @@ var Server = /*#__PURE__*/function () {
3777
3829
  key: "refreshMenuScheduleCacheAfterEmptyResult",
3778
3830
  value: (function () {
3779
3831
  var _refreshMenuScheduleCacheAfterEmptyResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
3780
- var _this8 = this;
3832
+ var _this9 = this;
3781
3833
  var now;
3782
3834
  return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3783
3835
  while (1) switch (_context44.prev = _context44.next) {
@@ -3800,11 +3852,11 @@ var Server = /*#__PURE__*/function () {
3800
3852
  this.menuScheduleRefreshInFlight = Promise.all([this.menu.loadMenuList(), this.schedule.loadAllSchedule()]).then(function () {
3801
3853
  return undefined;
3802
3854
  }).catch(function (error) {
3803
- _this8.logWarning('刷新菜单/日程缓存失败,继续使用现有缓存', {
3855
+ _this9.logWarning('刷新菜单/日程缓存失败,继续使用现有缓存', {
3804
3856
  error: error instanceof Error ? error.message : String(error)
3805
3857
  });
3806
3858
  }).finally(function () {
3807
- _this8.menuScheduleRefreshInFlight = null;
3859
+ _this9.menuScheduleRefreshInFlight = null;
3808
3860
  });
3809
3861
  }
3810
3862
  _context44.next = 8;
@@ -3990,10 +4042,10 @@ var Server = /*#__PURE__*/function () {
3990
4042
  }, {
3991
4043
  key: "stripSalesSearchPageParams",
3992
4044
  value: function stripSalesSearchPageParams(value) {
3993
- var _this9 = this;
4045
+ var _this10 = this;
3994
4046
  if (Array.isArray(value)) {
3995
4047
  return value.map(function (item) {
3996
- return _this9.stripSalesSearchPageParams(item);
4048
+ return _this10.stripSalesSearchPageParams(item);
3997
4049
  });
3998
4050
  }
3999
4051
  if (!value || _typeof(value) !== 'object') return value;
@@ -4031,12 +4083,12 @@ var Server = /*#__PURE__*/function () {
4031
4083
  key: "extractSalesSearchOrderIds",
4032
4084
  value: function extractSalesSearchOrderIds(kind, result) {
4033
4085
  var _this$findSalesSearch,
4034
- _this10 = this;
4086
+ _this11 = this;
4035
4087
  var data = this.extractSalesSearchResponseData(result);
4036
4088
  var list = kind === 'aggregate' ? (_this$findSalesSearch = this.findSalesSearchAggregateGroup(data)) === null || _this$findSalesSearch === void 0 ? void 0 : _this$findSalesSearch.list : data === null || data === void 0 ? void 0 : data.list;
4037
4089
  if (!Array.isArray(list)) return [];
4038
4090
  return list.map(function (item) {
4039
- return _this10.getSalesSearchOrderId(item);
4091
+ return _this11.getSalesSearchOrderId(item);
4040
4092
  }).filter(function (id) {
4041
4093
  return !!id;
4042
4094
  });
@@ -4203,11 +4255,11 @@ var Server = /*#__PURE__*/function () {
4203
4255
  }, {
4204
4256
  key: "stableSerialize",
4205
4257
  value: function stableSerialize(value) {
4206
- var _this11 = this;
4258
+ var _this12 = this;
4207
4259
  if (value === null || value === undefined) return 'null';
4208
4260
  if (Array.isArray(value)) {
4209
4261
  return "[".concat(value.map(function (item) {
4210
- return _this11.stableSerialize(item);
4262
+ return _this12.stableSerialize(item);
4211
4263
  }).join(','), "]");
4212
4264
  }
4213
4265
  if (_typeof(value) === 'object') {
@@ -4216,7 +4268,7 @@ var Server = /*#__PURE__*/function () {
4216
4268
  return obj[k] !== undefined;
4217
4269
  }).sort();
4218
4270
  return "{".concat(keys.map(function (k) {
4219
- return "".concat(JSON.stringify(k), ":").concat(_this11.stableSerialize(obj[k]));
4271
+ return "".concat(JSON.stringify(k), ":").concat(_this12.stableSerialize(obj[k]));
4220
4272
  }).join(','), "}");
4221
4273
  }
4222
4274
  return JSON.stringify(value);
@@ -4756,7 +4808,7 @@ var Server = /*#__PURE__*/function () {
4756
4808
  key: "runLocalPaymentUpdateInQueue",
4757
4809
  value: function () {
4758
4810
  var _runLocalPaymentUpdateInQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(key, task, context) {
4759
- var _this12 = this;
4811
+ var _this13 = this;
4760
4812
  var queuedAt, hasPreviousTask, previous, current, tail, _data, result, released;
4761
4813
  return _regeneratorRuntime().wrap(function _callee50$(_context50) {
4762
4814
  while (1) switch (_context50.prev = _context50.next) {
@@ -4775,7 +4827,7 @@ var Server = /*#__PURE__*/function () {
4775
4827
  return _regeneratorRuntime().wrap(function _callee49$(_context49) {
4776
4828
  while (1) switch (_context49.prev = _context49.next) {
4777
4829
  case 0:
4778
- _this12.logInfo('handleUpdateLocalPayment: 串行队列开始执行', _objectSpread(_objectSpread({}, context), {}, {
4830
+ _this13.logInfo('handleUpdateLocalPayment: 串行队列开始执行', _objectSpread(_objectSpread({}, context), {}, {
4779
4831
  queue_key: key,
4780
4832
  queue_wait_ms: Date.now() - queuedAt
4781
4833
  }));
@@ -6168,7 +6220,7 @@ var Server = /*#__PURE__*/function () {
6168
6220
  key: "handlePendingSyncCheckoutOrder",
6169
6221
  value: function () {
6170
6222
  var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
6171
- var _this13 = this;
6223
+ var _this14 = this;
6172
6224
  var backendPath, data, title, reason, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
6173
6225
  return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6174
6226
  while (1) switch (_context63.prev = _context63.next) {
@@ -6221,7 +6273,7 @@ var Server = /*#__PURE__*/function () {
6221
6273
  });
6222
6274
  changeGivenAmount = pendingOrder === null || pendingOrder === void 0 || (_pendingOrder$payment = pendingOrder.payments) === null || _pendingOrder$payment === void 0 ? void 0 : _pendingOrder$payment.reduce(function (sum, payment) {
6223
6275
  var _payment$metadata;
6224
- return sum + _this13.toAmountNumber(payment === null || payment === void 0 || (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.change_given_amount);
6276
+ return sum + _this14.toAmountNumber(payment === null || payment === void 0 || (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.change_given_amount);
6225
6277
  }, 0);
6226
6278
  return _context63.abrupt("return", {
6227
6279
  code: 200,
@@ -6361,13 +6413,13 @@ var Server = /*#__PURE__*/function () {
6361
6413
  }, {
6362
6414
  key: "sumPaidOrderPayments",
6363
6415
  value: function sumPaidOrderPayments(payments) {
6364
- var _this14 = this;
6416
+ var _this15 = this;
6365
6417
  if (!Array.isArray(payments)) return 0;
6366
6418
  return payments.reduce(function (sum, payment) {
6367
6419
  var _payment$amount;
6368
6420
  var status = String((payment === null || payment === void 0 ? void 0 : payment.status) || '').toLowerCase();
6369
6421
  if (status !== 'paid') return sum;
6370
- return sum + _this14.toAmountNumber((_payment$amount = payment === null || payment === void 0 ? void 0 : payment.amount) !== null && _payment$amount !== void 0 ? _payment$amount : payment === null || payment === void 0 ? void 0 : payment.origin_amount);
6422
+ return sum + _this15.toAmountNumber((_payment$amount = payment === null || payment === void 0 ? void 0 : payment.amount) !== null && _payment$amount !== void 0 ? _payment$amount : payment === null || payment === void 0 ? void 0 : payment.origin_amount);
6371
6423
  }, 0);
6372
6424
  }
6373
6425
  }, {
@@ -6383,7 +6435,7 @@ var Server = /*#__PURE__*/function () {
6383
6435
  value: function () {
6384
6436
  var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(order) {
6385
6437
  var _this$products3,
6386
- _this15 = this;
6438
+ _this16 = this;
6387
6439
  var products, productIdSet, productIds, entries;
6388
6440
  return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6389
6441
  while (1) switch (_context66.prev = _context66.next) {
@@ -6416,20 +6468,20 @@ var Server = /*#__PURE__*/function () {
6416
6468
  _context66.next = 8;
6417
6469
  return Promise.all(productIds.map( /*#__PURE__*/function () {
6418
6470
  var _ref68 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(id) {
6419
- var _this15$products, _this15$products$getP, product;
6471
+ var _this16$products, _this16$products$getP, product;
6420
6472
  return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6421
6473
  while (1) switch (_context65.prev = _context65.next) {
6422
6474
  case 0:
6423
6475
  _context65.prev = 0;
6424
6476
  _context65.next = 3;
6425
- return (_this15$products = _this15.products) === null || _this15$products === void 0 || (_this15$products$getP = _this15$products.getProductById) === null || _this15$products$getP === void 0 ? void 0 : _this15$products$getP.call(_this15$products, Number(id));
6477
+ return (_this16$products = _this16.products) === null || _this16$products === void 0 || (_this16$products$getP = _this16$products.getProductById) === null || _this16$products$getP === void 0 ? void 0 : _this16$products$getP.call(_this16$products, Number(id));
6426
6478
  case 3:
6427
6479
  product = _context65.sent;
6428
6480
  return _context65.abrupt("return", product ? [String(id), product] : null);
6429
6481
  case 7:
6430
6482
  _context65.prev = 7;
6431
6483
  _context65.t0 = _context65["catch"](0);
6432
- _this15.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
6484
+ _this16.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
6433
6485
  product_id: id,
6434
6486
  error: _context65.t0 instanceof Error ? _context65.t0.message : String(_context65.t0)
6435
6487
  });
@@ -6580,7 +6632,7 @@ var Server = /*#__PURE__*/function () {
6580
6632
  key: "withSalesDetailProductSnapshots",
6581
6633
  value: function () {
6582
6634
  var _withSalesDetailProductSnapshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(order) {
6583
- var _this16 = this;
6635
+ var _this17 = this;
6584
6636
  var products, snapshotMap, hasChanged, enrichedProducts, enrichedOrder;
6585
6637
  return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6586
6638
  while (1) switch (_context68.prev = _context68.next) {
@@ -6604,8 +6656,8 @@ var Server = /*#__PURE__*/function () {
6604
6656
  case 8:
6605
6657
  hasChanged = false;
6606
6658
  enrichedProducts = products.map(function (product) {
6607
- var productWithBundleSnapshots = _this16.withBundleCatalogSnapshots(product, snapshotMap);
6608
- var nextProduct = _this16.withProductCatalogSnapshots(productWithBundleSnapshots, snapshotMap);
6659
+ var productWithBundleSnapshots = _this17.withBundleCatalogSnapshots(product, snapshotMap);
6660
+ var nextProduct = _this17.withProductCatalogSnapshots(productWithBundleSnapshots, snapshotMap);
6609
6661
  if (nextProduct !== product) hasChanged = true;
6610
6662
  return nextProduct;
6611
6663
  });
@@ -6633,13 +6685,13 @@ var Server = /*#__PURE__*/function () {
6633
6685
  }, {
6634
6686
  key: "withPendingSyncProductTitles",
6635
6687
  value: function withPendingSyncProductTitles(order, productMap) {
6636
- var _this17 = this;
6688
+ var _this18 = this;
6637
6689
  var products = Array.isArray(order.products) ? order.products : null;
6638
6690
  if (!(products !== null && products !== void 0 && products.length)) return order;
6639
6691
  return _objectSpread(_objectSpread({}, order), {}, {
6640
6692
  products: products.map(function (product) {
6641
6693
  return _objectSpread(_objectSpread({}, product), {}, {
6642
- product_title: _this17.buildProductTitleSnapshot(product, productMap)
6694
+ product_title: _this18.buildProductTitleSnapshot(product, productMap)
6643
6695
  });
6644
6696
  })
6645
6697
  });
@@ -6650,7 +6702,7 @@ var Server = /*#__PURE__*/function () {
6650
6702
  var _product$product_id4,
6651
6703
  _product$product,
6652
6704
  _fallbackProduct$prod,
6653
- _this18 = this;
6705
+ _this19 = this;
6654
6706
  var productId = (_product$product_id4 = product.product_id) !== null && _product$product_id4 !== void 0 ? _product$product_id4 : product.id;
6655
6707
  var fallbackProduct = productId !== undefined && productId !== null ? productMap[productId] || productMap[String(productId)] : null;
6656
6708
  var ownTitle = product.product_title || product.title || product.name || ((_product$product = product.product) === null || _product$product === void 0 ? void 0 : _product$product.title);
@@ -6658,7 +6710,7 @@ var Server = /*#__PURE__*/function () {
6658
6710
  var currentLocale = this.getProductTitleSnapshotCurrentLocale();
6659
6711
  var autoTitle = this.resolveFirstProductTitleValue(ownTitle) || this.resolveFirstProductTitleValue(fallbackTitle);
6660
6712
  return PRODUCT_TITLE_SNAPSHOT_KEYS.reduce(function (snapshot, key) {
6661
- snapshot[key] = _this18.resolveProductTitleValue(ownTitle, key, currentLocale) || _this18.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === 'auto' || key === 'original' ? autoTitle : null);
6713
+ snapshot[key] = _this19.resolveProductTitleValue(ownTitle, key, currentLocale) || _this19.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === 'auto' || key === 'original' ? autoTitle : null);
6662
6714
  return snapshot;
6663
6715
  }, {});
6664
6716
  }
@@ -6757,14 +6809,14 @@ var Server = /*#__PURE__*/function () {
6757
6809
  key: "enrichPaymentNamesByCode",
6758
6810
  value: function () {
6759
6811
  var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(order) {
6760
- var _this19 = this;
6812
+ var _this20 = this;
6761
6813
  var payments, hasMissingName, paymentModule, payMethods, nameByCode, _iterator12, _step12, method, codeKey, name, hasResolvedName, enrichedPayments;
6762
6814
  return _regeneratorRuntime().wrap(function _callee69$(_context69) {
6763
6815
  while (1) switch (_context69.prev = _context69.next) {
6764
6816
  case 0:
6765
6817
  payments = Array.isArray(order === null || order === void 0 ? void 0 : order.payments) ? order.payments : [];
6766
6818
  hasMissingName = payments.some(function (payment) {
6767
- return _this19.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this19.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
6819
+ return _this20.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this20.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
6768
6820
  });
6769
6821
  if (hasMissingName) {
6770
6822
  _context69.next = 4;
@@ -6797,9 +6849,9 @@ var Server = /*#__PURE__*/function () {
6797
6849
  }
6798
6850
  hasResolvedName = false;
6799
6851
  enrichedPayments = payments.map(function (payment) {
6800
- if (!_this19.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name)) return payment;
6801
- if (!_this19.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code)) return payment;
6802
- var name = nameByCode.get(_this19.getPaymentCodeKey(payment === null || payment === void 0 ? void 0 : payment.code));
6852
+ if (!_this20.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name)) return payment;
6853
+ if (!_this20.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code)) return payment;
6854
+ var name = nameByCode.get(_this20.getPaymentCodeKey(payment === null || payment === void 0 ? void 0 : payment.code));
6803
6855
  if (!name) return payment;
6804
6856
  hasResolvedName = true;
6805
6857
  return _objectSpread(_objectSpread({}, payment), {}, {
@@ -7381,10 +7433,10 @@ var Server = /*#__PURE__*/function () {
7381
7433
  value: function extractBackendErrorResponse(error) {
7382
7434
  var _error$response3,
7383
7435
  _error$response4,
7384
- _this20 = this;
7436
+ _this21 = this;
7385
7437
  var candidates = [error === null || error === void 0 || (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data, error === null || error === void 0 ? void 0 : error.data, error === null || error === void 0 || (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.body, error === null || error === void 0 ? void 0 : error.body];
7386
7438
  return candidates.find(function (candidate) {
7387
- return _this20.isExplicitBackendErrorResponse(candidate);
7439
+ return _this21.isExplicitBackendErrorResponse(candidate);
7388
7440
  }) || null;
7389
7441
  }
7390
7442
  }, {
@@ -7745,8 +7797,8 @@ var Server = /*#__PURE__*/function () {
7745
7797
  value: (function () {
7746
7798
  var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(context, options) {
7747
7799
  var _menu_list_ids$length3,
7748
- _this21 = this;
7749
- var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, extension_type, product_id, strategy_context, queryIds, formatterContext, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, extensionFilteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, _tPrice3, _filteredProducts2, _tStatus, _beforeStatusCount, _tExtensionType, _beforeExtensionTypeCount, _tSort, activeMenuList, tMenu, getActiveMenus, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tExtensionType, beforeExtensionTypeCount, tSort;
7800
+ _this22 = this;
7801
+ var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, extension_type, product_id, strategy_context, queryIds, startupPreloadTask, formatterContext, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, extensionFilteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, _tPrice3, _filteredProducts2, _tStatus, _beforeStatusCount, _tExtensionType, _beforeExtensionTypeCount, _tSort, activeMenuList, tMenu, getActiveMenus, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tExtensionType, beforeExtensionTypeCount, tSort;
7750
7802
  return _regeneratorRuntime().wrap(function _callee75$(_context75) {
7751
7803
  while (1) switch (_context75.prev = _context75.next) {
7752
7804
  case 0:
@@ -7757,12 +7809,6 @@ var Server = /*#__PURE__*/function () {
7757
7809
  }).filter(function (id) {
7758
7810
  return Number.isFinite(id);
7759
7811
  }) : [];
7760
- formatterContext = this.buildProductFormatterContext({
7761
- schedule_date: schedule_date,
7762
- schedule_datetime: schedule_datetime,
7763
- customer_id: customer_id,
7764
- strategy_context: strategy_context
7765
- });
7766
7812
  this.logInfo('computeProductQueryResult 开始', {
7767
7813
  menuListIdsCount: (_menu_list_ids$length3 = menu_list_ids === null || menu_list_ids === void 0 ? void 0 : menu_list_ids.length) !== null && _menu_list_ids$length3 !== void 0 ? _menu_list_ids$length3 : 0,
7768
7814
  ids: queryIds,
@@ -7774,28 +7820,48 @@ var Server = /*#__PURE__*/function () {
7774
7820
  strategyContextKeys: strategy_context ? Object.keys(strategy_context) : [],
7775
7821
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
7776
7822
  });
7777
- if (this.products) {
7823
+
7824
+ // 预渲染可能在 PisellOS 顺序 preload 尚未完成时发起商品查询。此时 Menu/Schedule
7825
+ // 暂时为空不代表缓存失效;等待当前 preload 后再按原逻辑查询,避免并发远端刷新先 clear
7826
+ // SQLite/IndexDB,造成 preload 读到空数据并重复请求。正常运行期该字段为 null,不增加等待。
7827
+ startupPreloadTask = this.startupModulePreloadInFlight;
7828
+ if (!startupPreloadTask) {
7778
7829
  _context75.next = 8;
7779
7830
  break;
7780
7831
  }
7832
+ _context75.next = 8;
7833
+ return startupPreloadTask;
7834
+ case 8:
7835
+ // Menu/Schedule preload 会替换 store 中的数组;必须在等待完成后再读取,
7836
+ // 避免 formatterContext 持有预加载前的空数组快照。
7837
+ formatterContext = this.buildProductFormatterContext({
7838
+ schedule_date: schedule_date,
7839
+ schedule_datetime: schedule_datetime,
7840
+ customer_id: customer_id,
7841
+ strategy_context: strategy_context
7842
+ });
7843
+ if (this.products) {
7844
+ _context75.next = 12;
7845
+ break;
7846
+ }
7781
7847
  this.logError('computeProductQueryResult: Products 模块未注册');
7782
7848
  return _context75.abrupt("return", {
7783
7849
  message: 'Products 模块未注册',
7784
7850
  data: this.buildProductQueryResultPayload([], 0)
7785
7851
  });
7786
- case 8:
7852
+ case 12:
7787
7853
  if (!(queryIds.length > 0)) {
7788
- _context75.next = 20;
7854
+ _context75.next = 24;
7789
7855
  break;
7790
7856
  }
7791
7857
  uniqueIds = Array.from(new Set(queryIds));
7792
7858
  _tPrice = performance.now();
7793
- _context75.next = 13;
7859
+ _context75.next = 17;
7794
7860
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
7795
7861
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
7796
7862
  productIds: uniqueIds
7797
7863
  });
7798
- case 13:
7864
+ case 17:
7799
7865
  productsWithPrice = _context75.sent;
7800
7866
  perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
7801
7867
  count: productsWithPrice.length,
@@ -7822,18 +7888,18 @@ var Server = /*#__PURE__*/function () {
7822
7888
  message: '',
7823
7889
  status: true
7824
7890
  });
7825
- case 20:
7891
+ case 24:
7826
7892
  if (!(product_id != null && Number.isFinite(Number(product_id)))) {
7827
- _context75.next = 32;
7893
+ _context75.next = 36;
7828
7894
  break;
7829
7895
  }
7830
7896
  pid = Number(product_id);
7831
7897
  _tPrice2 = performance.now();
7832
- _context75.next = 25;
7898
+ _context75.next = 29;
7833
7899
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
7834
7900
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
7835
7901
  });
7836
- case 25:
7902
+ case 29:
7837
7903
  allProductsWithPrice = _context75.sent;
7838
7904
  perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
7839
7905
  count: allProductsWithPrice.length,
@@ -7860,17 +7926,17 @@ var Server = /*#__PURE__*/function () {
7860
7926
  message: item ? '' : '商品不存在或未发布',
7861
7927
  status: true
7862
7928
  });
7863
- case 32:
7929
+ case 36:
7864
7930
  if (!this.shouldQueryProductsByExtensionTypes(extension_type)) {
7865
- _context75.next = 52;
7931
+ _context75.next = 56;
7866
7932
  break;
7867
7933
  }
7868
7934
  _tPrice3 = performance.now();
7869
- _context75.next = 36;
7935
+ _context75.next = 40;
7870
7936
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
7871
7937
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
7872
7938
  });
7873
- case 36:
7939
+ case 40:
7874
7940
  _filteredProducts2 = _context75.sent;
7875
7941
  perfMark('computeQuery.getProductsWithPrice(extensionType)', performance.now() - _tPrice3, {
7876
7942
  count: _filteredProducts2.length,
@@ -7916,9 +7982,9 @@ var Server = /*#__PURE__*/function () {
7916
7982
  message: '',
7917
7983
  status: true
7918
7984
  });
7919
- case 52:
7985
+ case 56:
7920
7986
  if (this.menu) {
7921
- _context75.next = 55;
7987
+ _context75.next = 59;
7922
7988
  break;
7923
7989
  }
7924
7990
  this.logError('computeProductQueryResult: Menu 模块未注册');
@@ -7926,9 +7992,9 @@ var Server = /*#__PURE__*/function () {
7926
7992
  message: 'Menu 模块未注册',
7927
7993
  data: this.buildProductQueryResultPayload([], 0)
7928
7994
  });
7929
- case 55:
7995
+ case 59:
7930
7996
  if (this.schedule) {
7931
- _context75.next = 58;
7997
+ _context75.next = 62;
7932
7998
  break;
7933
7999
  }
7934
8000
  this.logError('computeProductQueryResult: Schedule 模块未注册');
@@ -7936,41 +8002,41 @@ var Server = /*#__PURE__*/function () {
7936
8002
  message: 'Schedule 模块未注册',
7937
8003
  data: this.buildProductQueryResultPayload([], 0)
7938
8004
  });
7939
- case 58:
8005
+ case 62:
7940
8006
  activeMenuList = [];
7941
8007
  if (!(menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0)) {
7942
- _context75.next = 71;
8008
+ _context75.next = 75;
7943
8009
  break;
7944
8010
  }
7945
8011
  tMenu = performance.now();
7946
8012
  getActiveMenus = function getActiveMenus() {
7947
- return _this21.menu.getMenuByIds(menu_list_ids).filter(function (menu) {
7948
- var _this21$schedule;
7949
- return ((_this21$schedule = _this21.schedule) === null || _this21$schedule === void 0 ? void 0 : _this21$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
8013
+ return _this22.menu.getMenuByIds(menu_list_ids).filter(function (menu) {
8014
+ var _this22$schedule;
8015
+ return ((_this22$schedule = _this22.schedule) === null || _this22$schedule === void 0 ? void 0 : _this22$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
7950
8016
  });
7951
8017
  };
7952
8018
  activeMenuList = getActiveMenus();
7953
8019
  _context75.t0 = !activeMenuList.length;
7954
8020
  if (!_context75.t0) {
7955
- _context75.next = 68;
8021
+ _context75.next = 72;
7956
8022
  break;
7957
8023
  }
7958
- _context75.next = 67;
8024
+ _context75.next = 71;
7959
8025
  return this.refreshMenuScheduleCacheAfterEmptyResult();
7960
- case 67:
8026
+ case 71:
7961
8027
  _context75.t0 = _context75.sent;
7962
- case 68:
8028
+ case 72:
7963
8029
  if (!_context75.t0) {
7964
- _context75.next = 70;
8030
+ _context75.next = 74;
7965
8031
  break;
7966
8032
  }
7967
8033
  activeMenuList = getActiveMenus();
7968
- case 70:
8034
+ case 74:
7969
8035
  perfMark('computeQuery.filterActiveMenu', performance.now() - tMenu, {
7970
8036
  totalMenu: menu_list_ids.length,
7971
8037
  activeMenu: activeMenuList.length
7972
8038
  });
7973
- case 71:
8039
+ case 75:
7974
8040
  tFilter = performance.now();
7975
8041
  productScope = this.getProductScopeByMenuConfig(activeMenuList);
7976
8042
  scopedProductIds = this.products.getProductIdsByScope(productScope);
@@ -7981,21 +8047,21 @@ var Server = /*#__PURE__*/function () {
7981
8047
  });
7982
8048
  tPrice = performance.now();
7983
8049
  if (!(scopedProductIds.length > 0)) {
7984
- _context75.next = 82;
8050
+ _context75.next = 86;
7985
8051
  break;
7986
8052
  }
7987
- _context75.next = 79;
8053
+ _context75.next = 83;
7988
8054
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
7989
8055
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
7990
8056
  productIds: productScope.isAllProducts ? undefined : scopedProductIds
7991
8057
  });
7992
- case 79:
8058
+ case 83:
7993
8059
  _context75.t1 = _context75.sent;
7994
- _context75.next = 83;
8060
+ _context75.next = 87;
7995
8061
  break;
7996
- case 82:
8062
+ case 86:
7997
8063
  _context75.t1 = [];
7998
- case 83:
8064
+ case 87:
7999
8065
  filteredProducts = _context75.t1;
8000
8066
  perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
8001
8067
  count: filteredProducts.length,
@@ -8043,7 +8109,7 @@ var Server = /*#__PURE__*/function () {
8043
8109
  message: '',
8044
8110
  status: true
8045
8111
  });
8046
- case 99:
8112
+ case 103:
8047
8113
  case "end":
8048
8114
  return _context75.stop();
8049
8115
  }
@@ -8255,7 +8321,7 @@ var Server = /*#__PURE__*/function () {
8255
8321
  }, {
8256
8322
  key: "notifySalesSearchSubscribers",
8257
8323
  value: function notifySalesSearchSubscribers(payload) {
8258
- var _this22 = this;
8324
+ var _this23 = this;
8259
8325
  if (this.salesSearchSubscribers.size === 0) return;
8260
8326
  var changedOrders = this.extractChangedOrdersFromPayload(payload);
8261
8327
  if (changedOrders.length === 0) {
@@ -8273,21 +8339,21 @@ var Server = /*#__PURE__*/function () {
8273
8339
  subscriber = _step20$value[1];
8274
8340
  try {
8275
8341
  var changedVisibleOrders = changedOrders.filter(function (order) {
8276
- var orderId = _this22.getSalesSearchOrderId(order);
8342
+ var orderId = _this23.getSalesSearchOrderId(order);
8277
8343
  return !!orderId && subscriber.visibleOrderIds.has(orderId);
8278
8344
  });
8279
8345
  if (changedVisibleOrders.length === 0) {
8280
8346
  return 1; // continue
8281
8347
  }
8282
- subscriber.callback(_this22.buildSalesSearchDeltaResponse(subscriber, changedVisibleOrders));
8283
- _this22.logInfo('notifySalesSearchSubscribers: 已推送 delta', {
8348
+ subscriber.callback(_this23.buildSalesSearchDeltaResponse(subscriber, changedVisibleOrders));
8349
+ _this23.logInfo('notifySalesSearchSubscribers: 已推送 delta', {
8284
8350
  subscriberId: subscriberId,
8285
8351
  kind: subscriber.kind,
8286
8352
  count: changedVisibleOrders.length
8287
8353
  });
8288
8354
  } catch (error) {
8289
8355
  var errorMessage = error instanceof Error ? error.message : String(error);
8290
- _this22.logError('notifySalesSearchSubscribers: 推送失败', {
8356
+ _this23.logError('notifySalesSearchSubscribers: 推送失败', {
8291
8357
  subscriberId: subscriberId,
8292
8358
  error: errorMessage
8293
8359
  });