@pisell/pisellos 0.10.7 → 0.10.9

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 (124) hide show
  1. package/dist/core/index.js +0 -1
  2. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
  3. package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
  4. package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
  5. package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
  6. package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
  7. package/dist/model/strategy/adapter/walletPass/utils.js +57 -26
  8. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +18 -12
  9. package/dist/modules/BookingContext/utils/productExtend.js +5 -9
  10. package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
  11. package/dist/modules/Customer/index.d.ts +4 -0
  12. package/dist/modules/Customer/index.js +91 -59
  13. package/dist/modules/Customer/types.d.ts +2 -0
  14. package/dist/modules/Discount/index.d.ts +2 -0
  15. package/dist/modules/Discount/index.js +38 -5
  16. package/dist/modules/Discount/types.d.ts +11 -0
  17. package/dist/modules/Order/index.d.ts +32 -6
  18. package/dist/modules/Order/index.js +1165 -819
  19. package/dist/modules/Order/types.d.ts +32 -4
  20. package/dist/modules/Order/types.js +11 -0
  21. package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
  22. package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
  23. package/dist/modules/Order/utils/virtualSettlement.d.ts +56 -0
  24. package/dist/modules/Order/utils/virtualSettlement.js +271 -0
  25. package/dist/modules/Order/utils.js +89 -48
  26. package/dist/modules/Payment/types.d.ts +2 -0
  27. package/dist/modules/Payment/utils.js +4 -1
  28. package/dist/modules/Payment/walletpass.d.ts +11 -0
  29. package/dist/modules/Payment/walletpass.js +235 -60
  30. package/dist/modules/Product/types.d.ts +23 -0
  31. package/dist/modules/ProductList/index.d.ts +15 -2
  32. package/dist/modules/ProductList/index.js +92 -13
  33. package/dist/modules/Rules/index.js +125 -52
  34. package/dist/modules/SalesSummary/index.d.ts +1 -0
  35. package/dist/modules/SalesSummary/index.js +4 -3
  36. package/dist/modules/SalesSummary/types.d.ts +1 -0
  37. package/dist/modules/SalesSummary/utils.d.ts +1 -0
  38. package/dist/modules/SalesSummary/utils.js +28 -2
  39. package/dist/server/index.d.ts +15 -0
  40. package/dist/server/index.js +894 -781
  41. package/dist/server/modules/order/index.d.ts +2 -0
  42. package/dist/server/modules/order/index.js +261 -96
  43. package/dist/server/modules/order/types.d.ts +1 -1
  44. package/dist/server/utils/small-ticket.js +2 -1
  45. package/dist/solution/BaseSales/index.d.ts +41 -7
  46. package/dist/solution/BaseSales/index.js +1405 -974
  47. package/dist/solution/BaseSales/utils/cartPromotion.js +26 -3
  48. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  49. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +79 -13
  50. package/dist/solution/BaseSales/utils.js +31 -20
  51. package/dist/solution/BookingByStep/index.d.ts +3 -3
  52. package/dist/solution/BookingTicket/index.d.ts +5 -1
  53. package/dist/solution/BookingTicket/index.js +221 -162
  54. package/dist/solution/BookingTicket/types.d.ts +3 -0
  55. package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
  56. package/dist/solution/BookingTicket/utils/cartView.js +44 -32
  57. package/dist/solution/Sales/index.d.ts +1 -0
  58. package/dist/solution/Sales/index.js +16 -2
  59. package/dist/solution/ScanOrder/index.js +25 -64
  60. package/dist/solution/ScanOrder/utils.js +31 -20
  61. package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
  62. package/dist/solution/UnifiedBookingSales/index.js +51 -39
  63. package/lib/core/index.js +0 -1
  64. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
  65. package/lib/model/strategy/adapter/dataVariant/evaluator.js +170 -7
  66. package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
  67. package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
  68. package/lib/model/strategy/adapter/walletPass/type.d.ts +5 -0
  69. package/lib/model/strategy/adapter/walletPass/utils.js +62 -11
  70. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +6 -1
  71. package/lib/modules/BookingContext/utils/productExtend.js +4 -3
  72. package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
  73. package/lib/modules/Customer/index.d.ts +4 -0
  74. package/lib/modules/Customer/index.js +11 -0
  75. package/lib/modules/Customer/types.d.ts +2 -0
  76. package/lib/modules/Discount/index.d.ts +2 -0
  77. package/lib/modules/Discount/index.js +37 -3
  78. package/lib/modules/Discount/types.d.ts +11 -0
  79. package/lib/modules/Order/index.d.ts +32 -6
  80. package/lib/modules/Order/index.js +518 -148
  81. package/lib/modules/Order/types.d.ts +32 -4
  82. package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
  83. package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
  84. package/lib/modules/Order/utils/virtualSettlement.d.ts +56 -0
  85. package/lib/modules/Order/utils/virtualSettlement.js +300 -0
  86. package/lib/modules/Order/utils.js +65 -21
  87. package/lib/modules/Payment/types.d.ts +2 -0
  88. package/lib/modules/Payment/utils.js +5 -1
  89. package/lib/modules/Payment/walletpass.d.ts +11 -0
  90. package/lib/modules/Payment/walletpass.js +198 -17
  91. package/lib/modules/Product/types.d.ts +23 -0
  92. package/lib/modules/ProductList/index.d.ts +15 -2
  93. package/lib/modules/ProductList/index.js +85 -3
  94. package/lib/modules/Rules/index.js +100 -20
  95. package/lib/modules/SalesSummary/index.d.ts +1 -0
  96. package/lib/modules/SalesSummary/index.js +10 -2
  97. package/lib/modules/SalesSummary/types.d.ts +1 -0
  98. package/lib/modules/SalesSummary/utils.d.ts +1 -0
  99. package/lib/modules/SalesSummary/utils.js +30 -2
  100. package/lib/server/index.d.ts +15 -0
  101. package/lib/server/index.js +105 -14
  102. package/lib/server/modules/order/index.d.ts +2 -0
  103. package/lib/server/modules/order/index.js +75 -5
  104. package/lib/server/modules/order/types.d.ts +1 -1
  105. package/lib/server/utils/small-ticket.js +1 -1
  106. package/lib/solution/BaseSales/index.d.ts +41 -7
  107. package/lib/solution/BaseSales/index.js +325 -39
  108. package/lib/solution/BaseSales/utils/cartPromotion.js +26 -2
  109. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  110. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +62 -12
  111. package/lib/solution/BaseSales/utils.js +29 -18
  112. package/lib/solution/BookingByStep/index.d.ts +3 -3
  113. package/lib/solution/BookingTicket/index.d.ts +5 -1
  114. package/lib/solution/BookingTicket/index.js +31 -6
  115. package/lib/solution/BookingTicket/types.d.ts +3 -0
  116. package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -1
  117. package/lib/solution/BookingTicket/utils/cartView.js +43 -30
  118. package/lib/solution/Sales/index.d.ts +1 -0
  119. package/lib/solution/Sales/index.js +15 -3
  120. package/lib/solution/ScanOrder/index.js +17 -54
  121. package/lib/solution/ScanOrder/utils.js +29 -18
  122. package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
  123. package/lib/solution/UnifiedBookingSales/index.js +35 -26
  124. package/package.json +1 -1
@@ -33,6 +33,7 @@ import { FloorPlanModule } from "./modules/floor-plan";
33
33
  import { FloorPlanHooks } from "./modules/floor-plan/types";
34
34
  import { PaymentServerModule } from "./modules/payment";
35
35
  import { extractScheduleIdsFromMenus, extractTimePointsFromSchedules } from "./utils/schedule";
36
+ import { sortTimePoints } from "./utils/time";
36
37
  import { ProductsHooks } from "./modules/products/types";
37
38
  import { perfMark } from "./utils/product";
38
39
  import { OrderModule } from "./modules/order";
@@ -58,6 +59,7 @@ import { getOrderPaymentIdentityKeys, isIdentifiedPendingOrderPayment, isPending
58
59
  /** 平面图 GET 查询订阅者(列表 / id 详情 / code 详情) */
59
60
 
60
61
  var PRODUCT_TITLE_SNAPSHOT_KEYS = ['en', 'ja', 'pt', 'auto', 'zh-CN', 'zh-HK', 'kitchen', 'original'];
62
+ var AUTO_PRINT_STORAGE_KEY = 'auto_print';
61
63
 
62
64
  /**
63
65
  * Server 类
@@ -336,7 +338,11 @@ var Server = /*#__PURE__*/function () {
336
338
  case 9:
337
339
  result = _context3.sent;
338
340
  if (subscriberId && typeof callback === 'function') {
339
- _this.syncProductQueryScheduleTimers(subscriberId, strategy_context);
341
+ _this.syncProductQueryScheduleTimers({
342
+ subscriberId: subscriberId,
343
+ menu_list_ids: menu_list_ids,
344
+ strategy_context: strategy_context
345
+ });
340
346
  }
341
347
  return _context3.abrupt("return", result);
342
348
  case 12:
@@ -1679,7 +1685,7 @@ var Server = /*#__PURE__*/function () {
1679
1685
  _defineProperty(this, "handleGetScheduleTimePoints", /*#__PURE__*/function () {
1680
1686
  var _ref59 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(_ref58) {
1681
1687
  var _menu_list_ids$length;
1682
- var url, method, data, config, menu_list_ids, _menu_list_ids$length2, menuList, scheduleIds, scheduleList, timePoints, errorMessage;
1688
+ var url, method, data, config, menu_list_ids, _menu_list_ids$length2, _this$getMenuSchedule, menuList, scheduleIds, scheduleList, timePoints, errorMessage;
1683
1689
  return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1684
1690
  while (1) switch (_context24.prev = _context24.next) {
1685
1691
  case 0:
@@ -1735,8 +1741,7 @@ var Server = /*#__PURE__*/function () {
1735
1741
  });
1736
1742
  case 16:
1737
1743
  _context24.prev = 16;
1738
- // 1. 获取餐牌列表
1739
- menuList = _this.menu.getMenuByIds(menu_list_ids);
1744
+ _this$getMenuSchedule = _this.getMenuScheduleTimePoints(menu_list_ids), menuList = _this$getMenuSchedule.menuList, scheduleIds = _this$getMenuSchedule.scheduleIds, scheduleList = _this$getMenuSchedule.scheduleList, timePoints = _this$getMenuSchedule.timePoints;
1740
1745
  console.log("[Server] \u627E\u5230 ".concat(menuList.length, " \u4E2A\u9910\u724C"));
1741
1746
  _this.logInfo('handleGetScheduleTimePoints: 获取到餐牌列表', {
1742
1747
  requestedCount: menu_list_ids.length,
@@ -1744,15 +1749,12 @@ var Server = /*#__PURE__*/function () {
1744
1749
  menu_list_ids: menu_list_ids,
1745
1750
  menuList: menuList
1746
1751
  });
1747
-
1748
- // 2. 提取所有的 schedule IDs
1749
- scheduleIds = extractScheduleIdsFromMenus(menuList);
1750
1752
  console.log("[Server] \u63D0\u53D6\u5230 ".concat(scheduleIds.length, " \u4E2A\u65E5\u7A0BID:"), scheduleIds);
1751
1753
  _this.logInfo('handleGetScheduleTimePoints: 提取到日程 IDs', {
1752
1754
  scheduleCount: scheduleIds.length
1753
1755
  });
1754
1756
  if (!(scheduleIds.length === 0)) {
1755
- _context24.next = 26;
1757
+ _context24.next = 25;
1756
1758
  break;
1757
1759
  }
1758
1760
  _this.logInfo('handleGetScheduleTimePoints: 没有找到相关日程', {
@@ -1764,17 +1766,12 @@ var Server = /*#__PURE__*/function () {
1764
1766
  data: [],
1765
1767
  status: true
1766
1768
  });
1767
- case 26:
1768
- // 3. 获取日程详情
1769
- scheduleList = _this.schedule.getScheduleByIds(scheduleIds);
1769
+ case 25:
1770
1770
  console.log("[Server] \u627E\u5230 ".concat(scheduleList.length, " \u4E2A\u65E5\u7A0B"));
1771
1771
  _this.logInfo('handleGetScheduleTimePoints: 获取到日程详情', {
1772
1772
  requestedCount: scheduleIds.length,
1773
1773
  foundCount: scheduleList.length
1774
1774
  });
1775
-
1776
- // 4. 提取时间点
1777
- timePoints = extractTimePointsFromSchedules(scheduleList);
1778
1775
  console.log("[Server] \u63D0\u53D6\u5230 ".concat(timePoints.length, " \u4E2A\u65F6\u95F4\u70B9:"), timePoints);
1779
1776
  _this.logInfo('handleGetScheduleTimePoints 处理完成', {
1780
1777
  menuListIdsCount: menu_list_ids.length,
@@ -1788,8 +1785,8 @@ var Server = /*#__PURE__*/function () {
1788
1785
  data: timePoints,
1789
1786
  status: true
1790
1787
  });
1791
- case 35:
1792
- _context24.prev = 35;
1788
+ case 32:
1789
+ _context24.prev = 32;
1793
1790
  _context24.t0 = _context24["catch"](16);
1794
1791
  errorMessage = _context24.t0 instanceof Error ? _context24.t0.message : '未知错误';
1795
1792
  console.error('[Server] 获取日程时间点失败:', _context24.t0);
@@ -1803,11 +1800,11 @@ var Server = /*#__PURE__*/function () {
1803
1800
  data: [],
1804
1801
  status: false
1805
1802
  });
1806
- case 41:
1803
+ case 38:
1807
1804
  case "end":
1808
1805
  return _context24.stop();
1809
1806
  }
1810
- }, _callee24, null, [[16, 35]]);
1807
+ }, _callee24, null, [[16, 32]]);
1811
1808
  }));
1812
1809
  return function (_x24) {
1813
1810
  return _ref59.apply(this, arguments);
@@ -2931,6 +2928,87 @@ var Server = /*#__PURE__*/function () {
2931
2928
  }
2932
2929
  return refreshOrdersInBackground;
2933
2930
  }()
2931
+ /**
2932
+ * 编辑正式订单时强制查询 Server 最新快照并覆盖本地缓存。
2933
+ * 商品成员增删由 OrderModule 在 SQLite/Store 更新完成后广播,
2934
+ * UI 可复用 order:onRemoteProductMembershipChanged 处理冲突。
2935
+ */
2936
+ )
2937
+ }, {
2938
+ key: "checkRemoteOrderProductMembership",
2939
+ value: (function () {
2940
+ var _checkRemoteOrderProductMembership = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(orderId) {
2941
+ var normalizedOrderId, error, startTime, freshOrders, freshOrder;
2942
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2943
+ while (1) switch (_context36.prev = _context36.next) {
2944
+ case 0:
2945
+ normalizedOrderId = String(orderId !== null && orderId !== void 0 ? orderId : '').trim();
2946
+ if (!(!normalizedOrderId || normalizedOrderId.startsWith('local_order'))) {
2947
+ _context36.next = 4;
2948
+ break;
2949
+ }
2950
+ this.logInfo('checkRemoteOrderProductMembership: 跳过非正式订单', {
2951
+ orderId: orderId
2952
+ });
2953
+ return _context36.abrupt("return");
2954
+ case 4:
2955
+ if (this.order) {
2956
+ _context36.next = 8;
2957
+ break;
2958
+ }
2959
+ error = new Error('Order 模块未注册');
2960
+ this.logWarning('checkRemoteOrderProductMembership: Order 模块未注册', {
2961
+ orderId: normalizedOrderId
2962
+ });
2963
+ throw error;
2964
+ case 8:
2965
+ this.logInfo('checkRemoteOrderProductMembership 开始', {
2966
+ orderId: normalizedOrderId
2967
+ });
2968
+ startTime = Date.now();
2969
+ _context36.prev = 10;
2970
+ _context36.next = 13;
2971
+ return this.order.fetchOrdersByHttp([normalizedOrderId]);
2972
+ case 13:
2973
+ freshOrders = _context36.sent;
2974
+ freshOrder = freshOrders.find(function (order) {
2975
+ return String(order === null || order === void 0 ? void 0 : order.order_id) === normalizedOrderId;
2976
+ });
2977
+ if (freshOrder) {
2978
+ _context36.next = 17;
2979
+ break;
2980
+ }
2981
+ throw new Error('Server 未返回目标订单最新快照');
2982
+ case 17:
2983
+ _context36.next = 19;
2984
+ return this.order.upsertOrdersFromRemote([freshOrder], 'manual.editOpenRemoteCheck');
2985
+ case 19:
2986
+ this.logInfo('checkRemoteOrderProductMembership 完成', {
2987
+ orderId: normalizedOrderId,
2988
+ duration: "".concat(Date.now() - startTime, "ms")
2989
+ });
2990
+ _context36.next = 26;
2991
+ break;
2992
+ case 22:
2993
+ _context36.prev = 22;
2994
+ _context36.t0 = _context36["catch"](10);
2995
+ this.logError('checkRemoteOrderProductMembership 失败', {
2996
+ orderId: normalizedOrderId,
2997
+ duration: "".concat(Date.now() - startTime, "ms"),
2998
+ error: _context36.t0 instanceof Error ? _context36.t0.message : String(_context36.t0)
2999
+ });
3000
+ throw _context36.t0;
3001
+ case 26:
3002
+ case "end":
3003
+ return _context36.stop();
3004
+ }
3005
+ }, _callee36, this, [[10, 22]]);
3006
+ }));
3007
+ function checkRemoteOrderProductMembership(_x36) {
3008
+ return _checkRemoteOrderProductMembership.apply(this, arguments);
3009
+ }
3010
+ return checkRemoteOrderProductMembership;
3011
+ }()
2934
3012
  /**
2935
3013
  * 清空所有server模块的IndexedDB缓存
2936
3014
  * @returns Promise<void>
@@ -2939,10 +3017,10 @@ var Server = /*#__PURE__*/function () {
2939
3017
  }, {
2940
3018
  key: "clearAllIndexDB",
2941
3019
  value: (function () {
2942
- var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
3020
+ var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
2943
3021
  var clearTasks, moduleNames, errorMessage;
2944
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2945
- while (1) switch (_context36.prev = _context36.next) {
3022
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3023
+ while (1) switch (_context37.prev = _context37.next) {
2946
3024
  case 0:
2947
3025
  console.log('[Server] 开始清空所有模块的IndexedDB缓存...');
2948
3026
  this.logInfo('开始清空所有模块的 IndexedDB 缓存');
@@ -2977,41 +3055,41 @@ var Server = /*#__PURE__*/function () {
2977
3055
  moduleNames.push('FloorPlan');
2978
3056
  }
2979
3057
  if (!(clearTasks.length === 0)) {
2980
- _context36.next = 15;
3058
+ _context37.next = 15;
2981
3059
  break;
2982
3060
  }
2983
3061
  console.warn('[Server] 没有找到已注册的模块,无需清空');
2984
3062
  this.logWarning('没有找到已注册的模块,无需清空 IndexedDB');
2985
- return _context36.abrupt("return");
3063
+ return _context37.abrupt("return");
2986
3064
  case 15:
2987
3065
  this.logInfo('准备清空模块缓存', {
2988
3066
  moduleNames: moduleNames
2989
3067
  });
2990
- _context36.prev = 16;
2991
- _context36.next = 19;
3068
+ _context37.prev = 16;
3069
+ _context37.next = 19;
2992
3070
  return Promise.all(clearTasks);
2993
3071
  case 19:
2994
3072
  console.log("[Server] \u2705 \u5DF2\u6210\u529F\u6E05\u7A7A\u6240\u6709\u6A21\u5757\u7684IndexedDB\u7F13\u5B58: ".concat(moduleNames.join(', ')));
2995
3073
  this.logInfo('成功清空所有模块的 IndexedDB 缓存', {
2996
3074
  moduleNames: moduleNames
2997
3075
  });
2998
- _context36.next = 29;
3076
+ _context37.next = 29;
2999
3077
  break;
3000
3078
  case 23:
3001
- _context36.prev = 23;
3002
- _context36.t0 = _context36["catch"](16);
3003
- errorMessage = _context36.t0 instanceof Error ? _context36.t0.message : String(_context36.t0);
3004
- console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context36.t0);
3079
+ _context37.prev = 23;
3080
+ _context37.t0 = _context37["catch"](16);
3081
+ errorMessage = _context37.t0 instanceof Error ? _context37.t0.message : String(_context37.t0);
3082
+ console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context37.t0);
3005
3083
  this.logError('清空 IndexedDB 缓存时发生错误', {
3006
3084
  moduleNames: moduleNames,
3007
3085
  error: errorMessage
3008
3086
  });
3009
- throw _context36.t0;
3087
+ throw _context37.t0;
3010
3088
  case 29:
3011
3089
  case "end":
3012
- return _context36.stop();
3090
+ return _context37.stop();
3013
3091
  }
3014
- }, _callee36, this, [[16, 23]]);
3092
+ }, _callee37, this, [[16, 23]]);
3015
3093
  }));
3016
3094
  function clearAllIndexDB() {
3017
3095
  return _clearAllIndexDB.apply(this, arguments);
@@ -3086,10 +3164,10 @@ var Server = /*#__PURE__*/function () {
3086
3164
  }, {
3087
3165
  key: "handleRoute",
3088
3166
  value: (function () {
3089
- var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(method, path, params) {
3167
+ var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(method, path, params) {
3090
3168
  var startTime, handler, result, duration, _duration4, errorMessage;
3091
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3092
- while (1) switch (_context37.prev = _context37.next) {
3169
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3170
+ while (1) switch (_context38.prev = _context38.next) {
3093
3171
  case 0:
3094
3172
  startTime = Date.now();
3095
3173
  this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5F00\u59CB: ".concat(method.toUpperCase(), " ").concat(path), {
@@ -3100,7 +3178,7 @@ var Server = /*#__PURE__*/function () {
3100
3178
  });
3101
3179
  handler = this.getRouteHandler(method, path);
3102
3180
  if (handler) {
3103
- _context37.next = 6;
3181
+ _context38.next = 6;
3104
3182
  break;
3105
3183
  }
3106
3184
  this.logError("\u8DEF\u7531\u672A\u627E\u5230: ".concat(method.toUpperCase(), " ").concat(path), {
@@ -3109,13 +3187,13 @@ var Server = /*#__PURE__*/function () {
3109
3187
  });
3110
3188
  throw new Error("Route not found: ".concat(method.toUpperCase(), " ").concat(path));
3111
3189
  case 6:
3112
- _context37.prev = 6;
3113
- _context37.next = 9;
3190
+ _context38.prev = 6;
3191
+ _context38.next = 9;
3114
3192
  return handler(_objectSpread(_objectSpread({}, params), {}, {
3115
3193
  path: path
3116
3194
  }));
3117
3195
  case 9:
3118
- result = _context37.sent;
3196
+ result = _context38.sent;
3119
3197
  duration = Date.now() - startTime;
3120
3198
  this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5B8C\u6210: ".concat(method.toUpperCase(), " ").concat(path), {
3121
3199
  method: method.toUpperCase(),
@@ -3124,12 +3202,12 @@ var Server = /*#__PURE__*/function () {
3124
3202
  resultCode: result === null || result === void 0 ? void 0 : result.code,
3125
3203
  resultStatus: result === null || result === void 0 ? void 0 : result.status
3126
3204
  });
3127
- return _context37.abrupt("return", result);
3205
+ return _context38.abrupt("return", result);
3128
3206
  case 15:
3129
- _context37.prev = 15;
3130
- _context37.t0 = _context37["catch"](6);
3207
+ _context38.prev = 15;
3208
+ _context38.t0 = _context38["catch"](6);
3131
3209
  _duration4 = Date.now() - startTime;
3132
- errorMessage = _context37.t0 instanceof Error ? _context37.t0.message : String(_context37.t0);
3210
+ errorMessage = _context38.t0 instanceof Error ? _context38.t0.message : String(_context38.t0);
3133
3211
  this.logError("\u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), {
3134
3212
  method: method.toUpperCase(),
3135
3213
  path: path,
@@ -3137,15 +3215,15 @@ var Server = /*#__PURE__*/function () {
3137
3215
  error: errorMessage,
3138
3216
  data: params.data
3139
3217
  });
3140
- console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), _context37.t0);
3141
- throw _context37.t0;
3218
+ console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), _context38.t0);
3219
+ throw _context38.t0;
3142
3220
  case 22:
3143
3221
  case "end":
3144
- return _context37.stop();
3222
+ return _context38.stop();
3145
3223
  }
3146
- }, _callee37, this, [[6, 15]]);
3224
+ }, _callee38, this, [[6, 15]]);
3147
3225
  }));
