@pisell/pisellos 2.3.65 → 2.3.67

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 (52) hide show
  1. package/dist/core/index.d.ts +7 -0
  2. package/dist/core/index.js +109 -65
  3. package/dist/model/strategy/adapter/walletPass/evaluator.js +1 -0
  4. package/dist/model/strategy/adapter/walletPass/utils.js +2 -0
  5. package/dist/modules/Customer/index.d.ts +0 -4
  6. package/dist/modules/Customer/index.js +59 -91
  7. package/dist/modules/Customer/types.d.ts +0 -2
  8. package/dist/modules/Payment/walletpass.js +5 -4
  9. package/dist/modules/Quotation/index.d.ts +6 -0
  10. package/dist/modules/Quotation/index.js +75 -19
  11. package/dist/plugins/request.d.ts +1 -0
  12. package/dist/server/index.d.ts +8 -2
  13. package/dist/server/index.js +209 -142
  14. package/dist/server/modules/floor-plan/index.d.ts +4 -0
  15. package/dist/server/modules/floor-plan/index.js +240 -98
  16. package/dist/server/modules/menu/index.js +48 -23
  17. package/dist/server/modules/order/index.d.ts +17 -8
  18. package/dist/server/modules/order/index.js +506 -453
  19. package/dist/server/modules/products/index.d.ts +8 -2
  20. package/dist/server/modules/products/index.js +167 -75
  21. package/dist/server/modules/resource/index.js +21 -13
  22. package/dist/server/utils/small-ticket.js +1 -2
  23. package/dist/solution/BookingByStep/index.d.ts +1 -1
  24. package/dist/solution/BookingTicket/index.d.ts +0 -2
  25. package/dist/solution/BookingTicket/index.js +10 -34
  26. package/lib/core/index.d.ts +7 -0
  27. package/lib/core/index.js +20 -2
  28. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  29. package/lib/model/strategy/adapter/walletPass/evaluator.js +1 -0
  30. package/lib/model/strategy/adapter/walletPass/utils.js +1 -0
  31. package/lib/modules/Customer/index.d.ts +0 -4
  32. package/lib/modules/Customer/index.js +0 -11
  33. package/lib/modules/Customer/types.d.ts +0 -2
  34. package/lib/modules/Payment/walletpass.js +1 -0
  35. package/lib/modules/Quotation/index.d.ts +6 -0
  36. package/lib/modules/Quotation/index.js +49 -5
  37. package/lib/plugins/request.d.ts +1 -0
  38. package/lib/server/index.d.ts +8 -2
  39. package/lib/server/index.js +55 -19
  40. package/lib/server/modules/floor-plan/index.d.ts +4 -0
  41. package/lib/server/modules/floor-plan/index.js +54 -6
  42. package/lib/server/modules/menu/index.js +31 -5
  43. package/lib/server/modules/order/index.d.ts +17 -8
  44. package/lib/server/modules/order/index.js +199 -106
  45. package/lib/server/modules/products/index.d.ts +8 -2
  46. package/lib/server/modules/products/index.js +97 -24
  47. package/lib/server/modules/resource/index.js +7 -2
  48. package/lib/server/utils/small-ticket.js +1 -1
  49. package/lib/solution/BookingByStep/index.d.ts +1 -1
  50. package/lib/solution/BookingTicket/index.d.ts +0 -2
  51. package/lib/solution/BookingTicket/index.js +2 -18
  52. 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
  }));
@@ -6041,8 +6093,9 @@ var Server = /*#__PURE__*/function () {
6041
6093
  checkoutData: syncResult.checkoutData,
6042
6094
  order: syncedOrder,
6043
6095
  response: syncResult.normalizedResponse,
6044
- requireFullyPaid: true
6096
+ requireFullyPaid: true,
6045
6097
  // print_all 的 type=0 是收据打印;不要沿用同步成功后的券/手环打印 type=99。
6098
+ isManualPrint: true
6046
6099
  });
6047
6100
  case 16:
6048
6101
  return _context61.abrupt("return", response);
@@ -6169,7 +6222,7 @@ var Server = /*#__PURE__*/function () {
6169
6222
  key: "handlePendingSyncCheckoutOrder",
6170
6223
  value: function () {
6171
6224
  var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
6172
- var _this13 = this;
6225
+ var _this14 = this;
6173
6226
  var backendPath, data, title, reason, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
6174
6227
  return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6175
6228
  while (1) switch (_context63.prev = _context63.next) {
@@ -6222,7 +6275,7 @@ var Server = /*#__PURE__*/function () {
6222
6275
  });
6223
6276
  changeGivenAmount = pendingOrder === null || pendingOrder === void 0 || (_pendingOrder$payment = pendingOrder.payments) === null || _pendingOrder$payment === void 0 ? void 0 : _pendingOrder$payment.reduce(function (sum, payment) {
6224
6277
  var _payment$metadata;
6225
- 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);
6278
+ 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);
6226
6279
  }, 0);
6227
6280
  return _context63.abrupt("return", {
6228
6281
  code: 200,
@@ -6317,7 +6370,7 @@ var Server = /*#__PURE__*/function () {
6317
6370
  value: function shouldAutoPrintCheckoutReceipt() {
6318
6371
  var _this$core$context2, _this$core$context2$g, _this$app17, _this$app17$getStorag;
6319
6372
  if (((_this$core$context2 = this.core.context) === null || _this$core$context2 === void 0 || (_this$core$context2$g = _this$core$context2.getPlatform) === null || _this$core$context2$g === void 0 ? void 0 : _this$core$context2$g.call(_this$core$context2)) !== 'android') return true;
6320
- return ((_this$app17 = this.app) === null || _this$app17 === void 0 || (_this$app17 = _this$app17.storage) === null || _this$app17 === void 0 || (_this$app17$getStorag = _this$app17.getStorage) === null || _this$app17$getStorag === void 0 ? void 0 : _this$app17$getStorag.call(_this$app17, AUTO_PRINT_STORAGE_KEY)) !== 'false';
6373
+ return ((_this$app17 = this.app) === null || _this$app17 === void 0 || (_this$app17 = _this$app17.storage) === null || _this$app17 === void 0 || (_this$app17$getStorag = _this$app17.getStorage) === null || _this$app17$getStorag === void 0 ? void 0 : _this$app17$getStorag.call(_this$app17, AUTO_PRINT_STORAGE_KEY)) === 'true';
6321
6374
  }
6322
6375
  }, {
6323
6376
  key: "shouldBuildSmallTicketData",
@@ -6362,13 +6415,13 @@ var Server = /*#__PURE__*/function () {
6362
6415
  }, {
6363
6416
  key: "sumPaidOrderPayments",
6364
6417
  value: function sumPaidOrderPayments(payments) {
6365
- var _this14 = this;
6418
+ var _this15 = this;
6366
6419
  if (!Array.isArray(payments)) return 0;
6367
6420
  return payments.reduce(function (sum, payment) {
6368
6421
  var _payment$amount;
6369
6422
  var status = String((payment === null || payment === void 0 ? void 0 : payment.status) || '').toLowerCase();
6370
6423
  if (status !== 'paid') return sum;
6371
- 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);
6424
+ 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);
6372
6425
  }, 0);
6373
6426
  }
6374
6427
  }, {
@@ -6384,7 +6437,7 @@ var Server = /*#__PURE__*/function () {
6384
6437
  value: function () {
6385
6438
  var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(order) {
6386
6439
  var _this$products3,
6387
- _this15 = this;
6440
+ _this16 = this;
6388
6441
  var products, productIdSet, productIds, entries;
6389
6442
  return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6390
6443
  while (1) switch (_context66.prev = _context66.next) {
@@ -6417,20 +6470,20 @@ var Server = /*#__PURE__*/function () {
6417
6470
  _context66.next = 8;
6418
6471
  return Promise.all(productIds.map( /*#__PURE__*/function () {
6419
6472
  var _ref68 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(id) {
6420
- var _this15$products, _this15$products$getP, product;
6473
+ var _this16$products, _this16$products$getP, product;
6421
6474
  return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6422
6475
  while (1) switch (_context65.prev = _context65.next) {
6423
6476
  case 0:
6424
6477
  _context65.prev = 0;
6425
6478
  _context65.next = 3;
6426
- 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));
6479
+ 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));
6427
6480
  case 3:
6428
6481
  product = _context65.sent;
6429
6482
  return _context65.abrupt("return", product ? [String(id), product] : null);
6430
6483
  case 7:
6431
6484
  _context65.prev = 7;
6432
6485
  _context65.t0 = _context65["catch"](0);
6433
- _this15.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
6486
+ _this16.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
6434
6487
  product_id: id,
6435
6488
  error: _context65.t0 instanceof Error ? _context65.t0.message : String(_context65.t0)
6436
6489
  });
@@ -6581,7 +6634,7 @@ var Server = /*#__PURE__*/function () {
6581
6634
  key: "withSalesDetailProductSnapshots",
6582
6635
  value: function () {
6583
6636
  var _withSalesDetailProductSnapshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(order) {
6584
- var _this16 = this;
6637
+ var _this17 = this;
6585
6638
  var products, snapshotMap, hasChanged, enrichedProducts, enrichedOrder;
6586
6639
  return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6587
6640
  while (1) switch (_context68.prev = _context68.next) {
@@ -6605,8 +6658,8 @@ var Server = /*#__PURE__*/function () {
6605
6658
  case 8:
6606
6659
  hasChanged = false;
6607
6660
  enrichedProducts = products.map(function (product) {
6608
- var productWithBundleSnapshots = _this16.withBundleCatalogSnapshots(product, snapshotMap);
6609
- var nextProduct = _this16.withProductCatalogSnapshots(productWithBundleSnapshots, snapshotMap);
6661
+ var productWithBundleSnapshots = _this17.withBundleCatalogSnapshots(product, snapshotMap);
6662
+ var nextProduct = _this17.withProductCatalogSnapshots(productWithBundleSnapshots, snapshotMap);
6610
6663
  if (nextProduct !== product) hasChanged = true;
6611
6664
  return nextProduct;
6612
6665
  });
@@ -6634,13 +6687,13 @@ var Server = /*#__PURE__*/function () {
6634
6687
  }, {
6635
6688
  key: "withPendingSyncProductTitles",
6636
6689
  value: function withPendingSyncProductTitles(order, productMap) {
6637
- var _this17 = this;
6690
+ var _this18 = this;
6638
6691
  var products = Array.isArray(order.products) ? order.products : null;
6639
6692
  if (!(products !== null && products !== void 0 && products.length)) return order;
6640
6693
  return _objectSpread(_objectSpread({}, order), {}, {
6641
6694
  products: products.map(function (product) {
6642
6695
  return _objectSpread(_objectSpread({}, product), {}, {
6643
- product_title: _this17.buildProductTitleSnapshot(product, productMap)
6696
+ product_title: _this18.buildProductTitleSnapshot(product, productMap)
6644
6697
  });
6645
6698
  })
6646
6699
  });
@@ -6651,7 +6704,7 @@ var Server = /*#__PURE__*/function () {
6651
6704
  var _product$product_id4,
6652
6705
  _product$product,
6653
6706
  _fallbackProduct$prod,
6654
- _this18 = this;
6707
+ _this19 = this;
6655
6708
  var productId = (_product$product_id4 = product.product_id) !== null && _product$product_id4 !== void 0 ? _product$product_id4 : product.id;
6656
6709
  var fallbackProduct = productId !== undefined && productId !== null ? productMap[productId] || productMap[String(productId)] : null;
6657
6710
  var ownTitle = product.product_title || product.title || product.name || ((_product$product = product.product) === null || _product$product === void 0 ? void 0 : _product$product.title);
@@ -6659,7 +6712,7 @@ var Server = /*#__PURE__*/function () {
6659
6712
  var currentLocale = this.getProductTitleSnapshotCurrentLocale();
6660
6713
  var autoTitle = this.resolveFirstProductTitleValue(ownTitle) || this.resolveFirstProductTitleValue(fallbackTitle);
6661
6714
  return PRODUCT_TITLE_SNAPSHOT_KEYS.reduce(function (snapshot, key) {
6662
- snapshot[key] = _this18.resolveProductTitleValue(ownTitle, key, currentLocale) || _this18.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === 'auto' || key === 'original' ? autoTitle : null);
6715
+ snapshot[key] = _this19.resolveProductTitleValue(ownTitle, key, currentLocale) || _this19.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === 'auto' || key === 'original' ? autoTitle : null);
6663
6716
  return snapshot;
6664
6717
  }, {});
6665
6718
  }
@@ -6758,14 +6811,14 @@ var Server = /*#__PURE__*/function () {
6758
6811
  key: "enrichPaymentNamesByCode",
6759
6812
  value: function () {
6760
6813
  var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(order) {
6761
- var _this19 = this;
6814
+ var _this20 = this;
6762
6815
  var payments, hasMissingName, paymentModule, payMethods, nameByCode, _iterator12, _step12, method, codeKey, name, hasResolvedName, enrichedPayments;
6763
6816
  return _regeneratorRuntime().wrap(function _callee69$(_context69) {
6764
6817
  while (1) switch (_context69.prev = _context69.next) {
6765
6818
  case 0:
6766
6819
  payments = Array.isArray(order === null || order === void 0 ? void 0 : order.payments) ? order.payments : [];
6767
6820
  hasMissingName = payments.some(function (payment) {
6768
- return _this19.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this19.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
6821
+ return _this20.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this20.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
6769
6822
  });
6770
6823
  if (hasMissingName) {
6771
6824
  _context69.next = 4;
@@ -6798,9 +6851,9 @@ var Server = /*#__PURE__*/function () {
6798
6851
  }
6799
6852
  hasResolvedName = false;
6800
6853
  enrichedPayments = payments.map(function (payment) {
6801
- if (!_this19.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name)) return payment;
6802
- if (!_this19.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code)) return payment;
6803
- var name = nameByCode.get(_this19.getPaymentCodeKey(payment === null || payment === void 0 ? void 0 : payment.code));
6854
+ if (!_this20.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name)) return payment;
6855
+ if (!_this20.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code)) return payment;
6856
+ var name = nameByCode.get(_this20.getPaymentCodeKey(payment === null || payment === void 0 ? void 0 : payment.code));
6804
6857
  if (!name) return payment;
6805
6858
  hasResolvedName = true;
6806
6859
  return _objectSpread(_objectSpread({}, payment), {}, {
@@ -7382,10 +7435,10 @@ var Server = /*#__PURE__*/function () {
7382
7435
  value: function extractBackendErrorResponse(error) {
7383
7436
  var _error$response3,
7384
7437
  _error$response4,
7385
- _this20 = this;
7438
+ _this21 = this;
7386
7439
  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];
7387
7440
  return candidates.find(function (candidate) {
7388
- return _this20.isExplicitBackendErrorResponse(candidate);
7441
+ return _this21.isExplicitBackendErrorResponse(candidate);
7389
7442
  }) || null;
7390
7443
  }
7391
7444
  }, {
@@ -7746,8 +7799,8 @@ var Server = /*#__PURE__*/function () {
7746
7799
  value: (function () {
7747
7800
  var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(context, options) {
7748
7801
  var _menu_list_ids$length3,
7749
- _this21 = this;
7750
- 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;
7802
+ _this22 = this;
7803
+ 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;
7751
7804
  return _regeneratorRuntime().wrap(function _callee75$(_context75) {
7752
7805
  while (1) switch (_context75.prev = _context75.next) {
7753
7806
  case 0:
@@ -7758,12 +7811,6 @@ var Server = /*#__PURE__*/function () {
7758
7811
  }).filter(function (id) {
7759
7812
  return Number.isFinite(id);
7760
7813
  }) : [];
7761
- formatterContext = this.buildProductFormatterContext({
7762
- schedule_date: schedule_date,
7763
- schedule_datetime: schedule_datetime,
7764
- customer_id: customer_id,
7765
- strategy_context: strategy_context
7766
- });
7767
7814
  this.logInfo('computeProductQueryResult 开始', {
7768
7815
  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,
7769
7816
  ids: queryIds,
@@ -7775,28 +7822,48 @@ var Server = /*#__PURE__*/function () {
7775
7822
  strategyContextKeys: strategy_context ? Object.keys(strategy_context) : [],
7776
7823
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
7777
7824
  });
7778
- if (this.products) {
7825
+
7826
+ // 预渲染可能在 PisellOS 顺序 preload 尚未完成时发起商品查询。此时 Menu/Schedule
7827
+ // 暂时为空不代表缓存失效;等待当前 preload 后再按原逻辑查询,避免并发远端刷新先 clear
7828
+ // SQLite/IndexDB,造成 preload 读到空数据并重复请求。正常运行期该字段为 null,不增加等待。
7829
+ startupPreloadTask = this.startupModulePreloadInFlight;
7830
+ if (!startupPreloadTask) {
7779
7831
  _context75.next = 8;
7780
7832
  break;
7781
7833
  }
7834
+ _context75.next = 8;
7835
+ return startupPreloadTask;
7836
+ case 8:
7837
+ // Menu/Schedule preload 会替换 store 中的数组;必须在等待完成后再读取,
7838
+ // 避免 formatterContext 持有预加载前的空数组快照。
7839
+ formatterContext = this.buildProductFormatterContext({
7840
+ schedule_date: schedule_date,
7841
+ schedule_datetime: schedule_datetime,
7842
+ customer_id: customer_id,
7843
+ strategy_context: strategy_context
7844
+ });
7845
+ if (this.products) {
7846
+ _context75.next = 12;
7847
+ break;
7848
+ }
7782
7849
  this.logError('computeProductQueryResult: Products 模块未注册');
7783
7850
  return _context75.abrupt("return", {
7784
7851
  message: 'Products 模块未注册',
7785
7852
  data: this.buildProductQueryResultPayload([], 0)
7786
7853
  });
7787
- case 8:
7854
+ case 12:
7788
7855
  if (!(queryIds.length > 0)) {
7789
- _context75.next = 20;
7856
+ _context75.next = 24;
7790
7857
  break;
7791
7858
  }
7792
7859
  uniqueIds = Array.from(new Set(queryIds));
7793
7860
  _tPrice = performance.now();
7794
- _context75.next = 13;
7861
+ _context75.next = 17;
7795
7862
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
7796
7863
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
7797
7864
  productIds: uniqueIds
7798
7865
  });
7799
- case 13:
7866
+ case 17:
7800
7867
  productsWithPrice = _context75.sent;
7801
7868
  perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
7802
7869
  count: productsWithPrice.length,
@@ -7823,18 +7890,18 @@ var Server = /*#__PURE__*/function () {
7823
7890
  message: '',
7824
7891
  status: true
7825
7892
  });
7826
- case 20:
7893
+ case 24:
7827
7894
  if (!(product_id != null && Number.isFinite(Number(product_id)))) {
7828
- _context75.next = 32;
7895
+ _context75.next = 36;
7829
7896
  break;
7830
7897
  }
7831
7898
  pid = Number(product_id);
7832
7899
  _tPrice2 = performance.now();
7833
- _context75.next = 25;
7900
+ _context75.next = 29;
7834
7901
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
7835
7902
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
7836
7903
  });
7837
- case 25:
7904
+ case 29:
7838
7905
  allProductsWithPrice = _context75.sent;
7839
7906
  perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
7840
7907
  count: allProductsWithPrice.length,
@@ -7861,17 +7928,17 @@ var Server = /*#__PURE__*/function () {
7861
7928
  message: item ? '' : '商品不存在或未发布',
7862
7929
  status: true
7863
7930
  });
7864
- case 32:
7931
+ case 36:
7865
7932
  if (!this.shouldQueryProductsByExtensionTypes(extension_type)) {
7866
- _context75.next = 52;
7933
+ _context75.next = 56;
7867
7934
  break;
7868
7935
  }
7869
7936
  _tPrice3 = performance.now();
7870
- _context75.next = 36;
7937
+ _context75.next = 40;
7871
7938
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
7872
7939
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
7873
7940
  });
7874
- case 36:
7941
+ case 40:
7875
7942
  _filteredProducts2 = _context75.sent;
7876
7943
  perfMark('computeQuery.getProductsWithPrice(extensionType)', performance.now() - _tPrice3, {
7877
7944
  count: _filteredProducts2.length,
@@ -7917,9 +7984,9 @@ var Server = /*#__PURE__*/function () {
7917
7984
  message: '',
7918
7985
  status: true
7919
7986
  });
7920
- case 52:
7987
+ case 56:
7921
7988
  if (this.menu) {
7922
- _context75.next = 55;
7989
+ _context75.next = 59;
7923
7990
  break;
7924
7991
  }
7925
7992
  this.logError('computeProductQueryResult: Menu 模块未注册');
@@ -7927,9 +7994,9 @@ var Server = /*#__PURE__*/function () {
7927
7994
  message: 'Menu 模块未注册',
7928
7995
  data: this.buildProductQueryResultPayload([], 0)
7929
7996
  });
7930
- case 55:
7997
+ case 59:
7931
7998
  if (this.schedule) {
7932
- _context75.next = 58;
7999
+ _context75.next = 62;
7933
8000
  break;
7934
8001
  }
7935
8002
  this.logError('computeProductQueryResult: Schedule 模块未注册');
@@ -7937,41 +8004,41 @@ var Server = /*#__PURE__*/function () {
7937
8004
  message: 'Schedule 模块未注册',
7938
8005
  data: this.buildProductQueryResultPayload([], 0)
7939
8006
  });
7940
- case 58:
8007
+ case 62:
7941
8008
  activeMenuList = [];
7942
8009
  if (!(menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0)) {
7943
- _context75.next = 71;
8010
+ _context75.next = 75;
7944
8011
  break;
7945
8012
  }
7946
8013
  tMenu = performance.now();
7947
8014
  getActiveMenus = function getActiveMenus() {
7948
- return _this21.menu.getMenuByIds(menu_list_ids).filter(function (menu) {
7949
- var _this21$schedule;
7950
- return ((_this21$schedule = _this21.schedule) === null || _this21$schedule === void 0 ? void 0 : _this21$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
8015
+ return _this22.menu.getMenuByIds(menu_list_ids).filter(function (menu) {
8016
+ var _this22$schedule;
8017
+ return ((_this22$schedule = _this22.schedule) === null || _this22$schedule === void 0 ? void 0 : _this22$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
7951
8018
  });
7952
8019
  };
7953
8020
  activeMenuList = getActiveMenus();
7954
8021
  _context75.t0 = !activeMenuList.length;
7955
8022
  if (!_context75.t0) {
7956
- _context75.next = 68;
8023
+ _context75.next = 72;
7957
8024
  break;
7958
8025
  }
7959
- _context75.next = 67;
8026
+ _context75.next = 71;
7960
8027
  return this.refreshMenuScheduleCacheAfterEmptyResult();
7961
- case 67:
8028
+ case 71:
7962
8029
  _context75.t0 = _context75.sent;
7963
- case 68:
8030
+ case 72:
7964
8031
  if (!_context75.t0) {
7965
- _context75.next = 70;
8032
+ _context75.next = 74;
7966
8033
  break;
7967
8034
  }
7968
8035
  activeMenuList = getActiveMenus();
7969
- case 70:
8036
+ case 74:
7970
8037
  perfMark('computeQuery.filterActiveMenu', performance.now() - tMenu, {
7971
8038
  totalMenu: menu_list_ids.length,
7972
8039
  activeMenu: activeMenuList.length
7973
8040
  });
7974
- case 71:
8041
+ case 75:
7975
8042
  tFilter = performance.now();
7976
8043
  productScope = this.getProductScopeByMenuConfig(activeMenuList);
7977
8044
  scopedProductIds = this.products.getProductIdsByScope(productScope);
@@ -7982,21 +8049,21 @@ var Server = /*#__PURE__*/function () {
7982
8049
  });
7983
8050
  tPrice = performance.now();
7984
8051
  if (!(scopedProductIds.length > 0)) {
7985
- _context75.next = 82;
8052
+ _context75.next = 86;
7986
8053
  break;
7987
8054
  }
7988
- _context75.next = 79;
8055
+ _context75.next = 83;
7989
8056
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
7990
8057
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
7991
8058
  productIds: productScope.isAllProducts ? undefined : scopedProductIds
7992
8059
  });
7993
- case 79:
8060
+ case 83:
7994
8061
  _context75.t1 = _context75.sent;
7995
- _context75.next = 83;
8062
+ _context75.next = 87;
7996
8063
  break;
7997
- case 82:
8064
+ case 86:
7998
8065
  _context75.t1 = [];
7999
- case 83:
8066
+ case 87:
8000
8067
  filteredProducts = _context75.t1;
8001
8068
  perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
8002
8069
  count: filteredProducts.length,
@@ -8044,7 +8111,7 @@ var Server = /*#__PURE__*/function () {
8044
8111
  message: '',
8045
8112
  status: true
8046
8113
  });
8047
- case 99:
8114
+ case 103:
8048
8115
  case "end":
8049
8116
  return _context75.stop();
8050
8117
  }
@@ -8256,7 +8323,7 @@ var Server = /*#__PURE__*/function () {
8256
8323
  }, {
8257
8324
  key: "notifySalesSearchSubscribers",
8258
8325
  value: function notifySalesSearchSubscribers(payload) {
8259
- var _this22 = this;
8326
+ var _this23 = this;
8260
8327
  if (this.salesSearchSubscribers.size === 0) return;
8261
8328
  var changedOrders = this.extractChangedOrdersFromPayload(payload);
8262
8329
  if (changedOrders.length === 0) {
@@ -8274,21 +8341,21 @@ var Server = /*#__PURE__*/function () {
8274
8341
  subscriber = _step20$value[1];
8275
8342
  try {
8276
8343
  var changedVisibleOrders = changedOrders.filter(function (order) {
8277
- var orderId = _this22.getSalesSearchOrderId(order);
8344
+ var orderId = _this23.getSalesSearchOrderId(order);
8278
8345
  return !!orderId && subscriber.visibleOrderIds.has(orderId);
8279
8346
  });
8280
8347
  if (changedVisibleOrders.length === 0) {
8281
8348
  return 1; // continue
8282
8349
  }
8283
- subscriber.callback(_this22.buildSalesSearchDeltaResponse(subscriber, changedVisibleOrders));
8284
- _this22.logInfo('notifySalesSearchSubscribers: 已推送 delta', {
8350
+ subscriber.callback(_this23.buildSalesSearchDeltaResponse(subscriber, changedVisibleOrders));
8351
+ _this23.logInfo('notifySalesSearchSubscribers: 已推送 delta', {
8285
8352
  subscriberId: subscriberId,
8286
8353
  kind: subscriber.kind,
8287
8354
  count: changedVisibleOrders.length
8288
8355
  });
8289
8356
  } catch (error) {
8290
8357
  var errorMessage = error instanceof Error ? error.message : String(error);
8291
- _this22.logError('notifySalesSearchSubscribers: 推送失败', {
8358
+ _this23.logError('notifySalesSearchSubscribers: 推送失败', {
8292
8359
  subscriberId: subscriberId,
8293
8360
  error: errorMessage
8294
8361
  });