3148
- function handleRoute(_x36, _x37, _x38) {
3226
+ function handleRoute(_x37, _x38, _x39) {
3149
3227
  return _handleRoute.apply(this, arguments);
3150
3228
  }
3151
3229
  return handleRoute;
@@ -3289,36 +3367,36 @@ var Server = /*#__PURE__*/function () {
3289
3367
  }, {
3290
3368
  key: "getPaymentRouteModule",
3291
3369
  value: function () {
3292
- var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3370
+ var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
3293
3371
  var _this6 = this;
3294
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3295
- while (1) switch (_context39.prev = _context39.next) {
3372
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3373
+ while (1) switch (_context40.prev = _context40.next) {
3296
3374
  case 0:
3297
3375
  if (!this.payment) {
3298
- _context39.next = 2;
3376
+ _context40.next = 2;
3299
3377
  break;
3300
3378
  }
3301
- return _context39.abrupt("return", this.payment);
3379
+ return _context40.abrupt("return", this.payment);
3302
3380
  case 2:
3303
3381
  if (!this.paymentRouteModule) {
3304
- _context39.next = 4;
3382
+ _context40.next = 4;
3305
3383
  break;
3306
3384
  }
3307
- return _context39.abrupt("return", this.paymentRouteModule);
3385
+ return _context40.abrupt("return", this.paymentRouteModule);
3308
3386
  case 4:
3309
3387
  if (!this.paymentRouteModuleInFlight) {
3310
- _context39.next = 6;
3388
+ _context40.next = 6;
3311
3389
  break;
3312
3390
  }
3313
- return _context39.abrupt("return", this.paymentRouteModuleInFlight);
3391
+ return _context40.abrupt("return", this.paymentRouteModuleInFlight);
3314
3392
  case 6:
3315
- this.paymentRouteModuleInFlight = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
3393
+ this.paymentRouteModuleInFlight = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3316
3394
  var module;
3317
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3318
- while (1) switch (_context38.prev = _context38.next) {
3395
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3396
+ while (1) switch (_context39.prev = _context39.next) {
3319
3397
  case 0:
3320
3398
  module = new PaymentServerModule('server_payment_route', '1.0.0');
3321
- _context38.next = 3;
3399
+ _context39.next = 3;
3322
3400
  return module.initialize(_this6.core, {
3323
3401
  store: {
3324
3402
  payMethods: []
@@ -3326,21 +3404,21 @@ var Server = /*#__PURE__*/function () {
3326
3404
  });
3327
3405
  case 3:
3328
3406
  _this6.paymentRouteModule = module;
3329
- return _context38.abrupt("return", module);
3407
+ return _context39.abrupt("return", module);
3330
3408
  case 5:
3331
3409
  case "end":
3332
- return _context38.stop();
3410
+ return _context39.stop();
3333
3411
  }
3334
- }, _callee38);
3412
+ }, _callee39);
3335
3413
  }))().finally(function () {
3336
3414
  _this6.paymentRouteModuleInFlight = undefined;
3337
3415
  });
3338
- return _context39.abrupt("return", this.paymentRouteModuleInFlight);
3416
+ return _context40.abrupt("return", this.paymentRouteModuleInFlight);
3339
3417
  case 8:
3340
3418
  case "end":
3341
- return _context39.stop();
3419
+ return _context40.stop();
3342
3420
  }
3343
- }, _callee39, this);
3421
+ }, _callee40, this);
3344
3422
  }));
3345
3423
  function getPaymentRouteModule() {
3346
3424
  return _getPaymentRouteModule.apply(this, arguments);
@@ -3350,19 +3428,19 @@ var Server = /*#__PURE__*/function () {
3350
3428
  }, {
3351
3429
  key: "fetchQuotationAvailableFromAPI",
3352
3430
  value: function () {
3353
- var _fetchQuotationAvailableFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(data) {
3431
+ var _fetchQuotationAvailableFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(data) {
3354
3432
  var _this$app7;
3355
3433
  var requester;
3356
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3357
- while (1) switch (_context40.prev = _context40.next) {
3434
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3435
+ while (1) switch (_context41.prev = _context41.next) {
3358
3436
  case 0:
3359
3437
  requester = ((_this$app7 = this.app) === null || _this$app7 === void 0 ? void 0 : _this$app7.request) || this.core.getPlugin('request');
3360
3438
  if (requester !== null && requester !== void 0 && requester.get) {
3361
- _context40.next = 4;
3439
+ _context41.next = 4;
3362
3440
  break;
3363
3441
  }
3364
3442
  this.logError('fetchQuotationAvailableFromAPI: request 不可用');
3365
- return _context40.abrupt("return", {
3443
+ return _context41.abrupt("return", {
3366
3444
  code: 500,
3367
3445
  message: 'request 不可用',
3368
3446
  data: {
@@ -3371,14 +3449,14 @@ var Server = /*#__PURE__*/function () {
3371
3449
  status: false
3372
3450
  });
3373
3451
  case 4:
3374
- return _context40.abrupt("return", requester.get('/shop/quotation/available', data));
3452
+ return _context41.abrupt("return", requester.get('/shop/quotation/available', data));
3375
3453
  case 5:
3376
3454
  case "end":
3377
- return _context40.stop();
3455
+ return _context41.stop();
3378
3456
  }
3379
- }, _callee40, this);
3457
+ }, _callee41, this);
3380
3458
  }));
3381
- function fetchQuotationAvailableFromAPI(_x39) {
3459
+ function fetchQuotationAvailableFromAPI(_x40) {
3382
3460
  return _fetchQuotationAvailableFromAPI.apply(this, arguments);
3383
3461
  }
3384
3462
  return fetchQuotationAvailableFromAPI;
@@ -3550,29 +3628,29 @@ var Server = /*#__PURE__*/function () {
3550
3628
  }, {
3551
3629
  key: "onScheduleTimePointTimerFire",
3552
3630
  value: (function () {
3553
- var _onScheduleTimePointTimerFire = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(subscriberId, timerId) {
3631
+ var _onScheduleTimePointTimerFire = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(subscriberId, timerId) {
3554
3632
  var subscriber;
3555
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3556
- while (1) switch (_context41.prev = _context41.next) {
3633
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3634
+ while (1) switch (_context42.prev = _context42.next) {
3557
3635
  case 0:
3558
3636
  timerId && this.removeScheduleTimerRef(subscriberId, timerId);
3559
3637
  if (this.productQuerySubscribers.has(subscriberId)) {
3560
- _context41.next = 3;
3638
+ _context42.next = 3;
3561
3639
  break;
3562
3640
  }
3563
- return _context41.abrupt("return");
3641
+ return _context42.abrupt("return");
3564
3642
  case 3:
3565
3643
  subscriber = this.productQuerySubscribers.get(subscriberId);
3566
3644
  this.refreshSubscriberScheduleAtExecution(subscriber);
3567
- _context41.next = 7;
3645
+ _context42.next = 7;
3568
3646
  return this.recomputeAndNotifySubscriber(subscriberId);
3569
3647
  case 7:
3570
3648
  case "end":
3571
- return _context41.stop();
3649
+ return _context42.stop();
3572
3650
  }
3573
- }, _callee41, this);
3651
+ }, _callee42, this);
3574
3652
  }));
3575
- function onScheduleTimePointTimerFire(_x40, _x41) {
3653
+ function onScheduleTimePointTimerFire(_x41, _x42) {
3576
3654
  return _onScheduleTimePointTimerFire.apply(this, arguments);
3577
3655
  }
3578
3656
  return onScheduleTimePointTimerFire;
@@ -3584,62 +3662,92 @@ var Server = /*#__PURE__*/function () {
3584
3662
  }, {
3585
3663
  key: "recomputeAndNotifySubscriber",
3586
3664
  value: (function () {
3587
- var _recomputeAndNotifySubscriber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(subscriberId) {
3665
+ var _recomputeAndNotifySubscriber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(subscriberId) {
3588
3666
  var subscriber, result, errorMessage;
3589
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3590
- while (1) switch (_context42.prev = _context42.next) {
3667
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3668
+ while (1) switch (_context43.prev = _context43.next) {
3591
3669
  case 0:
3592
3670
  subscriber = this.productQuerySubscribers.get(subscriberId);
3593
3671
  if (subscriber) {
3594
- _context42.next = 3;
3672
+ _context43.next = 3;
3595
3673
  break;
3596
3674
  }
3597
- return _context42.abrupt("return");
3675
+ return _context43.abrupt("return");
3598
3676
  case 3:
3599
- _context42.prev = 3;
3600
- _context42.next = 6;
3677
+ _context43.prev = 3;
3678
+ _context43.next = 6;
3601
3679
  return this.computeProductQueryResult(subscriber.context);
3602
3680
  case 6:
3603
- result = _context42.sent;
3681
+ result = _context43.sent;
3604
3682
  subscriber.callback(result);
3605
3683
  this.logInfo('recomputeAndNotifySubscriber: 已推送', {
3606
3684
  subscriberId: subscriberId,
3607
3685
  schedule_datetime: subscriber.context.schedule_datetime
3608
3686
  });
3609
- _context42.next = 15;
3687
+ _context43.next = 15;
3610
3688
  break;
3611
3689
  case 11:
3612
- _context42.prev = 11;
3613
- _context42.t0 = _context42["catch"](3);
3614
- errorMessage = _context42.t0 instanceof Error ? _context42.t0.message : String(_context42.t0);
3690
+ _context43.prev = 11;
3691
+ _context43.t0 = _context43["catch"](3);
3692
+ errorMessage = _context43.t0 instanceof Error ? _context43.t0.message : String(_context43.t0);
3615
3693
  this.logError('recomputeAndNotifySubscriber: 推送失败', {
3616
3694
  subscriberId: subscriberId,
3617
3695
  error: errorMessage
3618
3696
  });
3619
3697
  case 15:
3620
3698
  case "end":
3621
- return _context42.stop();
3699
+ return _context43.stop();
3622
3700
  }
3623
- }, _callee42, this, [[3, 11]]);
3701
+ }, _callee43, this, [[3, 11]]);
3624
3702
  }));
3625
- function recomputeAndNotifySubscriber(_x42) {
3703
+ function recomputeAndNotifySubscriber(_x43) {
3626
3704
  return _recomputeAndNotifySubscriber.apply(this, arguments);
3627
3705
  }
3628
3706
  return recomputeAndNotifySubscriber;
3629
3707
  }()
3630
3708
  /**
3631
- * query 完成后为 subscriber 同步 schedule 定时器(先 clear 再 schedule)。
3709
+ * 根据餐牌 ID 获取其绑定日程中的全部时间点。
3710
+ * 商品查询定时器与 schedule-time-points 路由共用此逻辑。
3632
3711
  */
3633
3712
  )
3713
+ }, {
3714
+ key: "getMenuScheduleTimePoints",
3715
+ value: function getMenuScheduleTimePoints(menuListIds) {
3716
+ var _this$menu$getMenuByI, _this$menu, _this$schedule$getSch, _this$schedule;
3717
+ var menuList = (_this$menu$getMenuByI = (_this$menu = this.menu) === null || _this$menu === void 0 ? void 0 : _this$menu.getMenuByIds(menuListIds)) !== null && _this$menu$getMenuByI !== void 0 ? _this$menu$getMenuByI : [];
3718
+ var scheduleIds = extractScheduleIdsFromMenus(menuList);
3719
+ var scheduleList = scheduleIds.length > 0 ? (_this$schedule$getSch = (_this$schedule = this.schedule) === null || _this$schedule === void 0 ? void 0 : _this$schedule.getScheduleByIds(scheduleIds)) !== null && _this$schedule$getSch !== void 0 ? _this$schedule$getSch : [] : [];
3720
+ var timePoints = extractTimePointsFromSchedules(scheduleList);
3721
+ return {
3722
+ menuList: menuList,
3723
+ scheduleIds: scheduleIds,
3724
+ scheduleList: scheduleList,
3725
+ timePoints: timePoints
3726
+ };
3727
+ }
3728
+
3729
+ /**
3730
+ * query 完成后为 subscriber 同步 schedule 定时器(先 clear 再 schedule)。
3731
+ */
3634
3732
  }, {
3635
3733
  key: "syncProductQueryScheduleTimers",
3636
- value: function syncProductQueryScheduleTimers(subscriberId, strategy_context) {
3734
+ value: function syncProductQueryScheduleTimers(_ref61) {
3637
3735
  var _this$products$getLas3, _this$products2, _this$products2$getLa;
3736
+ var subscriberId = _ref61.subscriberId,
3737
+ menu_list_ids = _ref61.menu_list_ids,
3738
+ strategy_context = _ref61.strategy_context;
3638
3739
  this.clearSubscriberScheduleTimers(subscriberId);
3639
3740
  if (!this.shouldScheduleProductQueryReload(strategy_context)) {
3640
3741
  return;
3641
3742
  }
3642
- var timePoints = (_this$products$getLas3 = (_this$products2 = this.products) === null || _this$products2 === void 0 || (_this$products2$getLa = _this$products2.getLastScheduleTimePoints) === null || _this$products2$getLa === void 0 ? void 0 : _this$products2$getLa.call(_this$products2)) !== null && _this$products$getLas3 !== void 0 ? _this$products$getLas3 : [];
3743
+ var productTimePoints = (_this$products$getLas3 = (_this$products2 = this.products) === null || _this$products2 === void 0 || (_this$products2$getLa = _this$products2.getLastScheduleTimePoints) === null || _this$products2$getLa === void 0 ? void 0 : _this$products2$getLa.call(_this$products2)) !== null && _this$products$getLas3 !== void 0 ? _this$products$getLas3 : [];
3744
+ var menuListIds = Array.isArray(menu_list_ids) ? Array.from(new Set(menu_list_ids.map(function (id) {
3745
+ return Number(id);
3746
+ }).filter(function (id) {
3747
+ return Number.isFinite(id);
3748
+ }))) : [];
3749
+ var menuTimePoints = this.getMenuScheduleTimePoints(menuListIds).timePoints;
3750
+ var timePoints = sortTimePoints(Array.from(new Set([].concat(_toConsumableArray(productTimePoints), _toConsumableArray(menuTimePoints)))));
3643
3751
  if (timePoints.length > 0) {
3644
3752
  this.scheduleSubscriberTimePointReloads(subscriberId, timePoints);
3645
3753
  }
@@ -3668,24 +3776,24 @@ var Server = /*#__PURE__*/function () {
3668
3776
  }, {
3669
3777
  key: "refreshMenuScheduleCacheAfterEmptyResult",
3670
3778
  value: (function () {
3671
- var _refreshMenuScheduleCacheAfterEmptyResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
3779
+ var _refreshMenuScheduleCacheAfterEmptyResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
3672
3780
  var _this8 = this;
3673
3781
  var now;
3674
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3675
- while (1) switch (_context43.prev = _context43.next) {
3782
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3783
+ while (1) switch (_context44.prev = _context44.next) {
3676
3784
  case 0:
3677
3785
  if (!(!this.menu || !this.schedule)) {
3678
- _context43.next = 2;
3786
+ _context44.next = 2;
3679
3787
  break;
3680
3788
  }
3681
- return _context43.abrupt("return", false);
3789
+ return _context44.abrupt("return", false);
3682
3790
  case 2:
3683
3791
  now = Date.now();
3684
3792
  if (!(now - this.lastMenuScheduleRefreshAt < this.MENU_SCHEDULE_REFRESH_COOLDOWN_MS)) {
3685
- _context43.next = 5;
3793
+ _context44.next = 5;
3686
3794
  break;
3687
3795
  }
3688
- return _context43.abrupt("return", false);
3796
+ return _context44.abrupt("return", false);
3689
3797
  case 5:
3690
3798
  if (!this.menuScheduleRefreshInFlight) {
3691
3799
  this.lastMenuScheduleRefreshAt = now;
@@ -3699,15 +3807,15 @@ var Server = /*#__PURE__*/function () {
3699
3807
  _this8.menuScheduleRefreshInFlight = null;
3700
3808
  });
3701
3809
  }
3702
- _context43.next = 8;
3810
+ _context44.next = 8;
3703
3811
  return this.menuScheduleRefreshInFlight;
3704
3812
  case 8:
3705
- return _context43.abrupt("return", true);
3813
+ return _context44.abrupt("return", true);
3706
3814
  case 9:
3707
3815
  case "end":
3708
- return _context43.stop();
3816
+ return _context44.stop();
3709
3817
  }
3710
- }, _callee43, this);
3818
+ }, _callee44, this);
3711
3819
  }));
3712
3820
  function refreshMenuScheduleCacheAfterEmptyResult() {
3713
3821
  return _refreshMenuScheduleCacheAfterEmptyResult.apply(this, arguments);
@@ -3725,17 +3833,17 @@ var Server = /*#__PURE__*/function () {
3725
3833
  * const result = await this.handleSalesSearchRequest('single', '/shop/es/search/sales', { keyword: '1001' }, {})
3726
3834
  */
3727
3835
  function () {
3728
- var _handleSalesSearchRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(kind, backendPath, data, config) {
3729
- var queryPayload, result, _ref61, callback, subscriberId, resetVisibleOrderIds, contextSignature, existing, shouldReset, visibleOrderIds, _iterator5, _step5, orderId;
3730
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3731
- while (1) switch (_context44.prev = _context44.next) {
3836
+ var _handleSalesSearchRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(kind, backendPath, data, config) {
3837
+ var queryPayload, result, _ref62, callback, subscriberId, resetVisibleOrderIds, contextSignature, existing, shouldReset, visibleOrderIds, _iterator5, _step5, orderId;
3838
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3839
+ while (1) switch (_context45.prev = _context45.next) {
3732
3840
  case 0:
3733
3841
  queryPayload = data && _typeof(data) === 'object' ? _objectSpread({}, data) : {};
3734
- _context44.next = 3;
3842
+ _context45.next = 3;
3735
3843
  return this.fetchSalesSearchFromAPI(backendPath, queryPayload);
3736
3844
  case 3:
3737
- result = _context44.sent;
3738
- _ref61 = config || {}, callback = _ref61.callback, subscriberId = _ref61.subscriberId, resetVisibleOrderIds = _ref61.resetVisibleOrderIds;
3845
+ result = _context45.sent;
3846
+ _ref62 = config || {}, callback = _ref62.callback, subscriberId = _ref62.subscriberId, resetVisibleOrderIds = _ref62.resetVisibleOrderIds;
3739
3847
  if (subscriberId && typeof callback === 'function') {
3740
3848
  contextSignature = this.buildSalesSearchSignature(kind, queryPayload);
3741
3849
  existing = this.salesSearchSubscribers.get(subscriberId);
@@ -3766,14 +3874,14 @@ var Server = /*#__PURE__*/function () {
3766
3874
  visibleCount: visibleOrderIds.size
3767
3875
  });
3768
3876
  }
3769
- return _context44.abrupt("return", result);
3877
+ return _context45.abrupt("return", result);
3770
3878
  case 7:
3771
3879
  case "end":
3772
- return _context44.stop();
3880
+ return _context45.stop();
3773
3881
  }
3774
- }, _callee44, this);
3882
+ }, _callee45, this);
3775
3883
  }));
3776
- function handleSalesSearchRequest(_x43, _x44, _x45, _x46) {
3884
+ function handleSalesSearchRequest(_x44, _x45, _x46, _x47) {
3777
3885
  return _handleSalesSearchRequest.apply(this, arguments);
3778
3886
  }
3779
3887
  return handleSalesSearchRequest;
@@ -3788,20 +3896,20 @@ var Server = /*#__PURE__*/function () {
3788
3896
  }, {
3789
3897
  key: "fetchSalesSearchFromAPI",
3790
3898
  value: (function () {
3791
- var _fetchSalesSearchFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(backendPath, data) {
3899
+ var _fetchSalesSearchFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(backendPath, data) {
3792
3900
  var _this$app8;
3793
3901
  var _response$data4, _response$code2, _response$status2, _response$message2, response, _payload, errorMessage;
3794
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3795
- while (1) switch (_context45.prev = _context45.next) {
3902
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
3903
+ while (1) switch (_context46.prev = _context46.next) {
3796
3904
  case 0:
3797
3905
  if ((_this$app8 = this.app) !== null && _this$app8 !== void 0 && _this$app8.request) {
3798
- _context45.next = 3;
3906
+ _context46.next = 3;
3799
3907
  break;
3800
3908
  }
3801
3909
  this.logError('fetchSalesSearchFromAPI: app.request 不可用', {
3802
3910
  backendPath: backendPath
3803
3911
  });
3804
- return _context45.abrupt("return", {
3912
+ return _context46.abrupt("return", {
3805
3913
  code: 500,
3806
3914
  message: 'app.request 不可用',
3807
3915
  data: backendPath === '/shop/es/search' ? {
@@ -3813,29 +3921,29 @@ var Server = /*#__PURE__*/function () {
3813
3921
  status: false
3814
3922
  });
3815
3923
  case 3:
3816
- _context45.prev = 3;
3817
- _context45.next = 6;
3924
+ _context46.prev = 3;
3925
+ _context46.next = 6;
3818
3926
  return this.app.request.post(backendPath, data, {
3819
3927
  isShopApi: true
3820
3928
  });
3821
3929
  case 6:
3822
- response = _context45.sent;
3930
+ response = _context46.sent;
3823
3931
  _payload = (_response$data4 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data4 !== void 0 ? _response$data4 : response;
3824
- return _context45.abrupt("return", {
3932
+ return _context46.abrupt("return", {
3825
3933
  code: (_response$code2 = response === null || response === void 0 ? void 0 : response.code) !== null && _response$code2 !== void 0 ? _response$code2 : 200,
3826
3934
  status: (_response$status2 = response === null || response === void 0 ? void 0 : response.status) !== null && _response$status2 !== void 0 ? _response$status2 : true,
3827
3935
  message: (_response$message2 = response === null || response === void 0 ? void 0 : response.message) !== null && _response$message2 !== void 0 ? _response$message2 : '',
3828
3936
  data: _payload
3829
3937
  });
3830
3938
  case 11:
3831
- _context45.prev = 11;
3832
- _context45.t0 = _context45["catch"](3);
3833
- errorMessage = _context45.t0 instanceof Error ? _context45.t0.message : String(_context45.t0);
3939
+ _context46.prev = 11;
3940
+ _context46.t0 = _context46["catch"](3);
3941
+ errorMessage = _context46.t0 instanceof Error ? _context46.t0.message : String(_context46.t0);
3834
3942
  this.logError('fetchSalesSearchFromAPI: 请求失败', {
3835
3943
  backendPath: backendPath,
3836
3944
  error: errorMessage
3837
3945
  });
3838
- return _context45.abrupt("return", {
3946
+ return _context46.abrupt("return", {
3839
3947
  code: 500,
3840
3948
  message: errorMessage,
3841
3949
  data: backendPath === '/shop/es/search' ? {
@@ -3848,11 +3956,11 @@ var Server = /*#__PURE__*/function () {
3848
3956
  });
3849
3957
  case 16:
3850
3958
  case "end":
3851
- return _context45.stop();
3959
+ return _context46.stop();
3852
3960
  }
3853
- }, _callee45, this, [[3, 11]]);
3961
+ }, _callee46, this, [[3, 11]]);
3854
3962
  }));
3855
- function fetchSalesSearchFromAPI(_x47, _x48) {
3963
+ function fetchSalesSearchFromAPI(_x48, _x49) {
3856
3964
  return _fetchSalesSearchFromAPI.apply(this, arguments);
3857
3965
  }
3858
3966
  return fetchSalesSearchFromAPI;
@@ -4373,18 +4481,18 @@ var Server = /*#__PURE__*/function () {
4373
4481
  }, {
4374
4482
  key: "fetchOrderListFromAPI",
4375
4483
  value: (function () {
4376
- var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(data) {
4484
+ var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(data) {
4377
4485
  var _this$app9;
4378
4486
  var _response$data5, response, _payload2, list, count, errorMessage;
4379
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
4380
- while (1) switch (_context46.prev = _context46.next) {
4487
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
4488
+ while (1) switch (_context47.prev = _context47.next) {
4381
4489
  case 0:
4382
4490
  if ((_this$app9 = this.app) !== null && _this$app9 !== void 0 && _this$app9.request) {
4383
- _context46.next = 3;
4491
+ _context47.next = 3;
4384
4492
  break;
4385
4493
  }
4386
4494
  this.logError('fetchOrderListFromAPI: app.request 不可用');
4387
- return _context46.abrupt("return", {
4495
+ return _context47.abrupt("return", {
4388
4496
  code: 500,
4389
4497
  message: 'app.request 不可用',
4390
4498
  data: {
@@ -4394,17 +4502,17 @@ var Server = /*#__PURE__*/function () {
4394
4502
  status: false
4395
4503
  });
4396
4504
  case 3:
4397
- _context46.prev = 3;
4398
- _context46.next = 6;
4505
+ _context47.prev = 3;
4506
+ _context47.next = 6;
4399
4507
  return this.app.request.post('/shop/order/v2/list', data, {
4400
4508
  isShopApi: true
4401
4509
  });
4402
4510
  case 6:
4403
- response = _context46.sent;
4511
+ response = _context47.sent;
4404
4512
  _payload2 = (_response$data5 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data5 !== void 0 ? _response$data5 : response;
4405
4513
  list = Array.isArray(_payload2 === null || _payload2 === void 0 ? void 0 : _payload2.list) ? _payload2.list : [];
4406
4514
  count = typeof (_payload2 === null || _payload2 === void 0 ? void 0 : _payload2.count) === 'number' ? _payload2.count : list.length;
4407
- return _context46.abrupt("return", {
4515
+ return _context47.abrupt("return", {
4408
4516
  code: 200,
4409
4517
  data: _objectSpread(_objectSpread({}, _payload2), {}, {
4410
4518
  list: list,
@@ -4414,13 +4522,13 @@ var Server = /*#__PURE__*/function () {
4414
4522
  status: true
4415
4523
  });
4416
4524
  case 13:
4417
- _context46.prev = 13;
4418
- _context46.t0 = _context46["catch"](3);
4419
- errorMessage = _context46.t0 instanceof Error ? _context46.t0.message : String(_context46.t0);
4525
+ _context47.prev = 13;
4526
+ _context47.t0 = _context47["catch"](3);
4527
+ errorMessage = _context47.t0 instanceof Error ? _context47.t0.message : String(_context47.t0);
4420
4528
  this.logError('fetchOrderListFromAPI: 请求失败', {
4421
4529
  error: errorMessage
4422
4530
  });
4423
- return _context46.abrupt("return", {
4531
+ return _context47.abrupt("return", {
4424
4532
  code: 500,
4425
4533
  message: errorMessage,
4426
4534
  data: {
@@ -4431,11 +4539,11 @@ var Server = /*#__PURE__*/function () {
4431
4539
  });
4432
4540
  case 18:
4433
4541
  case "end":
4434
- return _context46.stop();
4542
+ return _context47.stop();
4435
4543
  }
4436
- }, _callee46, this, [[3, 13]]);
4544
+ }, _callee47, this, [[3, 13]]);
4437
4545
  }));
4438
- function fetchOrderListFromAPI(_x49) {
4546
+ function fetchOrderListFromAPI(_x50) {
4439
4547
  return _fetchOrderListFromAPI.apply(this, arguments);
4440
4548
  }
4441
4549
  return fetchOrderListFromAPI;
@@ -4447,17 +4555,17 @@ var Server = /*#__PURE__*/function () {
4447
4555
  }, {
4448
4556
  key: "fetchBookingListFromAPI",
4449
4557
  value: (function () {
4450
- var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(data) {
4558
+ var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(data) {
4451
4559
  var memoryCacheEnabled, withFields, requestPayload, cacheKey, cached, rawList, bookingResult, _bookingResult$list, errorMessage;
4452
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
4453
- while (1) switch (_context47.prev = _context47.next) {
4560
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
4561
+ while (1) switch (_context48.prev = _context48.next) {
4454
4562
  case 0:
4455
4563
  if (this.order) {
4456
- _context47.next = 3;
4564
+ _context48.next = 3;
4457
4565
  break;
4458
4566
  }
4459
4567
  this.logError('fetchBookingListFromAPI: Order 模块不可用');
4460
- return _context47.abrupt("return", {
4568
+ return _context48.abrupt("return", {
4461
4569
  code: 500,
4462
4570
  message: 'Order 模块不可用',
4463
4571
  data: {
@@ -4467,18 +4575,18 @@ var Server = /*#__PURE__*/function () {
4467
4575
  status: false
4468
4576
  });
4469
4577
  case 3:
4470
- _context47.prev = 3;
4578
+ _context48.prev = 3;
4471
4579
  memoryCacheEnabled = this.isBookingRemoteMemoryCacheEnabled(data);
4472
4580
  withFields = this.resolveBookingSalesWith(data);
4473
4581
  requestPayload = this.normalizeBookingRemoteQueryPayload(data, withFields);
4474
4582
  cacheKey = this.buildBookingRemoteCacheKey(requestPayload);
4475
4583
  if (!memoryCacheEnabled) {
4476
- _context47.next = 13;
4584
+ _context48.next = 13;
4477
4585
  break;
4478
4586
  }
4479
4587
  cached = this.readBookingRemoteCache(cacheKey);
4480
4588
  if (!cached) {
4481
- _context47.next = 13;
4589
+ _context48.next = 13;
4482
4590
  break;
4483
4591
  }
4484
4592
  this.logInfo('fetchBookingListFromAPI: 命中内存缓存', {
@@ -4486,14 +4594,14 @@ var Server = /*#__PURE__*/function () {
4486
4594
  listCount: cached.bookingResult.count,
4487
4595
  withFields: cached.withFields
4488
4596
  });
4489
- return _context47.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
4597
+ return _context48.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
4490
4598
  cache_hit: true
4491
4599
  }));
4492
4600
  case 13:
4493
- _context47.next = 15;
4601
+ _context48.next = 15;
4494
4602
  return this.order.fetchOrdersBySSE(requestPayload);
4495
4603
  case 15:
4496
- rawList = _context47.sent;
4604
+ rawList = _context48.sent;
4497
4605
  bookingResult = sortBookings(filterBookingsFromOrders(rawList, data), data); // DEBUG: 挂到 window 上方便排查 SSE → 日历数据丢失问题
4498
4606
  if (typeof globalThis !== 'undefined') {
4499
4607
  globalThis.__SSE_BOOKING_DEBUG__ = {
@@ -4540,15 +4648,15 @@ var Server = /*#__PURE__*/function () {
4540
4648
  cacheKey: cacheKey,
4541
4649
  withFields: withFields
4542
4650
  });
4543
- return _context47.abrupt("return", this.buildBookingResponse(bookingResult));
4651
+ return _context48.abrupt("return", this.buildBookingResponse(bookingResult));
4544
4652
  case 23:
4545
- _context47.prev = 23;
4546
- _context47.t0 = _context47["catch"](3);
4547
- errorMessage = _context47.t0 instanceof Error ? _context47.t0.message : String(_context47.t0);
4653
+ _context48.prev = 23;
4654
+ _context48.t0 = _context48["catch"](3);
4655
+ errorMessage = _context48.t0 instanceof Error ? _context48.t0.message : String(_context48.t0);
4548
4656
  this.logError('fetchBookingListFromAPI: SSE 请求失败', {
4549
4657
  error: errorMessage
4550
4658
  });
4551
- return _context47.abrupt("return", {
4659
+ return _context48.abrupt("return", {
4552
4660
  code: 500,
4553
4661
  message: errorMessage,
4554
4662
  data: {
@@ -4559,11 +4667,11 @@ var Server = /*#__PURE__*/function () {
4559
4667
  });
4560
4668
  case 28:
4561
4669
  case "end":
4562
- return _context47.stop();
4670
+ return _context48.stop();
4563
4671
  }
4564
- }, _callee47, this, [[3, 23]]);
4672
+ }, _callee48, this, [[3, 23]]);
4565
4673
  }));
4566
- function fetchBookingListFromAPI(_x50) {
4674
+ function fetchBookingListFromAPI(_x51) {
4567
4675
  return _fetchBookingListFromAPI.apply(this, arguments);
4568
4676
  }
4569
4677
  return fetchBookingListFromAPI;
@@ -4647,11 +4755,11 @@ var Server = /*#__PURE__*/function () {
4647
4755
  }, {
4648
4756
  key: "runLocalPaymentUpdateInQueue",
4649
4757
  value: function () {
4650
- var _runLocalPaymentUpdateInQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(key, task, context) {
4758
+ var _runLocalPaymentUpdateInQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(key, task, context) {
4651
4759
  var _this12 = this;
4652
4760
  var queuedAt, hasPreviousTask, previous, current, tail, _data, result, released;
4653
- return _regeneratorRuntime().wrap(function _callee49$(_context49) {
4654
- while (1) switch (_context49.prev = _context49.next) {
4761
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
4762
+ while (1) switch (_context50.prev = _context50.next) {
4655
4763
  case 0:
4656
4764
  queuedAt = Date.now();
4657
4765
  hasPreviousTask = this.localPaymentUpdateQueues.has(key);
@@ -4663,20 +4771,20 @@ var Server = /*#__PURE__*/function () {
4663
4771
  }));
4664
4772
  current = previous.catch(function () {
4665
4773
  return undefined;
4666
- }).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48() {
4667
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
4668
- while (1) switch (_context48.prev = _context48.next) {
4774
+ }).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49() {
4775
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
4776
+ while (1) switch (_context49.prev = _context49.next) {
4669
4777
  case 0:
4670
4778
  _this12.logInfo('handleUpdateLocalPayment: 串行队列开始执行', _objectSpread(_objectSpread({}, context), {}, {
4671
4779
  queue_key: key,
4672
4780
  queue_wait_ms: Date.now() - queuedAt
4673
4781
  }));
4674
- return _context48.abrupt("return", task());
4782
+ return _context49.abrupt("return", task());
4675
4783
  case 2:
4676
4784
  case "end":
4677
- return _context48.stop();
4785
+ return _context49.stop();
4678
4786
  }
4679
- }, _callee48);
4787
+ }, _callee49);
4680
4788
  })));
4681
4789
  tail = current.then(function () {
4682
4790
  return undefined;
@@ -4684,11 +4792,11 @@ var Server = /*#__PURE__*/function () {
4684
4792
  return undefined;
4685
4793
  });
4686
4794
  this.localPaymentUpdateQueues.set(key, tail);
4687
- _context49.prev = 7;
4688
- _context49.next = 10;
4795
+ _context50.prev = 7;
4796
+ _context50.next = 10;
4689
4797
  return current;
4690
4798
  case 10:
4691
- result = _context49.sent;
4799
+ result = _context50.sent;
4692
4800
  this.logInfo('handleUpdateLocalPayment: 串行队列执行完成', _objectSpread(_objectSpread({}, context), {}, {
4693
4801
  queue_key: key,
4694
4802
  total_duration_ms: Date.now() - queuedAt,
@@ -4696,19 +4804,19 @@ var Server = /*#__PURE__*/function () {
4696
4804
  result_status: result === null || result === void 0 ? void 0 : result.status,
4697
4805
  payment: result === null || result === void 0 || (_data = result.data) === null || _data === void 0 ? void 0 : _data.payment
4698
4806
  }));
4699
- return _context49.abrupt("return", result);
4807
+ return _context50.abrupt("return", result);
4700
4808
  case 15:
4701
- _context49.prev = 15;
4702
- _context49.t0 = _context49["catch"](7);
4809
+ _context50.prev = 15;
4810
+ _context50.t0 = _context50["catch"](7);
4703
4811
  this.logError('handleUpdateLocalPayment: 串行队列执行失败', _objectSpread(_objectSpread({}, context), {}, {
4704
4812
  queue_key: key,
4705
4813
  total_duration_ms: Date.now() - queuedAt,
4706
- error: _context49.t0 instanceof Error ? _context49.t0.message : String(_context49.t0),
4707
- error_detail: this.normalizeUnknownError(_context49.t0)
4814
+ error: _context50.t0 instanceof Error ? _context50.t0.message : String(_context50.t0),
4815
+ error_detail: this.normalizeUnknownError(_context50.t0)
4708
4816
  }));
4709
- throw _context49.t0;
4817
+ throw _context50.t0;
4710
4818
  case 19:
4711
- _context49.prev = 19;
4819
+ _context50.prev = 19;
4712
4820
  released = false;
4713
4821
  if (this.localPaymentUpdateQueues.get(key) === tail) {
4714
4822
  this.localPaymentUpdateQueues.delete(key);
@@ -4719,14 +4827,14 @@ var Server = /*#__PURE__*/function () {
4719
4827
  released: released,
4720
4828
  active_queue_count: this.localPaymentUpdateQueues.size
4721
4829
  }));
4722
- return _context49.finish(19);
4830
+ return _context50.finish(19);
4723
4831
  case 24:
4724
4832
  case "end":
4725
- return _context49.stop();
4833
+ return _context50.stop();
4726
4834
  }
4727
- }, _callee49, this, [[7, 15, 19, 24]]);
4835
+ }, _callee50, this, [[7, 15, 19, 24]]);
4728
4836
  }));
4729
- function runLocalPaymentUpdateInQueue(_x51, _x52, _x53) {
4837
+ function runLocalPaymentUpdateInQueue(_x52, _x53, _x54) {
4730
4838
  return _runLocalPaymentUpdateInQueue.apply(this, arguments);
4731
4839
  }
4732
4840
  return runLocalPaymentUpdateInQueue;
@@ -4734,11 +4842,11 @@ var Server = /*#__PURE__*/function () {
4734
4842
  }, {
4735
4843
  key: "processLocalPaymentUpdate",
4736
4844
  value: function () {
4737
- var _processLocalPaymentUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
4845
+ var _processLocalPaymentUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
4738
4846
  var _params$serviceCharge4, _params$cardReaderSur, _found$payment, _found$payment2;
4739
4847
  var requestContext, found, surchargeUpdate, incomingPaymentUpdate, transactions, existingTransaction, hasRecordedSuccess, orderIsDraft, foundContext, alreadyRecordedFailure, updated;
4740
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
4741
- while (1) switch (_context50.prev = _context50.next) {
4848
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
4849
+ while (1) switch (_context51.prev = _context51.next) {
4742
4850
  case 0:
4743
4851
  requestContext = {
4744
4852
  operation_id: params.operationId,
@@ -4751,11 +4859,11 @@ var Server = /*#__PURE__*/function () {
4751
4859
  };
4752
4860
  this.logInfo('processLocalPaymentUpdate: 开始处理', requestContext);
4753
4861
  if (this.order) {
4754
- _context50.next = 5;
4862
+ _context51.next = 5;
4755
4863
  break;
4756
4864
  }
4757
4865
  this.logError('processLocalPaymentUpdate: Order 模块未注册', requestContext);
4758
- return _context50.abrupt("return", {
4866
+ return _context51.abrupt("return", {
4759
4867
  code: 500,
4760
4868
  status: false,
4761
4869
  message: 'Order 模块未注册',
@@ -4763,20 +4871,20 @@ var Server = /*#__PURE__*/function () {
4763
4871
  });
4764
4872
  case 5:
4765
4873
  this.logInfo('processLocalPaymentUpdate: 开始查询本地支付项', requestContext);
4766
- _context50.next = 8;
4874
+ _context51.next = 8;
4767
4875
  return this.order.getLocalPayment({
4768
4876
  saleId: params.saleId,
4769
4877
  paymentNumber: params.paymentNumber,
4770
4878
  operationId: params.operationId
4771
4879
  });
4772
4880
  case 8:
4773
- found = _context50.sent;
4881
+ found = _context51.sent;
4774
4882
  if (found) {
4775
- _context50.next = 12;
4883
+ _context51.next = 12;
4776
4884
  break;
4777
4885
  }
4778
4886
  this.logWarning('processLocalPaymentUpdate: 本地支付项不存在', requestContext);
4779
- return _context50.abrupt("return", {
4887
+ return _context51.abrupt("return", {
4780
4888
  code: 404,
4781
4889
  status: false,
4782
4890
  message: '本地支付项不存在',
@@ -4825,13 +4933,13 @@ var Server = /*#__PURE__*/function () {
4825
4933
  });
4826
4934
  this.logInfo('processLocalPaymentUpdate: 查询命中', foundContext);
4827
4935
  if (!(params.status === 'fail' && (found.payment.status === 'paid' || hasRecordedSuccess))) {
4828
- _context50.next = 23;
4936
+ _context51.next = 23;
4829
4937
  break;
4830
4938
  }
4831
4939
  this.logInfo('processLocalPaymentUpdate: 幂等返回', _objectSpread(_objectSpread({}, foundContext), {}, {
4832
4940
  idempotent_reason: 'ignore_failure_after_success'
4833
4941
  }));
4834
- return _context50.abrupt("return", {
4942
+ return _context51.abrupt("return", {
4835
4943
  code: 200,
4836
4944
  status: true,
4837
4945
  message: '',
@@ -4844,13 +4952,13 @@ var Server = /*#__PURE__*/function () {
4844
4952
  case 23:
4845
4953
  alreadyRecordedFailure = params.status === 'fail' && (existingTransaction === null || existingTransaction === void 0 ? void 0 : existingTransaction.status) === 'fail';
4846
4954
  if (!alreadyRecordedFailure) {
4847
- _context50.next = 27;
4955
+ _context51.next = 27;
4848
4956
  break;
4849
4957
  }
4850
4958
  this.logInfo('processLocalPaymentUpdate: 幂等返回', _objectSpread(_objectSpread({}, foundContext), {}, {
4851
4959
  idempotent_reason: 'failure_already_recorded'
4852
4960
  }));
4853
- return _context50.abrupt("return", {
4961
+ return _context51.abrupt("return", {
4854
4962
  code: 200,
4855
4963
  status: true,
4856
4964
  message: '',
@@ -4862,13 +4970,13 @@ var Server = /*#__PURE__*/function () {
4862
4970
  });
4863
4971
  case 27:
4864
4972
  if (!(params.status === 'success' && (existingTransaction === null || existingTransaction === void 0 ? void 0 : existingTransaction.status) === 'success' && found.payment.status === 'paid' && !orderIsDraft)) {
4865
- _context50.next = 30;
4973
+ _context51.next = 30;
4866
4974
  break;
4867
4975
  }
4868
4976
  this.logInfo('processLocalPaymentUpdate: 幂等返回', _objectSpread(_objectSpread({}, foundContext), {}, {
4869
4977
  idempotent_reason: 'success_already_committed'
4870
4978
  }));
4871
- return _context50.abrupt("return", {
4979
+ return _context51.abrupt("return", {
4872
4980
  code: 200,
4873
4981
  status: true,
4874
4982
  message: '',
@@ -4880,13 +4988,13 @@ var Server = /*#__PURE__*/function () {
4880
4988
  });
4881
4989
  case 30:
4882
4990
  if (!(params.status === 'success')) {
4883
- _context50.next = 33;
4991
+ _context51.next = 33;
4884
4992
  break;
4885
4993
  }
4886
4994
  this.logInfo('processLocalPaymentUpdate: 进入 success 恢复分支', _objectSpread(_objectSpread({}, foundContext), {}, {
4887
4995
  force_submit_if_paid: found.payment.status === 'paid' && orderIsDraft
4888
4996
  }));
4889
- return _context50.abrupt("return", this.processSuccessfulLocalPayment(_objectSpread(_objectSpread({}, params), {}, {
4997
+ return _context51.abrupt("return", this.processSuccessfulLocalPayment(_objectSpread(_objectSpread({}, params), {}, {
4890
4998
  order: found.order,
4891
4999
  payment: found.payment,
4892
5000
  matchBy: found.matchedBy === 'payment_number' ? 'payment_number' : 'compat',
@@ -4897,8 +5005,8 @@ var Server = /*#__PURE__*/function () {
4897
5005
  this.logInfo('processLocalPaymentUpdate: 进入 fail 本地更新分支', _objectSpread(_objectSpread({}, foundContext), {}, {
4898
5006
  incoming_payment_update: incomingPaymentUpdate
4899
5007
  }));
4900
- _context50.prev = 34;
4901
- _context50.next = 37;
5008
+ _context51.prev = 34;
5009
+ _context51.next = 37;
4902
5010
  return this.order.updateLocalPayment({
4903
5011
  saleId: params.saleId,
4904
5012
  paymentNumber: params.paymentNumber,
@@ -4906,25 +5014,25 @@ var Server = /*#__PURE__*/function () {
4906
5014
  updates: incomingPaymentUpdate
4907
5015
  });
4908
5016
  case 37:
4909
- updated = _context50.sent;
4910
- _context50.next = 44;
5017
+ updated = _context51.sent;
5018
+ _context51.next = 44;
4911
5019
  break;
4912
5020
  case 40:
4913
- _context50.prev = 40;
4914
- _context50.t0 = _context50["catch"](34);
5021
+ _context51.prev = 40;
5022
+ _context51.t0 = _context51["catch"](34);
4915
5023
  this.logError('processLocalPaymentUpdate: fail 本地更新失败', _objectSpread(_objectSpread({}, foundContext), {}, {
4916
5024
  incoming_payment_update: incomingPaymentUpdate,
4917
- error: _context50.t0 instanceof Error ? _context50.t0.message : String(_context50.t0),
4918
- error_detail: this.normalizeUnknownError(_context50.t0)
5025
+ error: _context51.t0 instanceof Error ? _context51.t0.message : String(_context51.t0),
5026
+ error_detail: this.normalizeUnknownError(_context51.t0)
4919
5027
  }));
4920
- throw _context50.t0;
5028
+ throw _context51.t0;
4921
5029
  case 44:
4922
5030
  if (updated) {
4923
- _context50.next = 47;
5031
+ _context51.next = 47;
4924
5032
  break;
4925
5033
  }
4926
5034
  this.logWarning('processLocalPaymentUpdate: fail 本地更新未命中', foundContext);
4927
- return _context50.abrupt("return", {
5035
+ return _context51.abrupt("return", {
4928
5036
  code: 404,
4929
5037
  status: false,
4930
5038
  message: '本地支付项不存在',
@@ -4935,7 +5043,7 @@ var Server = /*#__PURE__*/function () {
4935
5043
  previous_payment: updated.previousPayment,
4936
5044
  payment: updated.payment
4937
5045
  }));
4938
- return _context50.abrupt("return", {
5046
+ return _context51.abrupt("return", {
4939
5047
  code: 200,
4940
5048
  status: true,
4941
5049
  message: '',
@@ -4947,11 +5055,11 @@ var Server = /*#__PURE__*/function () {
4947
5055
  });
4948
5056
  case 49:
4949
5057
  case "end":
4950
- return _context50.stop();
5058
+ return _context51.stop();
4951
5059
  }
4952
- }, _callee50, this, [[34, 40]]);
5060
+ }, _callee51, this, [[34, 40]]);
4953
5061
  }));
4954
- function processLocalPaymentUpdate(_x54) {
5062
+ function processLocalPaymentUpdate(_x55) {
4955
5063
  return _processLocalPaymentUpdate.apply(this, arguments);
4956
5064
  }
4957
5065
  return processLocalPaymentUpdate;
@@ -4959,10 +5067,10 @@ var Server = /*#__PURE__*/function () {
4959
5067
  }, {
4960
5068
  key: "processSuccessfulLocalPayment",
4961
5069
  value: function () {
4962
- var _processSuccessfulLocalPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
5070
+ var _processSuccessfulLocalPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
4963
5071
  var moduleName, baseSales, startedAt, recoveryContext, _order$order_id3, _result$payments, _result$syncResult$su, _result$syncResult$su2, _result$draftResult, _result$draftResult2, order, result, message;
4964
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
4965
- while (1) switch (_context51.prev = _context51.next) {
5072
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5073
+ while (1) switch (_context52.prev = _context52.next) {
4966
5074
  case 0:
4967
5075
  moduleName = "local_payment_recovery_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 8));
4968
5076
  baseSales = new BaseSalesImpl(moduleName);
@@ -4981,13 +5089,13 @@ var Server = /*#__PURE__*/function () {
4981
5089
  payment: params.payment
4982
5090
  });
4983
5091
  this.logInfo('processSuccessfulLocalPayment: 创建临时 BaseSales', recoveryContext);
4984
- _context51.prev = 5;
5092
+ _context52.prev = 5;
4985
5093
  order = this.sanitizeLocalRecoveryOrder(params.order);
4986
5094
  this.logInfo('processSuccessfulLocalPayment: 本地订单清洗完成', _objectSpread(_objectSpread({}, recoveryContext), {}, {
4987
5095
  sanitized_order_id: (_order$order_id3 = order.order_id) !== null && _order$order_id3 !== void 0 ? _order$order_id3 : null,
4988
5096
  removed_synthetic_order_id: params.order.order_id != null && order.order_id == null
4989
5097
  }));
4990
- _context51.next = 10;
5098
+ _context52.next = 10;
4991
5099
  return baseSales.initialize(this.core, {
4992
5100
  otherParams: {
4993
5101
  platform: order.platform,
@@ -5000,14 +5108,14 @@ var Server = /*#__PURE__*/function () {
5000
5108
  });
5001
5109
  case 10:
5002
5110
  this.logInfo('processSuccessfulLocalPayment: BaseSales 初始化完成', recoveryContext);
5003
- _context51.next = 13;
5111
+ _context52.next = 13;
5004
5112
  return baseSales.replaceTempOrder(order);
5005
5113
  case 13:
5006
5114
  this.logInfo('processSuccessfulLocalPayment: 本地订单 tempOrder 恢复完成', recoveryContext);
5007
5115
  this.logInfo('processSuccessfulLocalPayment: 开始更新支付项并提交', _objectSpread(_objectSpread({}, recoveryContext), {}, {
5008
5116
  incoming_payment_update: params.paymentUpdate
5009
5117
  }));
5010
- _context51.next = 17;
5118
+ _context52.next = 17;
5011
5119
  return baseSales.updateOrderPayment(params.paymentNumber, params.paymentUpdate, {
5012
5120
  submitWhenPaid: true,
5013
5121
  matchBy: params.matchBy,
@@ -5016,7 +5124,7 @@ var Server = /*#__PURE__*/function () {
5016
5124
  smallTicketDataFlag: 1
5017
5125
  });
5018
5126
  case 17:
5019
- result = _context51.sent;
5127
+ result = _context52.sent;
5020
5128
  this.logInfo('processSuccessfulLocalPayment: 支付恢复完成', _objectSpread(_objectSpread({}, recoveryContext), {}, {
5021
5129
  duration_ms: Date.now() - startedAt,
5022
5130
  payment: result.payment,
@@ -5038,7 +5146,7 @@ var Server = /*#__PURE__*/function () {
5038
5146
  } : null,
5039
5147
  draft_error: result.draftError instanceof Error ? result.draftError.message : result.draftError
5040
5148
  }));
5041
- return _context51.abrupt("return", {
5149
+ return _context52.abrupt("return", {
5042
5150
  code: 200,
5043
5151
  status: true,
5044
5152
  message: '',
@@ -5050,48 +5158,48 @@ var Server = /*#__PURE__*/function () {
5050
5158
  }
5051
5159
  });
5052
5160
  case 22:
5053
- _context51.prev = 22;
5054
- _context51.t0 = _context51["catch"](5);
5055
- message = _context51.t0 instanceof Error ? _context51.t0.message : String(_context51.t0);
5161
+ _context52.prev = 22;
5162
+ _context52.t0 = _context52["catch"](5);
5163
+ message = _context52.t0 instanceof Error ? _context52.t0.message : String(_context52.t0);
5056
5164
  this.logError('processSuccessfulLocalPayment: 支付恢复失败', _objectSpread(_objectSpread({}, recoveryContext), {}, {
5057
5165
  duration_ms: Date.now() - startedAt,
5058
5166
  error: message,
5059
- error_detail: this.normalizeUnknownError(_context51.t0)
5167
+ error_detail: this.normalizeUnknownError(_context52.t0)
5060
5168
  }));
5061
- return _context51.abrupt("return", {
5169
+ return _context52.abrupt("return", {
5062
5170
  code: 500,
5063
5171
  status: false,
5064
5172
  message: message,
5065
5173
  data: null
5066
5174
  });
5067
5175
  case 27:
5068
- _context51.prev = 27;
5069
- _context51.prev = 28;
5070
- _context51.next = 31;
5176
+ _context52.prev = 27;
5177
+ _context52.prev = 28;
5178
+ _context52.next = 31;
5071
5179
  return baseSales.destroy();
5072
5180
  case 31:
5073
5181
  this.logInfo('processSuccessfulLocalPayment: 临时 BaseSales 销毁完成', _objectSpread(_objectSpread({}, recoveryContext), {}, {
5074
5182
  duration_ms: Date.now() - startedAt
5075
5183
  }));
5076
- _context51.next = 37;
5184
+ _context52.next = 37;
5077
5185
  break;
5078
5186
  case 34:
5079
- _context51.prev = 34;
5080
- _context51.t1 = _context51["catch"](28);
5187
+ _context52.prev = 34;
5188
+ _context52.t1 = _context52["catch"](28);
5081
5189
  this.logError('processSuccessfulLocalPayment: 临时 BaseSales 销毁失败', _objectSpread(_objectSpread({}, recoveryContext), {}, {
5082
5190
  duration_ms: Date.now() - startedAt,
5083
- error: _context51.t1 instanceof Error ? _context51.t1.message : String(_context51.t1),
5084
- error_detail: this.normalizeUnknownError(_context51.t1)
5191
+ error: _context52.t1 instanceof Error ? _context52.t1.message : String(_context52.t1),
5192
+ error_detail: this.normalizeUnknownError(_context52.t1)
5085
5193
  }));
5086
5194
  case 37:
5087
- return _context51.finish(27);
5195
+ return _context52.finish(27);
5088
5196
  case 38:
5089
5197
  case "end":
5090
- return _context51.stop();
5198
+ return _context52.stop();
5091
5199
  }
5092
- }, _callee51, this, [[5, 22, 27, 38], [28, 34]]);
5200
+ }, _callee52, this, [[5, 22, 27, 38], [28, 34]]);
5093
5201
  }));
5094
- function processSuccessfulLocalPayment(_x55) {
5202
+ function processSuccessfulLocalPayment(_x56) {
5095
5203
  return _processSuccessfulLocalPayment.apply(this, arguments);
5096
5204
  }
5097
5205
  return processSuccessfulLocalPayment;
@@ -5182,32 +5290,32 @@ var Server = /*#__PURE__*/function () {
5182
5290
  }, {
5183
5291
  key: "getShortNumberOrDeviceId",
5184
5292
  value: function () {
5185
- var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52() {
5293
+ var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53() {
5186
5294
  var getAsyncIotDeviceInfo, res;
5187
- return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5188
- while (1) switch (_context52.prev = _context52.next) {
5295
+ return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5296
+ while (1) switch (_context53.prev = _context53.next) {
5189
5297
  case 0:
5190
5298
  getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
5191
5299
  if (!getAsyncIotDeviceInfo) {
5192
- _context52.next = 7;
5300
+ _context53.next = 7;
5193
5301
  break;
5194
5302
  }
5195
- _context52.next = 4;
5303
+ _context53.next = 4;
5196
5304
  return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
5197
5305
  case 4:
5198
- res = _context52.sent;
5306
+ res = _context53.sent;
5199
5307
  if (!(res !== null && res !== void 0 && res.short_number)) {
5200
- _context52.next = 7;
5308
+ _context53.next = 7;
5201
5309
  break;
5202
5310
  }
5203
- return _context52.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
5311
+ return _context53.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
5204
5312
  case 7:
5205
- return _context52.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
5313
+ return _context53.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
5206
5314
  case 8:
5207
5315
  case "end":
5208
- return _context52.stop();
5316
+ return _context53.stop();
5209
5317
  }
5210
- }, _callee52, this);
5318
+ }, _callee53, this);
5211
5319
  }));
5212
5320
  function getShortNumberOrDeviceId() {
5213
5321
  return _getShortNumberOrDeviceId.apply(this, arguments);
@@ -5234,16 +5342,16 @@ var Server = /*#__PURE__*/function () {
5234
5342
  }, {
5235
5343
  key: "normalizeCheckoutSubmitData",
5236
5344
  value: function () {
5237
- var _normalizeCheckoutSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(data, title) {
5345
+ var _normalizeCheckoutSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(data, title) {
5238
5346
  var next, externalSaleNumber, shouldClearLocalOrderId, hasCheckoutOrderNumbers, localOrder;
5239
- return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5240
- while (1) switch (_context53.prev = _context53.next) {
5347
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5348
+ while (1) switch (_context54.prev = _context54.next) {
5241
5349
  case 0:
5242
5350
  if (!(!data || _typeof(data) !== 'object')) {
5243
- _context53.next = 2;
5351
+ _context54.next = 2;
5244
5352
  break;
5245
5353
  }
5246
- return _context53.abrupt("return", data);
5354
+ return _context54.abrupt("return", data);
5247
5355
  case 2:
5248
5356
  next = _objectSpread({}, data);
5249
5357
  externalSaleNumber = next.external_sale_number;
@@ -5253,7 +5361,7 @@ var Server = /*#__PURE__*/function () {
5253
5361
  delete next.vouchers;
5254
5362
  hasCheckoutOrderNumbers = !this.isBlankCheckoutValue(next.shop_order_number) && !this.isBlankCheckoutValue(next.shop_full_order_number);
5255
5363
  if (!hasCheckoutOrderNumbers) {
5256
- _context53.next = 11;
5364
+ _context54.next = 11;
5257
5365
  break;
5258
5366
  }
5259
5367
  this.logInfo("".concat(title, ": checkout \u5DF2\u643A\u5E26\u8BA2\u5355\u53F7\uFF0C\u8DF3\u8FC7\u67E5\u91CD"), {
@@ -5263,10 +5371,10 @@ var Server = /*#__PURE__*/function () {
5263
5371
  shop_order_number: next.shop_order_number,
5264
5372
  shop_full_order_number: next.shop_full_order_number
5265
5373
  });
5266
- return _context53.abrupt("return", next);
5374
+ return _context54.abrupt("return", next);
5267
5375
  case 11:
5268
5376
  if (!this.isBlankCheckoutValue(externalSaleNumber)) {
5269
- _context53.next = 14;
5377
+ _context54.next = 14;
5270
5378
  break;
5271
5379
  }
5272
5380
  if (shouldClearLocalOrderId) {
@@ -5275,10 +5383,10 @@ var Server = /*#__PURE__*/function () {
5275
5383
  order_id: next.order_id
5276
5384
  });
5277
5385
  }
5278
- return _context53.abrupt("return", next);
5386
+ return _context54.abrupt("return", next);
5279
5387
  case 14:
5280
5388
  if (!(!this.order || typeof this.order.getLocalOrderFromMemoryByLookup !== 'function')) {
5281
- _context53.next = 17;
5389
+ _context54.next = 17;
5282
5390
  break;
5283
5391
  }
5284
5392
  if (shouldClearLocalOrderId) {
@@ -5287,12 +5395,12 @@ var Server = /*#__PURE__*/function () {
5287
5395
  external_sale_number: externalSaleNumber
5288
5396
  });
5289
5397
  }
5290
- return _context53.abrupt("return", next);
5398
+ return _context54.abrupt("return", next);
5291
5399
  case 17:
5292
- _context53.prev = 17;
5400
+ _context54.prev = 17;
5293
5401
  localOrder = this.order.getLocalOrderFromMemoryByLookup(externalSaleNumber);
5294
5402
  if (localOrder) {
5295
- _context53.next = 22;
5403
+ _context54.next = 22;
5296
5404
  break;
5297
5405
  }
5298
5406
  if (shouldClearLocalOrderId) {
@@ -5302,7 +5410,7 @@ var Server = /*#__PURE__*/function () {
5302
5410
  localOrderFound: false
5303
5411
  });
5304
5412
  }
5305
- return _context53.abrupt("return", next);
5413
+ return _context54.abrupt("return", next);
5306
5414
  case 22:
5307
5415
  if (this.isBlankCheckoutValue(next.shop_order_number)) {
5308
5416
  next.shop_order_number = localOrder.shop_order_number;
@@ -5319,23 +5427,23 @@ var Server = /*#__PURE__*/function () {
5319
5427
  shop_full_order_number: next.shop_full_order_number
5320
5428
  });
5321
5429
  // 删除 数据体中的 vouchers,对小票和后端来说他们不需要,这个字段只是单向同步给前端用的,而且目前对订单来说还没什么用
5322
- return _context53.abrupt("return", next);
5430
+ return _context54.abrupt("return", next);
5323
5431
  case 28:
5324
- _context53.prev = 28;
5325
- _context53.t0 = _context53["catch"](17);
5432
+ _context54.prev = 28;
5433
+ _context54.t0 = _context54["catch"](17);
5326
5434
  this.logWarning("".concat(title, ": checkout \u67E5\u627E\u672C\u5730\u8BA2\u5355\u5931\u8D25"), {
5327
5435
  external_sale_number: externalSaleNumber,
5328
- error: this.getUnknownErrorMessage(_context53.t0),
5329
- error_detail: this.normalizeUnknownError(_context53.t0)
5436
+ error: this.getUnknownErrorMessage(_context54.t0),
5437
+ error_detail: this.normalizeUnknownError(_context54.t0)
5330
5438
  });
5331
- return _context53.abrupt("return", next);
5439
+ return _context54.abrupt("return", next);
5332
5440
  case 32:
5333
5441
  case "end":
5334
- return _context53.stop();
5442
+ return _context54.stop();
5335
5443
  }
5336
- }, _callee53, this, [[17, 28]]);
5444
+ }, _callee54, this, [[17, 28]]);
5337
5445
  }));
5338
- function normalizeCheckoutSubmitData(_x56, _x57) {
5446
+ function normalizeCheckoutSubmitData(_x57, _x58) {
5339
5447
  return _normalizeCheckoutSubmitData.apply(this, arguments);
5340
5448
  }
5341
5449
  return normalizeCheckoutSubmitData;
@@ -5343,81 +5451,81 @@ var Server = /*#__PURE__*/function () {
5343
5451
  }, {
5344
5452
  key: "ensureCheckoutOrderNumbers",
5345
5453
  value: function () {
5346
- var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(data, title) {
5454
+ var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(data, title) {
5347
5455
  var next, needsShopOrderNumber, needsShopFullOrderNumber, idGenerator;
5348
- return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5349
- while (1) switch (_context54.prev = _context54.next) {
5456
+ return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5457
+ while (1) switch (_context55.prev = _context55.next) {
5350
5458
  case 0:
5351
5459
  if (!(!data || _typeof(data) !== 'object')) {
5352
- _context54.next = 2;
5460
+ _context55.next = 2;
5353
5461
  break;
5354
5462
  }
5355
- return _context54.abrupt("return", data);
5463
+ return _context55.abrupt("return", data);
5356
5464
  case 2:
5357
5465
  next = _objectSpread({}, data);
5358
5466
  needsShopOrderNumber = next.shop_order_number === undefined || next.shop_order_number === null || next.shop_order_number === '';
5359
5467
  needsShopFullOrderNumber = next.shop_full_order_number === undefined || next.shop_full_order_number === null || next.shop_full_order_number === '';
5360
5468
  if (!(!needsShopOrderNumber && !needsShopFullOrderNumber)) {
5361
- _context54.next = 7;
5469
+ _context55.next = 7;
5362
5470
  break;
5363
5471
  }
5364
- return _context54.abrupt("return", next);
5472
+ return _context55.abrupt("return", next);
5365
5473
  case 7:
5366
5474
  idGenerator = this.getIdGeneratorPlugin();
5367
5475
  if (idGenerator) {
5368
- _context54.next = 11;
5476
+ _context55.next = 11;
5369
5477
  break;
5370
5478
  }
5371
5479
  this.logWarning("".concat(title, ": idGenerator \u63D2\u4EF6\u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u751F\u6210\u8BA2\u5355\u53F7"), {
5372
5480
  needsShopOrderNumber: needsShopOrderNumber,
5373
5481
  needsShopFullOrderNumber: needsShopFullOrderNumber
5374
5482
  });
5375
- return _context54.abrupt("return", next);
5483
+ return _context55.abrupt("return", next);
5376
5484
  case 11:
5377
- _context54.prev = 11;
5485
+ _context55.prev = 11;
5378
5486
  if (!(needsShopOrderNumber && idGenerator.generateShopOrderNumber)) {
5379
- _context54.next = 16;
5487
+ _context55.next = 16;
5380
5488
  break;
5381
5489
  }
5382
- _context54.next = 15;
5490
+ _context55.next = 15;
5383
5491
  return idGenerator.generateShopOrderNumber({
5384
5492
  biz: next.business_code || 'ticket'
5385
5493
  });
5386
5494
  case 15:
5387
- next.shop_order_number = _context54.sent;
5495
+ next.shop_order_number = _context55.sent;
5388
5496
  case 16:
5389
5497
  if (!(needsShopFullOrderNumber && idGenerator.generateReceiptId)) {
5390
- _context54.next = 20;
5498
+ _context55.next = 20;
5391
5499
  break;
5392
5500
  }
5393
- _context54.next = 19;
5501
+ _context55.next = 19;
5394
5502
  return idGenerator.generateReceiptId({
5395
5503
  biz: next.business_code || 'ticket'
5396
5504
  });
5397
5505
  case 19:
5398
- next.shop_full_order_number = _context54.sent;
5506
+ next.shop_full_order_number = _context55.sent;
5399
5507
  case 20:
5400
5508
  this.logInfo("".concat(title, ": checkout \u8BA2\u5355\u53F7\u5DF2\u51C6\u5907"), {
5401
5509
  shop_order_number: next.shop_order_number,
5402
5510
  shop_full_order_number: next.shop_full_order_number
5403
5511
  });
5404
- _context54.next = 26;
5512
+ _context55.next = 26;
5405
5513
  break;
5406
5514
  case 23:
5407
- _context54.prev = 23;
5408
- _context54.t0 = _context54["catch"](11);
5515
+ _context55.prev = 23;
5516
+ _context55.t0 = _context55["catch"](11);
5409
5517
  this.logError("".concat(title, ": \u751F\u6210 checkout \u8BA2\u5355\u53F7\u5931\u8D25"), {
5410
- error: _context54.t0 instanceof Error ? _context54.t0.message : String(_context54.t0)
5518
+ error: _context55.t0 instanceof Error ? _context55.t0.message : String(_context55.t0)
5411
5519
  });
5412
5520
  case 26:
5413
- return _context54.abrupt("return", next);
5521
+ return _context55.abrupt("return", next);
5414
5522
  case 27:
5415
5523
  case "end":
5416
- return _context54.stop();
5524
+ return _context55.stop();
5417
5525
  }
5418
- }, _callee54, this, [[11, 23]]);
5526
+ }, _callee55, this, [[11, 23]]);
5419
5527
  }));
5420
- function ensureCheckoutOrderNumbers(_x58, _x59) {
5528
+ function ensureCheckoutOrderNumbers(_x59, _x60) {
5421
5529
  return _ensureCheckoutOrderNumbers.apply(this, arguments);
5422
5530
  }
5423
5531
  return ensureCheckoutOrderNumbers;
@@ -5425,27 +5533,27 @@ var Server = /*#__PURE__*/function () {
5425
5533
  }, {
5426
5534
  key: "dispatchCheckoutSyncTask",
5427
5535
  value: function () {
5428
- var _dispatchCheckoutSyncTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(params) {
5536
+ var _dispatchCheckoutSyncTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
5429
5537
  var deviceTask, debugDeviceId, debugIdempotencyKey, _params$data, _params$data2, _params$data3, _params$data4, result;
5430
- return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5431
- while (1) switch (_context55.prev = _context55.next) {
5538
+ return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5539
+ while (1) switch (_context56.prev = _context56.next) {
5432
5540
  case 0:
5433
5541
  this.registerDeviceTaskActions();
5434
5542
  deviceTask = this.getDeviceTaskPlugin();
5435
- _context55.next = 4;
5543
+ _context56.next = 4;
5436
5544
  return this.getShortNumberOrDeviceId();
5437
5545
  case 4:
5438
- debugDeviceId = _context55.sent;
5546
+ debugDeviceId = _context56.sent;
5439
5547
  debugIdempotencyKey = this.buildCheckoutTaskIdempotencyKey(params.data);
5440
5548
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
5441
- _context55.next = 9;
5549
+ _context56.next = 9;
5442
5550
  break;
5443
5551
  }
5444
5552
  this.logError("".concat(params.title, ": deviceTask.dispatch \u4E0D\u53EF\u7528"));
5445
- return _context55.abrupt("return");
5553
+ return _context56.abrupt("return");
5446
5554
  case 9:
5447
- _context55.prev = 9;
5448
- _context55.next = 12;
5555
+ _context56.prev = 9;
5556
+ _context56.next = 12;
5449
5557
  return deviceTask.dispatch({
5450
5558
  action: 'sync_sales',
5451
5559
  device_id: debugDeviceId,
@@ -5463,27 +5571,27 @@ var Server = /*#__PURE__*/function () {
5463
5571
  source_id: ((_params$data2 = params.data) === null || _params$data2 === void 0 ? void 0 : _params$data2.order_id) || ((_params$data3 = params.data) === null || _params$data3 === void 0 ? void 0 : _params$data3.external_sale_number) || ((_params$data4 = params.data) === null || _params$data4 === void 0 ? void 0 : _params$data4.shop_order_number)
5464
5572
  });
5465
5573
  case 12:
5466
- result = _context55.sent;
5574
+ result = _context56.sent;
5467
5575
  this.logInfo("".concat(params.title, ": sync_sales \u4EFB\u52A1\u5DF2\u6D3E\u53D1"), {
5468
5576
  uuid: result === null || result === void 0 ? void 0 : result.uuid,
5469
5577
  status: result === null || result === void 0 ? void 0 : result.status,
5470
5578
  reused: result === null || result === void 0 ? void 0 : result.reused
5471
5579
  });
5472
- _context55.next = 19;
5580
+ _context56.next = 19;
5473
5581
  break;
5474
5582
  case 16:
5475
- _context55.prev = 16;
5476
- _context55.t0 = _context55["catch"](9);
5583
+ _context56.prev = 16;
5584
+ _context56.t0 = _context56["catch"](9);
5477
5585
  this.logError("".concat(params.title, ": \u6D3E\u53D1 sync_sales \u4EFB\u52A1\u5931\u8D25"), {
5478
- error: _context55.t0 instanceof Error ? _context55.t0.message : String(_context55.t0)
5586
+ error: _context56.t0 instanceof Error ? _context56.t0.message : String(_context56.t0)
5479
5587
  });
5480
5588
  case 19:
5481
5589
  case "end":
5482
- return _context55.stop();
5590
+ return _context56.stop();
5483
5591
  }
5484
- }, _callee55, this, [[9, 16]]);
5592
+ }, _callee56, this, [[9, 16]]);
5485
5593
  }));
5486
- function dispatchCheckoutSyncTask(_x60) {
5594
+ function dispatchCheckoutSyncTask(_x61) {
5487
5595
  return _dispatchCheckoutSyncTask.apply(this, arguments);
5488
5596
  }
5489
5597
  return dispatchCheckoutSyncTask;
@@ -5491,26 +5599,26 @@ var Server = /*#__PURE__*/function () {
5491
5599
  }, {
5492
5600
  key: "dispatchPrintOtherReceiptTask",
5493
5601
  value: function () {
5494
- var _dispatchPrintOtherReceiptTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
5602
+ var _dispatchPrintOtherReceiptTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(params) {
5495
5603
  var deviceTask, _params$deviceId, _params$syncedOrder, _params$syncedOrder2, _params$syncedOrder3, printIdentity, deviceId;
5496
- return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5497
- while (1) switch (_context56.prev = _context56.next) {
5604
+ return _regeneratorRuntime().wrap(function _callee57$(_context57) {
5605
+ while (1) switch (_context57.prev = _context57.next) {
5498
5606
  case 0:
5499
5607
  deviceTask = this.getDeviceTaskPlugin();
5500
5608
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
5501
- _context56.next = 4;
5609
+ _context57.next = 4;
5502
5610
  break;
5503
5611
  }
5504
5612
  this.logWarning('dispatchPrintOtherReceiptTask: deviceTask.dispatch 不可用');
5505
- return _context56.abrupt("return");
5613
+ return _context57.abrupt("return");
5506
5614
  case 4:
5507
- _context56.prev = 4;
5615
+ _context57.prev = 4;
5508
5616
  printIdentity = this.getPrintOrderIdentity(params.syncedOrder);
5509
- _context56.next = 8;
5617
+ _context57.next = 8;
5510
5618
  return this.getShortNumberOrDeviceId();
5511
5619
  case 8:
5512
- deviceId = _context56.sent;
5513
- _context56.next = 11;
5620
+ deviceId = _context57.sent;
5621
+ _context57.next = 11;
5514
5622
  return deviceTask.dispatch({
5515
5623
  action: 'print_all',
5516
5624
  device_id: (_params$deviceId = params.deviceId) !== null && _params$deviceId !== void 0 ? _params$deviceId : deviceId,
@@ -5537,21 +5645,21 @@ var Server = /*#__PURE__*/function () {
5537
5645
  source_id: printIdentity
5538
5646
  });
5539
5647
  case 11:
5540
- _context56.next = 16;
5648
+ _context57.next = 16;
5541
5649
  break;
5542
5650
  case 13:
5543
- _context56.prev = 13;
5544
- _context56.t0 = _context56["catch"](4);
5651
+ _context57.prev = 13;
5652
+ _context57.t0 = _context57["catch"](4);
5545
5653
  this.logError('dispatchPrintOtherReceiptTask: 派发失败', {
5546
- error: _context56.t0 instanceof Error ? _context56.t0.message : String(_context56.t0)
5654
+ error: _context57.t0 instanceof Error ? _context57.t0.message : String(_context57.t0)
5547
5655
  });
5548
5656
  case 16:
5549
5657
  case "end":
5550
- return _context56.stop();
5658
+ return _context57.stop();
5551
5659
  }
5552
- }, _callee56, this, [[4, 13]]);
5660
+ }, _callee57, this, [[4, 13]]);
5553
5661
  }));
5554
- function dispatchPrintOtherReceiptTask(_x61) {
5662
+ function dispatchPrintOtherReceiptTask(_x62) {
5555
5663
  return _dispatchPrintOtherReceiptTask.apply(this, arguments);
5556
5664
  }
5557
5665
  return dispatchPrintOtherReceiptTask;
@@ -5571,32 +5679,32 @@ var Server = /*#__PURE__*/function () {
5571
5679
  }, {
5572
5680
  key: "dispatchLocalReceiptPrint",
5573
5681
  value: function () {
5574
- var _dispatchLocalReceiptPrint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(params) {
5682
+ var _dispatchLocalReceiptPrint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(params) {
5575
5683
  var _payment_info;
5576
5684
  var printableOrder;
5577
- return _regeneratorRuntime().wrap(function _callee57$(_context57) {
5578
- while (1) switch (_context57.prev = _context57.next) {
5685
+ return _regeneratorRuntime().wrap(function _callee58$(_context58) {
5686
+ while (1) switch (_context58.prev = _context58.next) {
5579
5687
  case 0:
5580
5688
  if (!(params.requireFullyPaid && !this.isSalesOrderFullyPaid(params.order))) {
5581
- _context57.next = 2;
5689
+ _context58.next = 2;
5582
5690
  break;
5583
5691
  }
5584
- return _context57.abrupt("return", {
5692
+ return _context58.abrupt("return", {
5585
5693
  printed: false,
5586
5694
  order: params.order
5587
5695
  });
5588
5696
  case 2:
5589
- _context57.next = 4;
5697
+ _context58.next = 4;
5590
5698
  return this.withLocalSmallTicketData(params.order, {
5591
5699
  requireFullyPaid: params.requireFullyPaid
5592
5700
  });
5593
5701
  case 4:
5594
- printableOrder = _context57.sent;
5702
+ printableOrder = _context58.sent;
5595
5703
  if (hasSmallTicketData((_payment_info = printableOrder.payment_info) === null || _payment_info === void 0 ? void 0 : _payment_info.small_ticket_data)) {
5596
- _context57.next = 7;
5704
+ _context58.next = 7;
5597
5705
  break;
5598
5706
  }
5599
- return _context57.abrupt("return", {
5707
+ return _context58.abrupt("return", {
5600
5708
  printed: false,
5601
5709
  order: printableOrder
5602
5710
  });
@@ -5606,7 +5714,7 @@ var Server = /*#__PURE__*/function () {
5606
5714
  printableOrder: printableOrder,
5607
5715
  response: params.response
5608
5716
  });
5609
- _context57.next = 10;
5717
+ _context58.next = 10;
5610
5718
  return this.dispatchPrintOtherReceiptTask({
5611
5719
  checkoutData: params.checkoutData,
5612
5720
  syncedOrder: printableOrder,
@@ -5615,17 +5723,17 @@ var Server = /*#__PURE__*/function () {
5615
5723
  isManualPrint: params.isManualPrint
5616
5724
  });
5617
5725
  case 10:
5618
- return _context57.abrupt("return", {
5726
+ return _context58.abrupt("return", {
5619
5727
  printed: true,
5620
5728
  order: printableOrder
5621
5729
  });
5622
5730
  case 11:
5623
5731
  case "end":
5624
- return _context57.stop();
5732
+ return _context58.stop();
5625
5733
  }
5626
- }, _callee57, this);
5734
+ }, _callee58, this);
5627
5735
  }));
5628
- function dispatchLocalReceiptPrint(_x62) {
5736
+ function dispatchLocalReceiptPrint(_x63) {
5629
5737
  return _dispatchLocalReceiptPrint.apply(this, arguments);
5630
5738
  }
5631
5739
  return dispatchLocalReceiptPrint;
@@ -5660,47 +5768,47 @@ var Server = /*#__PURE__*/function () {
5660
5768
  }, {
5661
5769
  key: "syncMachinecodeRedeemStatusToLocalOrder",
5662
5770
  value: function () {
5663
- var _syncMachinecodeRedeemStatusToLocalOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(data, ids, status) {
5771
+ var _syncMachinecodeRedeemStatusToLocalOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(data, ids, status) {
5664
5772
  var _this$order3;
5665
5773
  var title, lookup, localOrder, voucherIdSet, vouchers, hasUpdatedVoucher, nextVouchers;
5666
- return _regeneratorRuntime().wrap(function _callee58$(_context58) {
5667
- while (1) switch (_context58.prev = _context58.next) {
5774
+ return _regeneratorRuntime().wrap(function _callee59$(_context59) {
5775
+ while (1) switch (_context59.prev = _context59.next) {
5668
5776
  case 0:
5669
5777
  title = 'handleMachinecodeBatchMetadata';
5670
5778
  lookup = this.resolveMachinecodeBatchMetadataLookup(data);
5671
5779
  if (!(lookup === undefined)) {
5672
- _context58.next = 5;
5780
+ _context59.next = 5;
5673
5781
  break;
5674
5782
  }
5675
5783
  this.logWarning("".concat(title, ": order lookup \u7F3A\u5931\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
5676
5784
  batchSize: ids.length,
5677
5785
  status: status
5678
5786
  });
5679
- return _context58.abrupt("return");
5787
+ return _context59.abrupt("return");
5680
5788
  case 5:
5681
5789
  if ((_this$order3 = this.order) !== null && _this$order3 !== void 0 && _this$order3.getLocalOrderByLookup) {
5682
- _context58.next = 8;
5790
+ _context59.next = 8;
5683
5791
  break;
5684
5792
  }
5685
5793
  this.logWarning("".concat(title, ": Order \u6A21\u5757\u672A\u6CE8\u518C\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
5686
5794
  lookup: lookup,
5687
5795
  status: status
5688
5796
  });
5689
- return _context58.abrupt("return");
5797
+ return _context59.abrupt("return");
5690
5798
  case 8:
5691
- _context58.next = 10;
5799
+ _context59.next = 10;
5692
5800
  return this.order.getLocalOrderByLookup(lookup);
5693
5801
  case 10:
5694
- localOrder = _context58.sent;
5802
+ localOrder = _context59.sent;
5695
5803
  if (localOrder) {
5696
- _context58.next = 14;
5804
+ _context59.next = 14;
5697
5805
  break;
5698
5806
  }
5699
5807
  this.logWarning("".concat(title, ": \u672C\u5730\u8BA2\u5355\u4E0D\u5B58\u5728\uFF0C\u8DF3\u8FC7\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
5700
5808
  lookup: lookup,
5701
5809
  status: status
5702
5810
  });
5703
- return _context58.abrupt("return");
5811
+ return _context59.abrupt("return");
5704
5812
  case 14:
5705
5813
  voucherIdSet = new Set(ids.filter(function (id) {
5706
5814
  return id !== undefined && id !== null && id !== '';
@@ -5708,14 +5816,14 @@ var Server = /*#__PURE__*/function () {
5708
5816
  return String(id);
5709
5817
  }));
5710
5818
  if (!(voucherIdSet.size === 0)) {
5711
- _context58.next = 18;
5819
+ _context59.next = 18;
5712
5820
  break;
5713
5821
  }
5714
5822
  this.logWarning("".concat(title, ": voucher ids \u7F3A\u5931\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
5715
5823
  lookup: lookup,
5716
5824
  status: status
5717
5825
  });
5718
- return _context58.abrupt("return");
5826
+ return _context59.abrupt("return");
5719
5827
  case 18:
5720
5828
  vouchers = Array.isArray(localOrder.vouchers) ? localOrder.vouchers : [];
5721
5829
  hasUpdatedVoucher = false;
@@ -5729,7 +5837,7 @@ var Server = /*#__PURE__*/function () {
5729
5837
  });
5730
5838
  });
5731
5839
  if (hasUpdatedVoucher) {
5732
- _context58.next = 24;
5840
+ _context59.next = 24;
5733
5841
  break;
5734
5842
  }
5735
5843
  this.logWarning("".concat(title, ": \u672C\u5730\u8BA2\u5355\u672A\u547D\u4E2D\u4EFB\u4F55 voucher\uFF0C\u8DF3\u8FC7\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
@@ -5737,13 +5845,13 @@ var Server = /*#__PURE__*/function () {
5737
5845
  voucher_ids: Array.from(voucherIdSet),
5738
5846
  status: status
5739
5847
  });
5740
- return _context58.abrupt("return");
5848
+ return _context59.abrupt("return");
5741
5849
  case 24:
5742
5850
  if (!(typeof this.order.overwriteExistingOrder === 'function')) {
5743
- _context58.next = 29;
5851
+ _context59.next = 29;
5744
5852
  break;
5745
5853
  }
5746
- _context58.next = 27;
5854
+ _context59.next = 27;
5747
5855
  return this.order.overwriteExistingOrder(_objectSpread(_objectSpread({}, localOrder), {}, {
5748
5856
  vouchers: nextVouchers
5749
5857
  }));
@@ -5753,13 +5861,13 @@ var Server = /*#__PURE__*/function () {
5753
5861
  updatedCount: voucherIdSet.size,
5754
5862
  status: status
5755
5863
  });
5756
- return _context58.abrupt("return");
5864
+ return _context59.abrupt("return");
5757
5865
  case 29:
5758
5866
  if (!(data !== null && data !== void 0 && data.external_sale_number && typeof this.order.markOrderSyncedByExternalSaleNumber === 'function')) {
5759
- _context58.next = 34;
5867
+ _context59.next = 34;
5760
5868
  break;
5761
5869
  }
5762
- _context58.next = 32;
5870
+ _context59.next = 32;
5763
5871
  return this.order.markOrderSyncedByExternalSaleNumber({
5764
5872
  externalSaleNumber: data.external_sale_number,
5765
5873
  patch: {
@@ -5772,7 +5880,7 @@ var Server = /*#__PURE__*/function () {
5772
5880
  updatedCount: voucherIdSet.size,
5773
5881
  status: status
5774
5882
  });
5775
- return _context58.abrupt("return");
5883
+ return _context59.abrupt("return");
5776
5884
  case 34:
5777
5885
  this.logWarning("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u8BA2\u5355\u8986\u76D6\uFF0C\u8DF3\u8FC7\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
5778
5886
  lookup: lookup,
@@ -5780,11 +5888,11 @@ var Server = /*#__PURE__*/function () {
5780
5888
  });
5781
5889
  case 35:
5782
5890
  case "end":
5783
- return _context58.stop();
5891
+ return _context59.stop();
5784
5892
  }
5785
- }, _callee58, this);
5893
+ }, _callee59, this);
5786
5894
  }));
5787
- function syncMachinecodeRedeemStatusToLocalOrder(_x63, _x64, _x65) {
5895
+ function syncMachinecodeRedeemStatusToLocalOrder(_x64, _x65, _x66) {
5788
5896
  return _syncMachinecodeRedeemStatusToLocalOrder.apply(this, arguments);
5789
5897
  }
5790
5898
  return syncMachinecodeRedeemStatusToLocalOrder;
@@ -5792,10 +5900,10 @@ var Server = /*#__PURE__*/function () {
5792
5900
  }, {
5793
5901
  key: "handleOrderCheckoutSubmit",
5794
5902
  value: function () {
5795
- var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(params) {
5796
- var backendPath, data, title, normalizedData, checkoutData, pendingResult, _this$core$context2, pendingOrder, platform, isAndroid;
5797
- return _regeneratorRuntime().wrap(function _callee59$(_context59) {
5798
- while (1) switch (_context59.prev = _context59.next) {
5903
+ var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(params) {
5904
+ var backendPath, data, title, normalizedData, checkoutData, pendingResult, pendingOrder;
5905
+ return _regeneratorRuntime().wrap(function _callee60$(_context60) {
5906
+ while (1) switch (_context60.prev = _context60.next) {
5799
5907
  case 0:
5800
5908
  backendPath = params.backendPath, data = params.data, title = params.title;
5801
5909
  this.logInfo("".concat(title, ": \u5F00\u59CB\u5904\u7406"), {
@@ -5805,24 +5913,24 @@ var Server = /*#__PURE__*/function () {
5805
5913
  order_number: data === null || data === void 0 ? void 0 : data.order_number
5806
5914
  });
5807
5915
  if (!(data !== null && data !== void 0 && data.sync_mode || data !== null && data !== void 0 && data.syncMode)) {
5808
- _context59.next = 4;
5916
+ _context60.next = 4;
5809
5917
  break;
5810
5918
  }
5811
- return _context59.abrupt("return", this.handleSyncCheckoutSubmit({
5919
+ return _context60.abrupt("return", this.handleSyncCheckoutSubmit({
5812
5920
  backendPath: backendPath,
5813
5921
  data: data,
5814
5922
  title: title
5815
5923
  }));
5816
5924
  case 4:
5817
- _context59.next = 6;
5925
+ _context60.next = 6;
5818
5926
  return this.normalizeCheckoutSubmitData(data, title);
5819
5927
  case 6:
5820
- normalizedData = _context59.sent;
5821
- _context59.next = 9;
5928
+ normalizedData = _context60.sent;
5929
+ _context60.next = 9;
5822
5930
  return this.ensureCheckoutOrderNumbers(normalizedData, title);
5823
5931
  case 9:
5824
- checkoutData = _context59.sent;
5825
- _context59.next = 12;
5932
+ checkoutData = _context60.sent;
5933
+ _context60.next = 12;
5826
5934
  return this.handlePendingSyncCheckoutOrder({
5827
5935
  backendPath: backendPath,
5828
5936
  data: checkoutData,
@@ -5830,53 +5938,49 @@ var Server = /*#__PURE__*/function () {
5830
5938
  reason: 'checkout 已转入设备任务同步'
5831
5939
  });
5832
5940
  case 12:
5833
- pendingResult = _context59.sent;
5941
+ pendingResult = _context60.sent;
5834
5942
  if (!((pendingResult === null || pendingResult === void 0 ? void 0 : pendingResult.status) === true)) {
5835
- _context59.next = 22;
5943
+ _context60.next = 20;
5836
5944
  break;
5837
5945
  }
5838
5946
  pendingOrder = pendingResult.data;
5839
- platform = (_this$core$context2 = this.core.context) === null || _this$core$context2 === void 0 ? void 0 : _this$core$context2.getPlatform();
5840
- isAndroid = platform === 'android';
5841
- if (!(pendingOrder && this.shouldBuildSmallTicketData(checkoutData) && this.isSalesOrderFullyPaid(pendingOrder) && (
5842
- // TODO 这里先加个兼容,如果是安卓,则需要 type=virtual 才走打印,如果是苹果则无限制
5843
- isAndroid ? checkoutData.type === 'virtual' : true))) {
5844
- _context59.next = 20;
5947
+ if (!(pendingOrder && this.shouldBuildSmallTicketData(checkoutData) && this.isSalesOrderFullyPaid(pendingOrder) && this.shouldAutoPrintCheckoutReceipt())) {
5948
+ _context60.next = 18;
5845
5949
  break;
5846
5950
  }
5847
- _context59.next = 20;
5951
+ _context60.next = 18;
5848
5952
  return this.dispatchLocalReceiptPrint({
5849
5953
  checkoutData: checkoutData,
5850
5954
  order: pendingOrder,
5851
5955
  response: pendingResult,
5852
5956
  requireFullyPaid: true
5853
5957
  });
5854
- case 20:
5855
- _context59.next = 22;
5958
+ case 18:
5959
+ _context60.next = 20;
5856
5960
  return this.dispatchCheckoutSyncTask({
5857
5961
  backendPath: backendPath,
5858
5962
  data: checkoutData,
5859
5963
  title: title
5860
5964
  });
5861
- case 22:
5965
+ case 20:
5862
5966
  if (pendingResult.data.order_id) {
5863
- _context59.next = 24;
5967
+ _context60.next = 22;
5864
5968
  break;
5865
5969
  }
5866
- return _context59.abrupt("return", _objectSpread(_objectSpread({}, pendingResult), {}, {
5970
+ return _context60.abrupt("return", _objectSpread(_objectSpread({}, pendingResult), {}, {
5867
5971
  data: _objectSpread(_objectSpread({}, pendingResult.data), {}, {
5868
5972
  order_id: pendingResult.data.external_sale_number
5869
5973
  })
5870
5974
  }));
5871
- case 24:
5872
- return _context59.abrupt("return", pendingResult);
5873
- case 25:
5975
+ case 22:
5976
+ return _context60.abrupt("return", pendingResult);
5977
+ case 23:
5874
5978
  case "end":
5875
- return _context59.stop();
5979
+ return _context60.stop();
5876
5980
  }
5877
- }, _callee59, this);
5981
+ }, _callee60, this);
5878
5982
  }));
5879
- function handleOrderCheckoutSubmit(_x66) {
5983
+ function handleOrderCheckoutSubmit(_x67) {
5880
5984
  return _handleOrderCheckoutSubmit.apply(this, arguments);
5881
5985
  }
5882
5986
  return handleOrderCheckoutSubmit;
@@ -5884,27 +5988,27 @@ var Server = /*#__PURE__*/function () {
5884
5988
  }, {
5885
5989
  key: "handleSyncCheckoutSubmit",
5886
5990
  value: function () {
5887
- var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(params) {
5991
+ var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(params) {
5888
5992
  var _this$app16;
5889
5993
  var backendPath, data, title, syncResult, _normalized$data, normalized, response, syncedOrder, backendError, _normalized$data2, _normalized, message;
5890
- return _regeneratorRuntime().wrap(function _callee60$(_context60) {
5891
- while (1) switch (_context60.prev = _context60.next) {
5994
+ return _regeneratorRuntime().wrap(function _callee61$(_context61) {
5995
+ while (1) switch (_context61.prev = _context61.next) {
5892
5996
  case 0:
5893
5997
  backendPath = params.backendPath, data = params.data, title = params.title;
5894
5998
  if ((_this$app16 = this.app) !== null && _this$app16 !== void 0 && (_this$app16 = _this$app16.request) !== null && _this$app16 !== void 0 && _this$app16.post) {
5895
- _context60.next = 4;
5999
+ _context61.next = 4;
5896
6000
  break;
5897
6001
  }
5898
6002
  this.logError("".concat(title, ": sync checkout app.request \u4E0D\u53EF\u7528"));
5899
- return _context60.abrupt("return", {
6003
+ return _context61.abrupt("return", {
5900
6004
  code: 500,
5901
6005
  status: false,
5902
6006
  message: 'app.request 不可用',
5903
6007
  data: null
5904
6008
  });
5905
6009
  case 4:
5906
- _context60.prev = 4;
5907
- _context60.next = 7;
6010
+ _context61.prev = 4;
6011
+ _context61.next = 7;
5908
6012
  return this.runCheckoutSync({
5909
6013
  backendPath: backendPath,
5910
6014
  data: data,
@@ -5912,13 +6016,13 @@ var Server = /*#__PURE__*/function () {
5912
6016
  persistCheckoutDataWithResponse: true
5913
6017
  });
5914
6018
  case 7:
5915
- syncResult = _context60.sent;
6019
+ syncResult = _context61.sent;
5916
6020
  if (!syncResult.rejected) {
5917
- _context60.next = 11;
6021
+ _context61.next = 11;
5918
6022
  break;
5919
6023
  }
5920
6024
  normalized = this.normalizeCheckoutResponse(syncResult.errorResponse);
5921
- return _context60.abrupt("return", _objectSpread(_objectSpread({}, normalized), {}, {
6025
+ return _context61.abrupt("return", _objectSpread(_objectSpread({}, normalized), {}, {
5922
6026
  status: false,
5923
6027
  message: syncResult.message || (normalized === null || normalized === void 0 ? void 0 : normalized.message) || '后端明确拒绝 checkout',
5924
6028
  data: (_normalized$data = normalized === null || normalized === void 0 ? void 0 : normalized.data) !== null && _normalized$data !== void 0 ? _normalized$data : null
@@ -5927,42 +6031,41 @@ var Server = /*#__PURE__*/function () {
5927
6031
  response = this.withSyncedOrderIdInCheckoutResponse(syncResult.normalizedResponse, syncResult.syncedOrder);
5928
6032
  syncedOrder = syncResult.syncedOrder;
5929
6033
  if (!(syncedOrder && this.shouldBuildSmallTicketData(syncResult.checkoutData) && this.isSalesOrderFullyPaid(syncedOrder))) {
5930
- _context60.next = 16;
6034
+ _context61.next = 16;
5931
6035
  break;
5932
6036
  }
5933
- _context60.next = 16;
6037
+ _context61.next = 16;
5934
6038
  return this.dispatchLocalReceiptPrint({
5935
6039
  checkoutData: syncResult.checkoutData,
5936
6040
  order: syncedOrder,
5937
6041
  response: syncResult.normalizedResponse,
5938
- requireFullyPaid: true,
6042
+ requireFullyPaid: true
5939
6043
  // print_all 的 type=0 是收据打印;不要沿用同步成功后的券/手环打印 type=99。
5940
- isManualPrint: true
5941
6044
  });
5942
6045
  case 16:
5943
- return _context60.abrupt("return", response);
6046
+ return _context61.abrupt("return", response);
5944
6047
  case 19:
5945
- _context60.prev = 19;
5946
- _context60.t0 = _context60["catch"](4);
5947
- backendError = this.extractBackendErrorResponse(_context60.t0);
6048
+ _context61.prev = 19;
6049
+ _context61.t0 = _context61["catch"](4);
6050
+ backendError = this.extractBackendErrorResponse(_context61.t0);
5948
6051
  if (!backendError) {
5949
- _context60.next = 25;
6052
+ _context61.next = 25;
5950
6053
  break;
5951
6054
  }
5952
6055
  _normalized = this.normalizeCheckoutResponse(backendError);
5953
- return _context60.abrupt("return", _objectSpread(_objectSpread({}, _normalized), {}, {
6056
+ return _context61.abrupt("return", _objectSpread(_objectSpread({}, _normalized), {}, {
5954
6057
  status: false,
5955
6058
  message: (backendError === null || backendError === void 0 ? void 0 : backendError.message) || (_normalized === null || _normalized === void 0 ? void 0 : _normalized.message) || '后端明确拒绝 checkout',
5956
6059
  data: (_normalized$data2 = _normalized === null || _normalized === void 0 ? void 0 : _normalized.data) !== null && _normalized$data2 !== void 0 ? _normalized$data2 : null
5957
6060
  }));
5958
6061
  case 25:
5959
- message = this.getUnknownErrorMessage(_context60.t0);
6062
+ message = this.getUnknownErrorMessage(_context61.t0);
5960
6063
  this.logError("".concat(title, ": sync checkout \u8BF7\u6C42\u672A\u660E\u786E\u6210\u529F"), {
5961
6064
  backendPath: backendPath,
5962
6065
  error: message,
5963
- error_detail: this.normalizeUnknownError(_context60.t0)
6066
+ error_detail: this.normalizeUnknownError(_context61.t0)
5964
6067
  });
5965
- return _context60.abrupt("return", {
6068
+ return _context61.abrupt("return", {
5966
6069
  code: 500,
5967
6070
  status: false,
5968
6071
  message: message,
@@ -5970,11 +6073,11 @@ var Server = /*#__PURE__*/function () {
5970
6073
  });
5971
6074
  case 28:
5972
6075
  case "end":
5973
- return _context60.stop();
6076
+ return _context61.stop();
5974
6077
  }
5975
- }, _callee60, this, [[4, 19]]);
6078
+ }, _callee61, this, [[4, 19]]);
5976
6079
  }));
5977
- function handleSyncCheckoutSubmit(_x67) {
6080
+ function handleSyncCheckoutSubmit(_x68) {
5978
6081
  return _handleSyncCheckoutSubmit.apply(this, arguments);
5979
6082
  }
5980
6083
  return handleSyncCheckoutSubmit;
@@ -5982,10 +6085,10 @@ var Server = /*#__PURE__*/function () {
5982
6085
  }, {
5983
6086
  key: "handleOrderDraftSubmit",
5984
6087
  value: function () {
5985
- var _handleOrderDraftSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(params) {
6088
+ var _handleOrderDraftSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(params) {
5986
6089
  var data, title, normalizedData, createdAt, draftOrder, _draftOrder$summary, _draftOrder$summary2, _draftOrder$summary3, errorMessage;
5987
- return _regeneratorRuntime().wrap(function _callee61$(_context61) {
5988
- while (1) switch (_context61.prev = _context61.next) {
6090
+ return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6091
+ while (1) switch (_context62.prev = _context62.next) {
5989
6092
  case 0:
5990
6093
  data = params.data, title = params.title;
5991
6094
  this.logInfo("".concat(title, ": \u5F00\u59CB\u5904\u7406"), {
@@ -5993,10 +6096,10 @@ var Server = /*#__PURE__*/function () {
5993
6096
  external_sale_number: data === null || data === void 0 ? void 0 : data.external_sale_number,
5994
6097
  order_number: data === null || data === void 0 ? void 0 : data.order_number
5995
6098
  });
5996
- _context61.next = 4;
6099
+ _context62.next = 4;
5997
6100
  return this.normalizeCheckoutSubmitData(data, title);
5998
6101
  case 4:
5999
- normalizedData = _context61.sent;
6102
+ normalizedData = _context62.sent;
6000
6103
  createdAt = normalizedData.created_at || normalizedData.create_date || dayjs().format('YYYY-MM-DD HH:mm:ss');
6001
6104
  draftOrder = _objectSpread(_objectSpread({}, normalizedData), {}, {
6002
6105
  external_sale_number: normalizedData.external_sale_number || "LOCAL_DRAFT_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 10)),
@@ -6006,26 +6109,26 @@ var Server = /*#__PURE__*/function () {
6006
6109
  is_draft_order: 1
6007
6110
  });
6008
6111
  if (!(!this.order || typeof this.order.upsertLocalDraftOrders !== 'function')) {
6009
- _context61.next = 10;
6112
+ _context62.next = 10;
6010
6113
  break;
6011
6114
  }
6012
6115
  this.logError("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u8349\u7A3F\u5199\u5165"));
6013
- return _context61.abrupt("return", {
6116
+ return _context62.abrupt("return", {
6014
6117
  code: 500,
6015
6118
  status: false,
6016
6119
  message: 'Order 模块不支持本地草稿写入',
6017
6120
  data: null
6018
6121
  });
6019
6122
  case 10:
6020
- _context61.prev = 10;
6021
- _context61.next = 13;
6123
+ _context62.prev = 10;
6124
+ _context62.next = 13;
6022
6125
  return this.order.upsertLocalDraftOrders([draftOrder]);
6023
6126
  case 13:
6024
6127
  this.logInfo("".concat(title, ": \u8349\u7A3F\u8BA2\u5355\u5DF2\u5199\u5165\u672C\u5730"), {
6025
6128
  order_id: draftOrder.order_id,
6026
6129
  external_sale_number: draftOrder.external_sale_number
6027
6130
  });
6028
- return _context61.abrupt("return", {
6131
+ return _context62.abrupt("return", {
6029
6132
  code: 200,
6030
6133
  status: true,
6031
6134
  message: '',
@@ -6037,13 +6140,13 @@ var Server = /*#__PURE__*/function () {
6037
6140
  })
6038
6141
  });
6039
6142
  case 17:
6040
- _context61.prev = 17;
6041
- _context61.t0 = _context61["catch"](10);
6042
- errorMessage = _context61.t0 instanceof Error ? _context61.t0.message : String(_context61.t0);
6143
+ _context62.prev = 17;
6144
+ _context62.t0 = _context62["catch"](10);
6145
+ errorMessage = _context62.t0 instanceof Error ? _context62.t0.message : String(_context62.t0);
6043
6146
  this.logError("".concat(title, ": \u5199\u5165\u672C\u5730\u8349\u7A3F\u8BA2\u5355\u5931\u8D25"), {
6044
6147
  error: errorMessage
6045
6148
  });
6046
- return _context61.abrupt("return", {
6149
+ return _context62.abrupt("return", {
6047
6150
  code: 500,
6048
6151
  status: false,
6049
6152
  message: errorMessage,
@@ -6051,11 +6154,11 @@ var Server = /*#__PURE__*/function () {
6051
6154
  });
6052
6155
  case 22:
6053
6156
  case "end":
6054
- return _context61.stop();
6157
+ return _context62.stop();
6055
6158
  }
6056
- }, _callee61, this, [[10, 17]]);
6159
+ }, _callee62, this, [[10, 17]]);
6057
6160
  }));
6058
- function handleOrderDraftSubmit(_x68) {
6161
+ function handleOrderDraftSubmit(_x69) {
6059
6162
  return _handleOrderDraftSubmit.apply(this, arguments);
6060
6163
  }
6061
6164
  return handleOrderDraftSubmit;
@@ -6063,26 +6166,26 @@ var Server = /*#__PURE__*/function () {
6063
6166
  }, {
6064
6167
  key: "handlePendingSyncCheckoutOrder",
6065
6168
  value: function () {
6066
- var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(params) {
6169
+ var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
6067
6170
  var _this13 = this;
6068
6171
  var backendPath, data, title, reason, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
6069
- return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6070
- while (1) switch (_context62.prev = _context62.next) {
6172
+ return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6173
+ while (1) switch (_context63.prev = _context63.next) {
6071
6174
  case 0:
6072
6175
  backendPath = params.backendPath, data = params.data, title = params.title, reason = params.reason;
6073
- _context62.next = 3;
6176
+ _context63.next = 3;
6074
6177
  return this.buildPendingSyncCheckoutOrder(data);
6075
6178
  case 3:
6076
- pendingOrder = _context62.sent;
6179
+ pendingOrder = _context63.sent;
6077
6180
  if (pendingOrder) {
6078
- _context62.next = 7;
6181
+ _context63.next = 7;
6079
6182
  break;
6080
6183
  }
6081
6184
  this.logError("".concat(title, ": checkout \u5931\u8D25\u4E14\u8BA2\u5355\u7F3A\u5C11\u672C\u5730\u5B58\u50A8\u6807\u8BC6"), {
6082
6185
  backendPath: backendPath,
6083
6186
  reason: reason
6084
6187
  });
6085
- return _context62.abrupt("return", {
6188
+ return _context63.abrupt("return", {
6086
6189
  code: 500,
6087
6190
  status: false,
6088
6191
  message: '订单缺少本地存储标识,无法写入待同步队列',
@@ -6090,22 +6193,22 @@ var Server = /*#__PURE__*/function () {
6090
6193
  });
6091
6194
  case 7:
6092
6195
  if (!(!this.order || typeof this.order.upsertPendingSyncOrders !== 'function')) {
6093
- _context62.next = 10;
6196
+ _context63.next = 10;
6094
6197
  break;
6095
6198
  }
6096
6199
  this.logError("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u5F85\u540C\u6B65\u5199\u5165"), {
6097
6200
  backendPath: backendPath,
6098
6201
  reason: reason
6099
6202
  });
6100
- return _context62.abrupt("return", {
6203
+ return _context63.abrupt("return", {
6101
6204
  code: 500,
6102
6205
  status: false,
6103
6206
  message: 'Order 模块不支持本地待同步写入',
6104
6207
  data: null
6105
6208
  });
6106
6209
  case 10:
6107
- _context62.prev = 10;
6108
- _context62.next = 13;
6210
+ _context63.prev = 10;
6211
+ _context63.next = 13;
6109
6212
  return this.order.upsertPendingSyncOrders([pendingOrder]);
6110
6213
  case 13:
6111
6214
  this.logInfo("".concat(title, ": \u8BA2\u5355\u5DF2\u5199\u5165\u672C\u5730\u5F85\u540C\u6B65"), {
@@ -6119,7 +6222,7 @@ var Server = /*#__PURE__*/function () {
6119
6222
  var _payment$metadata;
6120
6223
  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);
6121
6224
  }, 0);
6122
- return _context62.abrupt("return", {
6225
+ return _context63.abrupt("return", {
6123
6226
  code: 200,
6124
6227
  status: true,
6125
6228
  message: '',
@@ -6134,15 +6237,15 @@ var Server = /*#__PURE__*/function () {
6134
6237
  })
6135
6238
  });
6136
6239
  case 18:
6137
- _context62.prev = 18;
6138
- _context62.t0 = _context62["catch"](10);
6139
- errorMessage = _context62.t0 instanceof Error ? _context62.t0.message : String(_context62.t0);
6240
+ _context63.prev = 18;
6241
+ _context63.t0 = _context63["catch"](10);
6242
+ errorMessage = _context63.t0 instanceof Error ? _context63.t0.message : String(_context63.t0);
6140
6243
  this.logError("".concat(title, ": \u5199\u5165\u672C\u5730\u5F85\u540C\u6B65\u8BA2\u5355\u5931\u8D25"), {
6141
6244
  backendPath: backendPath,
6142
6245
  reason: reason,
6143
6246
  error: errorMessage
6144
6247
  });
6145
- return _context62.abrupt("return", {
6248
+ return _context63.abrupt("return", {
6146
6249
  code: 500,
6147
6250
  status: false,
6148
6251
  message: errorMessage,
@@ -6150,11 +6253,11 @@ var Server = /*#__PURE__*/function () {
6150
6253
  });
6151
6254
  case 23:
6152
6255
  case "end":
6153
- return _context62.stop();
6256
+ return _context63.stop();
6154
6257
  }
6155
- }, _callee62, this, [[10, 18]]);
6258
+ }, _callee63, this, [[10, 18]]);
6156
6259
  }));
6157
- function handlePendingSyncCheckoutOrder(_x69) {
6260
+ function handlePendingSyncCheckoutOrder(_x70) {
6158
6261
  return _handlePendingSyncCheckoutOrder.apply(this, arguments);
6159
6262
  }
6160
6263
  return handlePendingSyncCheckoutOrder;
@@ -6162,55 +6265,65 @@ var Server = /*#__PURE__*/function () {
6162
6265
  }, {
6163
6266
  key: "buildPendingSyncCheckoutOrder",
6164
6267
  value: function () {
6165
- var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(data) {
6268
+ var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(data) {
6166
6269
  var hasStorageKey, pendingOrder, productMap, orderWithProductTitles;
6167
- return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6168
- while (1) switch (_context63.prev = _context63.next) {
6270
+ return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6271
+ while (1) switch (_context64.prev = _context64.next) {
6169
6272
  case 0:
6170
6273
  if (!(!data || _typeof(data) !== 'object')) {
6171
- _context63.next = 2;
6274
+ _context64.next = 2;
6172
6275
  break;
6173
6276
  }
6174
- return _context63.abrupt("return", null);
6277
+ return _context64.abrupt("return", null);
6175
6278
  case 2:
6176
6279
  hasStorageKey = data.external_sale_number !== undefined && data.external_sale_number !== null && data.external_sale_number !== '' ? true : data.order_id !== undefined && data.order_id !== null && data.order_id !== '';
6177
6280
  if (hasStorageKey) {
6178
- _context63.next = 5;
6281
+ _context64.next = 5;
6179
6282
  break;
6180
6283
  }
6181
- return _context63.abrupt("return", null);
6284
+ return _context64.abrupt("return", null);
6182
6285
  case 5:
6183
6286
  pendingOrder = _objectSpread(_objectSpread({}, data), {}, {
6184
6287
  need_sync: 1,
6185
6288
  is_draft_order: 0
6186
6289
  });
6187
- _context63.next = 8;
6290
+ _context64.next = 8;
6188
6291
  return this.buildSmallTicketProductMap(pendingOrder);
6189
6292
  case 8:
6190
- productMap = _context63.sent;
6293
+ productMap = _context64.sent;
6191
6294
  orderWithProductTitles = this.withPendingSyncProductTitles(pendingOrder, productMap);
6192
- return _context63.abrupt("return", this.withLocalSmallTicketData(orderWithProductTitles, {
6295
+ return _context64.abrupt("return", this.withLocalSmallTicketData(orderWithProductTitles, {
6193
6296
  requireFullyPaid: true,
6194
6297
  productMap: productMap
6195
6298
  }));
6196
6299
  case 11:
6197
6300
  case "end":
6198
- return _context63.stop();
6301
+ return _context64.stop();
6199
6302
  }
6200
- }, _callee63, this);
6303
+ }, _callee64, this);
6201
6304
  }));
6202
- function buildPendingSyncCheckoutOrder(_x70) {
6305
+ function buildPendingSyncCheckoutOrder(_x71) {
6203
6306
  return _buildPendingSyncCheckoutOrder.apply(this, arguments);
6204
6307
  }
6205
6308
  return buildPendingSyncCheckoutOrder;
6206
6309
  }()
6310
+ /**
6311
+ * Android 结账自动小票由当前设备设置控制;其它平台保持原有行为。
6312
+ */
6313
+ }, {
6314
+ key: "shouldAutoPrintCheckoutReceipt",
6315
+ value: function shouldAutoPrintCheckoutReceipt() {
6316
+ var _this$core$context2, _this$core$context2$g, _this$app17, _this$app17$getStorag;
6317
+ 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;
6318
+ 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';
6319
+ }
6207
6320
  }, {
6208
6321
  key: "shouldBuildSmallTicketData",
6209
6322
  value: function shouldBuildSmallTicketData(order) {
6210
- var _ref63, _order$small_ticket_d;
6323
+ var _ref64, _order$small_ticket_d;
6211
6324
  if (!order || _typeof(order) !== 'object') return false;
6212
6325
  // if (hasSmallTicketData(order.payment_info?.small_ticket_data)) return false;
6213
- return Number((_ref63 = (_order$small_ticket_d = order.small_ticket_data_flag) !== null && _order$small_ticket_d !== void 0 ? _order$small_ticket_d : order.smallTicketDataFlag) !== null && _ref63 !== void 0 ? _ref63 : 0) === 1;
6326
+ return Number((_ref64 = (_order$small_ticket_d = order.small_ticket_data_flag) !== null && _order$small_ticket_d !== void 0 ? _order$small_ticket_d : order.smallTicketDataFlag) !== null && _ref64 !== void 0 ? _ref64 : 0) === 1;
6214
6327
  }
6215
6328
  }, {
6216
6329
  key: "shouldPrintSyncedOrder",
@@ -6228,7 +6341,7 @@ var Server = /*#__PURE__*/function () {
6228
6341
  }, {
6229
6342
  key: "isSalesOrderFullyPaid",
6230
6343
  value: function isSalesOrderFullyPaid(order) {
6231
- var _order$summary$amount, _order$summary, _ref64, _ref65, _order$summary$expect, _order$summary2, _order$summary3;
6344
+ var _order$summary$amount, _order$summary, _ref65, _ref66, _order$summary$expect, _order$summary2, _order$summary3;
6232
6345
  if (!order || _typeof(order) !== 'object') return false;
6233
6346
  var paymentStatus = String(order.payment_status || '').toLowerCase();
6234
6347
  if (paymentStatus === 'paid' || paymentStatus === 'finished') return true;
@@ -6240,7 +6353,7 @@ var Server = /*#__PURE__*/function () {
6240
6353
  return this.toAmountNumber(amountGap) <= 0;
6241
6354
  }
6242
6355
  var paidAmount = this.sumPaidOrderPayments(order.payments);
6243
- var targetAmount = this.toAmountNumber((_ref64 = (_ref65 = (_order$summary$expect = (_order$summary2 = order.summary) === null || _order$summary2 === void 0 ? void 0 : _order$summary2.expect_amount) !== null && _order$summary$expect !== void 0 ? _order$summary$expect : (_order$summary3 = order.summary) === null || _order$summary3 === void 0 ? void 0 : _order$summary3.total_amount) !== null && _ref65 !== void 0 ? _ref65 : order.expect_amount) !== null && _ref64 !== void 0 ? _ref64 : order.total_amount);
6356
+ var targetAmount = this.toAmountNumber((_ref65 = (_ref66 = (_order$summary$expect = (_order$summary2 = order.summary) === null || _order$summary2 === void 0 ? void 0 : _order$summary2.expect_amount) !== null && _order$summary$expect !== void 0 ? _order$summary$expect : (_order$summary3 = order.summary) === null || _order$summary3 === void 0 ? void 0 : _order$summary3.total_amount) !== null && _ref66 !== void 0 ? _ref66 : order.expect_amount) !== null && _ref65 !== void 0 ? _ref65 : order.total_amount);
6244
6357
  if (targetAmount <= 0) return paidAmount > 0;
6245
6358
  return paidAmount >= targetAmount;
6246
6359
  }
@@ -6267,12 +6380,12 @@ var Server = /*#__PURE__*/function () {
6267
6380
  }, {
6268
6381
  key: "buildSmallTicketProductMap",
6269
6382
  value: function () {
6270
- var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(order) {
6383
+ var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(order) {
6271
6384
  var _this$products3,
6272
6385
  _this15 = this;
6273
6386
  var products, productIdSet, productIds, entries;
6274
- return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6275
- while (1) switch (_context65.prev = _context65.next) {
6387
+ return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6388
+ while (1) switch (_context66.prev = _context66.next) {
6276
6389
  case 0:
6277
6390
  products = Array.isArray(order === null || order === void 0 ? void 0 : order.products) ? order.products : [];
6278
6391
  productIdSet = new Set();
@@ -6284,8 +6397,8 @@ var Server = /*#__PURE__*/function () {
6284
6397
  }
6285
6398
  if (Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) {
6286
6399
  product.product_bundle.forEach(function (bundle) {
6287
- var _ref66, _bundle$bundle_produc;
6288
- var bundleProductId = (_ref66 = (_bundle$bundle_produc = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref66 !== void 0 ? _ref66 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
6400
+ var _ref67, _bundle$bundle_produc;
6401
+ var bundleProductId = (_ref67 = (_bundle$bundle_produc = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref67 !== void 0 ? _ref67 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
6289
6402
  if (bundleProductId !== undefined && bundleProductId !== null && bundleProductId !== '') {
6290
6403
  productIdSet.add(bundleProductId);
6291
6404
  }
@@ -6294,45 +6407,45 @@ var Server = /*#__PURE__*/function () {
6294
6407
  });
6295
6408
  productIds = Array.from(productIdSet);
6296
6409
  if (!(!productIds.length || typeof ((_this$products3 = this.products) === null || _this$products3 === void 0 ? void 0 : _this$products3.getProductById) !== 'function')) {
6297
- _context65.next = 6;
6410
+ _context66.next = 6;
6298
6411
  break;
6299
6412
  }
6300
- return _context65.abrupt("return", {});
6413
+ return _context66.abrupt("return", {});
6301
6414
  case 6:
6302
- _context65.next = 8;
6415
+ _context66.next = 8;
6303
6416
  return Promise.all(productIds.map( /*#__PURE__*/function () {
6304
- var _ref67 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(id) {
6417
+ var _ref68 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(id) {
6305
6418
  var _this15$products, _this15$products$getP, product;
6306
- return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6307
- while (1) switch (_context64.prev = _context64.next) {
6419
+ return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6420
+ while (1) switch (_context65.prev = _context65.next) {
6308
6421
  case 0:
6309
- _context64.prev = 0;
6310
- _context64.next = 3;
6422
+ _context65.prev = 0;
6423
+ _context65.next = 3;
6311
6424
  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));
6312
6425
  case 3:
6313
- product = _context64.sent;
6314
- return _context64.abrupt("return", product ? [String(id), product] : null);
6426
+ product = _context65.sent;
6427
+ return _context65.abrupt("return", product ? [String(id), product] : null);
6315
6428
  case 7:
6316
- _context64.prev = 7;
6317
- _context64.t0 = _context64["catch"](0);
6429
+ _context65.prev = 7;
6430
+ _context65.t0 = _context65["catch"](0);
6318
6431
  _this15.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
6319
6432
  product_id: id,
6320
- error: _context64.t0 instanceof Error ? _context64.t0.message : String(_context64.t0)
6433
+ error: _context65.t0 instanceof Error ? _context65.t0.message : String(_context65.t0)
6321
6434
  });
6322
- return _context64.abrupt("return", null);
6435
+ return _context65.abrupt("return", null);
6323
6436
  case 11:
6324
6437
  case "end":
6325
- return _context64.stop();
6438
+ return _context65.stop();
6326
6439
  }
6327
- }, _callee64, null, [[0, 7]]);
6440
+ }, _callee65, null, [[0, 7]]);
6328
6441
  }));
6329
- return function (_x72) {
6330
- return _ref67.apply(this, arguments);
6442
+ return function (_x73) {
6443
+ return _ref68.apply(this, arguments);
6331
6444
  };
6332
6445
  }()));
6333
6446
  case 8:
6334
- entries = _context65.sent;
6335
- return _context65.abrupt("return", entries.reduce(function (map, entry) {
6447
+ entries = _context66.sent;
6448
+ return _context66.abrupt("return", entries.reduce(function (map, entry) {
6336
6449
  if (!entry) return map;
6337
6450
  var _entry = _slicedToArray(entry, 2),
6338
6451
  id = _entry[0],
@@ -6342,11 +6455,11 @@ var Server = /*#__PURE__*/function () {
6342
6455
  }, {}));
6343
6456
  case 10:
6344
6457
  case "end":
6345
- return _context65.stop();
6458
+ return _context66.stop();
6346
6459
  }
6347
- }, _callee65, this);
6460
+ }, _callee66, this);
6348
6461
  }));
6349
- function buildSmallTicketProductMap(_x71) {
6462
+ function buildSmallTicketProductMap(_x72) {
6350
6463
  return _buildSmallTicketProductMap.apply(this, arguments);
6351
6464
  }
6352
6465
  return buildSmallTicketProductMap;
@@ -6366,8 +6479,8 @@ var Server = /*#__PURE__*/function () {
6366
6479
  addProductId((_product$product_id2 = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id2 !== void 0 ? _product$product_id2 : product === null || product === void 0 ? void 0 : product.id);
6367
6480
  if (Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) {
6368
6481
  product.product_bundle.forEach(function (bundle) {
6369
- var _ref68, _bundle$bundle_produc2;
6370
- addProductId((_ref68 = (_bundle$bundle_produc2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref68 !== void 0 ? _ref68 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id);
6482
+ var _ref69, _bundle$bundle_produc2;
6483
+ addProductId((_ref69 = (_bundle$bundle_produc2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref69 !== void 0 ? _ref69 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id);
6371
6484
  });
6372
6485
  }
6373
6486
  });
@@ -6376,40 +6489,40 @@ var Server = /*#__PURE__*/function () {
6376
6489
  }, {
6377
6490
  key: "buildSalesDetailProductSnapshotMap",
6378
6491
  value: function () {
6379
- var _buildSalesDetailProductSnapshotMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(order) {
6492
+ var _buildSalesDetailProductSnapshotMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(order) {
6380
6493
  var _this$products4;
6381
6494
  var productIds, getSnapshots;
6382
- return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6383
- while (1) switch (_context66.prev = _context66.next) {
6495
+ return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6496
+ while (1) switch (_context67.prev = _context67.next) {
6384
6497
  case 0:
6385
6498
  productIds = this.collectSalesDetailProductIds(order);
6386
6499
  getSnapshots = (_this$products4 = this.products) === null || _this$products4 === void 0 ? void 0 : _this$products4.getProductSnapshotsByIds;
6387
6500
  if (!(!productIds.length || typeof getSnapshots !== 'function')) {
6388
- _context66.next = 4;
6501
+ _context67.next = 4;
6389
6502
  break;
6390
6503
  }
6391
- return _context66.abrupt("return", {});
6504
+ return _context67.abrupt("return", {});
6392
6505
  case 4:
6393
- _context66.prev = 4;
6394
- _context66.next = 7;
6506
+ _context67.prev = 4;
6507
+ _context67.next = 7;
6395
6508
  return getSnapshots.call(this.products, productIds);
6396
6509
  case 7:
6397
- return _context66.abrupt("return", _context66.sent);
6510
+ return _context67.abrupt("return", _context67.sent);
6398
6511
  case 10:
6399
- _context66.prev = 10;
6400
- _context66.t0 = _context66["catch"](4);
6512
+ _context67.prev = 10;
6513
+ _context67.t0 = _context67["catch"](4);
6401
6514
  this.logWarning('buildSalesDetailProductSnapshotMap: 查询本地商品快照失败', {
6402
6515
  product_ids: productIds,
6403
- error: _context66.t0 instanceof Error ? _context66.t0.message : String(_context66.t0)
6516
+ error: _context67.t0 instanceof Error ? _context67.t0.message : String(_context67.t0)
6404
6517
  });
6405
- return _context66.abrupt("return", {});
6518
+ return _context67.abrupt("return", {});
6406
6519
  case 14:
6407
6520
  case "end":
6408
- return _context66.stop();
6521
+ return _context67.stop();
6409
6522
  }
6410
- }, _callee66, this, [[4, 10]]);
6523
+ }, _callee67, this, [[4, 10]]);
6411
6524
  }));
6412
- function buildSalesDetailProductSnapshotMap(_x73) {
6525
+ function buildSalesDetailProductSnapshotMap(_x74) {
6413
6526
  return _buildSalesDetailProductSnapshotMap.apply(this, arguments);
6414
6527
  }
6415
6528
  return buildSalesDetailProductSnapshotMap;
@@ -6443,9 +6556,9 @@ var Server = /*#__PURE__*/function () {
6443
6556
  if (!Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) return product;
6444
6557
  var hasChanged = false;
6445
6558
  var productBundle = product.product_bundle.map(function (bundle) {
6446
- var _ref69, _bundle$bundle_produc3;
6559
+ var _ref70, _bundle$bundle_produc3;
6447
6560
  if (!bundle || _typeof(bundle) !== 'object') return bundle;
6448
- var rawProductId = (_ref69 = (_bundle$bundle_produc3 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc3 !== void 0 ? _bundle$bundle_produc3 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref69 !== void 0 ? _ref69 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
6561
+ var rawProductId = (_ref70 = (_bundle$bundle_produc3 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc3 !== void 0 ? _bundle$bundle_produc3 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref70 !== void 0 ? _ref70 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
6449
6562
  if (rawProductId === undefined || rawProductId === null || rawProductId === '') return bundle;
6450
6563
  var productId = Number(rawProductId);
6451
6564
  if (!Number.isFinite(productId)) return bundle;
@@ -6465,28 +6578,28 @@ var Server = /*#__PURE__*/function () {
6465
6578
  }, {
6466
6579
  key: "withSalesDetailProductSnapshots",
6467
6580
  value: function () {
6468
- var _withSalesDetailProductSnapshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(order) {
6581
+ var _withSalesDetailProductSnapshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(order) {
6469
6582
  var _this16 = this;
6470
6583
  var products, snapshotMap, hasChanged, enrichedProducts, enrichedOrder;
6471
- return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6472
- while (1) switch (_context67.prev = _context67.next) {
6584
+ return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6585
+ while (1) switch (_context68.prev = _context68.next) {
6473
6586
  case 0:
6474
6587
  products = Array.isArray(order === null || order === void 0 ? void 0 : order.products) ? order.products : null;
6475
6588
  if (products !== null && products !== void 0 && products.length) {
6476
- _context67.next = 3;
6589
+ _context68.next = 3;
6477
6590
  break;
6478
6591
  }
6479
- return _context67.abrupt("return", order);
6592
+ return _context68.abrupt("return", order);
6480
6593
  case 3:
6481
- _context67.next = 5;
6594
+ _context68.next = 5;
6482
6595
  return this.buildSalesDetailProductSnapshotMap(order);
6483
6596
  case 5:
6484
- snapshotMap = _context67.sent;
6597
+ snapshotMap = _context68.sent;
6485
6598
  if (Object.keys(snapshotMap).length) {
6486
- _context67.next = 8;
6599
+ _context68.next = 8;
6487
6600
  break;
6488
6601
  }
6489
- return _context67.abrupt("return", order);
6602
+ return _context68.abrupt("return", order);
6490
6603
  case 8:
6491
6604
  hasChanged = false;
6492
6605
  enrichedProducts = products.map(function (product) {
@@ -6496,22 +6609,22 @@ var Server = /*#__PURE__*/function () {
6496
6609
  return nextProduct;
6497
6610
  });
6498
6611
  if (hasChanged) {
6499
- _context67.next = 12;
6612
+ _context68.next = 12;
6500
6613
  break;
6501
6614
  }
6502
- return _context67.abrupt("return", order);
6615
+ return _context68.abrupt("return", order);
6503
6616
  case 12:
6504
6617
  enrichedOrder = _objectSpread(_objectSpread({}, order), {}, {
6505
6618
  products: enrichedProducts
6506
6619
  });
6507
- return _context67.abrupt("return", enrichedOrder);
6620
+ return _context68.abrupt("return", enrichedOrder);
6508
6621
  case 14:
6509
6622
  case "end":
6510
- return _context67.stop();
6623
+ return _context68.stop();
6511
6624
  }
6512
- }, _callee67, this);
6625
+ }, _callee68, this);
6513
6626
  }));
6514
- function withSalesDetailProductSnapshots(_x74) {
6627
+ function withSalesDetailProductSnapshots(_x75) {
6515
6628
  return _withSalesDetailProductSnapshots.apply(this, arguments);
6516
6629
  }
6517
6630
  return withSalesDetailProductSnapshots;
@@ -6569,7 +6682,7 @@ var Server = /*#__PURE__*/function () {
6569
6682
  }, {
6570
6683
  key: "resolveProductTitleValue",
6571
6684
  value: function resolveProductTitleValue(value, key, currentLocale) {
6572
- var _ref70, _ref71, _value$key;
6685
+ var _ref71, _ref72, _value$key;
6573
6686
  if (value === undefined || value === null || value === '') return null;
6574
6687
  if (_typeof(value) !== 'object') {
6575
6688
  var title = String(value);
@@ -6579,7 +6692,7 @@ var Server = /*#__PURE__*/function () {
6579
6692
  }
6580
6693
  var normalizedKey = key.replace('-', '_');
6581
6694
  var dashedKey = key.replace('_', '-');
6582
- var rawValue = (_ref70 = (_ref71 = (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : value[normalizedKey]) !== null && _ref71 !== void 0 ? _ref71 : value[dashedKey]) !== null && _ref70 !== void 0 ? _ref70 : key === 'auto' ? value.default : undefined;
6695
+ var rawValue = (_ref71 = (_ref72 = (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : value[normalizedKey]) !== null && _ref72 !== void 0 ? _ref72 : value[dashedKey]) !== null && _ref71 !== void 0 ? _ref71 : key === 'auto' ? value.default : undefined;
6583
6696
  if (rawValue === undefined || rawValue === null || rawValue === '') return null;
6584
6697
  if (_typeof(rawValue) === 'object') return this.resolveFirstProductTitleValue(rawValue);
6585
6698
  return String(rawValue);
@@ -6642,31 +6755,31 @@ var Server = /*#__PURE__*/function () {
6642
6755
  }, {
6643
6756
  key: "enrichPaymentNamesByCode",
6644
6757
  value: function () {
6645
- var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(order) {
6758
+ var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(order) {
6646
6759
  var _this19 = this;
6647
6760
  var payments, hasMissingName, paymentModule, payMethods, nameByCode, _iterator12, _step12, method, codeKey, name, hasResolvedName, enrichedPayments;
6648
- return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6649
- while (1) switch (_context68.prev = _context68.next) {
6761
+ return _regeneratorRuntime().wrap(function _callee69$(_context69) {
6762
+ while (1) switch (_context69.prev = _context69.next) {
6650
6763
  case 0:
6651
6764
  payments = Array.isArray(order === null || order === void 0 ? void 0 : order.payments) ? order.payments : [];
6652
6765
  hasMissingName = payments.some(function (payment) {
6653
6766
  return _this19.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this19.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
6654
6767
  });
6655
6768
  if (hasMissingName) {
6656
- _context68.next = 4;
6769
+ _context69.next = 4;
6657
6770
  break;
6658
6771
  }
6659
- return _context68.abrupt("return", order);
6772
+ return _context69.abrupt("return", order);
6660
6773
  case 4:
6661
- _context68.prev = 4;
6662
- _context68.next = 7;
6774
+ _context69.prev = 4;
6775
+ _context69.next = 7;
6663
6776
  return this.getPaymentRouteModule();
6664
6777
  case 7:
6665
- paymentModule = _context68.sent;
6666
- _context68.next = 10;
6778
+ paymentModule = _context69.sent;
6779
+ _context69.next = 10;
6667
6780
  return paymentModule.getPayMethodListAsync();
6668
6781
  case 10:
6669
- payMethods = _context68.sent;
6782
+ payMethods = _context69.sent;
6670
6783
  nameByCode = new Map();
6671
6784
  _iterator12 = _createForOfIteratorHelper(payMethods || []);
6672
6785
  try {
@@ -6693,28 +6806,28 @@ var Server = /*#__PURE__*/function () {
6693
6806
  });
6694
6807
  });
6695
6808
  if (hasResolvedName) {
6696
- _context68.next = 18;
6809
+ _context69.next = 18;
6697
6810
  break;
6698
6811
  }
6699
- return _context68.abrupt("return", order);
6812
+ return _context69.abrupt("return", order);
6700
6813
  case 18:
6701
- return _context68.abrupt("return", _objectSpread(_objectSpread({}, order), {}, {
6814
+ return _context69.abrupt("return", _objectSpread(_objectSpread({}, order), {}, {
6702
6815
  payments: enrichedPayments
6703
6816
  }));
6704
6817
  case 21:
6705
- _context68.prev = 21;
6706
- _context68.t0 = _context68["catch"](4);
6818
+ _context69.prev = 21;
6819
+ _context69.t0 = _context69["catch"](4);
6707
6820
  this.logWarning('enrichPaymentNamesByCode: 支付方式名称回填失败', {
6708
- error: _context68.t0 instanceof Error ? _context68.t0.message : String(_context68.t0)
6821
+ error: _context69.t0 instanceof Error ? _context69.t0.message : String(_context69.t0)
6709
6822
  });
6710
- return _context68.abrupt("return", order);
6823
+ return _context69.abrupt("return", order);
6711
6824
  case 25:
6712
6825
  case "end":
6713
- return _context68.stop();
6826
+ return _context69.stop();
6714
6827
  }
6715
- }, _callee68, this, [[4, 21]]);
6828
+ }, _callee69, this, [[4, 21]]);
6716
6829
  }));
6717
- function enrichPaymentNamesByCode(_x75) {
6830
+ function enrichPaymentNamesByCode(_x76) {
6718
6831
  return _enrichPaymentNamesByCode.apply(this, arguments);
6719
6832
  }
6720
6833
  return enrichPaymentNamesByCode;
@@ -6722,66 +6835,66 @@ var Server = /*#__PURE__*/function () {
6722
6835
  }, {
6723
6836
  key: "withLocalSmallTicketData",
6724
6837
  value: function () {
6725
- var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(order, options) {
6838
+ var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(order, options) {
6726
6839
  var _options$productMap, enrichedOrder, productMap, smallTicketData;
6727
- return _regeneratorRuntime().wrap(function _callee69$(_context69) {
6728
- while (1) switch (_context69.prev = _context69.next) {
6840
+ return _regeneratorRuntime().wrap(function _callee70$(_context70) {
6841
+ while (1) switch (_context70.prev = _context70.next) {
6729
6842
  case 0:
6730
6843
  if (this.shouldBuildSmallTicketData(order)) {
6731
- _context69.next = 2;
6844
+ _context70.next = 2;
6732
6845
  break;
6733
6846
  }
6734
- return _context69.abrupt("return", order);
6847
+ return _context70.abrupt("return", order);
6735
6848
  case 2:
6736
6849
  if (!(options !== null && options !== void 0 && options.requireFullyPaid && !this.isSalesOrderFullyPaid(order))) {
6737
- _context69.next = 4;
6850
+ _context70.next = 4;
6738
6851
  break;
6739
6852
  }
6740
- return _context69.abrupt("return", order);
6853
+ return _context70.abrupt("return", order);
6741
6854
  case 4:
6742
- _context69.prev = 4;
6743
- _context69.next = 7;
6855
+ _context70.prev = 4;
6856
+ _context70.next = 7;
6744
6857
  return this.enrichPaymentNamesByCode(order);
6745
6858
  case 7:
6746
- enrichedOrder = _context69.sent;
6859
+ enrichedOrder = _context70.sent;
6747
6860
  if (!((_options$productMap = options === null || options === void 0 ? void 0 : options.productMap) !== null && _options$productMap !== void 0)) {
6748
- _context69.next = 12;
6861
+ _context70.next = 12;
6749
6862
  break;
6750
6863
  }
6751
- _context69.t0 = _options$productMap;
6752
- _context69.next = 15;
6864
+ _context70.t0 = _options$productMap;
6865
+ _context70.next = 15;
6753
6866
  break;
6754
6867
  case 12:
6755
- _context69.next = 14;
6868
+ _context70.next = 14;
6756
6869
  return this.buildSmallTicketProductMap(enrichedOrder);
6757
6870
  case 14:
6758
- _context69.t0 = _context69.sent;
6871
+ _context70.t0 = _context70.sent;
6759
6872
  case 15:
6760
- productMap = _context69.t0;
6873
+ productMap = _context70.t0;
6761
6874
  smallTicketData = buildSmallTicketData({
6762
6875
  order: enrichedOrder,
6763
6876
  shopInfo: this.getSmallTicketShopInfo(),
6764
6877
  productMap: productMap
6765
6878
  });
6766
- return _context69.abrupt("return", _objectSpread(_objectSpread({}, enrichedOrder), {}, {
6879
+ return _context70.abrupt("return", _objectSpread(_objectSpread({}, enrichedOrder), {}, {
6767
6880
  payment_info: _objectSpread(_objectSpread({}, enrichedOrder.payment_info || {}), {}, {
6768
6881
  small_ticket_data: smallTicketData
6769
6882
  })
6770
6883
  }));
6771
6884
  case 20:
6772
- _context69.prev = 20;
6773
- _context69.t1 = _context69["catch"](4);
6885
+ _context70.prev = 20;
6886
+ _context70.t1 = _context70["catch"](4);
6774
6887
  this.logError('withLocalSmallTicketData: 生成本地小票数据失败', {
6775
- error: _context69.t1 instanceof Error ? _context69.t1.message : String(_context69.t1)
6888
+ error: _context70.t1 instanceof Error ? _context70.t1.message : String(_context70.t1)
6776
6889
  });
6777
- return _context69.abrupt("return", order);
6890
+ return _context70.abrupt("return", order);
6778
6891
  case 24:
6779
6892
  case "end":
6780
- return _context69.stop();
6893
+ return _context70.stop();
6781
6894
  }
6782
- }, _callee69, this, [[4, 20]]);
6895
+ }, _callee70, this, [[4, 20]]);
6783
6896
  }));
6784
- function withLocalSmallTicketData(_x76, _x77) {
6897
+ function withLocalSmallTicketData(_x77, _x78) {
6785
6898
  return _withLocalSmallTicketData.apply(this, arguments);
6786
6899
  }
6787
6900
  return withLocalSmallTicketData;
@@ -6843,34 +6956,34 @@ var Server = /*#__PURE__*/function () {
6843
6956
  }, {
6844
6957
  key: "handleUpdateLocalOrdersBatch",
6845
6958
  value: (function () {
6846
- var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(orderIds) {
6847
- var _this$app17;
6959
+ var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(orderIds) {
6960
+ var _this$app18;
6848
6961
  var existedBefore, _iterator13, _step13, id, fetched, message, fetchedMap, _iterator14, _step14, order, oid, freshOrders, succeedIds, failed, _iterator15, _step15, _id, fresh, _message2, overwritten, inserted;
6849
- return _regeneratorRuntime().wrap(function _callee70$(_context70) {
6850
- while (1) switch (_context70.prev = _context70.next) {
6962
+ return _regeneratorRuntime().wrap(function _callee71$(_context71) {
6963
+ while (1) switch (_context71.prev = _context71.next) {
6851
6964
  case 0:
6852
6965
  this.logInfo('handleUpdateLocalOrdersBatch: 开始处理', {
6853
6966
  count: orderIds.length,
6854
6967
  orderIds: orderIds
6855
6968
  });
6856
6969
  if (this.order) {
6857
- _context70.next = 4;
6970
+ _context71.next = 4;
6858
6971
  break;
6859
6972
  }
6860
6973
  this.logError('handleUpdateLocalOrdersBatch: Order 模块未注册');
6861
- return _context70.abrupt("return", {
6974
+ return _context71.abrupt("return", {
6862
6975
  code: 500,
6863
6976
  status: false,
6864
6977
  message: 'Order 模块未注册',
6865
6978
  data: null
6866
6979
  });
6867
6980
  case 4:
6868
- if ((_this$app17 = this.app) !== null && _this$app17 !== void 0 && _this$app17.request) {
6869
- _context70.next = 7;
6981
+ if ((_this$app18 = this.app) !== null && _this$app18 !== void 0 && _this$app18.request) {
6982
+ _context71.next = 7;
6870
6983
  break;
6871
6984
  }
6872
6985
  this.logError('handleUpdateLocalOrdersBatch: app.request 不可用');
6873
- return _context70.abrupt("return", {
6986
+ return _context71.abrupt("return", {
6874
6987
  code: 500,
6875
6988
  status: false,
6876
6989
  message: 'app.request 不可用',
@@ -6893,21 +7006,21 @@ var Server = /*#__PURE__*/function () {
6893
7006
  _iterator13.f();
6894
7007
  }
6895
7008
  fetched = [];
6896
- _context70.prev = 11;
6897
- _context70.next = 14;
7009
+ _context71.prev = 11;
7010
+ _context71.next = 14;
6898
7011
  return this.order.fetchOrdersByHttp(orderIds);
6899
7012
  case 14:
6900
- fetched = _context70.sent;
6901
- _context70.next = 22;
7013
+ fetched = _context71.sent;
7014
+ _context71.next = 22;
6902
7015
  break;
6903
7016
  case 17:
6904
- _context70.prev = 17;
6905
- _context70.t0 = _context70["catch"](11);
6906
- message = _context70.t0 instanceof Error ? _context70.t0.message : String(_context70.t0);
7017
+ _context71.prev = 17;
7018
+ _context71.t0 = _context71["catch"](11);
7019
+ message = _context71.t0 instanceof Error ? _context71.t0.message : String(_context71.t0);
6907
7020
  this.logError('handleUpdateLocalOrdersBatch: 批量拉取失败', {
6908
7021
  message: message
6909
7022
  });
6910
- return _context70.abrupt("return", {
7023
+ return _context71.abrupt("return", {
6911
7024
  code: 500,
6912
7025
  status: false,
6913
7026
  message: message,
@@ -6917,36 +7030,36 @@ var Server = /*#__PURE__*/function () {
6917
7030
  // 按返回结果中的 order_id 建索引,未命中即视为单笔失败
6918
7031
  fetchedMap = new Map();
6919
7032
  _iterator14 = _createForOfIteratorHelper(fetched);
6920
- _context70.prev = 24;
7033
+ _context71.prev = 24;
6921
7034
  _iterator14.s();
6922
7035
  case 26:
6923
7036
  if ((_step14 = _iterator14.n()).done) {
6924
- _context70.next = 34;
7037
+ _context71.next = 34;
6925
7038
  break;
6926
7039
  }
6927
7040
  order = _step14.value;
6928
7041
  oid = order === null || order === void 0 ? void 0 : order.order_id;
6929
7042
  if (!(oid === undefined || oid === null)) {
6930
- _context70.next = 31;
7043
+ _context71.next = 31;
6931
7044
  break;
6932
7045
  }
6933
- return _context70.abrupt("continue", 32);
7046
+ return _context71.abrupt("continue", 32);
6934
7047
  case 31:
6935
7048
  fetchedMap.set(String(oid), order);
6936
7049
  case 32:
6937
- _context70.next = 26;
7050
+ _context71.next = 26;
6938
7051
  break;
6939
7052
  case 34:
6940
- _context70.next = 39;
7053
+ _context71.next = 39;
6941
7054
  break;
6942
7055
  case 36:
6943
- _context70.prev = 36;
6944
- _context70.t1 = _context70["catch"](24);
6945
- _iterator14.e(_context70.t1);
7056
+ _context71.prev = 36;
7057
+ _context71.t1 = _context71["catch"](24);
7058
+ _iterator14.e(_context71.t1);
6946
7059
  case 39:
6947
- _context70.prev = 39;
7060
+ _context71.prev = 39;
6948
7061
  _iterator14.f();
6949
- return _context70.finish(39);
7062
+ return _context71.finish(39);
6950
7063
  case 42:
6951
7064
  freshOrders = [];
6952
7065
  succeedIds = [];
@@ -6972,23 +7085,23 @@ var Server = /*#__PURE__*/function () {
6972
7085
  _iterator15.f();
6973
7086
  }
6974
7087
  if (!(freshOrders.length > 0)) {
6975
- _context70.next = 58;
7088
+ _context71.next = 58;
6976
7089
  break;
6977
7090
  }
6978
- _context70.prev = 48;
6979
- _context70.next = 51;
7091
+ _context71.prev = 48;
7092
+ _context71.next = 51;
6980
7093
  return this.order.upsertOrdersFromRemote(freshOrders);
6981
7094
  case 51:
6982
- _context70.next = 58;
7095
+ _context71.next = 58;
6983
7096
  break;
6984
7097
  case 53:
6985
- _context70.prev = 53;
6986
- _context70.t2 = _context70["catch"](48);
6987
- _message2 = _context70.t2 instanceof Error ? _context70.t2.message : String(_context70.t2);
7098
+ _context71.prev = 53;
7099
+ _context71.t2 = _context71["catch"](48);
7100
+ _message2 = _context71.t2 instanceof Error ? _context71.t2.message : String(_context71.t2);
6988
7101
  this.logError('handleUpdateLocalOrdersBatch: 合并写入失败', {
6989
7102
  message: _message2
6990
7103
  });
6991
- return _context70.abrupt("return", {
7104
+ return _context71.abrupt("return", {
6992
7105
  code: 500,
6993
7106
  status: false,
6994
7107
  message: _message2,
@@ -7007,7 +7120,7 @@ var Server = /*#__PURE__*/function () {
7007
7120
  insertedCount: inserted.length,
7008
7121
  failedCount: failed.length
7009
7122
  });
7010
- return _context70.abrupt("return", {
7123
+ return _context71.abrupt("return", {
7011
7124
  code: 200,
7012
7125
  status: true,
7013
7126
  message: '',
@@ -7019,11 +7132,11 @@ var Server = /*#__PURE__*/function () {
7019
7132
  });
7020
7133
  case 62:
7021
7134
  case "end":
7022
- return _context70.stop();
7135
+ return _context71.stop();
7023
7136
  }
7024
- }, _callee70, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
7137
+ }, _callee71, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
7025
7138
  }));
7026
- function handleUpdateLocalOrdersBatch(_x78) {
7139
+ function handleUpdateLocalOrdersBatch(_x79) {
7027
7140
  return _handleUpdateLocalOrdersBatch.apply(this, arguments);
7028
7141
  }
7029
7142
  return handleUpdateLocalOrdersBatch;
@@ -7389,16 +7502,16 @@ var Server = /*#__PURE__*/function () {
7389
7502
  }, {
7390
7503
  key: "recomputeAndNotifyFloorPlanQuery",
7391
7504
  value: (function () {
7392
- var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71() {
7505
+ var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72() {
7393
7506
  var _iterator17, _step17, _step17$value, subscriberId, sub, result, errorMessage;
7394
- return _regeneratorRuntime().wrap(function _callee71$(_context71) {
7395
- while (1) switch (_context71.prev = _context71.next) {
7507
+ return _regeneratorRuntime().wrap(function _callee72$(_context72) {
7508
+ while (1) switch (_context72.prev = _context72.next) {
7396
7509
  case 0:
7397
7510
  if (!(this.floorPlanQuerySubscribers.size === 0)) {
7398
- _context71.next = 2;
7511
+ _context72.next = 2;
7399
7512
  break;
7400
7513
  }
7401
- return _context71.abrupt("return");
7514
+ return _context72.abrupt("return");
7402
7515
  case 2:
7403
7516
  this.logInfo('recomputeAndNotifyFloorPlanQuery: 开始推送', {
7404
7517
  subscriberCount: this.floorPlanQuerySubscribers.size
@@ -7428,9 +7541,9 @@ var Server = /*#__PURE__*/function () {
7428
7541
  }
7429
7542
  case 5:
7430
7543
  case "end":
7431
- return _context71.stop();
7544
+ return _context72.stop();
7432
7545
  }
7433
- }, _callee71, this);
7546
+ }, _callee72, this);
7434
7547
  }));
7435
7548
  function recomputeAndNotifyFloorPlanQuery() {
7436
7549
  return _recomputeAndNotifyFloorPlanQuery.apply(this, arguments);
@@ -7460,21 +7573,21 @@ var Server = /*#__PURE__*/function () {
7460
7573
  * filter 逻辑暂为 mock,仅记录参数
7461
7574
  */
7462
7575
  function () {
7463
- var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(data) {
7576
+ var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(data) {
7464
7577
  var rawList, result;
7465
- return _regeneratorRuntime().wrap(function _callee72$(_context72) {
7466
- while (1) switch (_context72.prev = _context72.next) {
7578
+ return _regeneratorRuntime().wrap(function _callee73$(_context73) {
7579
+ while (1) switch (_context73.prev = _context73.next) {
7467
7580
  case 0:
7468
7581
  this.logInfo('computeOrderQueryResult: 开始过滤', {
7469
7582
  data: data
7470
7583
  });
7471
7584
  console.log('[Server] computeOrderQueryResult', data);
7472
7585
  if (this.order) {
7473
- _context72.next = 5;
7586
+ _context73.next = 5;
7474
7587
  break;
7475
7588
  }
7476
7589
  this.logError('computeOrderQueryResult: Order 模块未注册');
7477
- return _context72.abrupt("return", {
7590
+ return _context73.abrupt("return", {
7478
7591
  code: 500,
7479
7592
  message: 'Order 模块未注册',
7480
7593
  data: {
@@ -7504,7 +7617,7 @@ var Server = /*#__PURE__*/function () {
7504
7617
  skip: result.skip,
7505
7618
  rejected: result.rejected
7506
7619
  });
7507
- return _context72.abrupt("return", {
7620
+ return _context73.abrupt("return", {
7508
7621
  code: 200,
7509
7622
  data: result,
7510
7623
  message: '',
@@ -7512,11 +7625,11 @@ var Server = /*#__PURE__*/function () {
7512
7625
  });
7513
7626
  case 11:
7514
7627
  case "end":
7515
- return _context72.stop();
7628
+ return _context73.stop();
7516
7629
  }
7517
- }, _callee72, this);
7630
+ }, _callee73, this);
7518
7631
  }));
7519
- function computeOrderQueryResult(_x79) {
7632
+ function computeOrderQueryResult(_x80) {
7520
7633
  return _computeOrderQueryResult.apply(this, arguments);
7521
7634
  }
7522
7635
  return computeOrderQueryResult;
@@ -7529,17 +7642,17 @@ var Server = /*#__PURE__*/function () {
7529
7642
  }, {
7530
7643
  key: "computeBookingQueryResult",
7531
7644
  value: (function () {
7532
- var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(data) {
7645
+ var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(data) {
7533
7646
  var rawOrders, result;
7534
- return _regeneratorRuntime().wrap(function _callee73$(_context73) {
7535
- while (1) switch (_context73.prev = _context73.next) {
7647
+ return _regeneratorRuntime().wrap(function _callee74$(_context74) {
7648
+ while (1) switch (_context74.prev = _context74.next) {
7536
7649
  case 0:
7537
7650
  if (this.order) {
7538
- _context73.next = 3;
7651
+ _context74.next = 3;
7539
7652
  break;
7540
7653
  }
7541
7654
  this.logError('computeBookingQueryResult: Order 模块未注册');
7542
- return _context73.abrupt("return", {
7655
+ return _context74.abrupt("return", {
7543
7656
  code: 500,
7544
7657
  message: 'Order 模块未注册',
7545
7658
  data: {
@@ -7558,7 +7671,7 @@ var Server = /*#__PURE__*/function () {
7558
7671
  size: result.size,
7559
7672
  skip: result.skip
7560
7673
  });
7561
- return _context73.abrupt("return", {
7674
+ return _context74.abrupt("return", {
7562
7675
  code: 200,
7563
7676
  data: result,
7564
7677
  message: '',
@@ -7566,11 +7679,11 @@ var Server = /*#__PURE__*/function () {
7566
7679
  });
7567
7680
  case 8:
7568
7681
  case "end":
7569
- return _context73.stop();
7682
+ return _context74.stop();
7570
7683
  }
7571
- }, _callee73, this);
7684
+ }, _callee74, this);
7572
7685
  }));
7573
- function computeBookingQueryResult(_x80) {
7686
+ function computeBookingQueryResult(_x81) {
7574
7687
  return _computeBookingQueryResult.apply(this, arguments);
7575
7688
  }
7576
7689
  return computeBookingQueryResult;
@@ -7629,12 +7742,12 @@ var Server = /*#__PURE__*/function () {
7629
7742
  }, {
7630
7743
  key: "computeProductQueryResult",
7631
7744
  value: (function () {
7632
- var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(context, options) {
7745
+ var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(context, options) {
7633
7746
  var _menu_list_ids$length3,
7634
7747
  _this21 = this;
7635
7748
  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;
7636
- return _regeneratorRuntime().wrap(function _callee74$(_context74) {
7637
- while (1) switch (_context74.prev = _context74.next) {
7749
+ return _regeneratorRuntime().wrap(function _callee75$(_context75) {
7750
+ while (1) switch (_context75.prev = _context75.next) {
7638
7751
  case 0:
7639
7752
  tTotal = performance.now();
7640
7753
  menu_list_ids = context.menu_list_ids, ids = context.ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime, customer_id = context.customer_id, extension_type = context.extension_type, product_id = context.product_id, strategy_context = context.strategy_context;
@@ -7661,28 +7774,28 @@ var Server = /*#__PURE__*/function () {
7661
7774
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
7662
7775
  });
7663
7776
  if (this.products) {
7664
- _context74.next = 8;
7777
+ _context75.next = 8;
7665
7778
  break;
7666
7779
  }
7667
7780
  this.logError('computeProductQueryResult: Products 模块未注册');
7668
- return _context74.abrupt("return", {
7781
+ return _context75.abrupt("return", {
7669
7782
  message: 'Products 模块未注册',
7670
7783
  data: this.buildProductQueryResultPayload([], 0)
7671
7784
  });
7672
7785
  case 8:
7673
7786
  if (!(queryIds.length > 0)) {
7674
- _context74.next = 20;
7787
+ _context75.next = 20;
7675
7788
  break;
7676
7789
  }
7677
7790
  uniqueIds = Array.from(new Set(queryIds));
7678
7791
  _tPrice = performance.now();
7679
- _context74.next = 13;
7792
+ _context75.next = 13;
7680
7793
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
7681
7794
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
7682
7795
  productIds: uniqueIds
7683
7796
  });
7684
7797
  case 13:
7685
- productsWithPrice = _context74.sent;
7798
+ productsWithPrice = _context75.sent;
7686
7799
  perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
7687
7800
  count: productsWithPrice.length,
7688
7801
  ids: uniqueIds
@@ -7702,7 +7815,7 @@ var Server = /*#__PURE__*/function () {
7702
7815
  ids: uniqueIds,
7703
7816
  count: extensionFilteredProducts.length
7704
7817
  });
7705
- return _context74.abrupt("return", {
7818
+ return _context75.abrupt("return", {
7706
7819
  code: 200,
7707
7820
  data: this.buildProductQueryResultPayload(extensionFilteredProducts),
7708
7821
  message: '',
@@ -7710,17 +7823,17 @@ var Server = /*#__PURE__*/function () {
7710
7823
  });
7711
7824
  case 20:
7712
7825
  if (!(product_id != null && Number.isFinite(Number(product_id)))) {
7713
- _context74.next = 32;
7826
+ _context75.next = 32;
7714
7827
  break;
7715
7828
  }
7716
7829
  pid = Number(product_id);
7717
7830
  _tPrice2 = performance.now();
7718
- _context74.next = 25;
7831
+ _context75.next = 25;
7719
7832
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
7720
7833
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
7721
7834
  });
7722
7835
  case 25:
7723
- allProductsWithPrice = _context74.sent;
7836
+ allProductsWithPrice = _context75.sent;
7724
7837
  perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
7725
7838
  count: allProductsWithPrice.length,
7726
7839
  productId: pid
@@ -7740,7 +7853,7 @@ var Server = /*#__PURE__*/function () {
7740
7853
  productId: pid,
7741
7854
  found: !!item
7742
7855
  });
7743
- return _context74.abrupt("return", {
7856
+ return _context75.abrupt("return", {
7744
7857
  code: 200,
7745
7858
  data: item,
7746
7859
  message: item ? '' : '商品不存在或未发布',
@@ -7748,16 +7861,16 @@ var Server = /*#__PURE__*/function () {
7748
7861
  });
7749
7862
  case 32:
7750
7863
  if (!this.shouldQueryProductsByExtensionTypes(extension_type)) {
7751
- _context74.next = 52;
7864
+ _context75.next = 52;
7752
7865
  break;
7753
7866
  }
7754
7867
  _tPrice3 = performance.now();
7755
- _context74.next = 36;
7868
+ _context75.next = 36;
7756
7869
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
7757
7870
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
7758
7871
  });
7759
7872
  case 36:
7760
- _filteredProducts2 = _context74.sent;
7873
+ _filteredProducts2 = _context75.sent;
7761
7874
  perfMark('computeQuery.getProductsWithPrice(extensionType)', performance.now() - _tPrice3, {
7762
7875
  count: _filteredProducts2.length,
7763
7876
  extension_type: extension_type
@@ -7796,7 +7909,7 @@ var Server = /*#__PURE__*/function () {
7796
7909
  filteredCount: _filteredProducts2.length,
7797
7910
  extension_type: extension_type
7798
7911
  });
7799
- return _context74.abrupt("return", {
7912
+ return _context75.abrupt("return", {
7800
7913
  code: 200,
7801
7914
  data: this.buildProductQueryResultPayload(_filteredProducts2),
7802
7915
  message: '',
@@ -7804,28 +7917,28 @@ var Server = /*#__PURE__*/function () {
7804
7917
  });
7805
7918
  case 52:
7806
7919
  if (this.menu) {
7807
- _context74.next = 55;
7920
+ _context75.next = 55;
7808
7921
  break;
7809
7922
  }
7810
7923
  this.logError('computeProductQueryResult: Menu 模块未注册');
7811
- return _context74.abrupt("return", {
7924
+ return _context75.abrupt("return", {
7812
7925
  message: 'Menu 模块未注册',
7813
7926
  data: this.buildProductQueryResultPayload([], 0)
7814
7927
  });
7815
7928
  case 55:
7816
7929
  if (this.schedule) {
7817
- _context74.next = 58;
7930
+ _context75.next = 58;
7818
7931
  break;
7819
7932
  }
7820
7933
  this.logError('computeProductQueryResult: Schedule 模块未注册');
7821
- return _context74.abrupt("return", {
7934
+ return _context75.abrupt("return", {
7822
7935
  message: 'Schedule 模块未注册',
7823
7936
  data: this.buildProductQueryResultPayload([], 0)
7824
7937
  });
7825
7938
  case 58:
7826
7939
  activeMenuList = [];
7827
7940
  if (!(menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0)) {
7828
- _context74.next = 71;
7941
+ _context75.next = 71;
7829
7942
  break;
7830
7943
  }
7831
7944
  tMenu = performance.now();
@@ -7836,18 +7949,18 @@ var Server = /*#__PURE__*/function () {
7836
7949
  });
7837
7950
  };
7838
7951
  activeMenuList = getActiveMenus();
7839
- _context74.t0 = !activeMenuList.length;
7840
- if (!_context74.t0) {
7841
- _context74.next = 68;
7952
+ _context75.t0 = !activeMenuList.length;
7953
+ if (!_context75.t0) {
7954
+ _context75.next = 68;
7842
7955
  break;
7843
7956
  }
7844
- _context74.next = 67;
7957
+ _context75.next = 67;
7845
7958
  return this.refreshMenuScheduleCacheAfterEmptyResult();
7846
7959
  case 67:
7847
- _context74.t0 = _context74.sent;
7960
+ _context75.t0 = _context75.sent;
7848
7961
  case 68:
7849
- if (!_context74.t0) {
7850
- _context74.next = 70;
7962
+ if (!_context75.t0) {
7963
+ _context75.next = 70;
7851
7964
  break;
7852
7965
  }
7853
7966
  activeMenuList = getActiveMenus();
@@ -7867,22 +7980,22 @@ var Server = /*#__PURE__*/function () {
7867
7980
  });
7868
7981
  tPrice = performance.now();
7869
7982
  if (!(scopedProductIds.length > 0)) {
7870
- _context74.next = 82;
7983
+ _context75.next = 82;
7871
7984
  break;
7872
7985
  }
7873
- _context74.next = 79;
7986
+ _context75.next = 79;
7874
7987
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
7875
7988
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
7876
7989
  productIds: productScope.isAllProducts ? undefined : scopedProductIds
7877
7990
  });
7878
7991
  case 79:
7879
- _context74.t1 = _context74.sent;
7880
- _context74.next = 83;
7992
+ _context75.t1 = _context75.sent;
7993
+ _context75.next = 83;
7881
7994
  break;
7882
7995
  case 82:
7883
- _context74.t1 = [];
7996
+ _context75.t1 = [];
7884
7997
  case 83:
7885
- filteredProducts = _context74.t1;
7998
+ filteredProducts = _context75.t1;
7886
7999
  perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
7887
8000
  count: filteredProducts.length,
7888
8001
  scopedProductCount: scopedProductIds.length
@@ -7923,7 +8036,7 @@ var Server = /*#__PURE__*/function () {
7923
8036
  filteredCount: filteredProducts.length,
7924
8037
  activeMenuCount: activeMenuList.length
7925
8038
  });
7926
- return _context74.abrupt("return", {
8039
+ return _context75.abrupt("return", {
7927
8040
  code: 200,
7928
8041
  data: this.buildProductQueryResultPayload(filteredProducts),
7929
8042
  message: '',
@@ -7931,11 +8044,11 @@ var Server = /*#__PURE__*/function () {
7931
8044
  });
7932
8045
  case 99:
7933
8046
  case "end":
7934
- return _context74.stop();
8047
+ return _context75.stop();
7935
8048
  }
7936
- }, _callee74, this);
8049
+ }, _callee75, this);
7937
8050
  }));
7938
- function computeProductQueryResult(_x81, _x82) {
8051
+ function computeProductQueryResult(_x82, _x83) {
7939
8052
  return _computeProductQueryResult.apply(this, arguments);
7940
8053
  }
7941
8054
  return computeProductQueryResult;
@@ -7949,14 +8062,14 @@ var Server = /*#__PURE__*/function () {
7949
8062
  }, {
7950
8063
  key: "buildProductFormatterContext",
7951
8064
  value: function buildProductFormatterContext(context) {
7952
- var _this$menu, _this$menu$getMenuLis, _scheduleModule$getSc, _this$core$context5;
8065
+ var _this$menu2, _this$menu2$getMenuLi, _scheduleModule$getSc, _this$core$context5;
7953
8066
  var scheduleModule = this.getSchedule();
7954
8067
  return {
7955
8068
  scheduleModule: scheduleModule,
7956
8069
  schedule_datetime: context.schedule_datetime,
7957
8070
  customer_id: context.customer_id,
7958
8071
  strategy_context: context.strategy_context,
7959
- menuList: ((_this$menu = this.menu) === null || _this$menu === void 0 || (_this$menu$getMenuLis = _this$menu.getMenuList) === null || _this$menu$getMenuLis === void 0 ? void 0 : _this$menu$getMenuLis.call(_this$menu)) || [],
8072
+ menuList: ((_this$menu2 = this.menu) === null || _this$menu2 === void 0 || (_this$menu2$getMenuLi = _this$menu2.getMenuList) === null || _this$menu2$getMenuLi === void 0 ? void 0 : _this$menu2$getMenuLi.call(_this$menu2)) || [],
7960
8073
  scheduleList: (scheduleModule === null || scheduleModule === void 0 || (_scheduleModule$getSc = scheduleModule.getScheduleList) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule)) || [],
7961
8074
  dataVariantEvaluator: (_this$core$context5 = this.core.context) === null || _this$core$context5 === void 0 ? void 0 : _this$core$context5.dataVariantEvaluator
7962
8075
  };
@@ -7971,72 +8084,72 @@ var Server = /*#__PURE__*/function () {
7971
8084
  }, {
7972
8085
  key: "recomputeAndNotifyProductQuery",
7973
8086
  value: (function () {
7974
- var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(options) {
8087
+ var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(options) {
7975
8088
  var _iterator18, _step18, _step18$value, subscriberId, subscriber, result, errorMessage;
7976
- return _regeneratorRuntime().wrap(function _callee75$(_context75) {
7977
- while (1) switch (_context75.prev = _context75.next) {
8089
+ return _regeneratorRuntime().wrap(function _callee76$(_context76) {
8090
+ while (1) switch (_context76.prev = _context76.next) {
7978
8091
  case 0:
7979
8092
  if (!(this.productQuerySubscribers.size === 0)) {
7980
- _context75.next = 2;
8093
+ _context76.next = 2;
7981
8094
  break;
7982
8095
  }
7983
- return _context75.abrupt("return");
8096
+ return _context76.abrupt("return");
7984
8097
  case 2:
7985
8098
  this.logInfo('recomputeAndNotifyProductQuery: 开始推送', {
7986
8099
  subscriberCount: this.productQuerySubscribers.size,
7987
8100
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
7988
8101
  });
7989
8102
  _iterator18 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
7990
- _context75.prev = 4;
8103
+ _context76.prev = 4;
7991
8104
  _iterator18.s();
7992
8105
  case 6:
7993
8106
  if ((_step18 = _iterator18.n()).done) {
7994
- _context75.next = 22;
8107
+ _context76.next = 22;
7995
8108
  break;
7996
8109
  }
7997
8110
  _step18$value = _slicedToArray(_step18.value, 2), subscriberId = _step18$value[0], subscriber = _step18$value[1];
7998
- _context75.prev = 8;
7999
- _context75.next = 11;
8111
+ _context76.prev = 8;
8112
+ _context76.next = 11;
8000
8113
  return this.computeProductQueryResult(subscriber.context, {
8001
8114
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
8002
8115
  });
8003
8116
  case 11:
8004
- result = _context75.sent;
8117
+ result = _context76.sent;
8005
8118
  subscriber.callback(result);
8006
8119
  this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
8007
8120
  subscriberId: subscriberId
8008
8121
  });
8009
- _context75.next = 20;
8122
+ _context76.next = 20;
8010
8123
  break;
8011
8124
  case 16:
8012
- _context75.prev = 16;
8013
- _context75.t0 = _context75["catch"](8);
8014
- errorMessage = _context75.t0 instanceof Error ? _context75.t0.message : String(_context75.t0);
8125
+ _context76.prev = 16;
8126
+ _context76.t0 = _context76["catch"](8);
8127
+ errorMessage = _context76.t0 instanceof Error ? _context76.t0.message : String(_context76.t0);
8015
8128
  this.logError('recomputeAndNotifyProductQuery: 推送失败', {
8016
8129
  subscriberId: subscriberId,
8017
8130
  error: errorMessage
8018
8131
  });
8019
8132
  case 20:
8020
- _context75.next = 6;
8133
+ _context76.next = 6;
8021
8134
  break;
8022
8135
  case 22:
8023
- _context75.next = 27;
8136
+ _context76.next = 27;
8024
8137
  break;
8025
8138
  case 24:
8026
- _context75.prev = 24;
8027
- _context75.t1 = _context75["catch"](4);
8028
- _iterator18.e(_context75.t1);
8139
+ _context76.prev = 24;
8140
+ _context76.t1 = _context76["catch"](4);
8141
+ _iterator18.e(_context76.t1);
8029
8142
  case 27:
8030
- _context75.prev = 27;
8143
+ _context76.prev = 27;
8031
8144
  _iterator18.f();
8032
- return _context75.finish(27);
8145
+ return _context76.finish(27);
8033
8146
  case 30:
8034
8147
  case "end":
8035
- return _context75.stop();
8148
+ return _context76.stop();
8036
8149
  }
8037
- }, _callee75, this, [[4, 24, 27, 30], [8, 16]]);
8150
+ }, _callee76, this, [[4, 24, 27, 30], [8, 16]]);
8038
8151
  }));
8039
- function recomputeAndNotifyProductQuery(_x83) {
8152
+ function recomputeAndNotifyProductQuery(_x84) {
8040
8153
  return _recomputeAndNotifyProductQuery.apply(this, arguments);
8041
8154
  }
8042
8155
  return recomputeAndNotifyProductQuery;
@@ -8048,16 +8161,16 @@ var Server = /*#__PURE__*/function () {
8048
8161
  }, {
8049
8162
  key: "recomputeAndNotifyOrderQuery",
8050
8163
  value: (function () {
8051
- var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76() {
8164
+ var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77() {
8052
8165
  var notifyStartAt, _iterator19, _step19, _step19$value, subscriberId, subscriber, computeStartAt, result, computeEndAt, callbackStartAt, callbackEndAt, errorMessage, notifyEndAt;
8053
- return _regeneratorRuntime().wrap(function _callee76$(_context76) {
8054
- while (1) switch (_context76.prev = _context76.next) {
8166
+ return _regeneratorRuntime().wrap(function _callee77$(_context77) {
8167
+ while (1) switch (_context77.prev = _context77.next) {
8055
8168
  case 0:
8056
8169
  if (!(this.orderQuerySubscribers.size === 0)) {
8057
- _context76.next = 2;
8170
+ _context77.next = 2;
8058
8171
  break;
8059
8172
  }
8060
- return _context76.abrupt("return");
8173
+ return _context77.abrupt("return");
8061
8174
  case 2:
8062
8175
  notifyStartAt = Date.now();
8063
8176
  this.logInfo('recomputeAndNotifyOrderQuery: 开始推送', {
@@ -8065,20 +8178,20 @@ var Server = /*#__PURE__*/function () {
8065
8178
  notifyStartAt: new Date(notifyStartAt).toISOString()
8066
8179
  });
8067
8180
  _iterator19 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
8068
- _context76.prev = 5;
8181
+ _context77.prev = 5;
8069
8182
  _iterator19.s();
8070
8183
  case 7:
8071
8184
  if ((_step19 = _iterator19.n()).done) {
8072
- _context76.next = 27;
8185
+ _context77.next = 27;
8073
8186
  break;
8074
8187
  }
8075
8188
  _step19$value = _slicedToArray(_step19.value, 2), subscriberId = _step19$value[0], subscriber = _step19$value[1];
8076
- _context76.prev = 9;
8189
+ _context77.prev = 9;
8077
8190
  computeStartAt = Date.now();
8078
- _context76.next = 13;
8191
+ _context77.next = 13;
8079
8192
  return this.computeOrderQueryResult(subscriber.context);
8080
8193
  case 13:
8081
- result = _context76.sent;
8194
+ result = _context77.sent;
8082
8195
  computeEndAt = Date.now();
8083
8196
  callbackStartAt = Date.now();
8084
8197
  subscriber.callback(result);
@@ -8089,30 +8202,30 @@ var Server = /*#__PURE__*/function () {
8089
8202
  callbackDurationMs: callbackEndAt - callbackStartAt,
8090
8203
  totalDurationMs: callbackEndAt - computeStartAt
8091
8204
  });
8092
- _context76.next = 25;
8205
+ _context77.next = 25;
8093
8206
  break;
8094
8207
  case 21:
8095
- _context76.prev = 21;
8096
- _context76.t0 = _context76["catch"](9);
8097
- errorMessage = _context76.t0 instanceof Error ? _context76.t0.message : String(_context76.t0);
8208
+ _context77.prev = 21;
8209
+ _context77.t0 = _context77["catch"](9);
8210
+ errorMessage = _context77.t0 instanceof Error ? _context77.t0.message : String(_context77.t0);
8098
8211
  this.logError('recomputeAndNotifyOrderQuery: 推送失败', {
8099
8212
  subscriberId: subscriberId,
8100
8213
  error: errorMessage
8101
8214
  });
8102
8215
  case 25:
8103
- _context76.next = 7;
8216
+ _context77.next = 7;
8104
8217
  break;
8105
8218
  case 27:
8106
- _context76.next = 32;
8219
+ _context77.next = 32;
8107
8220
  break;
8108
8221
  case 29:
8109
- _context76.prev = 29;
8110
- _context76.t1 = _context76["catch"](5);
8111
- _iterator19.e(_context76.t1);
8222
+ _context77.prev = 29;
8223
+ _context77.t1 = _context77["catch"](5);
8224
+ _iterator19.e(_context77.t1);
8112
8225
  case 32:
8113
- _context76.prev = 32;
8226
+ _context77.prev = 32;
8114
8227
  _iterator19.f();
8115
- return _context76.finish(32);
8228
+ return _context77.finish(32);
8116
8229
  case 35:
8117
8230
  notifyEndAt = Date.now();
8118
8231
  this.logInfo('recomputeAndNotifyOrderQuery: 推送完成', {
@@ -8121,9 +8234,9 @@ var Server = /*#__PURE__*/function () {
8121
8234
  });
8122
8235
  case 37:
8123
8236
  case "end":
8124
- return _context76.stop();
8237
+ return _context77.stop();
8125
8238
  }
8126
- }, _callee76, this, [[5, 29, 32, 35], [9, 21]]);
8239
+ }, _callee77, this, [[5, 29, 32, 35], [9, 21]]);
8127
8240
  }));
8128
8241
  function recomputeAndNotifyOrderQuery() {
8129
8242
  return _recomputeAndNotifyOrderQuery.apply(this, arguments);
@@ -8264,67 +8377,67 @@ var Server = /*#__PURE__*/function () {
8264
8377
  }, {
8265
8378
  key: "recomputeAndNotifyBookingQuery",
8266
8379
  value: (function () {
8267
- var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77() {
8380
+ var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78() {
8268
8381
  var _iterator21, _step21, _step21$value, subscriberId, subscriber, result, errorMessage;
8269
- return _regeneratorRuntime().wrap(function _callee77$(_context77) {
8270
- while (1) switch (_context77.prev = _context77.next) {
8382
+ return _regeneratorRuntime().wrap(function _callee78$(_context78) {
8383
+ while (1) switch (_context78.prev = _context78.next) {
8271
8384
  case 0:
8272
8385
  if (!(this.bookingQuerySubscribers.size === 0)) {
8273
- _context77.next = 2;
8386
+ _context78.next = 2;
8274
8387
  break;
8275
8388
  }
8276
- return _context77.abrupt("return");
8389
+ return _context78.abrupt("return");
8277
8390
  case 2:
8278
8391
  this.logInfo('recomputeAndNotifyBookingQuery: 开始推送', {
8279
8392
  subscriberCount: this.bookingQuerySubscribers.size
8280
8393
  });
8281
8394
  _iterator21 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
8282
- _context77.prev = 4;
8395
+ _context78.prev = 4;
8283
8396
  _iterator21.s();
8284
8397
  case 6:
8285
8398
  if ((_step21 = _iterator21.n()).done) {
8286
- _context77.next = 22;
8399
+ _context78.next = 22;
8287
8400
  break;
8288
8401
  }
8289
8402
  _step21$value = _slicedToArray(_step21.value, 2), subscriberId = _step21$value[0], subscriber = _step21$value[1];
8290
- _context77.prev = 8;
8291
- _context77.next = 11;
8403
+ _context78.prev = 8;
8404
+ _context78.next = 11;
8292
8405
  return this.computeBookingQueryResult(subscriber.context);
8293
8406
  case 11:
8294
- result = _context77.sent;
8407
+ result = _context78.sent;
8295
8408
  subscriber.callback(result);
8296
8409
  this.logInfo('recomputeAndNotifyBookingQuery: 已推送', {
8297
8410
  subscriberId: subscriberId
8298
8411
  });
8299
- _context77.next = 20;
8412
+ _context78.next = 20;
8300
8413
  break;
8301
8414
  case 16:
8302
- _context77.prev = 16;
8303
- _context77.t0 = _context77["catch"](8);
8304
- errorMessage = _context77.t0 instanceof Error ? _context77.t0.message : String(_context77.t0);
8415
+ _context78.prev = 16;
8416
+ _context78.t0 = _context78["catch"](8);
8417
+ errorMessage = _context78.t0 instanceof Error ? _context78.t0.message : String(_context78.t0);
8305
8418
  this.logError('recomputeAndNotifyBookingQuery: 推送失败', {
8306
8419
  subscriberId: subscriberId,
8307
8420
  error: errorMessage
8308
8421
  });
8309
8422
  case 20:
8310
- _context77.next = 6;
8423
+ _context78.next = 6;
8311
8424
  break;
8312
8425
  case 22:
8313
- _context77.next = 27;
8426
+ _context78.next = 27;
8314
8427
  break;
8315
8428
  case 24:
8316
- _context77.prev = 24;
8317
- _context77.t1 = _context77["catch"](4);
8318
- _iterator21.e(_context77.t1);
8429
+ _context78.prev = 24;
8430
+ _context78.t1 = _context78["catch"](4);
8431
+ _iterator21.e(_context78.t1);
8319
8432
  case 27:
8320
- _context77.prev = 27;
8433
+ _context78.prev = 27;
8321
8434
  _iterator21.f();
8322
- return _context77.finish(27);
8435
+ return _context78.finish(27);
8323
8436
  case 30:
8324
8437
  case "end":
8325
- return _context77.stop();
8438
+ return _context78.stop();
8326
8439
  }
8327
- }, _callee77, this, [[4, 24, 27, 30], [8, 16]]);
8440
+ }, _callee78, this, [[4, 24, 27, 30], [8, 16]]);
8328
8441
  }));
8329
8442
  function recomputeAndNotifyBookingQuery() {
8330
8443
  return _recomputeAndNotifyBookingQuery.apply(this, arguments);