@pisell/pisellos 2.2.278 → 2.2.280
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.
- package/dist/modules/BaseModule.d.ts +1 -0
- package/dist/modules/BaseModule.js +24 -28
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +7 -3
- package/dist/modules/BookingContext/utils/productExtend.js +5 -9
- package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
- package/dist/modules/Customer/index.d.ts +4 -0
- package/dist/modules/Customer/index.js +91 -59
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +40 -11
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- package/dist/modules/OpenData/index.js +2 -2
- package/dist/modules/Order/index.d.ts +32 -4
- package/dist/modules/Order/index.js +868 -675
- package/dist/modules/Order/types.d.ts +22 -1
- package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +75 -0
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +71 -34
- package/dist/modules/Payment/index.d.ts +4 -0
- package/dist/modules/Payment/index.js +14 -4
- package/dist/modules/Payment/walletpass.js +21 -7
- package/dist/modules/Product/types.d.ts +1 -0
- package/dist/modules/ProductList/index.js +33 -13
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.js +153 -56
- package/dist/modules/SalesSummary/index.js +12 -13
- package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/index.js +15 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
- package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +3 -1
- package/dist/modules/Schedule/index.js +21 -16
- package/dist/modules/Summary/utils.js +38 -13
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/server/index.d.ts +20 -0
- package/dist/server/index.js +1101 -909
- package/dist/server/modules/order/index.d.ts +2 -0
- package/dist/server/modules/order/index.js +261 -96
- package/dist/server/modules/order/types.d.ts +1 -1
- package/dist/solution/BaseSales/index.d.ts +20 -1
- package/dist/solution/BaseSales/index.js +989 -881
- package/dist/solution/BaseSales/utils/cartPromotion.js +19 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingByStep/index.d.ts +17 -2
- package/dist/solution/BookingByStep/index.js +294 -215
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/BookingByStep/utils/capacity.js +17 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/BookingTicket/index.d.ts +21 -3
- package/dist/solution/BookingTicket/index.js +312 -226
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1142 -739
- package/dist/solution/ScanOrder/types.d.ts +21 -1
- package/dist/solution/ScanOrder/utils.d.ts +8 -0
- package/dist/solution/ScanOrder/utils.js +97 -45
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +125 -87
- package/dist/solution/UnifiedBookingSales/index.d.ts +204 -0
- package/dist/solution/UnifiedBookingSales/index.js +2211 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +150 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +39 -11
- package/dist/solution/VenueBooking/index.js +1167 -841
- package/dist/solution/VenueBooking/types.d.ts +3 -0
- package/dist/solution/VenueBooking/utils/resource.js +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +1 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/modules/BaseModule.d.ts +1 -0
- package/lib/modules/BaseModule.js +24 -37
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -0
- package/lib/modules/BookingContext/utils/productExtend.js +4 -3
- package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
- package/lib/modules/Customer/index.d.ts +4 -0
- package/lib/modules/Customer/index.js +11 -0
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +9 -0
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- package/lib/modules/OpenData/index.js +1 -1
- package/lib/modules/Order/index.d.ts +32 -4
- package/lib/modules/Order/index.js +372 -156
- package/lib/modules/Order/types.d.ts +22 -1
- package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +70 -0
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +39 -6
- package/lib/modules/Payment/index.d.ts +4 -0
- package/lib/modules/Payment/index.js +7 -0
- package/lib/modules/Payment/walletpass.js +12 -0
- package/lib/modules/Product/types.d.ts +1 -0
- package/lib/modules/ProductList/index.js +49 -31
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.js +117 -25
- package/lib/modules/SalesSummary/index.js +6 -7
- package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/index.js +13 -1
- package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
- package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +3 -1
- package/lib/modules/Schedule/index.js +10 -8
- package/lib/modules/Summary/utils.js +21 -1
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/server/index.d.ts +20 -0
- package/lib/server/index.js +124 -19
- package/lib/server/modules/order/index.d.ts +2 -0
- package/lib/server/modules/order/index.js +75 -5
- package/lib/server/modules/order/types.d.ts +1 -1
- package/lib/solution/BaseSales/index.d.ts +20 -1
- package/lib/solution/BaseSales/index.js +105 -31
- package/lib/solution/BaseSales/utils/cartPromotion.js +18 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -0
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingByStep/index.d.ts +17 -2
- package/lib/solution/BookingByStep/index.js +60 -18
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/BookingByStep/utils/capacity.js +20 -1
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/BookingTicket/index.d.ts +21 -3
- package/lib/solution/BookingTicket/index.js +75 -16
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -182
- package/lib/solution/ScanOrder/types.d.ts +21 -1
- package/lib/solution/ScanOrder/utils.d.ts +8 -0
- package/lib/solution/ScanOrder/utils.js +60 -18
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +204 -0
- package/lib/solution/UnifiedBookingSales/index.js +1273 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +150 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +39 -11
- package/lib/solution/VenueBooking/index.js +322 -110
- package/lib/solution/VenueBooking/types.d.ts +3 -0
- package/lib/solution/VenueBooking/utils/resource.js +1 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/lib/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -101,6 +101,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
101
101
|
_defineProperty(this, "productQuerySubscribers", new Map());
|
|
102
102
|
/** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
|
|
103
103
|
_defineProperty(this, "productQueryScheduleTimers", new Map());
|
|
104
|
+
/** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
|
|
105
|
+
_defineProperty(this, "menuScheduleRefreshInFlight", null);
|
|
106
|
+
_defineProperty(this, "lastMenuScheduleRefreshAt", 0);
|
|
107
|
+
_defineProperty(this, "MENU_SCHEDULE_REFRESH_COOLDOWN_MS", 30 * 1000);
|
|
104
108
|
// ---- 订单 / 预约列表查询订阅者 ----
|
|
105
109
|
_defineProperty(this, "orderQuerySubscribers", new Map());
|
|
106
110
|
_defineProperty(this, "bookingQuerySubscribers", new Map());
|
|
@@ -280,13 +284,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
280
284
|
*/
|
|
281
285
|
_defineProperty(this, "handleProductQuery", /*#__PURE__*/function () {
|
|
282
286
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref5) {
|
|
283
|
-
var url, method, data, config, menu_list_ids,
|
|
287
|
+
var url, method, data, config, menu_list_ids, customer_id, ids, extension_type, strategy_context, _this$resolveProductQ, schedule_date, schedule_datetime, _ref7, callback, subscriberId, result;
|
|
284
288
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
285
289
|
while (1) switch (_context3.prev = _context3.next) {
|
|
286
290
|
case 0:
|
|
287
291
|
url = _ref5.url, method = _ref5.method, data = _ref5.data, config = _ref5.config;
|
|
288
292
|
console.log('[Server] handleProductQuery:', url, method, data, config);
|
|
289
|
-
menu_list_ids = data.menu_list_ids,
|
|
293
|
+
menu_list_ids = data.menu_list_ids, customer_id = data.customer_id, ids = data.ids, extension_type = data.extension_type, strategy_context = data.strategy_context;
|
|
294
|
+
_this$resolveProductQ = _this.resolveProductQueryScheduleContext({
|
|
295
|
+
schedule_date: data.schedule_date,
|
|
296
|
+
schedule_datetime: data.schedule_datetime
|
|
297
|
+
}), schedule_date = _this$resolveProductQ.schedule_date, schedule_datetime = _this$resolveProductQ.schedule_datetime;
|
|
290
298
|
_ref7 = config || {}, callback = _ref7.callback, subscriberId = _ref7.subscriberId;
|
|
291
299
|
_this.logInfo('handleProductQuery: 开始处理商品查询请求', {
|
|
292
300
|
menu_list_ids: menu_list_ids,
|
|
@@ -317,7 +325,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
317
325
|
totalSubscribers: _this.productQuerySubscribers.size
|
|
318
326
|
});
|
|
319
327
|
}
|
|
320
|
-
_context3.next =
|
|
328
|
+
_context3.next = 9;
|
|
321
329
|
return _this.computeProductQueryResult({
|
|
322
330
|
menu_list_ids: menu_list_ids,
|
|
323
331
|
ids: ids,
|
|
@@ -327,7 +335,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
327
335
|
extension_type: extension_type,
|
|
328
336
|
strategy_context: strategy_context
|
|
329
337
|
});
|
|
330
|
-
case
|
|
338
|
+
case 9:
|
|
331
339
|
result = _context3.sent;
|
|
332
340
|
if (subscriberId && typeof callback === 'function') {
|
|
333
341
|
_this.syncProductQueryScheduleTimers({
|
|
@@ -337,7 +345,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
337
345
|
});
|
|
338
346
|
}
|
|
339
347
|
return _context3.abrupt("return", result);
|
|
340
|
-
case
|
|
348
|
+
case 12:
|
|
341
349
|
case "end":
|
|
342
350
|
return _context3.stop();
|
|
343
351
|
}
|
|
@@ -2920,6 +2928,87 @@ var Server = /*#__PURE__*/function () {
|
|
|
2920
2928
|
}
|
|
2921
2929
|
return refreshOrdersInBackground;
|
|
2922
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
|
+
}()
|
|
2923
3012
|
/**
|
|
2924
3013
|
* 清空所有server模块的IndexedDB缓存
|
|
2925
3014
|
* @returns Promise<void>
|
|
@@ -2928,10 +3017,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
2928
3017
|
}, {
|
|
2929
3018
|
key: "clearAllIndexDB",
|
|
2930
3019
|
value: (function () {
|
|
2931
|
-
var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3020
|
+
var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
2932
3021
|
var clearTasks, moduleNames, errorMessage;
|
|
2933
|
-
return _regeneratorRuntime().wrap(function
|
|
2934
|
-
while (1) switch (
|
|
3022
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3023
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2935
3024
|
case 0:
|
|
2936
3025
|
console.log('[Server] 开始清空所有模块的IndexedDB缓存...');
|
|
2937
3026
|
this.logInfo('开始清空所有模块的 IndexedDB 缓存');
|
|
@@ -2966,41 +3055,41 @@ var Server = /*#__PURE__*/function () {
|
|
|
2966
3055
|
moduleNames.push('FloorPlan');
|
|
2967
3056
|
}
|
|
2968
3057
|
if (!(clearTasks.length === 0)) {
|
|
2969
|
-
|
|
3058
|
+
_context37.next = 15;
|
|
2970
3059
|
break;
|
|
2971
3060
|
}
|
|
2972
3061
|
console.warn('[Server] 没有找到已注册的模块,无需清空');
|
|
2973
3062
|
this.logWarning('没有找到已注册的模块,无需清空 IndexedDB');
|
|
2974
|
-
return
|
|
3063
|
+
return _context37.abrupt("return");
|
|
2975
3064
|
case 15:
|
|
2976
3065
|
this.logInfo('准备清空模块缓存', {
|
|
2977
3066
|
moduleNames: moduleNames
|
|
2978
3067
|
});
|
|
2979
|
-
|
|
2980
|
-
|
|
3068
|
+
_context37.prev = 16;
|
|
3069
|
+
_context37.next = 19;
|
|
2981
3070
|
return Promise.all(clearTasks);
|
|
2982
3071
|
case 19:
|
|
2983
3072
|
console.log("[Server] \u2705 \u5DF2\u6210\u529F\u6E05\u7A7A\u6240\u6709\u6A21\u5757\u7684IndexedDB\u7F13\u5B58: ".concat(moduleNames.join(', ')));
|
|
2984
3073
|
this.logInfo('成功清空所有模块的 IndexedDB 缓存', {
|
|
2985
3074
|
moduleNames: moduleNames
|
|
2986
3075
|
});
|
|
2987
|
-
|
|
3076
|
+
_context37.next = 29;
|
|
2988
3077
|
break;
|
|
2989
3078
|
case 23:
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
errorMessage =
|
|
2993
|
-
console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:',
|
|
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);
|
|
2994
3083
|
this.logError('清空 IndexedDB 缓存时发生错误', {
|
|
2995
3084
|
moduleNames: moduleNames,
|
|
2996
3085
|
error: errorMessage
|
|
2997
3086
|
});
|
|
2998
|
-
throw
|
|
3087
|
+
throw _context37.t0;
|
|
2999
3088
|
case 29:
|
|
3000
3089
|
case "end":
|
|
3001
|
-
return
|
|
3090
|
+
return _context37.stop();
|
|
3002
3091
|
}
|
|
3003
|
-
},
|
|
3092
|
+
}, _callee37, this, [[16, 23]]);
|
|
3004
3093
|
}));
|
|
3005
3094
|
function clearAllIndexDB() {
|
|
3006
3095
|
return _clearAllIndexDB.apply(this, arguments);
|
|
@@ -3075,10 +3164,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3075
3164
|
}, {
|
|
3076
3165
|
key: "handleRoute",
|
|
3077
3166
|
value: (function () {
|
|
3078
|
-
var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3167
|
+
var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(method, path, params) {
|
|
3079
3168
|
var startTime, handler, result, duration, _duration4, errorMessage;
|
|
3080
|
-
return _regeneratorRuntime().wrap(function
|
|
3081
|
-
while (1) switch (
|
|
3169
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3170
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3082
3171
|
case 0:
|
|
3083
3172
|
startTime = Date.now();
|
|
3084
3173
|
this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5F00\u59CB: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
@@ -3089,7 +3178,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3089
3178
|
});
|
|
3090
3179
|
handler = this.getRouteHandler(method, path);
|
|
3091
3180
|
if (handler) {
|
|
3092
|
-
|
|
3181
|
+
_context38.next = 6;
|
|
3093
3182
|
break;
|
|
3094
3183
|
}
|
|
3095
3184
|
this.logError("\u8DEF\u7531\u672A\u627E\u5230: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
@@ -3098,13 +3187,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
3098
3187
|
});
|
|
3099
3188
|
throw new Error("Route not found: ".concat(method.toUpperCase(), " ").concat(path));
|
|
3100
3189
|
case 6:
|
|
3101
|
-
|
|
3102
|
-
|
|
3190
|
+
_context38.prev = 6;
|
|
3191
|
+
_context38.next = 9;
|
|
3103
3192
|
return handler(_objectSpread(_objectSpread({}, params), {}, {
|
|
3104
3193
|
path: path
|
|
3105
3194
|
}));
|
|
3106
3195
|
case 9:
|
|
3107
|
-
result =
|
|
3196
|
+
result = _context38.sent;
|
|
3108
3197
|
duration = Date.now() - startTime;
|
|
3109
3198
|
this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5B8C\u6210: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
3110
3199
|
method: method.toUpperCase(),
|
|
@@ -3113,12 +3202,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
3113
3202
|
resultCode: result === null || result === void 0 ? void 0 : result.code,
|
|
3114
3203
|
resultStatus: result === null || result === void 0 ? void 0 : result.status
|
|
3115
3204
|
});
|
|
3116
|
-
return
|
|
3205
|
+
return _context38.abrupt("return", result);
|
|
3117
3206
|
case 15:
|
|
3118
|
-
|
|
3119
|
-
|
|
3207
|
+
_context38.prev = 15;
|
|
3208
|
+
_context38.t0 = _context38["catch"](6);
|
|
3120
3209
|
_duration4 = Date.now() - startTime;
|
|
3121
|
-
errorMessage =
|
|
3210
|
+
errorMessage = _context38.t0 instanceof Error ? _context38.t0.message : String(_context38.t0);
|
|
3122
3211
|
this.logError("\u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
3123
3212
|
method: method.toUpperCase(),
|
|
3124
3213
|
path: path,
|
|
@@ -3126,15 +3215,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
3126
3215
|
error: errorMessage,
|
|
3127
3216
|
data: params.data
|
|
3128
3217
|
});
|
|
3129
|
-
console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path),
|
|
3130
|
-
throw
|
|
3218
|
+
console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), _context38.t0);
|
|
3219
|
+
throw _context38.t0;
|
|
3131
3220
|
case 22:
|
|
3132
3221
|
case "end":
|
|
3133
|
-
return
|
|
3222
|
+
return _context38.stop();
|
|
3134
3223
|
}
|
|
3135
|
-
},
|
|
3224
|
+
}, _callee38, this, [[6, 15]]);
|
|
3136
3225
|
}));
|
|
3137
|
-
function handleRoute(
|
|
3226
|
+
function handleRoute(_x37, _x38, _x39) {
|
|
3138
3227
|
return _handleRoute.apply(this, arguments);
|
|
3139
3228
|
}
|
|
3140
3229
|
return handleRoute;
|
|
@@ -3278,36 +3367,36 @@ var Server = /*#__PURE__*/function () {
|
|
|
3278
3367
|
}, {
|
|
3279
3368
|
key: "getPaymentRouteModule",
|
|
3280
3369
|
value: function () {
|
|
3281
|
-
var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3370
|
+
var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3282
3371
|
var _this6 = this;
|
|
3283
|
-
return _regeneratorRuntime().wrap(function
|
|
3284
|
-
while (1) switch (
|
|
3372
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3373
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3285
3374
|
case 0:
|
|
3286
3375
|
if (!this.payment) {
|
|
3287
|
-
|
|
3376
|
+
_context40.next = 2;
|
|
3288
3377
|
break;
|
|
3289
3378
|
}
|
|
3290
|
-
return
|
|
3379
|
+
return _context40.abrupt("return", this.payment);
|
|
3291
3380
|
case 2:
|
|
3292
3381
|
if (!this.paymentRouteModule) {
|
|
3293
|
-
|
|
3382
|
+
_context40.next = 4;
|
|
3294
3383
|
break;
|
|
3295
3384
|
}
|
|
3296
|
-
return
|
|
3385
|
+
return _context40.abrupt("return", this.paymentRouteModule);
|
|
3297
3386
|
case 4:
|
|
3298
3387
|
if (!this.paymentRouteModuleInFlight) {
|
|
3299
|
-
|
|
3388
|
+
_context40.next = 6;
|
|
3300
3389
|
break;
|
|
3301
3390
|
}
|
|
3302
|
-
return
|
|
3391
|
+
return _context40.abrupt("return", this.paymentRouteModuleInFlight);
|
|
3303
3392
|
case 6:
|
|
3304
|
-
this.paymentRouteModuleInFlight = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3393
|
+
this.paymentRouteModuleInFlight = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3305
3394
|
var module;
|
|
3306
|
-
return _regeneratorRuntime().wrap(function
|
|
3307
|
-
while (1) switch (
|
|
3395
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3396
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3308
3397
|
case 0:
|
|
3309
3398
|
module = new PaymentServerModule('server_payment_route', '1.0.0');
|
|
3310
|
-
|
|
3399
|
+
_context39.next = 3;
|
|
3311
3400
|
return module.initialize(_this6.core, {
|
|
3312
3401
|
store: {
|
|
3313
3402
|
payMethods: []
|
|
@@ -3315,21 +3404,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
3315
3404
|
});
|
|
3316
3405
|
case 3:
|
|
3317
3406
|
_this6.paymentRouteModule = module;
|
|
3318
|
-
return
|
|
3407
|
+
return _context39.abrupt("return", module);
|
|
3319
3408
|
case 5:
|
|
3320
3409
|
case "end":
|
|
3321
|
-
return
|
|
3410
|
+
return _context39.stop();
|
|
3322
3411
|
}
|
|
3323
|
-
},
|
|
3412
|
+
}, _callee39);
|
|
3324
3413
|
}))().finally(function () {
|
|
3325
3414
|
_this6.paymentRouteModuleInFlight = undefined;
|
|
3326
3415
|
});
|
|
3327
|
-
return
|
|
3416
|
+
return _context40.abrupt("return", this.paymentRouteModuleInFlight);
|
|
3328
3417
|
case 8:
|
|
3329
3418
|
case "end":
|
|
3330
|
-
return
|
|
3419
|
+
return _context40.stop();
|
|
3331
3420
|
}
|
|
3332
|
-
},
|
|
3421
|
+
}, _callee40, this);
|
|
3333
3422
|
}));
|
|
3334
3423
|
function getPaymentRouteModule() {
|
|
3335
3424
|
return _getPaymentRouteModule.apply(this, arguments);
|
|
@@ -3339,19 +3428,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
3339
3428
|
}, {
|
|
3340
3429
|
key: "fetchQuotationAvailableFromAPI",
|
|
3341
3430
|
value: function () {
|
|
3342
|
-
var _fetchQuotationAvailableFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3431
|
+
var _fetchQuotationAvailableFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(data) {
|
|
3343
3432
|
var _this$app7;
|
|
3344
3433
|
var requester;
|
|
3345
|
-
return _regeneratorRuntime().wrap(function
|
|
3346
|
-
while (1) switch (
|
|
3434
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3435
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3347
3436
|
case 0:
|
|
3348
3437
|
requester = ((_this$app7 = this.app) === null || _this$app7 === void 0 ? void 0 : _this$app7.request) || this.core.getPlugin('request');
|
|
3349
3438
|
if (requester !== null && requester !== void 0 && requester.get) {
|
|
3350
|
-
|
|
3439
|
+
_context41.next = 4;
|
|
3351
3440
|
break;
|
|
3352
3441
|
}
|
|
3353
3442
|
this.logError('fetchQuotationAvailableFromAPI: request 不可用');
|
|
3354
|
-
return
|
|
3443
|
+
return _context41.abrupt("return", {
|
|
3355
3444
|
code: 500,
|
|
3356
3445
|
message: 'request 不可用',
|
|
3357
3446
|
data: {
|
|
@@ -3360,14 +3449,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
3360
3449
|
status: false
|
|
3361
3450
|
});
|
|
3362
3451
|
case 4:
|
|
3363
|
-
return
|
|
3452
|
+
return _context41.abrupt("return", requester.get('/shop/quotation/available', data));
|
|
3364
3453
|
case 5:
|
|
3365
3454
|
case "end":
|
|
3366
|
-
return
|
|
3455
|
+
return _context41.stop();
|
|
3367
3456
|
}
|
|
3368
|
-
},
|
|
3457
|
+
}, _callee41, this);
|
|
3369
3458
|
}));
|
|
3370
|
-
function fetchQuotationAvailableFromAPI(
|
|
3459
|
+
function fetchQuotationAvailableFromAPI(_x40) {
|
|
3371
3460
|
return _fetchQuotationAvailableFromAPI.apply(this, arguments);
|
|
3372
3461
|
}
|
|
3373
3462
|
return fetchQuotationAvailableFromAPI;
|
|
@@ -3503,26 +3592,25 @@ var Server = /*#__PURE__*/function () {
|
|
|
3503
3592
|
if (!subscriber || !timePoints.length) return;
|
|
3504
3593
|
var scheduleDate = subscriber.context.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
3505
3594
|
var timerIds = [];
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3595
|
+
|
|
3596
|
+
// ['07:00', '13:00', '15:00', '17:00']
|
|
3597
|
+
// for (const timePoint of timePoints) {
|
|
3598
|
+
// let delayMs = this.computeScheduleTimePointDelayMs(scheduleDate, timePoint);
|
|
3599
|
+
// if (delayMs < 0) {
|
|
3600
|
+
// delayMs = this.computeScheduleTimePointDelayMs(dayjs(scheduleDate).add(1, 'day').format('YYYY-MM-DD'), timePoint);
|
|
3601
|
+
// };
|
|
3602
|
+
|
|
3603
|
+
// const timerId = setTimeout(() => {
|
|
3604
|
+
// void this.onScheduleTimePointTimerFire(subscriberId, timerId);
|
|
3605
|
+
// }, delayMs);
|
|
3606
|
+
// timerIds.push(timerId);
|
|
3607
|
+
// }
|
|
3608
|
+
setInterval(function () {
|
|
3609
|
+
var currentTime = dayjs().format('hh:mm');
|
|
3610
|
+
if (timePoints.includes(currentTime)) {
|
|
3611
|
+
_this7.onScheduleTimePointTimerFire(subscriberId);
|
|
3520
3612
|
}
|
|
3521
|
-
}
|
|
3522
|
-
_iterator5.e(err);
|
|
3523
|
-
} finally {
|
|
3524
|
-
_iterator5.f();
|
|
3525
|
-
}
|
|
3613
|
+
}, 60000);
|
|
3526
3614
|
if (timerIds.length > 0) {
|
|
3527
3615
|
this.productQueryScheduleTimers.set(subscriberId, timerIds);
|
|
3528
3616
|
subscriber.scheduleTimerIds = timerIds;
|
|
@@ -3540,29 +3628,29 @@ var Server = /*#__PURE__*/function () {
|
|
|
3540
3628
|
}, {
|
|
3541
3629
|
key: "onScheduleTimePointTimerFire",
|
|
3542
3630
|
value: (function () {
|
|
3543
|
-
var _onScheduleTimePointTimerFire = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3631
|
+
var _onScheduleTimePointTimerFire = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(subscriberId, timerId) {
|
|
3544
3632
|
var subscriber;
|
|
3545
|
-
return _regeneratorRuntime().wrap(function
|
|
3546
|
-
while (1) switch (
|
|
3633
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3634
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3547
3635
|
case 0:
|
|
3548
|
-
this.removeScheduleTimerRef(subscriberId, timerId);
|
|
3636
|
+
timerId && this.removeScheduleTimerRef(subscriberId, timerId);
|
|
3549
3637
|
if (this.productQuerySubscribers.has(subscriberId)) {
|
|
3550
|
-
|
|
3638
|
+
_context42.next = 3;
|
|
3551
3639
|
break;
|
|
3552
3640
|
}
|
|
3553
|
-
return
|
|
3641
|
+
return _context42.abrupt("return");
|
|
3554
3642
|
case 3:
|
|
3555
3643
|
subscriber = this.productQuerySubscribers.get(subscriberId);
|
|
3556
3644
|
this.refreshSubscriberScheduleAtExecution(subscriber);
|
|
3557
|
-
|
|
3645
|
+
_context42.next = 7;
|
|
3558
3646
|
return this.recomputeAndNotifySubscriber(subscriberId);
|
|
3559
3647
|
case 7:
|
|
3560
3648
|
case "end":
|
|
3561
|
-
return
|
|
3649
|
+
return _context42.stop();
|
|
3562
3650
|
}
|
|
3563
|
-
},
|
|
3651
|
+
}, _callee42, this);
|
|
3564
3652
|
}));
|
|
3565
|
-
function onScheduleTimePointTimerFire(
|
|
3653
|
+
function onScheduleTimePointTimerFire(_x41, _x42) {
|
|
3566
3654
|
return _onScheduleTimePointTimerFire.apply(this, arguments);
|
|
3567
3655
|
}
|
|
3568
3656
|
return onScheduleTimePointTimerFire;
|
|
@@ -3574,45 +3662,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
3574
3662
|
}, {
|
|
3575
3663
|
key: "recomputeAndNotifySubscriber",
|
|
3576
3664
|
value: (function () {
|
|
3577
|
-
var _recomputeAndNotifySubscriber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3665
|
+
var _recomputeAndNotifySubscriber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(subscriberId) {
|
|
3578
3666
|
var subscriber, result, errorMessage;
|
|
3579
|
-
return _regeneratorRuntime().wrap(function
|
|
3580
|
-
while (1) switch (
|
|
3667
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3668
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3581
3669
|
case 0:
|
|
3582
3670
|
subscriber = this.productQuerySubscribers.get(subscriberId);
|
|
3583
3671
|
if (subscriber) {
|
|
3584
|
-
|
|
3672
|
+
_context43.next = 3;
|
|
3585
3673
|
break;
|
|
3586
3674
|
}
|
|
3587
|
-
return
|
|
3675
|
+
return _context43.abrupt("return");
|
|
3588
3676
|
case 3:
|
|
3589
|
-
|
|
3590
|
-
|
|
3677
|
+
_context43.prev = 3;
|
|
3678
|
+
_context43.next = 6;
|
|
3591
3679
|
return this.computeProductQueryResult(subscriber.context);
|
|
3592
3680
|
case 6:
|
|
3593
|
-
result =
|
|
3681
|
+
result = _context43.sent;
|
|
3594
3682
|
subscriber.callback(result);
|
|
3595
3683
|
this.logInfo('recomputeAndNotifySubscriber: 已推送', {
|
|
3596
3684
|
subscriberId: subscriberId,
|
|
3597
3685
|
schedule_datetime: subscriber.context.schedule_datetime
|
|
3598
3686
|
});
|
|
3599
|
-
|
|
3687
|
+
_context43.next = 15;
|
|
3600
3688
|
break;
|
|
3601
3689
|
case 11:
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
errorMessage =
|
|
3690
|
+
_context43.prev = 11;
|
|
3691
|
+
_context43.t0 = _context43["catch"](3);
|
|
3692
|
+
errorMessage = _context43.t0 instanceof Error ? _context43.t0.message : String(_context43.t0);
|
|
3605
3693
|
this.logError('recomputeAndNotifySubscriber: 推送失败', {
|
|
3606
3694
|
subscriberId: subscriberId,
|
|
3607
3695
|
error: errorMessage
|
|
3608
3696
|
});
|
|
3609
3697
|
case 15:
|
|
3610
3698
|
case "end":
|
|
3611
|
-
return
|
|
3699
|
+
return _context43.stop();
|
|
3612
3700
|
}
|
|
3613
|
-
},
|
|
3701
|
+
}, _callee43, this, [[3, 11]]);
|
|
3614
3702
|
}));
|
|
3615
|
-
function recomputeAndNotifySubscriber(
|
|
3703
|
+
function recomputeAndNotifySubscriber(_x43) {
|
|
3616
3704
|
return _recomputeAndNotifySubscriber.apply(this, arguments);
|
|
3617
3705
|
}
|
|
3618
3706
|
return recomputeAndNotifySubscriber;
|
|
@@ -3664,6 +3752,76 @@ var Server = /*#__PURE__*/function () {
|
|
|
3664
3752
|
this.scheduleSubscriberTimePointReloads(subscriberId, timePoints);
|
|
3665
3753
|
}
|
|
3666
3754
|
}
|
|
3755
|
+
}, {
|
|
3756
|
+
key: "resolveProductQueryScheduleContext",
|
|
3757
|
+
value:
|
|
3758
|
+
/**
|
|
3759
|
+
* ProductList callers such as standalone retail pages do not always have a selected schedule.
|
|
3760
|
+
* In that case query against the current local time so menu availability can still be evaluated.
|
|
3761
|
+
*/
|
|
3762
|
+
function resolveProductQueryScheduleContext(params) {
|
|
3763
|
+
var now = dayjs();
|
|
3764
|
+
var schedule_datetime = typeof params.schedule_datetime === 'string' && params.schedule_datetime.trim() ? params.schedule_datetime : now.format('YYYY-MM-DD HH:mm:ss');
|
|
3765
|
+
var schedule_date = typeof params.schedule_date === 'string' && params.schedule_date.trim() ? params.schedule_date : dayjs(schedule_datetime).isValid() ? dayjs(schedule_datetime).format('YYYY-MM-DD') : now.format('YYYY-MM-DD');
|
|
3766
|
+
return {
|
|
3767
|
+
schedule_date: schedule_date,
|
|
3768
|
+
schedule_datetime: schedule_datetime
|
|
3769
|
+
};
|
|
3770
|
+
}
|
|
3771
|
+
|
|
3772
|
+
/**
|
|
3773
|
+
* OpenData 的关联餐牌可能已更新,而 server_menu/server_schedule 仍命中本地持久化缓存。
|
|
3774
|
+
* 仅在当前筛选没有任何生效餐牌时刷新一次,并由调用方重新计算筛选结果。
|
|
3775
|
+
*/
|
|
3776
|
+
}, {
|
|
3777
|
+
key: "refreshMenuScheduleCacheAfterEmptyResult",
|
|
3778
|
+
value: (function () {
|
|
3779
|
+
var _refreshMenuScheduleCacheAfterEmptyResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
|
|
3780
|
+
var _this8 = this;
|
|
3781
|
+
var now;
|
|
3782
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3783
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3784
|
+
case 0:
|
|
3785
|
+
if (!(!this.menu || !this.schedule)) {
|
|
3786
|
+
_context44.next = 2;
|
|
3787
|
+
break;
|
|
3788
|
+
}
|
|
3789
|
+
return _context44.abrupt("return", false);
|
|
3790
|
+
case 2:
|
|
3791
|
+
now = Date.now();
|
|
3792
|
+
if (!(now - this.lastMenuScheduleRefreshAt < this.MENU_SCHEDULE_REFRESH_COOLDOWN_MS)) {
|
|
3793
|
+
_context44.next = 5;
|
|
3794
|
+
break;
|
|
3795
|
+
}
|
|
3796
|
+
return _context44.abrupt("return", false);
|
|
3797
|
+
case 5:
|
|
3798
|
+
if (!this.menuScheduleRefreshInFlight) {
|
|
3799
|
+
this.lastMenuScheduleRefreshAt = now;
|
|
3800
|
+
this.menuScheduleRefreshInFlight = Promise.all([this.menu.loadMenuList(), this.schedule.loadAllSchedule()]).then(function () {
|
|
3801
|
+
return undefined;
|
|
3802
|
+
}).catch(function (error) {
|
|
3803
|
+
_this8.logWarning('刷新菜单/日程缓存失败,继续使用现有缓存', {
|
|
3804
|
+
error: error instanceof Error ? error.message : String(error)
|
|
3805
|
+
});
|
|
3806
|
+
}).finally(function () {
|
|
3807
|
+
_this8.menuScheduleRefreshInFlight = null;
|
|
3808
|
+
});
|
|
3809
|
+
}
|
|
3810
|
+
_context44.next = 8;
|
|
3811
|
+
return this.menuScheduleRefreshInFlight;
|
|
3812
|
+
case 8:
|
|
3813
|
+
return _context44.abrupt("return", true);
|
|
3814
|
+
case 9:
|
|
3815
|
+
case "end":
|
|
3816
|
+
return _context44.stop();
|
|
3817
|
+
}
|
|
3818
|
+
}, _callee44, this);
|
|
3819
|
+
}));
|
|
3820
|
+
function refreshMenuScheduleCacheAfterEmptyResult() {
|
|
3821
|
+
return _refreshMenuScheduleCacheAfterEmptyResult.apply(this, arguments);
|
|
3822
|
+
}
|
|
3823
|
+
return refreshMenuScheduleCacheAfterEmptyResult;
|
|
3824
|
+
}())
|
|
3667
3825
|
}, {
|
|
3668
3826
|
key: "handleSalesSearchRequest",
|
|
3669
3827
|
value: (
|
|
@@ -3675,32 +3833,32 @@ var Server = /*#__PURE__*/function () {
|
|
|
3675
3833
|
* const result = await this.handleSalesSearchRequest('single', '/shop/es/search/sales', { keyword: '1001' }, {})
|
|
3676
3834
|
*/
|
|
3677
3835
|
function () {
|
|
3678
|
-
var _handleSalesSearchRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3679
|
-
var queryPayload, result, _ref62, callback, subscriberId, resetVisibleOrderIds, contextSignature, existing, shouldReset, visibleOrderIds,
|
|
3680
|
-
return _regeneratorRuntime().wrap(function
|
|
3681
|
-
while (1) switch (
|
|
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) {
|
|
3682
3840
|
case 0:
|
|
3683
3841
|
queryPayload = data && _typeof(data) === 'object' ? _objectSpread({}, data) : {};
|
|
3684
|
-
|
|
3842
|
+
_context45.next = 3;
|
|
3685
3843
|
return this.fetchSalesSearchFromAPI(backendPath, queryPayload);
|
|
3686
3844
|
case 3:
|
|
3687
|
-
result =
|
|
3845
|
+
result = _context45.sent;
|
|
3688
3846
|
_ref62 = config || {}, callback = _ref62.callback, subscriberId = _ref62.subscriberId, resetVisibleOrderIds = _ref62.resetVisibleOrderIds;
|
|
3689
3847
|
if (subscriberId && typeof callback === 'function') {
|
|
3690
3848
|
contextSignature = this.buildSalesSearchSignature(kind, queryPayload);
|
|
3691
3849
|
existing = this.salesSearchSubscribers.get(subscriberId);
|
|
3692
3850
|
shouldReset = resetVisibleOrderIds === true || !existing || existing.kind !== kind || existing.contextSignature !== contextSignature;
|
|
3693
3851
|
visibleOrderIds = shouldReset ? new Set() : new Set(existing.visibleOrderIds);
|
|
3694
|
-
|
|
3852
|
+
_iterator5 = _createForOfIteratorHelper(this.extractSalesSearchOrderIds(kind, result));
|
|
3695
3853
|
try {
|
|
3696
|
-
for (
|
|
3697
|
-
orderId =
|
|
3854
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
3855
|
+
orderId = _step5.value;
|
|
3698
3856
|
visibleOrderIds.add(orderId);
|
|
3699
3857
|
}
|
|
3700
3858
|
} catch (err) {
|
|
3701
|
-
|
|
3859
|
+
_iterator5.e(err);
|
|
3702
3860
|
} finally {
|
|
3703
|
-
|
|
3861
|
+
_iterator5.f();
|
|
3704
3862
|
}
|
|
3705
3863
|
this.salesSearchSubscribers.set(subscriberId, {
|
|
3706
3864
|
callback: callback,
|
|
@@ -3716,14 +3874,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
3716
3874
|
visibleCount: visibleOrderIds.size
|
|
3717
3875
|
});
|
|
3718
3876
|
}
|
|
3719
|
-
return
|
|
3877
|
+
return _context45.abrupt("return", result);
|
|
3720
3878
|
case 7:
|
|
3721
3879
|
case "end":
|
|
3722
|
-
return
|
|
3880
|
+
return _context45.stop();
|
|
3723
3881
|
}
|
|
3724
|
-
},
|
|
3882
|
+
}, _callee45, this);
|
|
3725
3883
|
}));
|
|
3726
|
-
function handleSalesSearchRequest(
|
|
3884
|
+
function handleSalesSearchRequest(_x44, _x45, _x46, _x47) {
|
|
3727
3885
|
return _handleSalesSearchRequest.apply(this, arguments);
|
|
3728
3886
|
}
|
|
3729
3887
|
return handleSalesSearchRequest;
|
|
@@ -3738,20 +3896,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
3738
3896
|
}, {
|
|
3739
3897
|
key: "fetchSalesSearchFromAPI",
|
|
3740
3898
|
value: (function () {
|
|
3741
|
-
var _fetchSalesSearchFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3899
|
+
var _fetchSalesSearchFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(backendPath, data) {
|
|
3742
3900
|
var _this$app8;
|
|
3743
3901
|
var _response$data4, _response$code2, _response$status2, _response$message2, response, _payload, errorMessage;
|
|
3744
|
-
return _regeneratorRuntime().wrap(function
|
|
3745
|
-
while (1) switch (
|
|
3902
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
3903
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
3746
3904
|
case 0:
|
|
3747
3905
|
if ((_this$app8 = this.app) !== null && _this$app8 !== void 0 && _this$app8.request) {
|
|
3748
|
-
|
|
3906
|
+
_context46.next = 3;
|
|
3749
3907
|
break;
|
|
3750
3908
|
}
|
|
3751
3909
|
this.logError('fetchSalesSearchFromAPI: app.request 不可用', {
|
|
3752
3910
|
backendPath: backendPath
|
|
3753
3911
|
});
|
|
3754
|
-
return
|
|
3912
|
+
return _context46.abrupt("return", {
|
|
3755
3913
|
code: 500,
|
|
3756
3914
|
message: 'app.request 不可用',
|
|
3757
3915
|
data: backendPath === '/shop/es/search' ? {
|
|
@@ -3763,29 +3921,29 @@ var Server = /*#__PURE__*/function () {
|
|
|
3763
3921
|
status: false
|
|
3764
3922
|
});
|
|
3765
3923
|
case 3:
|
|
3766
|
-
|
|
3767
|
-
|
|
3924
|
+
_context46.prev = 3;
|
|
3925
|
+
_context46.next = 6;
|
|
3768
3926
|
return this.app.request.post(backendPath, data, {
|
|
3769
3927
|
isShopApi: true
|
|
3770
3928
|
});
|
|
3771
3929
|
case 6:
|
|
3772
|
-
response =
|
|
3930
|
+
response = _context46.sent;
|
|
3773
3931
|
_payload = (_response$data4 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data4 !== void 0 ? _response$data4 : response;
|
|
3774
|
-
return
|
|
3932
|
+
return _context46.abrupt("return", {
|
|
3775
3933
|
code: (_response$code2 = response === null || response === void 0 ? void 0 : response.code) !== null && _response$code2 !== void 0 ? _response$code2 : 200,
|
|
3776
3934
|
status: (_response$status2 = response === null || response === void 0 ? void 0 : response.status) !== null && _response$status2 !== void 0 ? _response$status2 : true,
|
|
3777
3935
|
message: (_response$message2 = response === null || response === void 0 ? void 0 : response.message) !== null && _response$message2 !== void 0 ? _response$message2 : '',
|
|
3778
3936
|
data: _payload
|
|
3779
3937
|
});
|
|
3780
3938
|
case 11:
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
errorMessage =
|
|
3939
|
+
_context46.prev = 11;
|
|
3940
|
+
_context46.t0 = _context46["catch"](3);
|
|
3941
|
+
errorMessage = _context46.t0 instanceof Error ? _context46.t0.message : String(_context46.t0);
|
|
3784
3942
|
this.logError('fetchSalesSearchFromAPI: 请求失败', {
|
|
3785
3943
|
backendPath: backendPath,
|
|
3786
3944
|
error: errorMessage
|
|
3787
3945
|
});
|
|
3788
|
-
return
|
|
3946
|
+
return _context46.abrupt("return", {
|
|
3789
3947
|
code: 500,
|
|
3790
3948
|
message: errorMessage,
|
|
3791
3949
|
data: backendPath === '/shop/es/search' ? {
|
|
@@ -3798,11 +3956,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3798
3956
|
});
|
|
3799
3957
|
case 16:
|
|
3800
3958
|
case "end":
|
|
3801
|
-
return
|
|
3959
|
+
return _context46.stop();
|
|
3802
3960
|
}
|
|
3803
|
-
},
|
|
3961
|
+
}, _callee46, this, [[3, 11]]);
|
|
3804
3962
|
}));
|
|
3805
|
-
function fetchSalesSearchFromAPI(
|
|
3963
|
+
function fetchSalesSearchFromAPI(_x48, _x49) {
|
|
3806
3964
|
return _fetchSalesSearchFromAPI.apply(this, arguments);
|
|
3807
3965
|
}
|
|
3808
3966
|
return fetchSalesSearchFromAPI;
|
|
@@ -3832,10 +3990,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3832
3990
|
}, {
|
|
3833
3991
|
key: "stripSalesSearchPageParams",
|
|
3834
3992
|
value: function stripSalesSearchPageParams(value) {
|
|
3835
|
-
var
|
|
3993
|
+
var _this9 = this;
|
|
3836
3994
|
if (Array.isArray(value)) {
|
|
3837
3995
|
return value.map(function (item) {
|
|
3838
|
-
return
|
|
3996
|
+
return _this9.stripSalesSearchPageParams(item);
|
|
3839
3997
|
});
|
|
3840
3998
|
}
|
|
3841
3999
|
if (!value || _typeof(value) !== 'object') return value;
|
|
@@ -3873,12 +4031,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
3873
4031
|
key: "extractSalesSearchOrderIds",
|
|
3874
4032
|
value: function extractSalesSearchOrderIds(kind, result) {
|
|
3875
4033
|
var _this$findSalesSearch,
|
|
3876
|
-
|
|
4034
|
+
_this10 = this;
|
|
3877
4035
|
var data = this.extractSalesSearchResponseData(result);
|
|
3878
4036
|
var list = kind === 'aggregate' ? (_this$findSalesSearch = this.findSalesSearchAggregateGroup(data)) === null || _this$findSalesSearch === void 0 ? void 0 : _this$findSalesSearch.list : data === null || data === void 0 ? void 0 : data.list;
|
|
3879
4037
|
if (!Array.isArray(list)) return [];
|
|
3880
4038
|
return list.map(function (item) {
|
|
3881
|
-
return
|
|
4039
|
+
return _this10.getSalesSearchOrderId(item);
|
|
3882
4040
|
}).filter(function (id) {
|
|
3883
4041
|
return !!id;
|
|
3884
4042
|
});
|
|
@@ -4045,11 +4203,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4045
4203
|
}, {
|
|
4046
4204
|
key: "stableSerialize",
|
|
4047
4205
|
value: function stableSerialize(value) {
|
|
4048
|
-
var
|
|
4206
|
+
var _this11 = this;
|
|
4049
4207
|
if (value === null || value === undefined) return 'null';
|
|
4050
4208
|
if (Array.isArray(value)) {
|
|
4051
4209
|
return "[".concat(value.map(function (item) {
|
|
4052
|
-
return
|
|
4210
|
+
return _this11.stableSerialize(item);
|
|
4053
4211
|
}).join(','), "]");
|
|
4054
4212
|
}
|
|
4055
4213
|
if (_typeof(value) === 'object') {
|
|
@@ -4058,7 +4216,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4058
4216
|
return obj[k] !== undefined;
|
|
4059
4217
|
}).sort();
|
|
4060
4218
|
return "{".concat(keys.map(function (k) {
|
|
4061
|
-
return "".concat(JSON.stringify(k), ":").concat(
|
|
4219
|
+
return "".concat(JSON.stringify(k), ":").concat(_this11.stableSerialize(obj[k]));
|
|
4062
4220
|
}).join(','), "}");
|
|
4063
4221
|
}
|
|
4064
4222
|
return JSON.stringify(value);
|
|
@@ -4107,22 +4265,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
4107
4265
|
}
|
|
4108
4266
|
var oldestKey = null;
|
|
4109
4267
|
var oldestTime = Number.POSITIVE_INFINITY;
|
|
4110
|
-
var
|
|
4111
|
-
|
|
4268
|
+
var _iterator6 = _createForOfIteratorHelper(this.bookingRemoteCache.entries()),
|
|
4269
|
+
_step6;
|
|
4112
4270
|
try {
|
|
4113
|
-
for (
|
|
4114
|
-
var
|
|
4115
|
-
_key3 =
|
|
4116
|
-
cache =
|
|
4271
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
4272
|
+
var _step6$value = _slicedToArray(_step6.value, 2),
|
|
4273
|
+
_key3 = _step6$value[0],
|
|
4274
|
+
cache = _step6$value[1];
|
|
4117
4275
|
if (cache.updatedAt < oldestTime) {
|
|
4118
4276
|
oldestTime = cache.updatedAt;
|
|
4119
4277
|
oldestKey = _key3;
|
|
4120
4278
|
}
|
|
4121
4279
|
}
|
|
4122
4280
|
} catch (err) {
|
|
4123
|
-
|
|
4281
|
+
_iterator6.e(err);
|
|
4124
4282
|
} finally {
|
|
4125
|
-
|
|
4283
|
+
_iterator6.f();
|
|
4126
4284
|
}
|
|
4127
4285
|
if (oldestKey) this.bookingRemoteCache.delete(oldestKey);
|
|
4128
4286
|
}
|
|
@@ -4138,17 +4296,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
4138
4296
|
key: "markBookingRemoteCacheAllStale",
|
|
4139
4297
|
value: function markBookingRemoteCacheAllStale(reason) {
|
|
4140
4298
|
if (this.bookingRemoteCache.size === 0) return;
|
|
4141
|
-
var
|
|
4142
|
-
|
|
4299
|
+
var _iterator7 = _createForOfIteratorHelper(this.bookingRemoteCache.values()),
|
|
4300
|
+
_step7;
|
|
4143
4301
|
try {
|
|
4144
|
-
for (
|
|
4145
|
-
var entry =
|
|
4302
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
4303
|
+
var entry = _step7.value;
|
|
4146
4304
|
entry.stale = true;
|
|
4147
4305
|
}
|
|
4148
4306
|
} catch (err) {
|
|
4149
|
-
|
|
4307
|
+
_iterator7.e(err);
|
|
4150
4308
|
} finally {
|
|
4151
|
-
|
|
4309
|
+
_iterator7.f();
|
|
4152
4310
|
}
|
|
4153
4311
|
this.logWarning('bookingRemoteCache: 全量标记失效', {
|
|
4154
4312
|
reason: reason,
|
|
@@ -4174,13 +4332,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
4174
4332
|
key: "notifyBookingRemoteSubscribersByCacheKey",
|
|
4175
4333
|
value: function notifyBookingRemoteSubscribersByCacheKey(cacheKey, entry, reason) {
|
|
4176
4334
|
if (this.bookingRemoteQuerySubscribers.size === 0) return;
|
|
4177
|
-
var
|
|
4178
|
-
|
|
4335
|
+
var _iterator8 = _createForOfIteratorHelper(this.bookingRemoteQuerySubscribers.entries()),
|
|
4336
|
+
_step8;
|
|
4179
4337
|
try {
|
|
4180
|
-
for (
|
|
4181
|
-
var
|
|
4182
|
-
subscriberId =
|
|
4183
|
-
subscriber =
|
|
4338
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
4339
|
+
var _step8$value = _slicedToArray(_step8.value, 2),
|
|
4340
|
+
subscriberId = _step8$value[0],
|
|
4341
|
+
subscriber = _step8$value[1];
|
|
4184
4342
|
if (subscriber.cacheKey !== cacheKey) continue;
|
|
4185
4343
|
try {
|
|
4186
4344
|
var callbackStartAt = Date.now();
|
|
@@ -4207,9 +4365,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
4207
4365
|
}
|
|
4208
4366
|
}
|
|
4209
4367
|
} catch (err) {
|
|
4210
|
-
|
|
4368
|
+
_iterator8.e(err);
|
|
4211
4369
|
} finally {
|
|
4212
|
-
|
|
4370
|
+
_iterator8.f();
|
|
4213
4371
|
}
|
|
4214
4372
|
}
|
|
4215
4373
|
}, {
|
|
@@ -4224,13 +4382,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
4224
4382
|
return;
|
|
4225
4383
|
}
|
|
4226
4384
|
var syncedEntryCount = 0;
|
|
4227
|
-
var
|
|
4228
|
-
|
|
4385
|
+
var _iterator9 = _createForOfIteratorHelper(this.bookingRemoteCache.entries()),
|
|
4386
|
+
_step9;
|
|
4229
4387
|
try {
|
|
4230
|
-
for (
|
|
4231
|
-
var
|
|
4232
|
-
cacheKey =
|
|
4233
|
-
entry =
|
|
4388
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
4389
|
+
var _step9$value = _slicedToArray(_step9.value, 2),
|
|
4390
|
+
cacheKey = _step9$value[0],
|
|
4391
|
+
entry = _step9$value[1];
|
|
4234
4392
|
if (entry.stale) {
|
|
4235
4393
|
this.bookingRemoteCache.delete(cacheKey);
|
|
4236
4394
|
continue;
|
|
@@ -4238,25 +4396,25 @@ var Server = /*#__PURE__*/function () {
|
|
|
4238
4396
|
try {
|
|
4239
4397
|
var queryPayload = entry.queryPayload;
|
|
4240
4398
|
var orderMap = new Map();
|
|
4241
|
-
var
|
|
4242
|
-
|
|
4399
|
+
var _iterator10 = _createForOfIteratorHelper(entry.rawOrders),
|
|
4400
|
+
_step10;
|
|
4243
4401
|
try {
|
|
4244
|
-
for (
|
|
4245
|
-
var order =
|
|
4402
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
4403
|
+
var order = _step10.value;
|
|
4246
4404
|
var _key4 = this.toOrderIdKey(order);
|
|
4247
4405
|
if (_key4) orderMap.set(_key4, order);
|
|
4248
4406
|
}
|
|
4249
4407
|
} catch (err) {
|
|
4250
|
-
|
|
4408
|
+
_iterator10.e(err);
|
|
4251
4409
|
} finally {
|
|
4252
|
-
|
|
4410
|
+
_iterator10.f();
|
|
4253
4411
|
}
|
|
4254
4412
|
var changed = false;
|
|
4255
|
-
var
|
|
4256
|
-
|
|
4413
|
+
var _iterator11 = _createForOfIteratorHelper(latestOrders),
|
|
4414
|
+
_step11;
|
|
4257
4415
|
try {
|
|
4258
|
-
for (
|
|
4259
|
-
var latest =
|
|
4416
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
4417
|
+
var latest = _step11.value;
|
|
4260
4418
|
var _key5 = this.toOrderIdKey(latest);
|
|
4261
4419
|
if (!_key5) continue;
|
|
4262
4420
|
if (orderMap.has(_key5)) {
|
|
@@ -4268,9 +4426,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
4268
4426
|
changed = true;
|
|
4269
4427
|
}
|
|
4270
4428
|
} catch (err) {
|
|
4271
|
-
|
|
4429
|
+
_iterator11.e(err);
|
|
4272
4430
|
} finally {
|
|
4273
|
-
|
|
4431
|
+
_iterator11.f();
|
|
4274
4432
|
}
|
|
4275
4433
|
if (!changed) continue;
|
|
4276
4434
|
var mergedOrders = _toConsumableArray(orderMap.values());
|
|
@@ -4303,9 +4461,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
4303
4461
|
}
|
|
4304
4462
|
}
|
|
4305
4463
|
} catch (err) {
|
|
4306
|
-
|
|
4464
|
+
_iterator9.e(err);
|
|
4307
4465
|
} finally {
|
|
4308
|
-
|
|
4466
|
+
_iterator9.f();
|
|
4309
4467
|
}
|
|
4310
4468
|
var syncEndAt = Date.now();
|
|
4311
4469
|
if (syncedEntryCount > 0) {
|
|
@@ -4323,18 +4481,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
4323
4481
|
}, {
|
|
4324
4482
|
key: "fetchOrderListFromAPI",
|
|
4325
4483
|
value: (function () {
|
|
4326
|
-
var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4484
|
+
var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(data) {
|
|
4327
4485
|
var _this$app9;
|
|
4328
4486
|
var _response$data5, response, _payload2, list, count, errorMessage;
|
|
4329
|
-
return _regeneratorRuntime().wrap(function
|
|
4330
|
-
while (1) switch (
|
|
4487
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4488
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
4331
4489
|
case 0:
|
|
4332
4490
|
if ((_this$app9 = this.app) !== null && _this$app9 !== void 0 && _this$app9.request) {
|
|
4333
|
-
|
|
4491
|
+
_context47.next = 3;
|
|
4334
4492
|
break;
|
|
4335
4493
|
}
|
|
4336
4494
|
this.logError('fetchOrderListFromAPI: app.request 不可用');
|
|
4337
|
-
return
|
|
4495
|
+
return _context47.abrupt("return", {
|
|
4338
4496
|
code: 500,
|
|
4339
4497
|
message: 'app.request 不可用',
|
|
4340
4498
|
data: {
|
|
@@ -4344,17 +4502,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
4344
4502
|
status: false
|
|
4345
4503
|
});
|
|
4346
4504
|
case 3:
|
|
4347
|
-
|
|
4348
|
-
|
|
4505
|
+
_context47.prev = 3;
|
|
4506
|
+
_context47.next = 6;
|
|
4349
4507
|
return this.app.request.post('/shop/order/v2/list', data, {
|
|
4350
4508
|
isShopApi: true
|
|
4351
4509
|
});
|
|
4352
4510
|
case 6:
|
|
4353
|
-
response =
|
|
4511
|
+
response = _context47.sent;
|
|
4354
4512
|
_payload2 = (_response$data5 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data5 !== void 0 ? _response$data5 : response;
|
|
4355
4513
|
list = Array.isArray(_payload2 === null || _payload2 === void 0 ? void 0 : _payload2.list) ? _payload2.list : [];
|
|
4356
4514
|
count = typeof (_payload2 === null || _payload2 === void 0 ? void 0 : _payload2.count) === 'number' ? _payload2.count : list.length;
|
|
4357
|
-
return
|
|
4515
|
+
return _context47.abrupt("return", {
|
|
4358
4516
|
code: 200,
|
|
4359
4517
|
data: _objectSpread(_objectSpread({}, _payload2), {}, {
|
|
4360
4518
|
list: list,
|
|
@@ -4364,13 +4522,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
4364
4522
|
status: true
|
|
4365
4523
|
});
|
|
4366
4524
|
case 13:
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
errorMessage =
|
|
4525
|
+
_context47.prev = 13;
|
|
4526
|
+
_context47.t0 = _context47["catch"](3);
|
|
4527
|
+
errorMessage = _context47.t0 instanceof Error ? _context47.t0.message : String(_context47.t0);
|
|
4370
4528
|
this.logError('fetchOrderListFromAPI: 请求失败', {
|
|
4371
4529
|
error: errorMessage
|
|
4372
4530
|
});
|
|
4373
|
-
return
|
|
4531
|
+
return _context47.abrupt("return", {
|
|
4374
4532
|
code: 500,
|
|
4375
4533
|
message: errorMessage,
|
|
4376
4534
|
data: {
|
|
@@ -4381,11 +4539,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4381
4539
|
});
|
|
4382
4540
|
case 18:
|
|
4383
4541
|
case "end":
|
|
4384
|
-
return
|
|
4542
|
+
return _context47.stop();
|
|
4385
4543
|
}
|
|
4386
|
-
},
|
|
4544
|
+
}, _callee47, this, [[3, 13]]);
|
|
4387
4545
|
}));
|
|
4388
|
-
function fetchOrderListFromAPI(
|
|
4546
|
+
function fetchOrderListFromAPI(_x50) {
|
|
4389
4547
|
return _fetchOrderListFromAPI.apply(this, arguments);
|
|
4390
4548
|
}
|
|
4391
4549
|
return fetchOrderListFromAPI;
|
|
@@ -4397,17 +4555,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
4397
4555
|
}, {
|
|
4398
4556
|
key: "fetchBookingListFromAPI",
|
|
4399
4557
|
value: (function () {
|
|
4400
|
-
var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4558
|
+
var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(data) {
|
|
4401
4559
|
var memoryCacheEnabled, withFields, requestPayload, cacheKey, cached, rawList, bookingResult, _bookingResult$list, errorMessage;
|
|
4402
|
-
return _regeneratorRuntime().wrap(function
|
|
4403
|
-
while (1) switch (
|
|
4560
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
4561
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
4404
4562
|
case 0:
|
|
4405
4563
|
if (this.order) {
|
|
4406
|
-
|
|
4564
|
+
_context48.next = 3;
|
|
4407
4565
|
break;
|
|
4408
4566
|
}
|
|
4409
4567
|
this.logError('fetchBookingListFromAPI: Order 模块不可用');
|
|
4410
|
-
return
|
|
4568
|
+
return _context48.abrupt("return", {
|
|
4411
4569
|
code: 500,
|
|
4412
4570
|
message: 'Order 模块不可用',
|
|
4413
4571
|
data: {
|
|
@@ -4417,18 +4575,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
4417
4575
|
status: false
|
|
4418
4576
|
});
|
|
4419
4577
|
case 3:
|
|
4420
|
-
|
|
4578
|
+
_context48.prev = 3;
|
|
4421
4579
|
memoryCacheEnabled = this.isBookingRemoteMemoryCacheEnabled(data);
|
|
4422
4580
|
withFields = this.resolveBookingSalesWith(data);
|
|
4423
4581
|
requestPayload = this.normalizeBookingRemoteQueryPayload(data, withFields);
|
|
4424
4582
|
cacheKey = this.buildBookingRemoteCacheKey(requestPayload);
|
|
4425
4583
|
if (!memoryCacheEnabled) {
|
|
4426
|
-
|
|
4584
|
+
_context48.next = 13;
|
|
4427
4585
|
break;
|
|
4428
4586
|
}
|
|
4429
4587
|
cached = this.readBookingRemoteCache(cacheKey);
|
|
4430
4588
|
if (!cached) {
|
|
4431
|
-
|
|
4589
|
+
_context48.next = 13;
|
|
4432
4590
|
break;
|
|
4433
4591
|
}
|
|
4434
4592
|
this.logInfo('fetchBookingListFromAPI: 命中内存缓存', {
|
|
@@ -4436,14 +4594,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
4436
4594
|
listCount: cached.bookingResult.count,
|
|
4437
4595
|
withFields: cached.withFields
|
|
4438
4596
|
});
|
|
4439
|
-
return
|
|
4597
|
+
return _context48.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
|
|
4440
4598
|
cache_hit: true
|
|
4441
4599
|
}));
|
|
4442
4600
|
case 13:
|
|
4443
|
-
|
|
4601
|
+
_context48.next = 15;
|
|
4444
4602
|
return this.order.fetchOrdersBySSE(requestPayload);
|
|
4445
4603
|
case 15:
|
|
4446
|
-
rawList =
|
|
4604
|
+
rawList = _context48.sent;
|
|
4447
4605
|
bookingResult = sortBookings(filterBookingsFromOrders(rawList, data), data); // DEBUG: 挂到 window 上方便排查 SSE → 日历数据丢失问题
|
|
4448
4606
|
if (typeof globalThis !== 'undefined') {
|
|
4449
4607
|
globalThis.__SSE_BOOKING_DEBUG__ = {
|
|
@@ -4490,15 +4648,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
4490
4648
|
cacheKey: cacheKey,
|
|
4491
4649
|
withFields: withFields
|
|
4492
4650
|
});
|
|
4493
|
-
return
|
|
4651
|
+
return _context48.abrupt("return", this.buildBookingResponse(bookingResult));
|
|
4494
4652
|
case 23:
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
errorMessage =
|
|
4653
|
+
_context48.prev = 23;
|
|
4654
|
+
_context48.t0 = _context48["catch"](3);
|
|
4655
|
+
errorMessage = _context48.t0 instanceof Error ? _context48.t0.message : String(_context48.t0);
|
|
4498
4656
|
this.logError('fetchBookingListFromAPI: SSE 请求失败', {
|
|
4499
4657
|
error: errorMessage
|
|
4500
4658
|
});
|
|
4501
|
-
return
|
|
4659
|
+
return _context48.abrupt("return", {
|
|
4502
4660
|
code: 500,
|
|
4503
4661
|
message: errorMessage,
|
|
4504
4662
|
data: {
|
|
@@ -4509,11 +4667,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4509
4667
|
});
|
|
4510
4668
|
case 28:
|
|
4511
4669
|
case "end":
|
|
4512
|
-
return
|
|
4670
|
+
return _context48.stop();
|
|
4513
4671
|
}
|
|
4514
|
-
},
|
|
4672
|
+
}, _callee48, this, [[3, 23]]);
|
|
4515
4673
|
}));
|
|
4516
|
-
function fetchBookingListFromAPI(
|
|
4674
|
+
function fetchBookingListFromAPI(_x51) {
|
|
4517
4675
|
return _fetchBookingListFromAPI.apply(this, arguments);
|
|
4518
4676
|
}
|
|
4519
4677
|
return fetchBookingListFromAPI;
|
|
@@ -4597,11 +4755,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4597
4755
|
}, {
|
|
4598
4756
|
key: "runLocalPaymentUpdateInQueue",
|
|
4599
4757
|
value: function () {
|
|
4600
|
-
var _runLocalPaymentUpdateInQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4601
|
-
var
|
|
4758
|
+
var _runLocalPaymentUpdateInQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(key, task, context) {
|
|
4759
|
+
var _this12 = this;
|
|
4602
4760
|
var queuedAt, hasPreviousTask, previous, current, tail, _data, result, released;
|
|
4603
|
-
return _regeneratorRuntime().wrap(function
|
|
4604
|
-
while (1) switch (
|
|
4761
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
4762
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
4605
4763
|
case 0:
|
|
4606
4764
|
queuedAt = Date.now();
|
|
4607
4765
|
hasPreviousTask = this.localPaymentUpdateQueues.has(key);
|
|
@@ -4613,20 +4771,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
4613
4771
|
}));
|
|
4614
4772
|
current = previous.catch(function () {
|
|
4615
4773
|
return undefined;
|
|
4616
|
-
}).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4617
|
-
return _regeneratorRuntime().wrap(function
|
|
4618
|
-
while (1) switch (
|
|
4774
|
+
}).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49() {
|
|
4775
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4776
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
4619
4777
|
case 0:
|
|
4620
|
-
|
|
4778
|
+
_this12.logInfo('handleUpdateLocalPayment: 串行队列开始执行', _objectSpread(_objectSpread({}, context), {}, {
|
|
4621
4779
|
queue_key: key,
|
|
4622
4780
|
queue_wait_ms: Date.now() - queuedAt
|
|
4623
4781
|
}));
|
|
4624
|
-
return
|
|
4782
|
+
return _context49.abrupt("return", task());
|
|
4625
4783
|
case 2:
|
|
4626
4784
|
case "end":
|
|
4627
|
-
return
|
|
4785
|
+
return _context49.stop();
|
|
4628
4786
|
}
|
|
4629
|
-
},
|
|
4787
|
+
}, _callee49);
|
|
4630
4788
|
})));
|
|
4631
4789
|
tail = current.then(function () {
|
|
4632
4790
|
return undefined;
|
|
@@ -4634,11 +4792,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4634
4792
|
return undefined;
|
|
4635
4793
|
});
|
|
4636
4794
|
this.localPaymentUpdateQueues.set(key, tail);
|
|
4637
|
-
|
|
4638
|
-
|
|
4795
|
+
_context50.prev = 7;
|
|
4796
|
+
_context50.next = 10;
|
|
4639
4797
|
return current;
|
|
4640
4798
|
case 10:
|
|
4641
|
-
result =
|
|
4799
|
+
result = _context50.sent;
|
|
4642
4800
|
this.logInfo('handleUpdateLocalPayment: 串行队列执行完成', _objectSpread(_objectSpread({}, context), {}, {
|
|
4643
4801
|
queue_key: key,
|
|
4644
4802
|
total_duration_ms: Date.now() - queuedAt,
|
|
@@ -4646,19 +4804,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
4646
4804
|
result_status: result === null || result === void 0 ? void 0 : result.status,
|
|
4647
4805
|
payment: result === null || result === void 0 || (_data = result.data) === null || _data === void 0 ? void 0 : _data.payment
|
|
4648
4806
|
}));
|
|
4649
|
-
return
|
|
4807
|
+
return _context50.abrupt("return", result);
|
|
4650
4808
|
case 15:
|
|
4651
|
-
|
|
4652
|
-
|
|
4809
|
+
_context50.prev = 15;
|
|
4810
|
+
_context50.t0 = _context50["catch"](7);
|
|
4653
4811
|
this.logError('handleUpdateLocalPayment: 串行队列执行失败', _objectSpread(_objectSpread({}, context), {}, {
|
|
4654
4812
|
queue_key: key,
|
|
4655
4813
|
total_duration_ms: Date.now() - queuedAt,
|
|
4656
|
-
error:
|
|
4657
|
-
error_detail: this.normalizeUnknownError(
|
|
4814
|
+
error: _context50.t0 instanceof Error ? _context50.t0.message : String(_context50.t0),
|
|
4815
|
+
error_detail: this.normalizeUnknownError(_context50.t0)
|
|
4658
4816
|
}));
|
|
4659
|
-
throw
|
|
4817
|
+
throw _context50.t0;
|
|
4660
4818
|
case 19:
|
|
4661
|
-
|
|
4819
|
+
_context50.prev = 19;
|
|
4662
4820
|
released = false;
|
|
4663
4821
|
if (this.localPaymentUpdateQueues.get(key) === tail) {
|
|
4664
4822
|
this.localPaymentUpdateQueues.delete(key);
|
|
@@ -4669,14 +4827,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
4669
4827
|
released: released,
|
|
4670
4828
|
active_queue_count: this.localPaymentUpdateQueues.size
|
|
4671
4829
|
}));
|
|
4672
|
-
return
|
|
4830
|
+
return _context50.finish(19);
|
|
4673
4831
|
case 24:
|
|
4674
4832
|
case "end":
|
|
4675
|
-
return
|
|
4833
|
+
return _context50.stop();
|
|
4676
4834
|
}
|
|
4677
|
-
},
|
|
4835
|
+
}, _callee50, this, [[7, 15, 19, 24]]);
|
|
4678
4836
|
}));
|
|
4679
|
-
function runLocalPaymentUpdateInQueue(
|
|
4837
|
+
function runLocalPaymentUpdateInQueue(_x52, _x53, _x54) {
|
|
4680
4838
|
return _runLocalPaymentUpdateInQueue.apply(this, arguments);
|
|
4681
4839
|
}
|
|
4682
4840
|
return runLocalPaymentUpdateInQueue;
|
|
@@ -4684,11 +4842,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4684
4842
|
}, {
|
|
4685
4843
|
key: "processLocalPaymentUpdate",
|
|
4686
4844
|
value: function () {
|
|
4687
|
-
var _processLocalPaymentUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4845
|
+
var _processLocalPaymentUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
|
|
4688
4846
|
var _params$serviceCharge4, _params$cardReaderSur, _found$payment, _found$payment2;
|
|
4689
4847
|
var requestContext, found, surchargeUpdate, incomingPaymentUpdate, transactions, existingTransaction, hasRecordedSuccess, orderIsDraft, foundContext, alreadyRecordedFailure, updated;
|
|
4690
|
-
return _regeneratorRuntime().wrap(function
|
|
4691
|
-
while (1) switch (
|
|
4848
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
4849
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
4692
4850
|
case 0:
|
|
4693
4851
|
requestContext = {
|
|
4694
4852
|
operation_id: params.operationId,
|
|
@@ -4701,11 +4859,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4701
4859
|
};
|
|
4702
4860
|
this.logInfo('processLocalPaymentUpdate: 开始处理', requestContext);
|
|
4703
4861
|
if (this.order) {
|
|
4704
|
-
|
|
4862
|
+
_context51.next = 5;
|
|
4705
4863
|
break;
|
|
4706
4864
|
}
|
|
4707
4865
|
this.logError('processLocalPaymentUpdate: Order 模块未注册', requestContext);
|
|
4708
|
-
return
|
|
4866
|
+
return _context51.abrupt("return", {
|
|
4709
4867
|
code: 500,
|
|
4710
4868
|
status: false,
|
|
4711
4869
|
message: 'Order 模块未注册',
|
|
@@ -4713,20 +4871,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
4713
4871
|
});
|
|
4714
4872
|
case 5:
|
|
4715
4873
|
this.logInfo('processLocalPaymentUpdate: 开始查询本地支付项', requestContext);
|
|
4716
|
-
|
|
4874
|
+
_context51.next = 8;
|
|
4717
4875
|
return this.order.getLocalPayment({
|
|
4718
4876
|
saleId: params.saleId,
|
|
4719
4877
|
paymentNumber: params.paymentNumber,
|
|
4720
4878
|
operationId: params.operationId
|
|
4721
4879
|
});
|
|
4722
4880
|
case 8:
|
|
4723
|
-
found =
|
|
4881
|
+
found = _context51.sent;
|
|
4724
4882
|
if (found) {
|
|
4725
|
-
|
|
4883
|
+
_context51.next = 12;
|
|
4726
4884
|
break;
|
|
4727
4885
|
}
|
|
4728
4886
|
this.logWarning('processLocalPaymentUpdate: 本地支付项不存在', requestContext);
|
|
4729
|
-
return
|
|
4887
|
+
return _context51.abrupt("return", {
|
|
4730
4888
|
code: 404,
|
|
4731
4889
|
status: false,
|
|
4732
4890
|
message: '本地支付项不存在',
|
|
@@ -4775,13 +4933,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
4775
4933
|
});
|
|
4776
4934
|
this.logInfo('processLocalPaymentUpdate: 查询命中', foundContext);
|
|
4777
4935
|
if (!(params.status === 'fail' && (found.payment.status === 'paid' || hasRecordedSuccess))) {
|
|
4778
|
-
|
|
4936
|
+
_context51.next = 23;
|
|
4779
4937
|
break;
|
|
4780
4938
|
}
|
|
4781
4939
|
this.logInfo('processLocalPaymentUpdate: 幂等返回', _objectSpread(_objectSpread({}, foundContext), {}, {
|
|
4782
4940
|
idempotent_reason: 'ignore_failure_after_success'
|
|
4783
4941
|
}));
|
|
4784
|
-
return
|
|
4942
|
+
return _context51.abrupt("return", {
|
|
4785
4943
|
code: 200,
|
|
4786
4944
|
status: true,
|
|
4787
4945
|
message: '',
|
|
@@ -4794,13 +4952,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
4794
4952
|
case 23:
|
|
4795
4953
|
alreadyRecordedFailure = params.status === 'fail' && (existingTransaction === null || existingTransaction === void 0 ? void 0 : existingTransaction.status) === 'fail';
|
|
4796
4954
|
if (!alreadyRecordedFailure) {
|
|
4797
|
-
|
|
4955
|
+
_context51.next = 27;
|
|
4798
4956
|
break;
|
|
4799
4957
|
}
|
|
4800
4958
|
this.logInfo('processLocalPaymentUpdate: 幂等返回', _objectSpread(_objectSpread({}, foundContext), {}, {
|
|
4801
4959
|
idempotent_reason: 'failure_already_recorded'
|
|
4802
4960
|
}));
|
|
4803
|
-
return
|
|
4961
|
+
return _context51.abrupt("return", {
|
|
4804
4962
|
code: 200,
|
|
4805
4963
|
status: true,
|
|
4806
4964
|
message: '',
|
|
@@ -4812,13 +4970,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
4812
4970
|
});
|
|
4813
4971
|
case 27:
|
|
4814
4972
|
if (!(params.status === 'success' && (existingTransaction === null || existingTransaction === void 0 ? void 0 : existingTransaction.status) === 'success' && found.payment.status === 'paid' && !orderIsDraft)) {
|
|
4815
|
-
|
|
4973
|
+
_context51.next = 30;
|
|
4816
4974
|
break;
|
|
4817
4975
|
}
|
|
4818
4976
|
this.logInfo('processLocalPaymentUpdate: 幂等返回', _objectSpread(_objectSpread({}, foundContext), {}, {
|
|
4819
4977
|
idempotent_reason: 'success_already_committed'
|
|
4820
4978
|
}));
|
|
4821
|
-
return
|
|
4979
|
+
return _context51.abrupt("return", {
|
|
4822
4980
|
code: 200,
|
|
4823
4981
|
status: true,
|
|
4824
4982
|
message: '',
|
|
@@ -4830,13 +4988,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
4830
4988
|
});
|
|
4831
4989
|
case 30:
|
|
4832
4990
|
if (!(params.status === 'success')) {
|
|
4833
|
-
|
|
4991
|
+
_context51.next = 33;
|
|
4834
4992
|
break;
|
|
4835
4993
|
}
|
|
4836
4994
|
this.logInfo('processLocalPaymentUpdate: 进入 success 恢复分支', _objectSpread(_objectSpread({}, foundContext), {}, {
|
|
4837
4995
|
force_submit_if_paid: found.payment.status === 'paid' && orderIsDraft
|
|
4838
4996
|
}));
|
|
4839
|
-
return
|
|
4997
|
+
return _context51.abrupt("return", this.processSuccessfulLocalPayment(_objectSpread(_objectSpread({}, params), {}, {
|
|
4840
4998
|
order: found.order,
|
|
4841
4999
|
payment: found.payment,
|
|
4842
5000
|
matchBy: found.matchedBy === 'payment_number' ? 'payment_number' : 'compat',
|
|
@@ -4847,8 +5005,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
4847
5005
|
this.logInfo('processLocalPaymentUpdate: 进入 fail 本地更新分支', _objectSpread(_objectSpread({}, foundContext), {}, {
|
|
4848
5006
|
incoming_payment_update: incomingPaymentUpdate
|
|
4849
5007
|
}));
|
|
4850
|
-
|
|
4851
|
-
|
|
5008
|
+
_context51.prev = 34;
|
|
5009
|
+
_context51.next = 37;
|
|
4852
5010
|
return this.order.updateLocalPayment({
|
|
4853
5011
|
saleId: params.saleId,
|
|
4854
5012
|
paymentNumber: params.paymentNumber,
|
|
@@ -4856,25 +5014,25 @@ var Server = /*#__PURE__*/function () {
|
|
|
4856
5014
|
updates: incomingPaymentUpdate
|
|
4857
5015
|
});
|
|
4858
5016
|
case 37:
|
|
4859
|
-
updated =
|
|
4860
|
-
|
|
5017
|
+
updated = _context51.sent;
|
|
5018
|
+
_context51.next = 44;
|
|
4861
5019
|
break;
|
|
4862
5020
|
case 40:
|
|
4863
|
-
|
|
4864
|
-
|
|
5021
|
+
_context51.prev = 40;
|
|
5022
|
+
_context51.t0 = _context51["catch"](34);
|
|
4865
5023
|
this.logError('processLocalPaymentUpdate: fail 本地更新失败', _objectSpread(_objectSpread({}, foundContext), {}, {
|
|
4866
5024
|
incoming_payment_update: incomingPaymentUpdate,
|
|
4867
|
-
error:
|
|
4868
|
-
error_detail: this.normalizeUnknownError(
|
|
5025
|
+
error: _context51.t0 instanceof Error ? _context51.t0.message : String(_context51.t0),
|
|
5026
|
+
error_detail: this.normalizeUnknownError(_context51.t0)
|
|
4869
5027
|
}));
|
|
4870
|
-
throw
|
|
5028
|
+
throw _context51.t0;
|
|
4871
5029
|
case 44:
|
|
4872
5030
|
if (updated) {
|
|
4873
|
-
|
|
5031
|
+
_context51.next = 47;
|
|
4874
5032
|
break;
|
|
4875
5033
|
}
|
|
4876
5034
|
this.logWarning('processLocalPaymentUpdate: fail 本地更新未命中', foundContext);
|
|
4877
|
-
return
|
|
5035
|
+
return _context51.abrupt("return", {
|
|
4878
5036
|
code: 404,
|
|
4879
5037
|
status: false,
|
|
4880
5038
|
message: '本地支付项不存在',
|
|
@@ -4885,7 +5043,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4885
5043
|
previous_payment: updated.previousPayment,
|
|
4886
5044
|
payment: updated.payment
|
|
4887
5045
|
}));
|
|
4888
|
-
return
|
|
5046
|
+
return _context51.abrupt("return", {
|
|
4889
5047
|
code: 200,
|
|
4890
5048
|
status: true,
|
|
4891
5049
|
message: '',
|
|
@@ -4897,11 +5055,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4897
5055
|
});
|
|
4898
5056
|
case 49:
|
|
4899
5057
|
case "end":
|
|
4900
|
-
return
|
|
5058
|
+
return _context51.stop();
|
|
4901
5059
|
}
|
|
4902
|
-
},
|
|
5060
|
+
}, _callee51, this, [[34, 40]]);
|
|
4903
5061
|
}));
|
|
4904
|
-
function processLocalPaymentUpdate(
|
|
5062
|
+
function processLocalPaymentUpdate(_x55) {
|
|
4905
5063
|
return _processLocalPaymentUpdate.apply(this, arguments);
|
|
4906
5064
|
}
|
|
4907
5065
|
return processLocalPaymentUpdate;
|
|
@@ -4909,10 +5067,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
4909
5067
|
}, {
|
|
4910
5068
|
key: "processSuccessfulLocalPayment",
|
|
4911
5069
|
value: function () {
|
|
4912
|
-
var _processSuccessfulLocalPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5070
|
+
var _processSuccessfulLocalPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
|
|
4913
5071
|
var moduleName, baseSales, startedAt, recoveryContext, _order$order_id3, _result$payments, _result$syncResult$su, _result$syncResult$su2, _result$draftResult, _result$draftResult2, order, result, message;
|
|
4914
|
-
return _regeneratorRuntime().wrap(function
|
|
4915
|
-
while (1) switch (
|
|
5072
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
5073
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
4916
5074
|
case 0:
|
|
4917
5075
|
moduleName = "local_payment_recovery_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 8));
|
|
4918
5076
|
baseSales = new BaseSalesImpl(moduleName);
|
|
@@ -4931,13 +5089,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
4931
5089
|
payment: params.payment
|
|
4932
5090
|
});
|
|
4933
5091
|
this.logInfo('processSuccessfulLocalPayment: 创建临时 BaseSales', recoveryContext);
|
|
4934
|
-
|
|
5092
|
+
_context52.prev = 5;
|
|
4935
5093
|
order = this.sanitizeLocalRecoveryOrder(params.order);
|
|
4936
5094
|
this.logInfo('processSuccessfulLocalPayment: 本地订单清洗完成', _objectSpread(_objectSpread({}, recoveryContext), {}, {
|
|
4937
5095
|
sanitized_order_id: (_order$order_id3 = order.order_id) !== null && _order$order_id3 !== void 0 ? _order$order_id3 : null,
|
|
4938
5096
|
removed_synthetic_order_id: params.order.order_id != null && order.order_id == null
|
|
4939
5097
|
}));
|
|
4940
|
-
|
|
5098
|
+
_context52.next = 10;
|
|
4941
5099
|
return baseSales.initialize(this.core, {
|
|
4942
5100
|
otherParams: {
|
|
4943
5101
|
platform: order.platform,
|
|
@@ -4950,14 +5108,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
4950
5108
|
});
|
|
4951
5109
|
case 10:
|
|
4952
5110
|
this.logInfo('processSuccessfulLocalPayment: BaseSales 初始化完成', recoveryContext);
|
|
4953
|
-
|
|
5111
|
+
_context52.next = 13;
|
|
4954
5112
|
return baseSales.replaceTempOrder(order);
|
|
4955
5113
|
case 13:
|
|
4956
5114
|
this.logInfo('processSuccessfulLocalPayment: 本地订单 tempOrder 恢复完成', recoveryContext);
|
|
4957
5115
|
this.logInfo('processSuccessfulLocalPayment: 开始更新支付项并提交', _objectSpread(_objectSpread({}, recoveryContext), {}, {
|
|
4958
5116
|
incoming_payment_update: params.paymentUpdate
|
|
4959
5117
|
}));
|
|
4960
|
-
|
|
5118
|
+
_context52.next = 17;
|
|
4961
5119
|
return baseSales.updateOrderPayment(params.paymentNumber, params.paymentUpdate, {
|
|
4962
5120
|
submitWhenPaid: true,
|
|
4963
5121
|
matchBy: params.matchBy,
|
|
@@ -4966,7 +5124,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4966
5124
|
smallTicketDataFlag: 1
|
|
4967
5125
|
});
|
|
4968
5126
|
case 17:
|
|
4969
|
-
result =
|
|
5127
|
+
result = _context52.sent;
|
|
4970
5128
|
this.logInfo('processSuccessfulLocalPayment: 支付恢复完成', _objectSpread(_objectSpread({}, recoveryContext), {}, {
|
|
4971
5129
|
duration_ms: Date.now() - startedAt,
|
|
4972
5130
|
payment: result.payment,
|
|
@@ -4988,7 +5146,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4988
5146
|
} : null,
|
|
4989
5147
|
draft_error: result.draftError instanceof Error ? result.draftError.message : result.draftError
|
|
4990
5148
|
}));
|
|
4991
|
-
return
|
|
5149
|
+
return _context52.abrupt("return", {
|
|
4992
5150
|
code: 200,
|
|
4993
5151
|
status: true,
|
|
4994
5152
|
message: '',
|
|
@@ -5000,48 +5158,48 @@ var Server = /*#__PURE__*/function () {
|
|
|
5000
5158
|
}
|
|
5001
5159
|
});
|
|
5002
5160
|
case 22:
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
message =
|
|
5161
|
+
_context52.prev = 22;
|
|
5162
|
+
_context52.t0 = _context52["catch"](5);
|
|
5163
|
+
message = _context52.t0 instanceof Error ? _context52.t0.message : String(_context52.t0);
|
|
5006
5164
|
this.logError('processSuccessfulLocalPayment: 支付恢复失败', _objectSpread(_objectSpread({}, recoveryContext), {}, {
|
|
5007
5165
|
duration_ms: Date.now() - startedAt,
|
|
5008
5166
|
error: message,
|
|
5009
|
-
error_detail: this.normalizeUnknownError(
|
|
5167
|
+
error_detail: this.normalizeUnknownError(_context52.t0)
|
|
5010
5168
|
}));
|
|
5011
|
-
return
|
|
5169
|
+
return _context52.abrupt("return", {
|
|
5012
5170
|
code: 500,
|
|
5013
5171
|
status: false,
|
|
5014
5172
|
message: message,
|
|
5015
5173
|
data: null
|
|
5016
5174
|
});
|
|
5017
5175
|
case 27:
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5176
|
+
_context52.prev = 27;
|
|
5177
|
+
_context52.prev = 28;
|
|
5178
|
+
_context52.next = 31;
|
|
5021
5179
|
return baseSales.destroy();
|
|
5022
5180
|
case 31:
|
|
5023
5181
|
this.logInfo('processSuccessfulLocalPayment: 临时 BaseSales 销毁完成', _objectSpread(_objectSpread({}, recoveryContext), {}, {
|
|
5024
5182
|
duration_ms: Date.now() - startedAt
|
|
5025
5183
|
}));
|
|
5026
|
-
|
|
5184
|
+
_context52.next = 37;
|
|
5027
5185
|
break;
|
|
5028
5186
|
case 34:
|
|
5029
|
-
|
|
5030
|
-
|
|
5187
|
+
_context52.prev = 34;
|
|
5188
|
+
_context52.t1 = _context52["catch"](28);
|
|
5031
5189
|
this.logError('processSuccessfulLocalPayment: 临时 BaseSales 销毁失败', _objectSpread(_objectSpread({}, recoveryContext), {}, {
|
|
5032
5190
|
duration_ms: Date.now() - startedAt,
|
|
5033
|
-
error:
|
|
5034
|
-
error_detail: this.normalizeUnknownError(
|
|
5191
|
+
error: _context52.t1 instanceof Error ? _context52.t1.message : String(_context52.t1),
|
|
5192
|
+
error_detail: this.normalizeUnknownError(_context52.t1)
|
|
5035
5193
|
}));
|
|
5036
5194
|
case 37:
|
|
5037
|
-
return
|
|
5195
|
+
return _context52.finish(27);
|
|
5038
5196
|
case 38:
|
|
5039
5197
|
case "end":
|
|
5040
|
-
return
|
|
5198
|
+
return _context52.stop();
|
|
5041
5199
|
}
|
|
5042
|
-
},
|
|
5200
|
+
}, _callee52, this, [[5, 22, 27, 38], [28, 34]]);
|
|
5043
5201
|
}));
|
|
5044
|
-
function processSuccessfulLocalPayment(
|
|
5202
|
+
function processSuccessfulLocalPayment(_x56) {
|
|
5045
5203
|
return _processSuccessfulLocalPayment.apply(this, arguments);
|
|
5046
5204
|
}
|
|
5047
5205
|
return processSuccessfulLocalPayment;
|
|
@@ -5132,32 +5290,32 @@ var Server = /*#__PURE__*/function () {
|
|
|
5132
5290
|
}, {
|
|
5133
5291
|
key: "getShortNumberOrDeviceId",
|
|
5134
5292
|
value: function () {
|
|
5135
|
-
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5293
|
+
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53() {
|
|
5136
5294
|
var getAsyncIotDeviceInfo, res;
|
|
5137
|
-
return _regeneratorRuntime().wrap(function
|
|
5138
|
-
while (1) switch (
|
|
5295
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
5296
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
5139
5297
|
case 0:
|
|
5140
5298
|
getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
|
|
5141
5299
|
if (!getAsyncIotDeviceInfo) {
|
|
5142
|
-
|
|
5300
|
+
_context53.next = 7;
|
|
5143
5301
|
break;
|
|
5144
5302
|
}
|
|
5145
|
-
|
|
5303
|
+
_context53.next = 4;
|
|
5146
5304
|
return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
|
|
5147
5305
|
case 4:
|
|
5148
|
-
res =
|
|
5306
|
+
res = _context53.sent;
|
|
5149
5307
|
if (!(res !== null && res !== void 0 && res.short_number)) {
|
|
5150
|
-
|
|
5308
|
+
_context53.next = 7;
|
|
5151
5309
|
break;
|
|
5152
5310
|
}
|
|
5153
|
-
return
|
|
5311
|
+
return _context53.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
|
|
5154
5312
|
case 7:
|
|
5155
|
-
return
|
|
5313
|
+
return _context53.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
|
|
5156
5314
|
case 8:
|
|
5157
5315
|
case "end":
|
|
5158
|
-
return
|
|
5316
|
+
return _context53.stop();
|
|
5159
5317
|
}
|
|
5160
|
-
},
|
|
5318
|
+
}, _callee53, this);
|
|
5161
5319
|
}));
|
|
5162
5320
|
function getShortNumberOrDeviceId() {
|
|
5163
5321
|
return _getShortNumberOrDeviceId.apply(this, arguments);
|
|
@@ -5184,16 +5342,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
5184
5342
|
}, {
|
|
5185
5343
|
key: "normalizeCheckoutSubmitData",
|
|
5186
5344
|
value: function () {
|
|
5187
|
-
var _normalizeCheckoutSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5345
|
+
var _normalizeCheckoutSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(data, title) {
|
|
5188
5346
|
var next, externalSaleNumber, shouldClearLocalOrderId, hasCheckoutOrderNumbers, localOrder;
|
|
5189
|
-
return _regeneratorRuntime().wrap(function
|
|
5190
|
-
while (1) switch (
|
|
5347
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
5348
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
5191
5349
|
case 0:
|
|
5192
5350
|
if (!(!data || _typeof(data) !== 'object')) {
|
|
5193
|
-
|
|
5351
|
+
_context54.next = 2;
|
|
5194
5352
|
break;
|
|
5195
5353
|
}
|
|
5196
|
-
return
|
|
5354
|
+
return _context54.abrupt("return", data);
|
|
5197
5355
|
case 2:
|
|
5198
5356
|
next = _objectSpread({}, data);
|
|
5199
5357
|
externalSaleNumber = next.external_sale_number;
|
|
@@ -5203,7 +5361,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5203
5361
|
delete next.vouchers;
|
|
5204
5362
|
hasCheckoutOrderNumbers = !this.isBlankCheckoutValue(next.shop_order_number) && !this.isBlankCheckoutValue(next.shop_full_order_number);
|
|
5205
5363
|
if (!hasCheckoutOrderNumbers) {
|
|
5206
|
-
|
|
5364
|
+
_context54.next = 11;
|
|
5207
5365
|
break;
|
|
5208
5366
|
}
|
|
5209
5367
|
this.logInfo("".concat(title, ": checkout \u5DF2\u643A\u5E26\u8BA2\u5355\u53F7\uFF0C\u8DF3\u8FC7\u67E5\u91CD"), {
|
|
@@ -5213,10 +5371,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
5213
5371
|
shop_order_number: next.shop_order_number,
|
|
5214
5372
|
shop_full_order_number: next.shop_full_order_number
|
|
5215
5373
|
});
|
|
5216
|
-
return
|
|
5374
|
+
return _context54.abrupt("return", next);
|
|
5217
5375
|
case 11:
|
|
5218
5376
|
if (!this.isBlankCheckoutValue(externalSaleNumber)) {
|
|
5219
|
-
|
|
5377
|
+
_context54.next = 14;
|
|
5220
5378
|
break;
|
|
5221
5379
|
}
|
|
5222
5380
|
if (shouldClearLocalOrderId) {
|
|
@@ -5225,10 +5383,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
5225
5383
|
order_id: next.order_id
|
|
5226
5384
|
});
|
|
5227
5385
|
}
|
|
5228
|
-
return
|
|
5386
|
+
return _context54.abrupt("return", next);
|
|
5229
5387
|
case 14:
|
|
5230
5388
|
if (!(!this.order || typeof this.order.getLocalOrderFromMemoryByLookup !== 'function')) {
|
|
5231
|
-
|
|
5389
|
+
_context54.next = 17;
|
|
5232
5390
|
break;
|
|
5233
5391
|
}
|
|
5234
5392
|
if (shouldClearLocalOrderId) {
|
|
@@ -5237,12 +5395,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
5237
5395
|
external_sale_number: externalSaleNumber
|
|
5238
5396
|
});
|
|
5239
5397
|
}
|
|
5240
|
-
return
|
|
5398
|
+
return _context54.abrupt("return", next);
|
|
5241
5399
|
case 17:
|
|
5242
|
-
|
|
5400
|
+
_context54.prev = 17;
|
|
5243
5401
|
localOrder = this.order.getLocalOrderFromMemoryByLookup(externalSaleNumber);
|
|
5244
5402
|
if (localOrder) {
|
|
5245
|
-
|
|
5403
|
+
_context54.next = 22;
|
|
5246
5404
|
break;
|
|
5247
5405
|
}
|
|
5248
5406
|
if (shouldClearLocalOrderId) {
|
|
@@ -5252,7 +5410,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5252
5410
|
localOrderFound: false
|
|
5253
5411
|
});
|
|
5254
5412
|
}
|
|
5255
|
-
return
|
|
5413
|
+
return _context54.abrupt("return", next);
|
|
5256
5414
|
case 22:
|
|
5257
5415
|
if (this.isBlankCheckoutValue(next.shop_order_number)) {
|
|
5258
5416
|
next.shop_order_number = localOrder.shop_order_number;
|
|
@@ -5269,23 +5427,23 @@ var Server = /*#__PURE__*/function () {
|
|
|
5269
5427
|
shop_full_order_number: next.shop_full_order_number
|
|
5270
5428
|
});
|
|
5271
5429
|
// 删除 数据体中的 vouchers,对小票和后端来说他们不需要,这个字段只是单向同步给前端用的,而且目前对订单来说还没什么用
|
|
5272
|
-
return
|
|
5430
|
+
return _context54.abrupt("return", next);
|
|
5273
5431
|
case 28:
|
|
5274
|
-
|
|
5275
|
-
|
|
5432
|
+
_context54.prev = 28;
|
|
5433
|
+
_context54.t0 = _context54["catch"](17);
|
|
5276
5434
|
this.logWarning("".concat(title, ": checkout \u67E5\u627E\u672C\u5730\u8BA2\u5355\u5931\u8D25"), {
|
|
5277
5435
|
external_sale_number: externalSaleNumber,
|
|
5278
|
-
error: this.getUnknownErrorMessage(
|
|
5279
|
-
error_detail: this.normalizeUnknownError(
|
|
5436
|
+
error: this.getUnknownErrorMessage(_context54.t0),
|
|
5437
|
+
error_detail: this.normalizeUnknownError(_context54.t0)
|
|
5280
5438
|
});
|
|
5281
|
-
return
|
|
5439
|
+
return _context54.abrupt("return", next);
|
|
5282
5440
|
case 32:
|
|
5283
5441
|
case "end":
|
|
5284
|
-
return
|
|
5442
|
+
return _context54.stop();
|
|
5285
5443
|
}
|
|
5286
|
-
},
|
|
5444
|
+
}, _callee54, this, [[17, 28]]);
|
|
5287
5445
|
}));
|
|
5288
|
-
function normalizeCheckoutSubmitData(
|
|
5446
|
+
function normalizeCheckoutSubmitData(_x57, _x58) {
|
|
5289
5447
|
return _normalizeCheckoutSubmitData.apply(this, arguments);
|
|
5290
5448
|
}
|
|
5291
5449
|
return normalizeCheckoutSubmitData;
|
|
@@ -5293,81 +5451,81 @@ var Server = /*#__PURE__*/function () {
|
|
|
5293
5451
|
}, {
|
|
5294
5452
|
key: "ensureCheckoutOrderNumbers",
|
|
5295
5453
|
value: function () {
|
|
5296
|
-
var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5454
|
+
var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(data, title) {
|
|
5297
5455
|
var next, needsShopOrderNumber, needsShopFullOrderNumber, idGenerator;
|
|
5298
|
-
return _regeneratorRuntime().wrap(function
|
|
5299
|
-
while (1) switch (
|
|
5456
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
5457
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
5300
5458
|
case 0:
|
|
5301
5459
|
if (!(!data || _typeof(data) !== 'object')) {
|
|
5302
|
-
|
|
5460
|
+
_context55.next = 2;
|
|
5303
5461
|
break;
|
|
5304
5462
|
}
|
|
5305
|
-
return
|
|
5463
|
+
return _context55.abrupt("return", data);
|
|
5306
5464
|
case 2:
|
|
5307
5465
|
next = _objectSpread({}, data);
|
|
5308
5466
|
needsShopOrderNumber = next.shop_order_number === undefined || next.shop_order_number === null || next.shop_order_number === '';
|
|
5309
5467
|
needsShopFullOrderNumber = next.shop_full_order_number === undefined || next.shop_full_order_number === null || next.shop_full_order_number === '';
|
|
5310
5468
|
if (!(!needsShopOrderNumber && !needsShopFullOrderNumber)) {
|
|
5311
|
-
|
|
5469
|
+
_context55.next = 7;
|
|
5312
5470
|
break;
|
|
5313
5471
|
}
|
|
5314
|
-
return
|
|
5472
|
+
return _context55.abrupt("return", next);
|
|
5315
5473
|
case 7:
|
|
5316
5474
|
idGenerator = this.getIdGeneratorPlugin();
|
|
5317
5475
|
if (idGenerator) {
|
|
5318
|
-
|
|
5476
|
+
_context55.next = 11;
|
|
5319
5477
|
break;
|
|
5320
5478
|
}
|
|
5321
5479
|
this.logWarning("".concat(title, ": idGenerator \u63D2\u4EF6\u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u751F\u6210\u8BA2\u5355\u53F7"), {
|
|
5322
5480
|
needsShopOrderNumber: needsShopOrderNumber,
|
|
5323
5481
|
needsShopFullOrderNumber: needsShopFullOrderNumber
|
|
5324
5482
|
});
|
|
5325
|
-
return
|
|
5483
|
+
return _context55.abrupt("return", next);
|
|
5326
5484
|
case 11:
|
|
5327
|
-
|
|
5485
|
+
_context55.prev = 11;
|
|
5328
5486
|
if (!(needsShopOrderNumber && idGenerator.generateShopOrderNumber)) {
|
|
5329
|
-
|
|
5487
|
+
_context55.next = 16;
|
|
5330
5488
|
break;
|
|
5331
5489
|
}
|
|
5332
|
-
|
|
5490
|
+
_context55.next = 15;
|
|
5333
5491
|
return idGenerator.generateShopOrderNumber({
|
|
5334
5492
|
biz: next.business_code || 'ticket'
|
|
5335
5493
|
});
|
|
5336
5494
|
case 15:
|
|
5337
|
-
next.shop_order_number =
|
|
5495
|
+
next.shop_order_number = _context55.sent;
|
|
5338
5496
|
case 16:
|
|
5339
5497
|
if (!(needsShopFullOrderNumber && idGenerator.generateReceiptId)) {
|
|
5340
|
-
|
|
5498
|
+
_context55.next = 20;
|
|
5341
5499
|
break;
|
|
5342
5500
|
}
|
|
5343
|
-
|
|
5501
|
+
_context55.next = 19;
|
|
5344
5502
|
return idGenerator.generateReceiptId({
|
|
5345
5503
|
biz: next.business_code || 'ticket'
|
|
5346
5504
|
});
|
|
5347
5505
|
case 19:
|
|
5348
|
-
next.shop_full_order_number =
|
|
5506
|
+
next.shop_full_order_number = _context55.sent;
|
|
5349
5507
|
case 20:
|
|
5350
5508
|
this.logInfo("".concat(title, ": checkout \u8BA2\u5355\u53F7\u5DF2\u51C6\u5907"), {
|
|
5351
5509
|
shop_order_number: next.shop_order_number,
|
|
5352
5510
|
shop_full_order_number: next.shop_full_order_number
|
|
5353
5511
|
});
|
|
5354
|
-
|
|
5512
|
+
_context55.next = 26;
|
|
5355
5513
|
break;
|
|
5356
5514
|
case 23:
|
|
5357
|
-
|
|
5358
|
-
|
|
5515
|
+
_context55.prev = 23;
|
|
5516
|
+
_context55.t0 = _context55["catch"](11);
|
|
5359
5517
|
this.logError("".concat(title, ": \u751F\u6210 checkout \u8BA2\u5355\u53F7\u5931\u8D25"), {
|
|
5360
|
-
error:
|
|
5518
|
+
error: _context55.t0 instanceof Error ? _context55.t0.message : String(_context55.t0)
|
|
5361
5519
|
});
|
|
5362
5520
|
case 26:
|
|
5363
|
-
return
|
|
5521
|
+
return _context55.abrupt("return", next);
|
|
5364
5522
|
case 27:
|
|
5365
5523
|
case "end":
|
|
5366
|
-
return
|
|
5524
|
+
return _context55.stop();
|
|
5367
5525
|
}
|
|
5368
|
-
},
|
|
5526
|
+
}, _callee55, this, [[11, 23]]);
|
|
5369
5527
|
}));
|
|
5370
|
-
function ensureCheckoutOrderNumbers(
|
|
5528
|
+
function ensureCheckoutOrderNumbers(_x59, _x60) {
|
|
5371
5529
|
return _ensureCheckoutOrderNumbers.apply(this, arguments);
|
|
5372
5530
|
}
|
|
5373
5531
|
return ensureCheckoutOrderNumbers;
|
|
@@ -5375,27 +5533,27 @@ var Server = /*#__PURE__*/function () {
|
|
|
5375
5533
|
}, {
|
|
5376
5534
|
key: "dispatchCheckoutSyncTask",
|
|
5377
5535
|
value: function () {
|
|
5378
|
-
var _dispatchCheckoutSyncTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5536
|
+
var _dispatchCheckoutSyncTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
|
|
5379
5537
|
var deviceTask, debugDeviceId, debugIdempotencyKey, _params$data, _params$data2, _params$data3, _params$data4, result;
|
|
5380
|
-
return _regeneratorRuntime().wrap(function
|
|
5381
|
-
while (1) switch (
|
|
5538
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
|
5539
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
5382
5540
|
case 0:
|
|
5383
5541
|
this.registerDeviceTaskActions();
|
|
5384
5542
|
deviceTask = this.getDeviceTaskPlugin();
|
|
5385
|
-
|
|
5543
|
+
_context56.next = 4;
|
|
5386
5544
|
return this.getShortNumberOrDeviceId();
|
|
5387
5545
|
case 4:
|
|
5388
|
-
debugDeviceId =
|
|
5546
|
+
debugDeviceId = _context56.sent;
|
|
5389
5547
|
debugIdempotencyKey = this.buildCheckoutTaskIdempotencyKey(params.data);
|
|
5390
5548
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
5391
|
-
|
|
5549
|
+
_context56.next = 9;
|
|
5392
5550
|
break;
|
|
5393
5551
|
}
|
|
5394
5552
|
this.logError("".concat(params.title, ": deviceTask.dispatch \u4E0D\u53EF\u7528"));
|
|
5395
|
-
return
|
|
5553
|
+
return _context56.abrupt("return");
|
|
5396
5554
|
case 9:
|
|
5397
|
-
|
|
5398
|
-
|
|
5555
|
+
_context56.prev = 9;
|
|
5556
|
+
_context56.next = 12;
|
|
5399
5557
|
return deviceTask.dispatch({
|
|
5400
5558
|
action: 'sync_sales',
|
|
5401
5559
|
device_id: debugDeviceId,
|
|
@@ -5413,27 +5571,27 @@ var Server = /*#__PURE__*/function () {
|
|
|
5413
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)
|
|
5414
5572
|
});
|
|
5415
5573
|
case 12:
|
|
5416
|
-
result =
|
|
5574
|
+
result = _context56.sent;
|
|
5417
5575
|
this.logInfo("".concat(params.title, ": sync_sales \u4EFB\u52A1\u5DF2\u6D3E\u53D1"), {
|
|
5418
5576
|
uuid: result === null || result === void 0 ? void 0 : result.uuid,
|
|
5419
5577
|
status: result === null || result === void 0 ? void 0 : result.status,
|
|
5420
5578
|
reused: result === null || result === void 0 ? void 0 : result.reused
|
|
5421
5579
|
});
|
|
5422
|
-
|
|
5580
|
+
_context56.next = 19;
|
|
5423
5581
|
break;
|
|
5424
5582
|
case 16:
|
|
5425
|
-
|
|
5426
|
-
|
|
5583
|
+
_context56.prev = 16;
|
|
5584
|
+
_context56.t0 = _context56["catch"](9);
|
|
5427
5585
|
this.logError("".concat(params.title, ": \u6D3E\u53D1 sync_sales \u4EFB\u52A1\u5931\u8D25"), {
|
|
5428
|
-
error:
|
|
5586
|
+
error: _context56.t0 instanceof Error ? _context56.t0.message : String(_context56.t0)
|
|
5429
5587
|
});
|
|
5430
5588
|
case 19:
|
|
5431
5589
|
case "end":
|
|
5432
|
-
return
|
|
5590
|
+
return _context56.stop();
|
|
5433
5591
|
}
|
|
5434
|
-
},
|
|
5592
|
+
}, _callee56, this, [[9, 16]]);
|
|
5435
5593
|
}));
|
|
5436
|
-
function dispatchCheckoutSyncTask(
|
|
5594
|
+
function dispatchCheckoutSyncTask(_x61) {
|
|
5437
5595
|
return _dispatchCheckoutSyncTask.apply(this, arguments);
|
|
5438
5596
|
}
|
|
5439
5597
|
return dispatchCheckoutSyncTask;
|
|
@@ -5441,26 +5599,26 @@ var Server = /*#__PURE__*/function () {
|
|
|
5441
5599
|
}, {
|
|
5442
5600
|
key: "dispatchPrintOtherReceiptTask",
|
|
5443
5601
|
value: function () {
|
|
5444
|
-
var _dispatchPrintOtherReceiptTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5602
|
+
var _dispatchPrintOtherReceiptTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(params) {
|
|
5445
5603
|
var deviceTask, _params$deviceId, _params$syncedOrder, _params$syncedOrder2, _params$syncedOrder3, printIdentity, deviceId;
|
|
5446
|
-
return _regeneratorRuntime().wrap(function
|
|
5447
|
-
while (1) switch (
|
|
5604
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
|
5605
|
+
while (1) switch (_context57.prev = _context57.next) {
|
|
5448
5606
|
case 0:
|
|
5449
5607
|
deviceTask = this.getDeviceTaskPlugin();
|
|
5450
5608
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
5451
|
-
|
|
5609
|
+
_context57.next = 4;
|
|
5452
5610
|
break;
|
|
5453
5611
|
}
|
|
5454
5612
|
this.logWarning('dispatchPrintOtherReceiptTask: deviceTask.dispatch 不可用');
|
|
5455
|
-
return
|
|
5613
|
+
return _context57.abrupt("return");
|
|
5456
5614
|
case 4:
|
|
5457
|
-
|
|
5615
|
+
_context57.prev = 4;
|
|
5458
5616
|
printIdentity = this.getPrintOrderIdentity(params.syncedOrder);
|
|
5459
|
-
|
|
5617
|
+
_context57.next = 8;
|
|
5460
5618
|
return this.getShortNumberOrDeviceId();
|
|
5461
5619
|
case 8:
|
|
5462
|
-
deviceId =
|
|
5463
|
-
|
|
5620
|
+
deviceId = _context57.sent;
|
|
5621
|
+
_context57.next = 11;
|
|
5464
5622
|
return deviceTask.dispatch({
|
|
5465
5623
|
action: 'print_all',
|
|
5466
5624
|
device_id: (_params$deviceId = params.deviceId) !== null && _params$deviceId !== void 0 ? _params$deviceId : deviceId,
|
|
@@ -5487,21 +5645,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
5487
5645
|
source_id: printIdentity
|
|
5488
5646
|
});
|
|
5489
5647
|
case 11:
|
|
5490
|
-
|
|
5648
|
+
_context57.next = 16;
|
|
5491
5649
|
break;
|
|
5492
5650
|
case 13:
|
|
5493
|
-
|
|
5494
|
-
|
|
5651
|
+
_context57.prev = 13;
|
|
5652
|
+
_context57.t0 = _context57["catch"](4);
|
|
5495
5653
|
this.logError('dispatchPrintOtherReceiptTask: 派发失败', {
|
|
5496
|
-
error:
|
|
5654
|
+
error: _context57.t0 instanceof Error ? _context57.t0.message : String(_context57.t0)
|
|
5497
5655
|
});
|
|
5498
5656
|
case 16:
|
|
5499
5657
|
case "end":
|
|
5500
|
-
return
|
|
5658
|
+
return _context57.stop();
|
|
5501
5659
|
}
|
|
5502
|
-
},
|
|
5660
|
+
}, _callee57, this, [[4, 13]]);
|
|
5503
5661
|
}));
|
|
5504
|
-
function dispatchPrintOtherReceiptTask(
|
|
5662
|
+
function dispatchPrintOtherReceiptTask(_x62) {
|
|
5505
5663
|
return _dispatchPrintOtherReceiptTask.apply(this, arguments);
|
|
5506
5664
|
}
|
|
5507
5665
|
return dispatchPrintOtherReceiptTask;
|
|
@@ -5521,32 +5679,32 @@ var Server = /*#__PURE__*/function () {
|
|
|
5521
5679
|
}, {
|
|
5522
5680
|
key: "dispatchLocalReceiptPrint",
|
|
5523
5681
|
value: function () {
|
|
5524
|
-
var _dispatchLocalReceiptPrint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5682
|
+
var _dispatchLocalReceiptPrint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(params) {
|
|
5525
5683
|
var _payment_info;
|
|
5526
5684
|
var printableOrder;
|
|
5527
|
-
return _regeneratorRuntime().wrap(function
|
|
5528
|
-
while (1) switch (
|
|
5685
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
|
5686
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
5529
5687
|
case 0:
|
|
5530
5688
|
if (!(params.requireFullyPaid && !this.isSalesOrderFullyPaid(params.order))) {
|
|
5531
|
-
|
|
5689
|
+
_context58.next = 2;
|
|
5532
5690
|
break;
|
|
5533
5691
|
}
|
|
5534
|
-
return
|
|
5692
|
+
return _context58.abrupt("return", {
|
|
5535
5693
|
printed: false,
|
|
5536
5694
|
order: params.order
|
|
5537
5695
|
});
|
|
5538
5696
|
case 2:
|
|
5539
|
-
|
|
5697
|
+
_context58.next = 4;
|
|
5540
5698
|
return this.withLocalSmallTicketData(params.order, {
|
|
5541
5699
|
requireFullyPaid: params.requireFullyPaid
|
|
5542
5700
|
});
|
|
5543
5701
|
case 4:
|
|
5544
|
-
printableOrder =
|
|
5702
|
+
printableOrder = _context58.sent;
|
|
5545
5703
|
if (hasSmallTicketData((_payment_info = printableOrder.payment_info) === null || _payment_info === void 0 ? void 0 : _payment_info.small_ticket_data)) {
|
|
5546
|
-
|
|
5704
|
+
_context58.next = 7;
|
|
5547
5705
|
break;
|
|
5548
5706
|
}
|
|
5549
|
-
return
|
|
5707
|
+
return _context58.abrupt("return", {
|
|
5550
5708
|
printed: false,
|
|
5551
5709
|
order: printableOrder
|
|
5552
5710
|
});
|
|
@@ -5556,7 +5714,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5556
5714
|
printableOrder: printableOrder,
|
|
5557
5715
|
response: params.response
|
|
5558
5716
|
});
|
|
5559
|
-
|
|
5717
|
+
_context58.next = 10;
|
|
5560
5718
|
return this.dispatchPrintOtherReceiptTask({
|
|
5561
5719
|
checkoutData: params.checkoutData,
|
|
5562
5720
|
syncedOrder: printableOrder,
|
|
@@ -5565,17 +5723,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
5565
5723
|
isManualPrint: params.isManualPrint
|
|
5566
5724
|
});
|
|
5567
5725
|
case 10:
|
|
5568
|
-
return
|
|
5726
|
+
return _context58.abrupt("return", {
|
|
5569
5727
|
printed: true,
|
|
5570
5728
|
order: printableOrder
|
|
5571
5729
|
});
|
|
5572
5730
|
case 11:
|
|
5573
5731
|
case "end":
|
|
5574
|
-
return
|
|
5732
|
+
return _context58.stop();
|
|
5575
5733
|
}
|
|
5576
|
-
},
|
|
5734
|
+
}, _callee58, this);
|
|
5577
5735
|
}));
|
|
5578
|
-
function dispatchLocalReceiptPrint(
|
|
5736
|
+
function dispatchLocalReceiptPrint(_x63) {
|
|
5579
5737
|
return _dispatchLocalReceiptPrint.apply(this, arguments);
|
|
5580
5738
|
}
|
|
5581
5739
|
return dispatchLocalReceiptPrint;
|
|
@@ -5610,47 +5768,47 @@ var Server = /*#__PURE__*/function () {
|
|
|
5610
5768
|
}, {
|
|
5611
5769
|
key: "syncMachinecodeRedeemStatusToLocalOrder",
|
|
5612
5770
|
value: function () {
|
|
5613
|
-
var _syncMachinecodeRedeemStatusToLocalOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5771
|
+
var _syncMachinecodeRedeemStatusToLocalOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(data, ids, status) {
|
|
5614
5772
|
var _this$order3;
|
|
5615
5773
|
var title, lookup, localOrder, voucherIdSet, vouchers, hasUpdatedVoucher, nextVouchers;
|
|
5616
|
-
return _regeneratorRuntime().wrap(function
|
|
5617
|
-
while (1) switch (
|
|
5774
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
|
5775
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
5618
5776
|
case 0:
|
|
5619
5777
|
title = 'handleMachinecodeBatchMetadata';
|
|
5620
5778
|
lookup = this.resolveMachinecodeBatchMetadataLookup(data);
|
|
5621
5779
|
if (!(lookup === undefined)) {
|
|
5622
|
-
|
|
5780
|
+
_context59.next = 5;
|
|
5623
5781
|
break;
|
|
5624
5782
|
}
|
|
5625
5783
|
this.logWarning("".concat(title, ": order lookup \u7F3A\u5931\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
|
|
5626
5784
|
batchSize: ids.length,
|
|
5627
5785
|
status: status
|
|
5628
5786
|
});
|
|
5629
|
-
return
|
|
5787
|
+
return _context59.abrupt("return");
|
|
5630
5788
|
case 5:
|
|
5631
5789
|
if ((_this$order3 = this.order) !== null && _this$order3 !== void 0 && _this$order3.getLocalOrderByLookup) {
|
|
5632
|
-
|
|
5790
|
+
_context59.next = 8;
|
|
5633
5791
|
break;
|
|
5634
5792
|
}
|
|
5635
5793
|
this.logWarning("".concat(title, ": Order \u6A21\u5757\u672A\u6CE8\u518C\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
|
|
5636
5794
|
lookup: lookup,
|
|
5637
5795
|
status: status
|
|
5638
5796
|
});
|
|
5639
|
-
return
|
|
5797
|
+
return _context59.abrupt("return");
|
|
5640
5798
|
case 8:
|
|
5641
|
-
|
|
5799
|
+
_context59.next = 10;
|
|
5642
5800
|
return this.order.getLocalOrderByLookup(lookup);
|
|
5643
5801
|
case 10:
|
|
5644
|
-
localOrder =
|
|
5802
|
+
localOrder = _context59.sent;
|
|
5645
5803
|
if (localOrder) {
|
|
5646
|
-
|
|
5804
|
+
_context59.next = 14;
|
|
5647
5805
|
break;
|
|
5648
5806
|
}
|
|
5649
5807
|
this.logWarning("".concat(title, ": \u672C\u5730\u8BA2\u5355\u4E0D\u5B58\u5728\uFF0C\u8DF3\u8FC7\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
|
|
5650
5808
|
lookup: lookup,
|
|
5651
5809
|
status: status
|
|
5652
5810
|
});
|
|
5653
|
-
return
|
|
5811
|
+
return _context59.abrupt("return");
|
|
5654
5812
|
case 14:
|
|
5655
5813
|
voucherIdSet = new Set(ids.filter(function (id) {
|
|
5656
5814
|
return id !== undefined && id !== null && id !== '';
|
|
@@ -5658,14 +5816,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
5658
5816
|
return String(id);
|
|
5659
5817
|
}));
|
|
5660
5818
|
if (!(voucherIdSet.size === 0)) {
|
|
5661
|
-
|
|
5819
|
+
_context59.next = 18;
|
|
5662
5820
|
break;
|
|
5663
5821
|
}
|
|
5664
5822
|
this.logWarning("".concat(title, ": voucher ids \u7F3A\u5931\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
|
|
5665
5823
|
lookup: lookup,
|
|
5666
5824
|
status: status
|
|
5667
5825
|
});
|
|
5668
|
-
return
|
|
5826
|
+
return _context59.abrupt("return");
|
|
5669
5827
|
case 18:
|
|
5670
5828
|
vouchers = Array.isArray(localOrder.vouchers) ? localOrder.vouchers : [];
|
|
5671
5829
|
hasUpdatedVoucher = false;
|
|
@@ -5679,7 +5837,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5679
5837
|
});
|
|
5680
5838
|
});
|
|
5681
5839
|
if (hasUpdatedVoucher) {
|
|
5682
|
-
|
|
5840
|
+
_context59.next = 24;
|
|
5683
5841
|
break;
|
|
5684
5842
|
}
|
|
5685
5843
|
this.logWarning("".concat(title, ": \u672C\u5730\u8BA2\u5355\u672A\u547D\u4E2D\u4EFB\u4F55 voucher\uFF0C\u8DF3\u8FC7\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
|
|
@@ -5687,13 +5845,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
5687
5845
|
voucher_ids: Array.from(voucherIdSet),
|
|
5688
5846
|
status: status
|
|
5689
5847
|
});
|
|
5690
|
-
return
|
|
5848
|
+
return _context59.abrupt("return");
|
|
5691
5849
|
case 24:
|
|
5692
5850
|
if (!(typeof this.order.overwriteExistingOrder === 'function')) {
|
|
5693
|
-
|
|
5851
|
+
_context59.next = 29;
|
|
5694
5852
|
break;
|
|
5695
5853
|
}
|
|
5696
|
-
|
|
5854
|
+
_context59.next = 27;
|
|
5697
5855
|
return this.order.overwriteExistingOrder(_objectSpread(_objectSpread({}, localOrder), {}, {
|
|
5698
5856
|
vouchers: nextVouchers
|
|
5699
5857
|
}));
|
|
@@ -5703,13 +5861,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
5703
5861
|
updatedCount: voucherIdSet.size,
|
|
5704
5862
|
status: status
|
|
5705
5863
|
});
|
|
5706
|
-
return
|
|
5864
|
+
return _context59.abrupt("return");
|
|
5707
5865
|
case 29:
|
|
5708
5866
|
if (!(data !== null && data !== void 0 && data.external_sale_number && typeof this.order.markOrderSyncedByExternalSaleNumber === 'function')) {
|
|
5709
|
-
|
|
5867
|
+
_context59.next = 34;
|
|
5710
5868
|
break;
|
|
5711
5869
|
}
|
|
5712
|
-
|
|
5870
|
+
_context59.next = 32;
|
|
5713
5871
|
return this.order.markOrderSyncedByExternalSaleNumber({
|
|
5714
5872
|
externalSaleNumber: data.external_sale_number,
|
|
5715
5873
|
patch: {
|
|
@@ -5722,7 +5880,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5722
5880
|
updatedCount: voucherIdSet.size,
|
|
5723
5881
|
status: status
|
|
5724
5882
|
});
|
|
5725
|
-
return
|
|
5883
|
+
return _context59.abrupt("return");
|
|
5726
5884
|
case 34:
|
|
5727
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"), {
|
|
5728
5886
|
lookup: lookup,
|
|
@@ -5730,11 +5888,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
5730
5888
|
});
|
|
5731
5889
|
case 35:
|
|
5732
5890
|
case "end":
|
|
5733
|
-
return
|
|
5891
|
+
return _context59.stop();
|
|
5734
5892
|
}
|
|
5735
|
-
},
|
|
5893
|
+
}, _callee59, this);
|
|
5736
5894
|
}));
|
|
5737
|
-
function syncMachinecodeRedeemStatusToLocalOrder(
|
|
5895
|
+
function syncMachinecodeRedeemStatusToLocalOrder(_x64, _x65, _x66) {
|
|
5738
5896
|
return _syncMachinecodeRedeemStatusToLocalOrder.apply(this, arguments);
|
|
5739
5897
|
}
|
|
5740
5898
|
return syncMachinecodeRedeemStatusToLocalOrder;
|
|
@@ -5742,10 +5900,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
5742
5900
|
}, {
|
|
5743
5901
|
key: "handleOrderCheckoutSubmit",
|
|
5744
5902
|
value: function () {
|
|
5745
|
-
var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5903
|
+
var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(params) {
|
|
5746
5904
|
var backendPath, data, title, normalizedData, checkoutData, pendingResult, pendingOrder;
|
|
5747
|
-
return _regeneratorRuntime().wrap(function
|
|
5748
|
-
while (1) switch (
|
|
5905
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
|
5906
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
5749
5907
|
case 0:
|
|
5750
5908
|
backendPath = params.backendPath, data = params.data, title = params.title;
|
|
5751
5909
|
this.logInfo("".concat(title, ": \u5F00\u59CB\u5904\u7406"), {
|
|
@@ -5755,24 +5913,24 @@ var Server = /*#__PURE__*/function () {
|
|
|
5755
5913
|
order_number: data === null || data === void 0 ? void 0 : data.order_number
|
|
5756
5914
|
});
|
|
5757
5915
|
if (!(data !== null && data !== void 0 && data.sync_mode || data !== null && data !== void 0 && data.syncMode)) {
|
|
5758
|
-
|
|
5916
|
+
_context60.next = 4;
|
|
5759
5917
|
break;
|
|
5760
5918
|
}
|
|
5761
|
-
return
|
|
5919
|
+
return _context60.abrupt("return", this.handleSyncCheckoutSubmit({
|
|
5762
5920
|
backendPath: backendPath,
|
|
5763
5921
|
data: data,
|
|
5764
5922
|
title: title
|
|
5765
5923
|
}));
|
|
5766
5924
|
case 4:
|
|
5767
|
-
|
|
5925
|
+
_context60.next = 6;
|
|
5768
5926
|
return this.normalizeCheckoutSubmitData(data, title);
|
|
5769
5927
|
case 6:
|
|
5770
|
-
normalizedData =
|
|
5771
|
-
|
|
5928
|
+
normalizedData = _context60.sent;
|
|
5929
|
+
_context60.next = 9;
|
|
5772
5930
|
return this.ensureCheckoutOrderNumbers(normalizedData, title);
|
|
5773
5931
|
case 9:
|
|
5774
|
-
checkoutData =
|
|
5775
|
-
|
|
5932
|
+
checkoutData = _context60.sent;
|
|
5933
|
+
_context60.next = 12;
|
|
5776
5934
|
return this.handlePendingSyncCheckoutOrder({
|
|
5777
5935
|
backendPath: backendPath,
|
|
5778
5936
|
data: checkoutData,
|
|
@@ -5780,27 +5938,25 @@ var Server = /*#__PURE__*/function () {
|
|
|
5780
5938
|
reason: 'checkout 已转入设备任务同步'
|
|
5781
5939
|
});
|
|
5782
5940
|
case 12:
|
|
5783
|
-
pendingResult =
|
|
5941
|
+
pendingResult = _context60.sent;
|
|
5784
5942
|
if (!((pendingResult === null || pendingResult === void 0 ? void 0 : pendingResult.status) === true)) {
|
|
5785
|
-
|
|
5943
|
+
_context60.next = 20;
|
|
5786
5944
|
break;
|
|
5787
5945
|
}
|
|
5788
5946
|
pendingOrder = pendingResult.data;
|
|
5789
5947
|
if (!(pendingOrder && this.shouldBuildSmallTicketData(checkoutData) && this.isSalesOrderFullyPaid(pendingOrder) && this.shouldAutoPrintCheckoutReceipt())) {
|
|
5790
|
-
|
|
5948
|
+
_context60.next = 18;
|
|
5791
5949
|
break;
|
|
5792
5950
|
}
|
|
5793
|
-
|
|
5951
|
+
_context60.next = 18;
|
|
5794
5952
|
return this.dispatchLocalReceiptPrint({
|
|
5795
5953
|
checkoutData: checkoutData,
|
|
5796
5954
|
order: pendingOrder,
|
|
5797
5955
|
response: pendingResult,
|
|
5798
|
-
requireFullyPaid: true
|
|
5799
|
-
// 自动小票固定使用 print_all 的收据类型 0,不随订单 type 改成券/手环类型 99。
|
|
5800
|
-
isManualPrint: true
|
|
5956
|
+
requireFullyPaid: true
|
|
5801
5957
|
});
|
|
5802
5958
|
case 18:
|
|
5803
|
-
|
|
5959
|
+
_context60.next = 20;
|
|
5804
5960
|
return this.dispatchCheckoutSyncTask({
|
|
5805
5961
|
backendPath: backendPath,
|
|
5806
5962
|
data: checkoutData,
|
|
@@ -5808,23 +5964,23 @@ var Server = /*#__PURE__*/function () {
|
|
|
5808
5964
|
});
|
|
5809
5965
|
case 20:
|
|
5810
5966
|
if (pendingResult.data.order_id) {
|
|
5811
|
-
|
|
5967
|
+
_context60.next = 22;
|
|
5812
5968
|
break;
|
|
5813
5969
|
}
|
|
5814
|
-
return
|
|
5970
|
+
return _context60.abrupt("return", _objectSpread(_objectSpread({}, pendingResult), {}, {
|
|
5815
5971
|
data: _objectSpread(_objectSpread({}, pendingResult.data), {}, {
|
|
5816
5972
|
order_id: pendingResult.data.external_sale_number
|
|
5817
5973
|
})
|
|
5818
5974
|
}));
|
|
5819
5975
|
case 22:
|
|
5820
|
-
return
|
|
5976
|
+
return _context60.abrupt("return", pendingResult);
|
|
5821
5977
|
case 23:
|
|
5822
5978
|
case "end":
|
|
5823
|
-
return
|
|
5979
|
+
return _context60.stop();
|
|
5824
5980
|
}
|
|
5825
|
-
},
|
|
5981
|
+
}, _callee60, this);
|
|
5826
5982
|
}));
|
|
5827
|
-
function handleOrderCheckoutSubmit(
|
|
5983
|
+
function handleOrderCheckoutSubmit(_x67) {
|
|
5828
5984
|
return _handleOrderCheckoutSubmit.apply(this, arguments);
|
|
5829
5985
|
}
|
|
5830
5986
|
return handleOrderCheckoutSubmit;
|
|
@@ -5832,27 +5988,27 @@ var Server = /*#__PURE__*/function () {
|
|
|
5832
5988
|
}, {
|
|
5833
5989
|
key: "handleSyncCheckoutSubmit",
|
|
5834
5990
|
value: function () {
|
|
5835
|
-
var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5991
|
+
var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(params) {
|
|
5836
5992
|
var _this$app16;
|
|
5837
|
-
var backendPath, data, title, syncResult, _normalized$data, normalized, backendError, _normalized$data2, _normalized, message;
|
|
5838
|
-
return _regeneratorRuntime().wrap(function
|
|
5839
|
-
while (1) switch (
|
|
5993
|
+
var backendPath, data, title, syncResult, _normalized$data, normalized, response, syncedOrder, backendError, _normalized$data2, _normalized, message;
|
|
5994
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
|
5995
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
5840
5996
|
case 0:
|
|
5841
5997
|
backendPath = params.backendPath, data = params.data, title = params.title;
|
|
5842
5998
|
if ((_this$app16 = this.app) !== null && _this$app16 !== void 0 && (_this$app16 = _this$app16.request) !== null && _this$app16 !== void 0 && _this$app16.post) {
|
|
5843
|
-
|
|
5999
|
+
_context61.next = 4;
|
|
5844
6000
|
break;
|
|
5845
6001
|
}
|
|
5846
6002
|
this.logError("".concat(title, ": sync checkout app.request \u4E0D\u53EF\u7528"));
|
|
5847
|
-
return
|
|
6003
|
+
return _context61.abrupt("return", {
|
|
5848
6004
|
code: 500,
|
|
5849
6005
|
status: false,
|
|
5850
6006
|
message: 'app.request 不可用',
|
|
5851
6007
|
data: null
|
|
5852
6008
|
});
|
|
5853
6009
|
case 4:
|
|
5854
|
-
|
|
5855
|
-
|
|
6010
|
+
_context61.prev = 4;
|
|
6011
|
+
_context61.next = 7;
|
|
5856
6012
|
return this.runCheckoutSync({
|
|
5857
6013
|
backendPath: backendPath,
|
|
5858
6014
|
data: data,
|
|
@@ -5860,53 +6016,68 @@ var Server = /*#__PURE__*/function () {
|
|
|
5860
6016
|
persistCheckoutDataWithResponse: true
|
|
5861
6017
|
});
|
|
5862
6018
|
case 7:
|
|
5863
|
-
syncResult =
|
|
6019
|
+
syncResult = _context61.sent;
|
|
5864
6020
|
if (!syncResult.rejected) {
|
|
5865
|
-
|
|
6021
|
+
_context61.next = 11;
|
|
5866
6022
|
break;
|
|
5867
6023
|
}
|
|
5868
6024
|
normalized = this.normalizeCheckoutResponse(syncResult.errorResponse);
|
|
5869
|
-
return
|
|
6025
|
+
return _context61.abrupt("return", _objectSpread(_objectSpread({}, normalized), {}, {
|
|
5870
6026
|
status: false,
|
|
5871
6027
|
message: syncResult.message || (normalized === null || normalized === void 0 ? void 0 : normalized.message) || '后端明确拒绝 checkout',
|
|
5872
6028
|
data: (_normalized$data = normalized === null || normalized === void 0 ? void 0 : normalized.data) !== null && _normalized$data !== void 0 ? _normalized$data : null
|
|
5873
6029
|
}));
|
|
5874
6030
|
case 11:
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
6031
|
+
response = this.withSyncedOrderIdInCheckoutResponse(syncResult.normalizedResponse, syncResult.syncedOrder);
|
|
6032
|
+
syncedOrder = syncResult.syncedOrder;
|
|
6033
|
+
if (!(syncedOrder && this.shouldBuildSmallTicketData(syncResult.checkoutData) && this.isSalesOrderFullyPaid(syncedOrder))) {
|
|
6034
|
+
_context61.next = 16;
|
|
6035
|
+
break;
|
|
6036
|
+
}
|
|
6037
|
+
_context61.next = 16;
|
|
6038
|
+
return this.dispatchLocalReceiptPrint({
|
|
6039
|
+
checkoutData: syncResult.checkoutData,
|
|
6040
|
+
order: syncedOrder,
|
|
6041
|
+
response: syncResult.normalizedResponse,
|
|
6042
|
+
requireFullyPaid: true
|
|
6043
|
+
// print_all 的 type=0 是收据打印;不要沿用同步成功后的券/手环打印 type=99。
|
|
6044
|
+
});
|
|
6045
|
+
case 16:
|
|
6046
|
+
return _context61.abrupt("return", response);
|
|
6047
|
+
case 19:
|
|
6048
|
+
_context61.prev = 19;
|
|
6049
|
+
_context61.t0 = _context61["catch"](4);
|
|
6050
|
+
backendError = this.extractBackendErrorResponse(_context61.t0);
|
|
5880
6051
|
if (!backendError) {
|
|
5881
|
-
|
|
6052
|
+
_context61.next = 25;
|
|
5882
6053
|
break;
|
|
5883
6054
|
}
|
|
5884
6055
|
_normalized = this.normalizeCheckoutResponse(backendError);
|
|
5885
|
-
return
|
|
6056
|
+
return _context61.abrupt("return", _objectSpread(_objectSpread({}, _normalized), {}, {
|
|
5886
6057
|
status: false,
|
|
5887
6058
|
message: (backendError === null || backendError === void 0 ? void 0 : backendError.message) || (_normalized === null || _normalized === void 0 ? void 0 : _normalized.message) || '后端明确拒绝 checkout',
|
|
5888
6059
|
data: (_normalized$data2 = _normalized === null || _normalized === void 0 ? void 0 : _normalized.data) !== null && _normalized$data2 !== void 0 ? _normalized$data2 : null
|
|
5889
6060
|
}));
|
|
5890
|
-
case
|
|
5891
|
-
message = this.getUnknownErrorMessage(
|
|
6061
|
+
case 25:
|
|
6062
|
+
message = this.getUnknownErrorMessage(_context61.t0);
|
|
5892
6063
|
this.logError("".concat(title, ": sync checkout \u8BF7\u6C42\u672A\u660E\u786E\u6210\u529F"), {
|
|
5893
6064
|
backendPath: backendPath,
|
|
5894
6065
|
error: message,
|
|
5895
|
-
error_detail: this.normalizeUnknownError(
|
|
6066
|
+
error_detail: this.normalizeUnknownError(_context61.t0)
|
|
5896
6067
|
});
|
|
5897
|
-
return
|
|
6068
|
+
return _context61.abrupt("return", {
|
|
5898
6069
|
code: 500,
|
|
5899
6070
|
status: false,
|
|
5900
6071
|
message: message,
|
|
5901
6072
|
data: null
|
|
5902
6073
|
});
|
|
5903
|
-
case
|
|
6074
|
+
case 28:
|
|
5904
6075
|
case "end":
|
|
5905
|
-
return
|
|
6076
|
+
return _context61.stop();
|
|
5906
6077
|
}
|
|
5907
|
-
},
|
|
6078
|
+
}, _callee61, this, [[4, 19]]);
|
|
5908
6079
|
}));
|
|
5909
|
-
function handleSyncCheckoutSubmit(
|
|
6080
|
+
function handleSyncCheckoutSubmit(_x68) {
|
|
5910
6081
|
return _handleSyncCheckoutSubmit.apply(this, arguments);
|
|
5911
6082
|
}
|
|
5912
6083
|
return handleSyncCheckoutSubmit;
|
|
@@ -5914,10 +6085,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
5914
6085
|
}, {
|
|
5915
6086
|
key: "handleOrderDraftSubmit",
|
|
5916
6087
|
value: function () {
|
|
5917
|
-
var _handleOrderDraftSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6088
|
+
var _handleOrderDraftSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(params) {
|
|
5918
6089
|
var data, title, normalizedData, createdAt, draftOrder, _draftOrder$summary, _draftOrder$summary2, _draftOrder$summary3, errorMessage;
|
|
5919
|
-
return _regeneratorRuntime().wrap(function
|
|
5920
|
-
while (1) switch (
|
|
6090
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
|
6091
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
5921
6092
|
case 0:
|
|
5922
6093
|
data = params.data, title = params.title;
|
|
5923
6094
|
this.logInfo("".concat(title, ": \u5F00\u59CB\u5904\u7406"), {
|
|
@@ -5925,10 +6096,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
5925
6096
|
external_sale_number: data === null || data === void 0 ? void 0 : data.external_sale_number,
|
|
5926
6097
|
order_number: data === null || data === void 0 ? void 0 : data.order_number
|
|
5927
6098
|
});
|
|
5928
|
-
|
|
6099
|
+
_context62.next = 4;
|
|
5929
6100
|
return this.normalizeCheckoutSubmitData(data, title);
|
|
5930
6101
|
case 4:
|
|
5931
|
-
normalizedData =
|
|
6102
|
+
normalizedData = _context62.sent;
|
|
5932
6103
|
createdAt = normalizedData.created_at || normalizedData.create_date || dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
5933
6104
|
draftOrder = _objectSpread(_objectSpread({}, normalizedData), {}, {
|
|
5934
6105
|
external_sale_number: normalizedData.external_sale_number || "LOCAL_DRAFT_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 10)),
|
|
@@ -5938,26 +6109,26 @@ var Server = /*#__PURE__*/function () {
|
|
|
5938
6109
|
is_draft_order: 1
|
|
5939
6110
|
});
|
|
5940
6111
|
if (!(!this.order || typeof this.order.upsertLocalDraftOrders !== 'function')) {
|
|
5941
|
-
|
|
6112
|
+
_context62.next = 10;
|
|
5942
6113
|
break;
|
|
5943
6114
|
}
|
|
5944
6115
|
this.logError("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u8349\u7A3F\u5199\u5165"));
|
|
5945
|
-
return
|
|
6116
|
+
return _context62.abrupt("return", {
|
|
5946
6117
|
code: 500,
|
|
5947
6118
|
status: false,
|
|
5948
6119
|
message: 'Order 模块不支持本地草稿写入',
|
|
5949
6120
|
data: null
|
|
5950
6121
|
});
|
|
5951
6122
|
case 10:
|
|
5952
|
-
|
|
5953
|
-
|
|
6123
|
+
_context62.prev = 10;
|
|
6124
|
+
_context62.next = 13;
|
|
5954
6125
|
return this.order.upsertLocalDraftOrders([draftOrder]);
|
|
5955
6126
|
case 13:
|
|
5956
6127
|
this.logInfo("".concat(title, ": \u8349\u7A3F\u8BA2\u5355\u5DF2\u5199\u5165\u672C\u5730"), {
|
|
5957
6128
|
order_id: draftOrder.order_id,
|
|
5958
6129
|
external_sale_number: draftOrder.external_sale_number
|
|
5959
6130
|
});
|
|
5960
|
-
return
|
|
6131
|
+
return _context62.abrupt("return", {
|
|
5961
6132
|
code: 200,
|
|
5962
6133
|
status: true,
|
|
5963
6134
|
message: '',
|
|
@@ -5969,13 +6140,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
5969
6140
|
})
|
|
5970
6141
|
});
|
|
5971
6142
|
case 17:
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
errorMessage =
|
|
6143
|
+
_context62.prev = 17;
|
|
6144
|
+
_context62.t0 = _context62["catch"](10);
|
|
6145
|
+
errorMessage = _context62.t0 instanceof Error ? _context62.t0.message : String(_context62.t0);
|
|
5975
6146
|
this.logError("".concat(title, ": \u5199\u5165\u672C\u5730\u8349\u7A3F\u8BA2\u5355\u5931\u8D25"), {
|
|
5976
6147
|
error: errorMessage
|
|
5977
6148
|
});
|
|
5978
|
-
return
|
|
6149
|
+
return _context62.abrupt("return", {
|
|
5979
6150
|
code: 500,
|
|
5980
6151
|
status: false,
|
|
5981
6152
|
message: errorMessage,
|
|
@@ -5983,11 +6154,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
5983
6154
|
});
|
|
5984
6155
|
case 22:
|
|
5985
6156
|
case "end":
|
|
5986
|
-
return
|
|
6157
|
+
return _context62.stop();
|
|
5987
6158
|
}
|
|
5988
|
-
},
|
|
6159
|
+
}, _callee62, this, [[10, 17]]);
|
|
5989
6160
|
}));
|
|
5990
|
-
function handleOrderDraftSubmit(
|
|
6161
|
+
function handleOrderDraftSubmit(_x69) {
|
|
5991
6162
|
return _handleOrderDraftSubmit.apply(this, arguments);
|
|
5992
6163
|
}
|
|
5993
6164
|
return handleOrderDraftSubmit;
|
|
@@ -5995,26 +6166,26 @@ var Server = /*#__PURE__*/function () {
|
|
|
5995
6166
|
}, {
|
|
5996
6167
|
key: "handlePendingSyncCheckoutOrder",
|
|
5997
6168
|
value: function () {
|
|
5998
|
-
var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5999
|
-
var
|
|
6169
|
+
var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
|
|
6170
|
+
var _this13 = this;
|
|
6000
6171
|
var backendPath, data, title, reason, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
|
|
6001
|
-
return _regeneratorRuntime().wrap(function
|
|
6002
|
-
while (1) switch (
|
|
6172
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
6173
|
+
while (1) switch (_context63.prev = _context63.next) {
|
|
6003
6174
|
case 0:
|
|
6004
6175
|
backendPath = params.backendPath, data = params.data, title = params.title, reason = params.reason;
|
|
6005
|
-
|
|
6176
|
+
_context63.next = 3;
|
|
6006
6177
|
return this.buildPendingSyncCheckoutOrder(data);
|
|
6007
6178
|
case 3:
|
|
6008
|
-
pendingOrder =
|
|
6179
|
+
pendingOrder = _context63.sent;
|
|
6009
6180
|
if (pendingOrder) {
|
|
6010
|
-
|
|
6181
|
+
_context63.next = 7;
|
|
6011
6182
|
break;
|
|
6012
6183
|
}
|
|
6013
6184
|
this.logError("".concat(title, ": checkout \u5931\u8D25\u4E14\u8BA2\u5355\u7F3A\u5C11\u672C\u5730\u5B58\u50A8\u6807\u8BC6"), {
|
|
6014
6185
|
backendPath: backendPath,
|
|
6015
6186
|
reason: reason
|
|
6016
6187
|
});
|
|
6017
|
-
return
|
|
6188
|
+
return _context63.abrupt("return", {
|
|
6018
6189
|
code: 500,
|
|
6019
6190
|
status: false,
|
|
6020
6191
|
message: '订单缺少本地存储标识,无法写入待同步队列',
|
|
@@ -6022,22 +6193,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
6022
6193
|
});
|
|
6023
6194
|
case 7:
|
|
6024
6195
|
if (!(!this.order || typeof this.order.upsertPendingSyncOrders !== 'function')) {
|
|
6025
|
-
|
|
6196
|
+
_context63.next = 10;
|
|
6026
6197
|
break;
|
|
6027
6198
|
}
|
|
6028
6199
|
this.logError("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u5F85\u540C\u6B65\u5199\u5165"), {
|
|
6029
6200
|
backendPath: backendPath,
|
|
6030
6201
|
reason: reason
|
|
6031
6202
|
});
|
|
6032
|
-
return
|
|
6203
|
+
return _context63.abrupt("return", {
|
|
6033
6204
|
code: 500,
|
|
6034
6205
|
status: false,
|
|
6035
6206
|
message: 'Order 模块不支持本地待同步写入',
|
|
6036
6207
|
data: null
|
|
6037
6208
|
});
|
|
6038
6209
|
case 10:
|
|
6039
|
-
|
|
6040
|
-
|
|
6210
|
+
_context63.prev = 10;
|
|
6211
|
+
_context63.next = 13;
|
|
6041
6212
|
return this.order.upsertPendingSyncOrders([pendingOrder]);
|
|
6042
6213
|
case 13:
|
|
6043
6214
|
this.logInfo("".concat(title, ": \u8BA2\u5355\u5DF2\u5199\u5165\u672C\u5730\u5F85\u540C\u6B65"), {
|
|
@@ -6049,9 +6220,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
6049
6220
|
});
|
|
6050
6221
|
changeGivenAmount = pendingOrder === null || pendingOrder === void 0 || (_pendingOrder$payment = pendingOrder.payments) === null || _pendingOrder$payment === void 0 ? void 0 : _pendingOrder$payment.reduce(function (sum, payment) {
|
|
6051
6222
|
var _payment$metadata;
|
|
6052
|
-
return sum +
|
|
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);
|
|
6053
6224
|
}, 0);
|
|
6054
|
-
return
|
|
6225
|
+
return _context63.abrupt("return", {
|
|
6055
6226
|
code: 200,
|
|
6056
6227
|
status: true,
|
|
6057
6228
|
message: '',
|
|
@@ -6066,15 +6237,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
6066
6237
|
})
|
|
6067
6238
|
});
|
|
6068
6239
|
case 18:
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
errorMessage =
|
|
6240
|
+
_context63.prev = 18;
|
|
6241
|
+
_context63.t0 = _context63["catch"](10);
|
|
6242
|
+
errorMessage = _context63.t0 instanceof Error ? _context63.t0.message : String(_context63.t0);
|
|
6072
6243
|
this.logError("".concat(title, ": \u5199\u5165\u672C\u5730\u5F85\u540C\u6B65\u8BA2\u5355\u5931\u8D25"), {
|
|
6073
6244
|
backendPath: backendPath,
|
|
6074
6245
|
reason: reason,
|
|
6075
6246
|
error: errorMessage
|
|
6076
6247
|
});
|
|
6077
|
-
return
|
|
6248
|
+
return _context63.abrupt("return", {
|
|
6078
6249
|
code: 500,
|
|
6079
6250
|
status: false,
|
|
6080
6251
|
message: errorMessage,
|
|
@@ -6082,11 +6253,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
6082
6253
|
});
|
|
6083
6254
|
case 23:
|
|
6084
6255
|
case "end":
|
|
6085
|
-
return
|
|
6256
|
+
return _context63.stop();
|
|
6086
6257
|
}
|
|
6087
|
-
},
|
|
6258
|
+
}, _callee63, this, [[10, 18]]);
|
|
6088
6259
|
}));
|
|
6089
|
-
function handlePendingSyncCheckoutOrder(
|
|
6260
|
+
function handlePendingSyncCheckoutOrder(_x70) {
|
|
6090
6261
|
return _handlePendingSyncCheckoutOrder.apply(this, arguments);
|
|
6091
6262
|
}
|
|
6092
6263
|
return handlePendingSyncCheckoutOrder;
|
|
@@ -6094,44 +6265,44 @@ var Server = /*#__PURE__*/function () {
|
|
|
6094
6265
|
}, {
|
|
6095
6266
|
key: "buildPendingSyncCheckoutOrder",
|
|
6096
6267
|
value: function () {
|
|
6097
|
-
var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6268
|
+
var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(data) {
|
|
6098
6269
|
var hasStorageKey, pendingOrder, productMap, orderWithProductTitles;
|
|
6099
|
-
return _regeneratorRuntime().wrap(function
|
|
6100
|
-
while (1) switch (
|
|
6270
|
+
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
|
6271
|
+
while (1) switch (_context64.prev = _context64.next) {
|
|
6101
6272
|
case 0:
|
|
6102
6273
|
if (!(!data || _typeof(data) !== 'object')) {
|
|
6103
|
-
|
|
6274
|
+
_context64.next = 2;
|
|
6104
6275
|
break;
|
|
6105
6276
|
}
|
|
6106
|
-
return
|
|
6277
|
+
return _context64.abrupt("return", null);
|
|
6107
6278
|
case 2:
|
|
6108
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 !== '';
|
|
6109
6280
|
if (hasStorageKey) {
|
|
6110
|
-
|
|
6281
|
+
_context64.next = 5;
|
|
6111
6282
|
break;
|
|
6112
6283
|
}
|
|
6113
|
-
return
|
|
6284
|
+
return _context64.abrupt("return", null);
|
|
6114
6285
|
case 5:
|
|
6115
6286
|
pendingOrder = _objectSpread(_objectSpread({}, data), {}, {
|
|
6116
6287
|
need_sync: 1,
|
|
6117
6288
|
is_draft_order: 0
|
|
6118
6289
|
});
|
|
6119
|
-
|
|
6290
|
+
_context64.next = 8;
|
|
6120
6291
|
return this.buildSmallTicketProductMap(pendingOrder);
|
|
6121
6292
|
case 8:
|
|
6122
|
-
productMap =
|
|
6293
|
+
productMap = _context64.sent;
|
|
6123
6294
|
orderWithProductTitles = this.withPendingSyncProductTitles(pendingOrder, productMap);
|
|
6124
|
-
return
|
|
6295
|
+
return _context64.abrupt("return", this.withLocalSmallTicketData(orderWithProductTitles, {
|
|
6125
6296
|
requireFullyPaid: true,
|
|
6126
6297
|
productMap: productMap
|
|
6127
6298
|
}));
|
|
6128
6299
|
case 11:
|
|
6129
6300
|
case "end":
|
|
6130
|
-
return
|
|
6301
|
+
return _context64.stop();
|
|
6131
6302
|
}
|
|
6132
|
-
},
|
|
6303
|
+
}, _callee64, this);
|
|
6133
6304
|
}));
|
|
6134
|
-
function buildPendingSyncCheckoutOrder(
|
|
6305
|
+
function buildPendingSyncCheckoutOrder(_x71) {
|
|
6135
6306
|
return _buildPendingSyncCheckoutOrder.apply(this, arguments);
|
|
6136
6307
|
}
|
|
6137
6308
|
return buildPendingSyncCheckoutOrder;
|
|
@@ -6144,7 +6315,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6144
6315
|
value: function shouldAutoPrintCheckoutReceipt() {
|
|
6145
6316
|
var _this$core$context2, _this$core$context2$g, _this$app17, _this$app17$getStorag;
|
|
6146
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;
|
|
6147
|
-
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))
|
|
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';
|
|
6148
6319
|
}
|
|
6149
6320
|
}, {
|
|
6150
6321
|
key: "shouldBuildSmallTicketData",
|
|
@@ -6189,13 +6360,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6189
6360
|
}, {
|
|
6190
6361
|
key: "sumPaidOrderPayments",
|
|
6191
6362
|
value: function sumPaidOrderPayments(payments) {
|
|
6192
|
-
var
|
|
6363
|
+
var _this14 = this;
|
|
6193
6364
|
if (!Array.isArray(payments)) return 0;
|
|
6194
6365
|
return payments.reduce(function (sum, payment) {
|
|
6195
6366
|
var _payment$amount;
|
|
6196
6367
|
var status = String((payment === null || payment === void 0 ? void 0 : payment.status) || '').toLowerCase();
|
|
6197
6368
|
if (status !== 'paid') return sum;
|
|
6198
|
-
return sum +
|
|
6369
|
+
return sum + _this14.toAmountNumber((_payment$amount = payment === null || payment === void 0 ? void 0 : payment.amount) !== null && _payment$amount !== void 0 ? _payment$amount : payment === null || payment === void 0 ? void 0 : payment.origin_amount);
|
|
6199
6370
|
}, 0);
|
|
6200
6371
|
}
|
|
6201
6372
|
}, {
|
|
@@ -6209,12 +6380,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
6209
6380
|
}, {
|
|
6210
6381
|
key: "buildSmallTicketProductMap",
|
|
6211
6382
|
value: function () {
|
|
6212
|
-
var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6383
|
+
var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(order) {
|
|
6213
6384
|
var _this$products3,
|
|
6214
|
-
|
|
6385
|
+
_this15 = this;
|
|
6215
6386
|
var products, productIdSet, productIds, entries;
|
|
6216
|
-
return _regeneratorRuntime().wrap(function
|
|
6217
|
-
while (1) switch (
|
|
6387
|
+
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
|
6388
|
+
while (1) switch (_context66.prev = _context66.next) {
|
|
6218
6389
|
case 0:
|
|
6219
6390
|
products = Array.isArray(order === null || order === void 0 ? void 0 : order.products) ? order.products : [];
|
|
6220
6391
|
productIdSet = new Set();
|
|
@@ -6236,45 +6407,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
6236
6407
|
});
|
|
6237
6408
|
productIds = Array.from(productIdSet);
|
|
6238
6409
|
if (!(!productIds.length || typeof ((_this$products3 = this.products) === null || _this$products3 === void 0 ? void 0 : _this$products3.getProductById) !== 'function')) {
|
|
6239
|
-
|
|
6410
|
+
_context66.next = 6;
|
|
6240
6411
|
break;
|
|
6241
6412
|
}
|
|
6242
|
-
return
|
|
6413
|
+
return _context66.abrupt("return", {});
|
|
6243
6414
|
case 6:
|
|
6244
|
-
|
|
6415
|
+
_context66.next = 8;
|
|
6245
6416
|
return Promise.all(productIds.map( /*#__PURE__*/function () {
|
|
6246
|
-
var _ref68 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6247
|
-
var
|
|
6248
|
-
return _regeneratorRuntime().wrap(function
|
|
6249
|
-
while (1) switch (
|
|
6417
|
+
var _ref68 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(id) {
|
|
6418
|
+
var _this15$products, _this15$products$getP, product;
|
|
6419
|
+
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
|
6420
|
+
while (1) switch (_context65.prev = _context65.next) {
|
|
6250
6421
|
case 0:
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
return (
|
|
6422
|
+
_context65.prev = 0;
|
|
6423
|
+
_context65.next = 3;
|
|
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));
|
|
6254
6425
|
case 3:
|
|
6255
|
-
product =
|
|
6256
|
-
return
|
|
6426
|
+
product = _context65.sent;
|
|
6427
|
+
return _context65.abrupt("return", product ? [String(id), product] : null);
|
|
6257
6428
|
case 7:
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6429
|
+
_context65.prev = 7;
|
|
6430
|
+
_context65.t0 = _context65["catch"](0);
|
|
6431
|
+
_this15.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
|
|
6261
6432
|
product_id: id,
|
|
6262
|
-
error:
|
|
6433
|
+
error: _context65.t0 instanceof Error ? _context65.t0.message : String(_context65.t0)
|
|
6263
6434
|
});
|
|
6264
|
-
return
|
|
6435
|
+
return _context65.abrupt("return", null);
|
|
6265
6436
|
case 11:
|
|
6266
6437
|
case "end":
|
|
6267
|
-
return
|
|
6438
|
+
return _context65.stop();
|
|
6268
6439
|
}
|
|
6269
|
-
},
|
|
6440
|
+
}, _callee65, null, [[0, 7]]);
|
|
6270
6441
|
}));
|
|
6271
|
-
return function (
|
|
6442
|
+
return function (_x73) {
|
|
6272
6443
|
return _ref68.apply(this, arguments);
|
|
6273
6444
|
};
|
|
6274
6445
|
}()));
|
|
6275
6446
|
case 8:
|
|
6276
|
-
entries =
|
|
6277
|
-
return
|
|
6447
|
+
entries = _context66.sent;
|
|
6448
|
+
return _context66.abrupt("return", entries.reduce(function (map, entry) {
|
|
6278
6449
|
if (!entry) return map;
|
|
6279
6450
|
var _entry = _slicedToArray(entry, 2),
|
|
6280
6451
|
id = _entry[0],
|
|
@@ -6284,11 +6455,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
6284
6455
|
}, {}));
|
|
6285
6456
|
case 10:
|
|
6286
6457
|
case "end":
|
|
6287
|
-
return
|
|
6458
|
+
return _context66.stop();
|
|
6288
6459
|
}
|
|
6289
|
-
},
|
|
6460
|
+
}, _callee66, this);
|
|
6290
6461
|
}));
|
|
6291
|
-
function buildSmallTicketProductMap(
|
|
6462
|
+
function buildSmallTicketProductMap(_x72) {
|
|
6292
6463
|
return _buildSmallTicketProductMap.apply(this, arguments);
|
|
6293
6464
|
}
|
|
6294
6465
|
return buildSmallTicketProductMap;
|
|
@@ -6318,40 +6489,40 @@ var Server = /*#__PURE__*/function () {
|
|
|
6318
6489
|
}, {
|
|
6319
6490
|
key: "buildSalesDetailProductSnapshotMap",
|
|
6320
6491
|
value: function () {
|
|
6321
|
-
var _buildSalesDetailProductSnapshotMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6492
|
+
var _buildSalesDetailProductSnapshotMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(order) {
|
|
6322
6493
|
var _this$products4;
|
|
6323
6494
|
var productIds, getSnapshots;
|
|
6324
|
-
return _regeneratorRuntime().wrap(function
|
|
6325
|
-
while (1) switch (
|
|
6495
|
+
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
|
6496
|
+
while (1) switch (_context67.prev = _context67.next) {
|
|
6326
6497
|
case 0:
|
|
6327
6498
|
productIds = this.collectSalesDetailProductIds(order);
|
|
6328
6499
|
getSnapshots = (_this$products4 = this.products) === null || _this$products4 === void 0 ? void 0 : _this$products4.getProductSnapshotsByIds;
|
|
6329
6500
|
if (!(!productIds.length || typeof getSnapshots !== 'function')) {
|
|
6330
|
-
|
|
6501
|
+
_context67.next = 4;
|
|
6331
6502
|
break;
|
|
6332
6503
|
}
|
|
6333
|
-
return
|
|
6504
|
+
return _context67.abrupt("return", {});
|
|
6334
6505
|
case 4:
|
|
6335
|
-
|
|
6336
|
-
|
|
6506
|
+
_context67.prev = 4;
|
|
6507
|
+
_context67.next = 7;
|
|
6337
6508
|
return getSnapshots.call(this.products, productIds);
|
|
6338
6509
|
case 7:
|
|
6339
|
-
return
|
|
6510
|
+
return _context67.abrupt("return", _context67.sent);
|
|
6340
6511
|
case 10:
|
|
6341
|
-
|
|
6342
|
-
|
|
6512
|
+
_context67.prev = 10;
|
|
6513
|
+
_context67.t0 = _context67["catch"](4);
|
|
6343
6514
|
this.logWarning('buildSalesDetailProductSnapshotMap: 查询本地商品快照失败', {
|
|
6344
6515
|
product_ids: productIds,
|
|
6345
|
-
error:
|
|
6516
|
+
error: _context67.t0 instanceof Error ? _context67.t0.message : String(_context67.t0)
|
|
6346
6517
|
});
|
|
6347
|
-
return
|
|
6518
|
+
return _context67.abrupt("return", {});
|
|
6348
6519
|
case 14:
|
|
6349
6520
|
case "end":
|
|
6350
|
-
return
|
|
6521
|
+
return _context67.stop();
|
|
6351
6522
|
}
|
|
6352
|
-
},
|
|
6523
|
+
}, _callee67, this, [[4, 10]]);
|
|
6353
6524
|
}));
|
|
6354
|
-
function buildSalesDetailProductSnapshotMap(
|
|
6525
|
+
function buildSalesDetailProductSnapshotMap(_x74) {
|
|
6355
6526
|
return _buildSalesDetailProductSnapshotMap.apply(this, arguments);
|
|
6356
6527
|
}
|
|
6357
6528
|
return buildSalesDetailProductSnapshotMap;
|
|
@@ -6407,53 +6578,53 @@ var Server = /*#__PURE__*/function () {
|
|
|
6407
6578
|
}, {
|
|
6408
6579
|
key: "withSalesDetailProductSnapshots",
|
|
6409
6580
|
value: function () {
|
|
6410
|
-
var _withSalesDetailProductSnapshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6411
|
-
var
|
|
6581
|
+
var _withSalesDetailProductSnapshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(order) {
|
|
6582
|
+
var _this16 = this;
|
|
6412
6583
|
var products, snapshotMap, hasChanged, enrichedProducts, enrichedOrder;
|
|
6413
|
-
return _regeneratorRuntime().wrap(function
|
|
6414
|
-
while (1) switch (
|
|
6584
|
+
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
|
6585
|
+
while (1) switch (_context68.prev = _context68.next) {
|
|
6415
6586
|
case 0:
|
|
6416
6587
|
products = Array.isArray(order === null || order === void 0 ? void 0 : order.products) ? order.products : null;
|
|
6417
6588
|
if (products !== null && products !== void 0 && products.length) {
|
|
6418
|
-
|
|
6589
|
+
_context68.next = 3;
|
|
6419
6590
|
break;
|
|
6420
6591
|
}
|
|
6421
|
-
return
|
|
6592
|
+
return _context68.abrupt("return", order);
|
|
6422
6593
|
case 3:
|
|
6423
|
-
|
|
6594
|
+
_context68.next = 5;
|
|
6424
6595
|
return this.buildSalesDetailProductSnapshotMap(order);
|
|
6425
6596
|
case 5:
|
|
6426
|
-
snapshotMap =
|
|
6597
|
+
snapshotMap = _context68.sent;
|
|
6427
6598
|
if (Object.keys(snapshotMap).length) {
|
|
6428
|
-
|
|
6599
|
+
_context68.next = 8;
|
|
6429
6600
|
break;
|
|
6430
6601
|
}
|
|
6431
|
-
return
|
|
6602
|
+
return _context68.abrupt("return", order);
|
|
6432
6603
|
case 8:
|
|
6433
6604
|
hasChanged = false;
|
|
6434
6605
|
enrichedProducts = products.map(function (product) {
|
|
6435
|
-
var productWithBundleSnapshots =
|
|
6436
|
-
var nextProduct =
|
|
6606
|
+
var productWithBundleSnapshots = _this16.withBundleCatalogSnapshots(product, snapshotMap);
|
|
6607
|
+
var nextProduct = _this16.withProductCatalogSnapshots(productWithBundleSnapshots, snapshotMap);
|
|
6437
6608
|
if (nextProduct !== product) hasChanged = true;
|
|
6438
6609
|
return nextProduct;
|
|
6439
6610
|
});
|
|
6440
6611
|
if (hasChanged) {
|
|
6441
|
-
|
|
6612
|
+
_context68.next = 12;
|
|
6442
6613
|
break;
|
|
6443
6614
|
}
|
|
6444
|
-
return
|
|
6615
|
+
return _context68.abrupt("return", order);
|
|
6445
6616
|
case 12:
|
|
6446
6617
|
enrichedOrder = _objectSpread(_objectSpread({}, order), {}, {
|
|
6447
6618
|
products: enrichedProducts
|
|
6448
6619
|
});
|
|
6449
|
-
return
|
|
6620
|
+
return _context68.abrupt("return", enrichedOrder);
|
|
6450
6621
|
case 14:
|
|
6451
6622
|
case "end":
|
|
6452
|
-
return
|
|
6623
|
+
return _context68.stop();
|
|
6453
6624
|
}
|
|
6454
|
-
},
|
|
6625
|
+
}, _callee68, this);
|
|
6455
6626
|
}));
|
|
6456
|
-
function withSalesDetailProductSnapshots(
|
|
6627
|
+
function withSalesDetailProductSnapshots(_x75) {
|
|
6457
6628
|
return _withSalesDetailProductSnapshots.apply(this, arguments);
|
|
6458
6629
|
}
|
|
6459
6630
|
return withSalesDetailProductSnapshots;
|
|
@@ -6461,13 +6632,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6461
6632
|
}, {
|
|
6462
6633
|
key: "withPendingSyncProductTitles",
|
|
6463
6634
|
value: function withPendingSyncProductTitles(order, productMap) {
|
|
6464
|
-
var
|
|
6635
|
+
var _this17 = this;
|
|
6465
6636
|
var products = Array.isArray(order.products) ? order.products : null;
|
|
6466
6637
|
if (!(products !== null && products !== void 0 && products.length)) return order;
|
|
6467
6638
|
return _objectSpread(_objectSpread({}, order), {}, {
|
|
6468
6639
|
products: products.map(function (product) {
|
|
6469
6640
|
return _objectSpread(_objectSpread({}, product), {}, {
|
|
6470
|
-
product_title:
|
|
6641
|
+
product_title: _this17.buildProductTitleSnapshot(product, productMap)
|
|
6471
6642
|
});
|
|
6472
6643
|
})
|
|
6473
6644
|
});
|
|
@@ -6478,7 +6649,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6478
6649
|
var _product$product_id4,
|
|
6479
6650
|
_product$product,
|
|
6480
6651
|
_fallbackProduct$prod,
|
|
6481
|
-
|
|
6652
|
+
_this18 = this;
|
|
6482
6653
|
var productId = (_product$product_id4 = product.product_id) !== null && _product$product_id4 !== void 0 ? _product$product_id4 : product.id;
|
|
6483
6654
|
var fallbackProduct = productId !== undefined && productId !== null ? productMap[productId] || productMap[String(productId)] : null;
|
|
6484
6655
|
var ownTitle = product.product_title || product.title || product.name || ((_product$product = product.product) === null || _product$product === void 0 ? void 0 : _product$product.title);
|
|
@@ -6486,7 +6657,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6486
6657
|
var currentLocale = this.getProductTitleSnapshotCurrentLocale();
|
|
6487
6658
|
var autoTitle = this.resolveFirstProductTitleValue(ownTitle) || this.resolveFirstProductTitleValue(fallbackTitle);
|
|
6488
6659
|
return PRODUCT_TITLE_SNAPSHOT_KEYS.reduce(function (snapshot, key) {
|
|
6489
|
-
snapshot[key] =
|
|
6660
|
+
snapshot[key] = _this18.resolveProductTitleValue(ownTitle, key, currentLocale) || _this18.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === 'auto' || key === 'original' ? autoTitle : null);
|
|
6490
6661
|
return snapshot;
|
|
6491
6662
|
}, {});
|
|
6492
6663
|
}
|
|
@@ -6584,50 +6755,50 @@ var Server = /*#__PURE__*/function () {
|
|
|
6584
6755
|
}, {
|
|
6585
6756
|
key: "enrichPaymentNamesByCode",
|
|
6586
6757
|
value: function () {
|
|
6587
|
-
var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6588
|
-
var
|
|
6589
|
-
var payments, hasMissingName, paymentModule, payMethods, nameByCode,
|
|
6590
|
-
return _regeneratorRuntime().wrap(function
|
|
6591
|
-
while (1) switch (
|
|
6758
|
+
var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(order) {
|
|
6759
|
+
var _this19 = this;
|
|
6760
|
+
var payments, hasMissingName, paymentModule, payMethods, nameByCode, _iterator12, _step12, method, codeKey, name, hasResolvedName, enrichedPayments;
|
|
6761
|
+
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
|
6762
|
+
while (1) switch (_context69.prev = _context69.next) {
|
|
6592
6763
|
case 0:
|
|
6593
6764
|
payments = Array.isArray(order === null || order === void 0 ? void 0 : order.payments) ? order.payments : [];
|
|
6594
6765
|
hasMissingName = payments.some(function (payment) {
|
|
6595
|
-
return
|
|
6766
|
+
return _this19.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this19.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
|
|
6596
6767
|
});
|
|
6597
6768
|
if (hasMissingName) {
|
|
6598
|
-
|
|
6769
|
+
_context69.next = 4;
|
|
6599
6770
|
break;
|
|
6600
6771
|
}
|
|
6601
|
-
return
|
|
6772
|
+
return _context69.abrupt("return", order);
|
|
6602
6773
|
case 4:
|
|
6603
|
-
|
|
6604
|
-
|
|
6774
|
+
_context69.prev = 4;
|
|
6775
|
+
_context69.next = 7;
|
|
6605
6776
|
return this.getPaymentRouteModule();
|
|
6606
6777
|
case 7:
|
|
6607
|
-
paymentModule =
|
|
6608
|
-
|
|
6778
|
+
paymentModule = _context69.sent;
|
|
6779
|
+
_context69.next = 10;
|
|
6609
6780
|
return paymentModule.getPayMethodListAsync();
|
|
6610
6781
|
case 10:
|
|
6611
|
-
payMethods =
|
|
6782
|
+
payMethods = _context69.sent;
|
|
6612
6783
|
nameByCode = new Map();
|
|
6613
|
-
|
|
6784
|
+
_iterator12 = _createForOfIteratorHelper(payMethods || []);
|
|
6614
6785
|
try {
|
|
6615
|
-
for (
|
|
6616
|
-
method =
|
|
6786
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
6787
|
+
method = _step12.value;
|
|
6617
6788
|
codeKey = this.getPaymentCodeKey(method === null || method === void 0 ? void 0 : method.code);
|
|
6618
6789
|
name = this.resolveFirstProductTitleValue(method === null || method === void 0 ? void 0 : method.name);
|
|
6619
6790
|
if (codeKey && name) nameByCode.set(codeKey, name);
|
|
6620
6791
|
}
|
|
6621
6792
|
} catch (err) {
|
|
6622
|
-
|
|
6793
|
+
_iterator12.e(err);
|
|
6623
6794
|
} finally {
|
|
6624
|
-
|
|
6795
|
+
_iterator12.f();
|
|
6625
6796
|
}
|
|
6626
6797
|
hasResolvedName = false;
|
|
6627
6798
|
enrichedPayments = payments.map(function (payment) {
|
|
6628
|
-
if (!
|
|
6629
|
-
if (!
|
|
6630
|
-
var name = nameByCode.get(
|
|
6799
|
+
if (!_this19.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name)) return payment;
|
|
6800
|
+
if (!_this19.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code)) return payment;
|
|
6801
|
+
var name = nameByCode.get(_this19.getPaymentCodeKey(payment === null || payment === void 0 ? void 0 : payment.code));
|
|
6631
6802
|
if (!name) return payment;
|
|
6632
6803
|
hasResolvedName = true;
|
|
6633
6804
|
return _objectSpread(_objectSpread({}, payment), {}, {
|
|
@@ -6635,28 +6806,28 @@ var Server = /*#__PURE__*/function () {
|
|
|
6635
6806
|
});
|
|
6636
6807
|
});
|
|
6637
6808
|
if (hasResolvedName) {
|
|
6638
|
-
|
|
6809
|
+
_context69.next = 18;
|
|
6639
6810
|
break;
|
|
6640
6811
|
}
|
|
6641
|
-
return
|
|
6812
|
+
return _context69.abrupt("return", order);
|
|
6642
6813
|
case 18:
|
|
6643
|
-
return
|
|
6814
|
+
return _context69.abrupt("return", _objectSpread(_objectSpread({}, order), {}, {
|
|
6644
6815
|
payments: enrichedPayments
|
|
6645
6816
|
}));
|
|
6646
6817
|
case 21:
|
|
6647
|
-
|
|
6648
|
-
|
|
6818
|
+
_context69.prev = 21;
|
|
6819
|
+
_context69.t0 = _context69["catch"](4);
|
|
6649
6820
|
this.logWarning('enrichPaymentNamesByCode: 支付方式名称回填失败', {
|
|
6650
|
-
error:
|
|
6821
|
+
error: _context69.t0 instanceof Error ? _context69.t0.message : String(_context69.t0)
|
|
6651
6822
|
});
|
|
6652
|
-
return
|
|
6823
|
+
return _context69.abrupt("return", order);
|
|
6653
6824
|
case 25:
|
|
6654
6825
|
case "end":
|
|
6655
|
-
return
|
|
6826
|
+
return _context69.stop();
|
|
6656
6827
|
}
|
|
6657
|
-
},
|
|
6828
|
+
}, _callee69, this, [[4, 21]]);
|
|
6658
6829
|
}));
|
|
6659
|
-
function enrichPaymentNamesByCode(
|
|
6830
|
+
function enrichPaymentNamesByCode(_x76) {
|
|
6660
6831
|
return _enrichPaymentNamesByCode.apply(this, arguments);
|
|
6661
6832
|
}
|
|
6662
6833
|
return enrichPaymentNamesByCode;
|
|
@@ -6664,66 +6835,66 @@ var Server = /*#__PURE__*/function () {
|
|
|
6664
6835
|
}, {
|
|
6665
6836
|
key: "withLocalSmallTicketData",
|
|
6666
6837
|
value: function () {
|
|
6667
|
-
var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6838
|
+
var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(order, options) {
|
|
6668
6839
|
var _options$productMap, enrichedOrder, productMap, smallTicketData;
|
|
6669
|
-
return _regeneratorRuntime().wrap(function
|
|
6670
|
-
while (1) switch (
|
|
6840
|
+
return _regeneratorRuntime().wrap(function _callee70$(_context70) {
|
|
6841
|
+
while (1) switch (_context70.prev = _context70.next) {
|
|
6671
6842
|
case 0:
|
|
6672
6843
|
if (this.shouldBuildSmallTicketData(order)) {
|
|
6673
|
-
|
|
6844
|
+
_context70.next = 2;
|
|
6674
6845
|
break;
|
|
6675
6846
|
}
|
|
6676
|
-
return
|
|
6847
|
+
return _context70.abrupt("return", order);
|
|
6677
6848
|
case 2:
|
|
6678
6849
|
if (!(options !== null && options !== void 0 && options.requireFullyPaid && !this.isSalesOrderFullyPaid(order))) {
|
|
6679
|
-
|
|
6850
|
+
_context70.next = 4;
|
|
6680
6851
|
break;
|
|
6681
6852
|
}
|
|
6682
|
-
return
|
|
6853
|
+
return _context70.abrupt("return", order);
|
|
6683
6854
|
case 4:
|
|
6684
|
-
|
|
6685
|
-
|
|
6855
|
+
_context70.prev = 4;
|
|
6856
|
+
_context70.next = 7;
|
|
6686
6857
|
return this.enrichPaymentNamesByCode(order);
|
|
6687
6858
|
case 7:
|
|
6688
|
-
enrichedOrder =
|
|
6859
|
+
enrichedOrder = _context70.sent;
|
|
6689
6860
|
if (!((_options$productMap = options === null || options === void 0 ? void 0 : options.productMap) !== null && _options$productMap !== void 0)) {
|
|
6690
|
-
|
|
6861
|
+
_context70.next = 12;
|
|
6691
6862
|
break;
|
|
6692
6863
|
}
|
|
6693
|
-
|
|
6694
|
-
|
|
6864
|
+
_context70.t0 = _options$productMap;
|
|
6865
|
+
_context70.next = 15;
|
|
6695
6866
|
break;
|
|
6696
6867
|
case 12:
|
|
6697
|
-
|
|
6868
|
+
_context70.next = 14;
|
|
6698
6869
|
return this.buildSmallTicketProductMap(enrichedOrder);
|
|
6699
6870
|
case 14:
|
|
6700
|
-
|
|
6871
|
+
_context70.t0 = _context70.sent;
|
|
6701
6872
|
case 15:
|
|
6702
|
-
productMap =
|
|
6873
|
+
productMap = _context70.t0;
|
|
6703
6874
|
smallTicketData = buildSmallTicketData({
|
|
6704
6875
|
order: enrichedOrder,
|
|
6705
6876
|
shopInfo: this.getSmallTicketShopInfo(),
|
|
6706
6877
|
productMap: productMap
|
|
6707
6878
|
});
|
|
6708
|
-
return
|
|
6879
|
+
return _context70.abrupt("return", _objectSpread(_objectSpread({}, enrichedOrder), {}, {
|
|
6709
6880
|
payment_info: _objectSpread(_objectSpread({}, enrichedOrder.payment_info || {}), {}, {
|
|
6710
6881
|
small_ticket_data: smallTicketData
|
|
6711
6882
|
})
|
|
6712
6883
|
}));
|
|
6713
6884
|
case 20:
|
|
6714
|
-
|
|
6715
|
-
|
|
6885
|
+
_context70.prev = 20;
|
|
6886
|
+
_context70.t1 = _context70["catch"](4);
|
|
6716
6887
|
this.logError('withLocalSmallTicketData: 生成本地小票数据失败', {
|
|
6717
|
-
error:
|
|
6888
|
+
error: _context70.t1 instanceof Error ? _context70.t1.message : String(_context70.t1)
|
|
6718
6889
|
});
|
|
6719
|
-
return
|
|
6890
|
+
return _context70.abrupt("return", order);
|
|
6720
6891
|
case 24:
|
|
6721
6892
|
case "end":
|
|
6722
|
-
return
|
|
6893
|
+
return _context70.stop();
|
|
6723
6894
|
}
|
|
6724
|
-
},
|
|
6895
|
+
}, _callee70, this, [[4, 20]]);
|
|
6725
6896
|
}));
|
|
6726
|
-
function withLocalSmallTicketData(
|
|
6897
|
+
function withLocalSmallTicketData(_x77, _x78) {
|
|
6727
6898
|
return _withLocalSmallTicketData.apply(this, arguments);
|
|
6728
6899
|
}
|
|
6729
6900
|
return withLocalSmallTicketData;
|
|
@@ -6785,22 +6956,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
6785
6956
|
}, {
|
|
6786
6957
|
key: "handleUpdateLocalOrdersBatch",
|
|
6787
6958
|
value: (function () {
|
|
6788
|
-
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6959
|
+
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(orderIds) {
|
|
6789
6960
|
var _this$app18;
|
|
6790
|
-
var existedBefore,
|
|
6791
|
-
return _regeneratorRuntime().wrap(function
|
|
6792
|
-
while (1) switch (
|
|
6961
|
+
var existedBefore, _iterator13, _step13, id, fetched, message, fetchedMap, _iterator14, _step14, order, oid, freshOrders, succeedIds, failed, _iterator15, _step15, _id, fresh, _message2, overwritten, inserted;
|
|
6962
|
+
return _regeneratorRuntime().wrap(function _callee71$(_context71) {
|
|
6963
|
+
while (1) switch (_context71.prev = _context71.next) {
|
|
6793
6964
|
case 0:
|
|
6794
6965
|
this.logInfo('handleUpdateLocalOrdersBatch: 开始处理', {
|
|
6795
6966
|
count: orderIds.length,
|
|
6796
6967
|
orderIds: orderIds
|
|
6797
6968
|
});
|
|
6798
6969
|
if (this.order) {
|
|
6799
|
-
|
|
6970
|
+
_context71.next = 4;
|
|
6800
6971
|
break;
|
|
6801
6972
|
}
|
|
6802
6973
|
this.logError('handleUpdateLocalOrdersBatch: Order 模块未注册');
|
|
6803
|
-
return
|
|
6974
|
+
return _context71.abrupt("return", {
|
|
6804
6975
|
code: 500,
|
|
6805
6976
|
status: false,
|
|
6806
6977
|
message: 'Order 模块未注册',
|
|
@@ -6808,11 +6979,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
6808
6979
|
});
|
|
6809
6980
|
case 4:
|
|
6810
6981
|
if ((_this$app18 = this.app) !== null && _this$app18 !== void 0 && _this$app18.request) {
|
|
6811
|
-
|
|
6982
|
+
_context71.next = 7;
|
|
6812
6983
|
break;
|
|
6813
6984
|
}
|
|
6814
6985
|
this.logError('handleUpdateLocalOrdersBatch: app.request 不可用');
|
|
6815
|
-
return
|
|
6986
|
+
return _context71.abrupt("return", {
|
|
6816
6987
|
code: 500,
|
|
6817
6988
|
status: false,
|
|
6818
6989
|
message: 'app.request 不可用',
|
|
@@ -6821,35 +6992,35 @@ var Server = /*#__PURE__*/function () {
|
|
|
6821
6992
|
case 7:
|
|
6822
6993
|
// 拉取前先记录"本地是否已存在",用于区分 overwritten / inserted
|
|
6823
6994
|
existedBefore = new Map();
|
|
6824
|
-
|
|
6995
|
+
_iterator13 = _createForOfIteratorHelper(orderIds);
|
|
6825
6996
|
try {
|
|
6826
|
-
for (
|
|
6827
|
-
id =
|
|
6997
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
6998
|
+
id = _step13.value;
|
|
6828
6999
|
existedBefore.set(id, !!this.order.getOrderByOrderId(id));
|
|
6829
7000
|
}
|
|
6830
7001
|
|
|
6831
7002
|
// 走 orderDataSource 的批量 HTTP 通道,一次请求拉回多笔详情
|
|
6832
7003
|
} catch (err) {
|
|
6833
|
-
|
|
7004
|
+
_iterator13.e(err);
|
|
6834
7005
|
} finally {
|
|
6835
|
-
|
|
7006
|
+
_iterator13.f();
|
|
6836
7007
|
}
|
|
6837
7008
|
fetched = [];
|
|
6838
|
-
|
|
6839
|
-
|
|
7009
|
+
_context71.prev = 11;
|
|
7010
|
+
_context71.next = 14;
|
|
6840
7011
|
return this.order.fetchOrdersByHttp(orderIds);
|
|
6841
7012
|
case 14:
|
|
6842
|
-
fetched =
|
|
6843
|
-
|
|
7013
|
+
fetched = _context71.sent;
|
|
7014
|
+
_context71.next = 22;
|
|
6844
7015
|
break;
|
|
6845
7016
|
case 17:
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
message =
|
|
7017
|
+
_context71.prev = 17;
|
|
7018
|
+
_context71.t0 = _context71["catch"](11);
|
|
7019
|
+
message = _context71.t0 instanceof Error ? _context71.t0.message : String(_context71.t0);
|
|
6849
7020
|
this.logError('handleUpdateLocalOrdersBatch: 批量拉取失败', {
|
|
6850
7021
|
message: message
|
|
6851
7022
|
});
|
|
6852
|
-
return
|
|
7023
|
+
return _context71.abrupt("return", {
|
|
6853
7024
|
code: 500,
|
|
6854
7025
|
status: false,
|
|
6855
7026
|
message: message,
|
|
@@ -6858,45 +7029,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
6858
7029
|
case 22:
|
|
6859
7030
|
// 按返回结果中的 order_id 建索引,未命中即视为单笔失败
|
|
6860
7031
|
fetchedMap = new Map();
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
7032
|
+
_iterator14 = _createForOfIteratorHelper(fetched);
|
|
7033
|
+
_context71.prev = 24;
|
|
7034
|
+
_iterator14.s();
|
|
6864
7035
|
case 26:
|
|
6865
|
-
if ((
|
|
6866
|
-
|
|
7036
|
+
if ((_step14 = _iterator14.n()).done) {
|
|
7037
|
+
_context71.next = 34;
|
|
6867
7038
|
break;
|
|
6868
7039
|
}
|
|
6869
|
-
order =
|
|
7040
|
+
order = _step14.value;
|
|
6870
7041
|
oid = order === null || order === void 0 ? void 0 : order.order_id;
|
|
6871
7042
|
if (!(oid === undefined || oid === null)) {
|
|
6872
|
-
|
|
7043
|
+
_context71.next = 31;
|
|
6873
7044
|
break;
|
|
6874
7045
|
}
|
|
6875
|
-
return
|
|
7046
|
+
return _context71.abrupt("continue", 32);
|
|
6876
7047
|
case 31:
|
|
6877
7048
|
fetchedMap.set(String(oid), order);
|
|
6878
7049
|
case 32:
|
|
6879
|
-
|
|
7050
|
+
_context71.next = 26;
|
|
6880
7051
|
break;
|
|
6881
7052
|
case 34:
|
|
6882
|
-
|
|
7053
|
+
_context71.next = 39;
|
|
6883
7054
|
break;
|
|
6884
7055
|
case 36:
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
7056
|
+
_context71.prev = 36;
|
|
7057
|
+
_context71.t1 = _context71["catch"](24);
|
|
7058
|
+
_iterator14.e(_context71.t1);
|
|
6888
7059
|
case 39:
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
return
|
|
7060
|
+
_context71.prev = 39;
|
|
7061
|
+
_iterator14.f();
|
|
7062
|
+
return _context71.finish(39);
|
|
6892
7063
|
case 42:
|
|
6893
7064
|
freshOrders = [];
|
|
6894
7065
|
succeedIds = [];
|
|
6895
7066
|
failed = [];
|
|
6896
|
-
|
|
7067
|
+
_iterator15 = _createForOfIteratorHelper(orderIds);
|
|
6897
7068
|
try {
|
|
6898
|
-
for (
|
|
6899
|
-
_id =
|
|
7069
|
+
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
|
7070
|
+
_id = _step15.value;
|
|
6900
7071
|
fresh = fetchedMap.get(_id);
|
|
6901
7072
|
if (fresh) {
|
|
6902
7073
|
freshOrders.push(fresh);
|
|
@@ -6909,28 +7080,28 @@ var Server = /*#__PURE__*/function () {
|
|
|
6909
7080
|
}
|
|
6910
7081
|
}
|
|
6911
7082
|
} catch (err) {
|
|
6912
|
-
|
|
7083
|
+
_iterator15.e(err);
|
|
6913
7084
|
} finally {
|
|
6914
|
-
|
|
7085
|
+
_iterator15.f();
|
|
6915
7086
|
}
|
|
6916
7087
|
if (!(freshOrders.length > 0)) {
|
|
6917
|
-
|
|
7088
|
+
_context71.next = 58;
|
|
6918
7089
|
break;
|
|
6919
7090
|
}
|
|
6920
|
-
|
|
6921
|
-
|
|
7091
|
+
_context71.prev = 48;
|
|
7092
|
+
_context71.next = 51;
|
|
6922
7093
|
return this.order.upsertOrdersFromRemote(freshOrders);
|
|
6923
7094
|
case 51:
|
|
6924
|
-
|
|
7095
|
+
_context71.next = 58;
|
|
6925
7096
|
break;
|
|
6926
7097
|
case 53:
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
_message2 =
|
|
7098
|
+
_context71.prev = 53;
|
|
7099
|
+
_context71.t2 = _context71["catch"](48);
|
|
7100
|
+
_message2 = _context71.t2 instanceof Error ? _context71.t2.message : String(_context71.t2);
|
|
6930
7101
|
this.logError('handleUpdateLocalOrdersBatch: 合并写入失败', {
|
|
6931
7102
|
message: _message2
|
|
6932
7103
|
});
|
|
6933
|
-
return
|
|
7104
|
+
return _context71.abrupt("return", {
|
|
6934
7105
|
code: 500,
|
|
6935
7106
|
status: false,
|
|
6936
7107
|
message: _message2,
|
|
@@ -6949,7 +7120,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6949
7120
|
insertedCount: inserted.length,
|
|
6950
7121
|
failedCount: failed.length
|
|
6951
7122
|
});
|
|
6952
|
-
return
|
|
7123
|
+
return _context71.abrupt("return", {
|
|
6953
7124
|
code: 200,
|
|
6954
7125
|
status: true,
|
|
6955
7126
|
message: '',
|
|
@@ -6961,11 +7132,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
6961
7132
|
});
|
|
6962
7133
|
case 62:
|
|
6963
7134
|
case "end":
|
|
6964
|
-
return
|
|
7135
|
+
return _context71.stop();
|
|
6965
7136
|
}
|
|
6966
|
-
},
|
|
7137
|
+
}, _callee71, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
|
|
6967
7138
|
}));
|
|
6968
|
-
function handleUpdateLocalOrdersBatch(
|
|
7139
|
+
function handleUpdateLocalOrdersBatch(_x79) {
|
|
6969
7140
|
return _handleUpdateLocalOrdersBatch.apply(this, arguments);
|
|
6970
7141
|
}
|
|
6971
7142
|
return handleUpdateLocalOrdersBatch;
|
|
@@ -6986,11 +7157,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
6986
7157
|
var queryIndex = url.indexOf('?');
|
|
6987
7158
|
if (queryIndex < 0) return null;
|
|
6988
7159
|
var query = url.slice(queryIndex + 1);
|
|
6989
|
-
var
|
|
6990
|
-
|
|
7160
|
+
var _iterator16 = _createForOfIteratorHelper(query.split('&')),
|
|
7161
|
+
_step16;
|
|
6991
7162
|
try {
|
|
6992
|
-
for (
|
|
6993
|
-
var pair =
|
|
7163
|
+
for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
|
|
7164
|
+
var pair = _step16.value;
|
|
6994
7165
|
if (!pair) continue;
|
|
6995
7166
|
var _pair$split = pair.split('='),
|
|
6996
7167
|
_pair$split2 = _slicedToArray(_pair$split, 2),
|
|
@@ -7006,9 +7177,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
7006
7177
|
}
|
|
7007
7178
|
}
|
|
7008
7179
|
} catch (err) {
|
|
7009
|
-
|
|
7180
|
+
_iterator16.e(err);
|
|
7010
7181
|
} finally {
|
|
7011
|
-
|
|
7182
|
+
_iterator16.f();
|
|
7012
7183
|
}
|
|
7013
7184
|
return null;
|
|
7014
7185
|
}
|
|
@@ -7209,10 +7380,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
7209
7380
|
value: function extractBackendErrorResponse(error) {
|
|
7210
7381
|
var _error$response3,
|
|
7211
7382
|
_error$response4,
|
|
7212
|
-
|
|
7383
|
+
_this20 = this;
|
|
7213
7384
|
var candidates = [error === null || error === void 0 || (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data, error === null || error === void 0 ? void 0 : error.data, error === null || error === void 0 || (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.body, error === null || error === void 0 ? void 0 : error.body];
|
|
7214
7385
|
return candidates.find(function (candidate) {
|
|
7215
|
-
return
|
|
7386
|
+
return _this20.isExplicitBackendErrorResponse(candidate);
|
|
7216
7387
|
}) || null;
|
|
7217
7388
|
}
|
|
7218
7389
|
}, {
|
|
@@ -7331,24 +7502,24 @@ var Server = /*#__PURE__*/function () {
|
|
|
7331
7502
|
}, {
|
|
7332
7503
|
key: "recomputeAndNotifyFloorPlanQuery",
|
|
7333
7504
|
value: (function () {
|
|
7334
|
-
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7335
|
-
var
|
|
7336
|
-
return _regeneratorRuntime().wrap(function
|
|
7337
|
-
while (1) switch (
|
|
7505
|
+
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72() {
|
|
7506
|
+
var _iterator17, _step17, _step17$value, subscriberId, sub, result, errorMessage;
|
|
7507
|
+
return _regeneratorRuntime().wrap(function _callee72$(_context72) {
|
|
7508
|
+
while (1) switch (_context72.prev = _context72.next) {
|
|
7338
7509
|
case 0:
|
|
7339
7510
|
if (!(this.floorPlanQuerySubscribers.size === 0)) {
|
|
7340
|
-
|
|
7511
|
+
_context72.next = 2;
|
|
7341
7512
|
break;
|
|
7342
7513
|
}
|
|
7343
|
-
return
|
|
7514
|
+
return _context72.abrupt("return");
|
|
7344
7515
|
case 2:
|
|
7345
7516
|
this.logInfo('recomputeAndNotifyFloorPlanQuery: 开始推送', {
|
|
7346
7517
|
subscriberCount: this.floorPlanQuerySubscribers.size
|
|
7347
7518
|
});
|
|
7348
|
-
|
|
7519
|
+
_iterator17 = _createForOfIteratorHelper(this.floorPlanQuerySubscribers.entries());
|
|
7349
7520
|
try {
|
|
7350
|
-
for (
|
|
7351
|
-
|
|
7521
|
+
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
|
|
7522
|
+
_step17$value = _slicedToArray(_step17.value, 2), subscriberId = _step17$value[0], sub = _step17$value[1];
|
|
7352
7523
|
try {
|
|
7353
7524
|
result = this.computeFloorPlanQueryResult(sub.context);
|
|
7354
7525
|
sub.callback(result);
|
|
@@ -7364,15 +7535,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
7364
7535
|
}
|
|
7365
7536
|
}
|
|
7366
7537
|
} catch (err) {
|
|
7367
|
-
|
|
7538
|
+
_iterator17.e(err);
|
|
7368
7539
|
} finally {
|
|
7369
|
-
|
|
7540
|
+
_iterator17.f();
|
|
7370
7541
|
}
|
|
7371
7542
|
case 5:
|
|
7372
7543
|
case "end":
|
|
7373
|
-
return
|
|
7544
|
+
return _context72.stop();
|
|
7374
7545
|
}
|
|
7375
|
-
},
|
|
7546
|
+
}, _callee72, this);
|
|
7376
7547
|
}));
|
|
7377
7548
|
function recomputeAndNotifyFloorPlanQuery() {
|
|
7378
7549
|
return _recomputeAndNotifyFloorPlanQuery.apply(this, arguments);
|
|
@@ -7402,21 +7573,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
7402
7573
|
* filter 逻辑暂为 mock,仅记录参数
|
|
7403
7574
|
*/
|
|
7404
7575
|
function () {
|
|
7405
|
-
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7576
|
+
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(data) {
|
|
7406
7577
|
var rawList, result;
|
|
7407
|
-
return _regeneratorRuntime().wrap(function
|
|
7408
|
-
while (1) switch (
|
|
7578
|
+
return _regeneratorRuntime().wrap(function _callee73$(_context73) {
|
|
7579
|
+
while (1) switch (_context73.prev = _context73.next) {
|
|
7409
7580
|
case 0:
|
|
7410
7581
|
this.logInfo('computeOrderQueryResult: 开始过滤', {
|
|
7411
7582
|
data: data
|
|
7412
7583
|
});
|
|
7413
7584
|
console.log('[Server] computeOrderQueryResult', data);
|
|
7414
7585
|
if (this.order) {
|
|
7415
|
-
|
|
7586
|
+
_context73.next = 5;
|
|
7416
7587
|
break;
|
|
7417
7588
|
}
|
|
7418
7589
|
this.logError('computeOrderQueryResult: Order 模块未注册');
|
|
7419
|
-
return
|
|
7590
|
+
return _context73.abrupt("return", {
|
|
7420
7591
|
code: 500,
|
|
7421
7592
|
message: 'Order 模块未注册',
|
|
7422
7593
|
data: {
|
|
@@ -7446,7 +7617,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7446
7617
|
skip: result.skip,
|
|
7447
7618
|
rejected: result.rejected
|
|
7448
7619
|
});
|
|
7449
|
-
return
|
|
7620
|
+
return _context73.abrupt("return", {
|
|
7450
7621
|
code: 200,
|
|
7451
7622
|
data: result,
|
|
7452
7623
|
message: '',
|
|
@@ -7454,11 +7625,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
7454
7625
|
});
|
|
7455
7626
|
case 11:
|
|
7456
7627
|
case "end":
|
|
7457
|
-
return
|
|
7628
|
+
return _context73.stop();
|
|
7458
7629
|
}
|
|
7459
|
-
},
|
|
7630
|
+
}, _callee73, this);
|
|
7460
7631
|
}));
|
|
7461
|
-
function computeOrderQueryResult(
|
|
7632
|
+
function computeOrderQueryResult(_x80) {
|
|
7462
7633
|
return _computeOrderQueryResult.apply(this, arguments);
|
|
7463
7634
|
}
|
|
7464
7635
|
return computeOrderQueryResult;
|
|
@@ -7471,17 +7642,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
7471
7642
|
}, {
|
|
7472
7643
|
key: "computeBookingQueryResult",
|
|
7473
7644
|
value: (function () {
|
|
7474
|
-
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7645
|
+
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(data) {
|
|
7475
7646
|
var rawOrders, result;
|
|
7476
|
-
return _regeneratorRuntime().wrap(function
|
|
7477
|
-
while (1) switch (
|
|
7647
|
+
return _regeneratorRuntime().wrap(function _callee74$(_context74) {
|
|
7648
|
+
while (1) switch (_context74.prev = _context74.next) {
|
|
7478
7649
|
case 0:
|
|
7479
7650
|
if (this.order) {
|
|
7480
|
-
|
|
7651
|
+
_context74.next = 3;
|
|
7481
7652
|
break;
|
|
7482
7653
|
}
|
|
7483
7654
|
this.logError('computeBookingQueryResult: Order 模块未注册');
|
|
7484
|
-
return
|
|
7655
|
+
return _context74.abrupt("return", {
|
|
7485
7656
|
code: 500,
|
|
7486
7657
|
message: 'Order 模块未注册',
|
|
7487
7658
|
data: {
|
|
@@ -7500,7 +7671,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7500
7671
|
size: result.size,
|
|
7501
7672
|
skip: result.skip
|
|
7502
7673
|
});
|
|
7503
|
-
return
|
|
7674
|
+
return _context74.abrupt("return", {
|
|
7504
7675
|
code: 200,
|
|
7505
7676
|
data: result,
|
|
7506
7677
|
message: '',
|
|
@@ -7508,11 +7679,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
7508
7679
|
});
|
|
7509
7680
|
case 8:
|
|
7510
7681
|
case "end":
|
|
7511
|
-
return
|
|
7682
|
+
return _context74.stop();
|
|
7512
7683
|
}
|
|
7513
|
-
},
|
|
7684
|
+
}, _callee74, this);
|
|
7514
7685
|
}));
|
|
7515
|
-
function computeBookingQueryResult(
|
|
7686
|
+
function computeBookingQueryResult(_x81) {
|
|
7516
7687
|
return _computeBookingQueryResult.apply(this, arguments);
|
|
7517
7688
|
}
|
|
7518
7689
|
return computeBookingQueryResult;
|
|
@@ -7571,12 +7742,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
7571
7742
|
}, {
|
|
7572
7743
|
key: "computeProductQueryResult",
|
|
7573
7744
|
value: (function () {
|
|
7574
|
-
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7745
|
+
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(context, options) {
|
|
7575
7746
|
var _menu_list_ids$length3,
|
|
7576
|
-
|
|
7577
|
-
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,
|
|
7578
|
-
return _regeneratorRuntime().wrap(function
|
|
7579
|
-
while (1) switch (
|
|
7747
|
+
_this21 = this;
|
|
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;
|
|
7749
|
+
return _regeneratorRuntime().wrap(function _callee75$(_context75) {
|
|
7750
|
+
while (1) switch (_context75.prev = _context75.next) {
|
|
7580
7751
|
case 0:
|
|
7581
7752
|
tTotal = performance.now();
|
|
7582
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;
|
|
@@ -7603,28 +7774,28 @@ var Server = /*#__PURE__*/function () {
|
|
|
7603
7774
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
7604
7775
|
});
|
|
7605
7776
|
if (this.products) {
|
|
7606
|
-
|
|
7777
|
+
_context75.next = 8;
|
|
7607
7778
|
break;
|
|
7608
7779
|
}
|
|
7609
7780
|
this.logError('computeProductQueryResult: Products 模块未注册');
|
|
7610
|
-
return
|
|
7781
|
+
return _context75.abrupt("return", {
|
|
7611
7782
|
message: 'Products 模块未注册',
|
|
7612
7783
|
data: this.buildProductQueryResultPayload([], 0)
|
|
7613
7784
|
});
|
|
7614
7785
|
case 8:
|
|
7615
7786
|
if (!(queryIds.length > 0)) {
|
|
7616
|
-
|
|
7787
|
+
_context75.next = 20;
|
|
7617
7788
|
break;
|
|
7618
7789
|
}
|
|
7619
7790
|
uniqueIds = Array.from(new Set(queryIds));
|
|
7620
7791
|
_tPrice = performance.now();
|
|
7621
|
-
|
|
7792
|
+
_context75.next = 13;
|
|
7622
7793
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
7623
7794
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
|
|
7624
7795
|
productIds: uniqueIds
|
|
7625
7796
|
});
|
|
7626
7797
|
case 13:
|
|
7627
|
-
productsWithPrice =
|
|
7798
|
+
productsWithPrice = _context75.sent;
|
|
7628
7799
|
perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
|
|
7629
7800
|
count: productsWithPrice.length,
|
|
7630
7801
|
ids: uniqueIds
|
|
@@ -7644,7 +7815,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7644
7815
|
ids: uniqueIds,
|
|
7645
7816
|
count: extensionFilteredProducts.length
|
|
7646
7817
|
});
|
|
7647
|
-
return
|
|
7818
|
+
return _context75.abrupt("return", {
|
|
7648
7819
|
code: 200,
|
|
7649
7820
|
data: this.buildProductQueryResultPayload(extensionFilteredProducts),
|
|
7650
7821
|
message: '',
|
|
@@ -7652,17 +7823,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
7652
7823
|
});
|
|
7653
7824
|
case 20:
|
|
7654
7825
|
if (!(product_id != null && Number.isFinite(Number(product_id)))) {
|
|
7655
|
-
|
|
7826
|
+
_context75.next = 32;
|
|
7656
7827
|
break;
|
|
7657
7828
|
}
|
|
7658
7829
|
pid = Number(product_id);
|
|
7659
7830
|
_tPrice2 = performance.now();
|
|
7660
|
-
|
|
7831
|
+
_context75.next = 25;
|
|
7661
7832
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
7662
7833
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
7663
7834
|
});
|
|
7664
7835
|
case 25:
|
|
7665
|
-
allProductsWithPrice =
|
|
7836
|
+
allProductsWithPrice = _context75.sent;
|
|
7666
7837
|
perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
|
|
7667
7838
|
count: allProductsWithPrice.length,
|
|
7668
7839
|
productId: pid
|
|
@@ -7682,7 +7853,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7682
7853
|
productId: pid,
|
|
7683
7854
|
found: !!item
|
|
7684
7855
|
});
|
|
7685
|
-
return
|
|
7856
|
+
return _context75.abrupt("return", {
|
|
7686
7857
|
code: 200,
|
|
7687
7858
|
data: item,
|
|
7688
7859
|
message: item ? '' : '商品不存在或未发布',
|
|
@@ -7690,16 +7861,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
7690
7861
|
});
|
|
7691
7862
|
case 32:
|
|
7692
7863
|
if (!this.shouldQueryProductsByExtensionTypes(extension_type)) {
|
|
7693
|
-
|
|
7864
|
+
_context75.next = 52;
|
|
7694
7865
|
break;
|
|
7695
7866
|
}
|
|
7696
7867
|
_tPrice3 = performance.now();
|
|
7697
|
-
|
|
7868
|
+
_context75.next = 36;
|
|
7698
7869
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
7699
7870
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
7700
7871
|
});
|
|
7701
7872
|
case 36:
|
|
7702
|
-
_filteredProducts2 =
|
|
7873
|
+
_filteredProducts2 = _context75.sent;
|
|
7703
7874
|
perfMark('computeQuery.getProductsWithPrice(extensionType)', performance.now() - _tPrice3, {
|
|
7704
7875
|
count: _filteredProducts2.length,
|
|
7705
7876
|
extension_type: extension_type
|
|
@@ -7738,7 +7909,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7738
7909
|
filteredCount: _filteredProducts2.length,
|
|
7739
7910
|
extension_type: extension_type
|
|
7740
7911
|
});
|
|
7741
|
-
return
|
|
7912
|
+
return _context75.abrupt("return", {
|
|
7742
7913
|
code: 200,
|
|
7743
7914
|
data: this.buildProductQueryResultPayload(_filteredProducts2),
|
|
7744
7915
|
message: '',
|
|
@@ -7746,38 +7917,59 @@ var Server = /*#__PURE__*/function () {
|
|
|
7746
7917
|
});
|
|
7747
7918
|
case 52:
|
|
7748
7919
|
if (this.menu) {
|
|
7749
|
-
|
|
7920
|
+
_context75.next = 55;
|
|
7750
7921
|
break;
|
|
7751
7922
|
}
|
|
7752
7923
|
this.logError('computeProductQueryResult: Menu 模块未注册');
|
|
7753
|
-
return
|
|
7924
|
+
return _context75.abrupt("return", {
|
|
7754
7925
|
message: 'Menu 模块未注册',
|
|
7755
7926
|
data: this.buildProductQueryResultPayload([], 0)
|
|
7756
7927
|
});
|
|
7757
7928
|
case 55:
|
|
7758
7929
|
if (this.schedule) {
|
|
7759
|
-
|
|
7930
|
+
_context75.next = 58;
|
|
7760
7931
|
break;
|
|
7761
7932
|
}
|
|
7762
7933
|
this.logError('computeProductQueryResult: Schedule 模块未注册');
|
|
7763
|
-
return
|
|
7934
|
+
return _context75.abrupt("return", {
|
|
7764
7935
|
message: 'Schedule 模块未注册',
|
|
7765
7936
|
data: this.buildProductQueryResultPayload([], 0)
|
|
7766
7937
|
});
|
|
7767
7938
|
case 58:
|
|
7768
7939
|
activeMenuList = [];
|
|
7769
|
-
if (menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0) {
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
activeMenu: activeMenuList.length
|
|
7940
|
+
if (!(menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0)) {
|
|
7941
|
+
_context75.next = 71;
|
|
7942
|
+
break;
|
|
7943
|
+
}
|
|
7944
|
+
tMenu = performance.now();
|
|
7945
|
+
getActiveMenus = function getActiveMenus() {
|
|
7946
|
+
return _this21.menu.getMenuByIds(menu_list_ids).filter(function (menu) {
|
|
7947
|
+
var _this21$schedule;
|
|
7948
|
+
return ((_this21$schedule = _this21.schedule) === null || _this21$schedule === void 0 ? void 0 : _this21$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
|
|
7779
7949
|
});
|
|
7950
|
+
};
|
|
7951
|
+
activeMenuList = getActiveMenus();
|
|
7952
|
+
_context75.t0 = !activeMenuList.length;
|
|
7953
|
+
if (!_context75.t0) {
|
|
7954
|
+
_context75.next = 68;
|
|
7955
|
+
break;
|
|
7956
|
+
}
|
|
7957
|
+
_context75.next = 67;
|
|
7958
|
+
return this.refreshMenuScheduleCacheAfterEmptyResult();
|
|
7959
|
+
case 67:
|
|
7960
|
+
_context75.t0 = _context75.sent;
|
|
7961
|
+
case 68:
|
|
7962
|
+
if (!_context75.t0) {
|
|
7963
|
+
_context75.next = 70;
|
|
7964
|
+
break;
|
|
7780
7965
|
}
|
|
7966
|
+
activeMenuList = getActiveMenus();
|
|
7967
|
+
case 70:
|
|
7968
|
+
perfMark('computeQuery.filterActiveMenu', performance.now() - tMenu, {
|
|
7969
|
+
totalMenu: menu_list_ids.length,
|
|
7970
|
+
activeMenu: activeMenuList.length
|
|
7971
|
+
});
|
|
7972
|
+
case 71:
|
|
7781
7973
|
tFilter = performance.now();
|
|
7782
7974
|
productScope = this.getProductScopeByMenuConfig(activeMenuList);
|
|
7783
7975
|
scopedProductIds = this.products.getProductIdsByScope(productScope);
|
|
@@ -7788,22 +7980,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
7788
7980
|
});
|
|
7789
7981
|
tPrice = performance.now();
|
|
7790
7982
|
if (!(scopedProductIds.length > 0)) {
|
|
7791
|
-
|
|
7983
|
+
_context75.next = 82;
|
|
7792
7984
|
break;
|
|
7793
7985
|
}
|
|
7794
|
-
|
|
7986
|
+
_context75.next = 79;
|
|
7795
7987
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
7796
7988
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
|
|
7797
7989
|
productIds: productScope.isAllProducts ? undefined : scopedProductIds
|
|
7798
7990
|
});
|
|
7799
|
-
case
|
|
7800
|
-
|
|
7801
|
-
|
|
7991
|
+
case 79:
|
|
7992
|
+
_context75.t1 = _context75.sent;
|
|
7993
|
+
_context75.next = 83;
|
|
7802
7994
|
break;
|
|
7803
|
-
case
|
|
7804
|
-
|
|
7805
|
-
case
|
|
7806
|
-
filteredProducts =
|
|
7995
|
+
case 82:
|
|
7996
|
+
_context75.t1 = [];
|
|
7997
|
+
case 83:
|
|
7998
|
+
filteredProducts = _context75.t1;
|
|
7807
7999
|
perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
|
|
7808
8000
|
count: filteredProducts.length,
|
|
7809
8001
|
scopedProductCount: scopedProductIds.length
|
|
@@ -7844,19 +8036,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
7844
8036
|
filteredCount: filteredProducts.length,
|
|
7845
8037
|
activeMenuCount: activeMenuList.length
|
|
7846
8038
|
});
|
|
7847
|
-
return
|
|
8039
|
+
return _context75.abrupt("return", {
|
|
7848
8040
|
code: 200,
|
|
7849
8041
|
data: this.buildProductQueryResultPayload(filteredProducts),
|
|
7850
8042
|
message: '',
|
|
7851
8043
|
status: true
|
|
7852
8044
|
});
|
|
7853
|
-
case
|
|
8045
|
+
case 99:
|
|
7854
8046
|
case "end":
|
|
7855
|
-
return
|
|
8047
|
+
return _context75.stop();
|
|
7856
8048
|
}
|
|
7857
|
-
},
|
|
8049
|
+
}, _callee75, this);
|
|
7858
8050
|
}));
|
|
7859
|
-
function computeProductQueryResult(
|
|
8051
|
+
function computeProductQueryResult(_x82, _x83) {
|
|
7860
8052
|
return _computeProductQueryResult.apply(this, arguments);
|
|
7861
8053
|
}
|
|
7862
8054
|
return computeProductQueryResult;
|
|
@@ -7892,72 +8084,72 @@ var Server = /*#__PURE__*/function () {
|
|
|
7892
8084
|
}, {
|
|
7893
8085
|
key: "recomputeAndNotifyProductQuery",
|
|
7894
8086
|
value: (function () {
|
|
7895
|
-
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7896
|
-
var
|
|
7897
|
-
return _regeneratorRuntime().wrap(function
|
|
7898
|
-
while (1) switch (
|
|
8087
|
+
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(options) {
|
|
8088
|
+
var _iterator18, _step18, _step18$value, subscriberId, subscriber, result, errorMessage;
|
|
8089
|
+
return _regeneratorRuntime().wrap(function _callee76$(_context76) {
|
|
8090
|
+
while (1) switch (_context76.prev = _context76.next) {
|
|
7899
8091
|
case 0:
|
|
7900
8092
|
if (!(this.productQuerySubscribers.size === 0)) {
|
|
7901
|
-
|
|
8093
|
+
_context76.next = 2;
|
|
7902
8094
|
break;
|
|
7903
8095
|
}
|
|
7904
|
-
return
|
|
8096
|
+
return _context76.abrupt("return");
|
|
7905
8097
|
case 2:
|
|
7906
8098
|
this.logInfo('recomputeAndNotifyProductQuery: 开始推送', {
|
|
7907
8099
|
subscriberCount: this.productQuerySubscribers.size,
|
|
7908
8100
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
7909
8101
|
});
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
8102
|
+
_iterator18 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
|
|
8103
|
+
_context76.prev = 4;
|
|
8104
|
+
_iterator18.s();
|
|
7913
8105
|
case 6:
|
|
7914
|
-
if ((
|
|
7915
|
-
|
|
8106
|
+
if ((_step18 = _iterator18.n()).done) {
|
|
8107
|
+
_context76.next = 22;
|
|
7916
8108
|
break;
|
|
7917
8109
|
}
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
8110
|
+
_step18$value = _slicedToArray(_step18.value, 2), subscriberId = _step18$value[0], subscriber = _step18$value[1];
|
|
8111
|
+
_context76.prev = 8;
|
|
8112
|
+
_context76.next = 11;
|
|
7921
8113
|
return this.computeProductQueryResult(subscriber.context, {
|
|
7922
8114
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
7923
8115
|
});
|
|
7924
8116
|
case 11:
|
|
7925
|
-
result =
|
|
8117
|
+
result = _context76.sent;
|
|
7926
8118
|
subscriber.callback(result);
|
|
7927
8119
|
this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
|
|
7928
8120
|
subscriberId: subscriberId
|
|
7929
8121
|
});
|
|
7930
|
-
|
|
8122
|
+
_context76.next = 20;
|
|
7931
8123
|
break;
|
|
7932
8124
|
case 16:
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
errorMessage =
|
|
8125
|
+
_context76.prev = 16;
|
|
8126
|
+
_context76.t0 = _context76["catch"](8);
|
|
8127
|
+
errorMessage = _context76.t0 instanceof Error ? _context76.t0.message : String(_context76.t0);
|
|
7936
8128
|
this.logError('recomputeAndNotifyProductQuery: 推送失败', {
|
|
7937
8129
|
subscriberId: subscriberId,
|
|
7938
8130
|
error: errorMessage
|
|
7939
8131
|
});
|
|
7940
8132
|
case 20:
|
|
7941
|
-
|
|
8133
|
+
_context76.next = 6;
|
|
7942
8134
|
break;
|
|
7943
8135
|
case 22:
|
|
7944
|
-
|
|
8136
|
+
_context76.next = 27;
|
|
7945
8137
|
break;
|
|
7946
8138
|
case 24:
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
8139
|
+
_context76.prev = 24;
|
|
8140
|
+
_context76.t1 = _context76["catch"](4);
|
|
8141
|
+
_iterator18.e(_context76.t1);
|
|
7950
8142
|
case 27:
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
return
|
|
8143
|
+
_context76.prev = 27;
|
|
8144
|
+
_iterator18.f();
|
|
8145
|
+
return _context76.finish(27);
|
|
7954
8146
|
case 30:
|
|
7955
8147
|
case "end":
|
|
7956
|
-
return
|
|
8148
|
+
return _context76.stop();
|
|
7957
8149
|
}
|
|
7958
|
-
},
|
|
8150
|
+
}, _callee76, this, [[4, 24, 27, 30], [8, 16]]);
|
|
7959
8151
|
}));
|
|
7960
|
-
function recomputeAndNotifyProductQuery(
|
|
8152
|
+
function recomputeAndNotifyProductQuery(_x84) {
|
|
7961
8153
|
return _recomputeAndNotifyProductQuery.apply(this, arguments);
|
|
7962
8154
|
}
|
|
7963
8155
|
return recomputeAndNotifyProductQuery;
|
|
@@ -7969,37 +8161,37 @@ var Server = /*#__PURE__*/function () {
|
|
|
7969
8161
|
}, {
|
|
7970
8162
|
key: "recomputeAndNotifyOrderQuery",
|
|
7971
8163
|
value: (function () {
|
|
7972
|
-
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7973
|
-
var notifyStartAt,
|
|
7974
|
-
return _regeneratorRuntime().wrap(function
|
|
7975
|
-
while (1) switch (
|
|
8164
|
+
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77() {
|
|
8165
|
+
var notifyStartAt, _iterator19, _step19, _step19$value, subscriberId, subscriber, computeStartAt, result, computeEndAt, callbackStartAt, callbackEndAt, errorMessage, notifyEndAt;
|
|
8166
|
+
return _regeneratorRuntime().wrap(function _callee77$(_context77) {
|
|
8167
|
+
while (1) switch (_context77.prev = _context77.next) {
|
|
7976
8168
|
case 0:
|
|
7977
8169
|
if (!(this.orderQuerySubscribers.size === 0)) {
|
|
7978
|
-
|
|
8170
|
+
_context77.next = 2;
|
|
7979
8171
|
break;
|
|
7980
8172
|
}
|
|
7981
|
-
return
|
|
8173
|
+
return _context77.abrupt("return");
|
|
7982
8174
|
case 2:
|
|
7983
8175
|
notifyStartAt = Date.now();
|
|
7984
8176
|
this.logInfo('recomputeAndNotifyOrderQuery: 开始推送', {
|
|
7985
8177
|
subscriberCount: this.orderQuerySubscribers.size,
|
|
7986
8178
|
notifyStartAt: new Date(notifyStartAt).toISOString()
|
|
7987
8179
|
});
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
8180
|
+
_iterator19 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
|
|
8181
|
+
_context77.prev = 5;
|
|
8182
|
+
_iterator19.s();
|
|
7991
8183
|
case 7:
|
|
7992
|
-
if ((
|
|
7993
|
-
|
|
8184
|
+
if ((_step19 = _iterator19.n()).done) {
|
|
8185
|
+
_context77.next = 27;
|
|
7994
8186
|
break;
|
|
7995
8187
|
}
|
|
7996
|
-
|
|
7997
|
-
|
|
8188
|
+
_step19$value = _slicedToArray(_step19.value, 2), subscriberId = _step19$value[0], subscriber = _step19$value[1];
|
|
8189
|
+
_context77.prev = 9;
|
|
7998
8190
|
computeStartAt = Date.now();
|
|
7999
|
-
|
|
8191
|
+
_context77.next = 13;
|
|
8000
8192
|
return this.computeOrderQueryResult(subscriber.context);
|
|
8001
8193
|
case 13:
|
|
8002
|
-
result =
|
|
8194
|
+
result = _context77.sent;
|
|
8003
8195
|
computeEndAt = Date.now();
|
|
8004
8196
|
callbackStartAt = Date.now();
|
|
8005
8197
|
subscriber.callback(result);
|
|
@@ -8010,30 +8202,30 @@ var Server = /*#__PURE__*/function () {
|
|
|
8010
8202
|
callbackDurationMs: callbackEndAt - callbackStartAt,
|
|
8011
8203
|
totalDurationMs: callbackEndAt - computeStartAt
|
|
8012
8204
|
});
|
|
8013
|
-
|
|
8205
|
+
_context77.next = 25;
|
|
8014
8206
|
break;
|
|
8015
8207
|
case 21:
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
errorMessage =
|
|
8208
|
+
_context77.prev = 21;
|
|
8209
|
+
_context77.t0 = _context77["catch"](9);
|
|
8210
|
+
errorMessage = _context77.t0 instanceof Error ? _context77.t0.message : String(_context77.t0);
|
|
8019
8211
|
this.logError('recomputeAndNotifyOrderQuery: 推送失败', {
|
|
8020
8212
|
subscriberId: subscriberId,
|
|
8021
8213
|
error: errorMessage
|
|
8022
8214
|
});
|
|
8023
8215
|
case 25:
|
|
8024
|
-
|
|
8216
|
+
_context77.next = 7;
|
|
8025
8217
|
break;
|
|
8026
8218
|
case 27:
|
|
8027
|
-
|
|
8219
|
+
_context77.next = 32;
|
|
8028
8220
|
break;
|
|
8029
8221
|
case 29:
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8222
|
+
_context77.prev = 29;
|
|
8223
|
+
_context77.t1 = _context77["catch"](5);
|
|
8224
|
+
_iterator19.e(_context77.t1);
|
|
8033
8225
|
case 32:
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
return
|
|
8226
|
+
_context77.prev = 32;
|
|
8227
|
+
_iterator19.f();
|
|
8228
|
+
return _context77.finish(32);
|
|
8037
8229
|
case 35:
|
|
8038
8230
|
notifyEndAt = Date.now();
|
|
8039
8231
|
this.logInfo('recomputeAndNotifyOrderQuery: 推送完成', {
|
|
@@ -8042,9 +8234,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
8042
8234
|
});
|
|
8043
8235
|
case 37:
|
|
8044
8236
|
case "end":
|
|
8045
|
-
return
|
|
8237
|
+
return _context77.stop();
|
|
8046
8238
|
}
|
|
8047
|
-
},
|
|
8239
|
+
}, _callee77, this, [[5, 29, 32, 35], [9, 21]]);
|
|
8048
8240
|
}));
|
|
8049
8241
|
function recomputeAndNotifyOrderQuery() {
|
|
8050
8242
|
return _recomputeAndNotifyOrderQuery.apply(this, arguments);
|
|
@@ -8062,7 +8254,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
8062
8254
|
}, {
|
|
8063
8255
|
key: "notifySalesSearchSubscribers",
|
|
8064
8256
|
value: function notifySalesSearchSubscribers(payload) {
|
|
8065
|
-
var
|
|
8257
|
+
var _this22 = this;
|
|
8066
8258
|
if (this.salesSearchSubscribers.size === 0) return;
|
|
8067
8259
|
var changedOrders = this.extractChangedOrdersFromPayload(payload);
|
|
8068
8260
|
if (changedOrders.length === 0) {
|
|
@@ -8071,42 +8263,42 @@ var Server = /*#__PURE__*/function () {
|
|
|
8071
8263
|
// 如果当前开启了 checkout 弹窗,先不进行刷新,下面的代码会导致在全局搜索页调用 bookingTicket.destroy()
|
|
8072
8264
|
// 导致模块被销毁 ,checkout 弹窗永远无法关闭
|
|
8073
8265
|
if (window.isPaymentModalPluginOpen) return;
|
|
8074
|
-
var
|
|
8075
|
-
|
|
8266
|
+
var _iterator20 = _createForOfIteratorHelper(this.salesSearchSubscribers.entries()),
|
|
8267
|
+
_step20;
|
|
8076
8268
|
try {
|
|
8077
|
-
var
|
|
8078
|
-
var
|
|
8079
|
-
subscriberId =
|
|
8080
|
-
subscriber =
|
|
8269
|
+
var _loop = function _loop() {
|
|
8270
|
+
var _step20$value = _slicedToArray(_step20.value, 2),
|
|
8271
|
+
subscriberId = _step20$value[0],
|
|
8272
|
+
subscriber = _step20$value[1];
|
|
8081
8273
|
try {
|
|
8082
8274
|
var changedVisibleOrders = changedOrders.filter(function (order) {
|
|
8083
|
-
var orderId =
|
|
8275
|
+
var orderId = _this22.getSalesSearchOrderId(order);
|
|
8084
8276
|
return !!orderId && subscriber.visibleOrderIds.has(orderId);
|
|
8085
8277
|
});
|
|
8086
8278
|
if (changedVisibleOrders.length === 0) {
|
|
8087
8279
|
return 1; // continue
|
|
8088
8280
|
}
|
|
8089
|
-
subscriber.callback(
|
|
8090
|
-
|
|
8281
|
+
subscriber.callback(_this22.buildSalesSearchDeltaResponse(subscriber, changedVisibleOrders));
|
|
8282
|
+
_this22.logInfo('notifySalesSearchSubscribers: 已推送 delta', {
|
|
8091
8283
|
subscriberId: subscriberId,
|
|
8092
8284
|
kind: subscriber.kind,
|
|
8093
8285
|
count: changedVisibleOrders.length
|
|
8094
8286
|
});
|
|
8095
8287
|
} catch (error) {
|
|
8096
8288
|
var errorMessage = error instanceof Error ? error.message : String(error);
|
|
8097
|
-
|
|
8289
|
+
_this22.logError('notifySalesSearchSubscribers: 推送失败', {
|
|
8098
8290
|
subscriberId: subscriberId,
|
|
8099
8291
|
error: errorMessage
|
|
8100
8292
|
});
|
|
8101
8293
|
}
|
|
8102
8294
|
};
|
|
8103
|
-
for (
|
|
8104
|
-
if (
|
|
8295
|
+
for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
|
|
8296
|
+
if (_loop()) continue;
|
|
8105
8297
|
}
|
|
8106
8298
|
} catch (err) {
|
|
8107
|
-
|
|
8299
|
+
_iterator20.e(err);
|
|
8108
8300
|
} finally {
|
|
8109
|
-
|
|
8301
|
+
_iterator20.f();
|
|
8110
8302
|
}
|
|
8111
8303
|
}
|
|
8112
8304
|
|
|
@@ -8185,67 +8377,67 @@ var Server = /*#__PURE__*/function () {
|
|
|
8185
8377
|
}, {
|
|
8186
8378
|
key: "recomputeAndNotifyBookingQuery",
|
|
8187
8379
|
value: (function () {
|
|
8188
|
-
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8189
|
-
var
|
|
8190
|
-
return _regeneratorRuntime().wrap(function
|
|
8191
|
-
while (1) switch (
|
|
8380
|
+
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78() {
|
|
8381
|
+
var _iterator21, _step21, _step21$value, subscriberId, subscriber, result, errorMessage;
|
|
8382
|
+
return _regeneratorRuntime().wrap(function _callee78$(_context78) {
|
|
8383
|
+
while (1) switch (_context78.prev = _context78.next) {
|
|
8192
8384
|
case 0:
|
|
8193
8385
|
if (!(this.bookingQuerySubscribers.size === 0)) {
|
|
8194
|
-
|
|
8386
|
+
_context78.next = 2;
|
|
8195
8387
|
break;
|
|
8196
8388
|
}
|
|
8197
|
-
return
|
|
8389
|
+
return _context78.abrupt("return");
|
|
8198
8390
|
case 2:
|
|
8199
8391
|
this.logInfo('recomputeAndNotifyBookingQuery: 开始推送', {
|
|
8200
8392
|
subscriberCount: this.bookingQuerySubscribers.size
|
|
8201
8393
|
});
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8394
|
+
_iterator21 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
|
|
8395
|
+
_context78.prev = 4;
|
|
8396
|
+
_iterator21.s();
|
|
8205
8397
|
case 6:
|
|
8206
|
-
if ((
|
|
8207
|
-
|
|
8398
|
+
if ((_step21 = _iterator21.n()).done) {
|
|
8399
|
+
_context78.next = 22;
|
|
8208
8400
|
break;
|
|
8209
8401
|
}
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
|
|
8402
|
+
_step21$value = _slicedToArray(_step21.value, 2), subscriberId = _step21$value[0], subscriber = _step21$value[1];
|
|
8403
|
+
_context78.prev = 8;
|
|
8404
|
+
_context78.next = 11;
|
|
8213
8405
|
return this.computeBookingQueryResult(subscriber.context);
|
|
8214
8406
|
case 11:
|
|
8215
|
-
result =
|
|
8407
|
+
result = _context78.sent;
|
|
8216
8408
|
subscriber.callback(result);
|
|
8217
8409
|
this.logInfo('recomputeAndNotifyBookingQuery: 已推送', {
|
|
8218
8410
|
subscriberId: subscriberId
|
|
8219
8411
|
});
|
|
8220
|
-
|
|
8412
|
+
_context78.next = 20;
|
|
8221
8413
|
break;
|
|
8222
8414
|
case 16:
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
errorMessage =
|
|
8415
|
+
_context78.prev = 16;
|
|
8416
|
+
_context78.t0 = _context78["catch"](8);
|
|
8417
|
+
errorMessage = _context78.t0 instanceof Error ? _context78.t0.message : String(_context78.t0);
|
|
8226
8418
|
this.logError('recomputeAndNotifyBookingQuery: 推送失败', {
|
|
8227
8419
|
subscriberId: subscriberId,
|
|
8228
8420
|
error: errorMessage
|
|
8229
8421
|
});
|
|
8230
8422
|
case 20:
|
|
8231
|
-
|
|
8423
|
+
_context78.next = 6;
|
|
8232
8424
|
break;
|
|
8233
8425
|
case 22:
|
|
8234
|
-
|
|
8426
|
+
_context78.next = 27;
|
|
8235
8427
|
break;
|
|
8236
8428
|
case 24:
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8429
|
+
_context78.prev = 24;
|
|
8430
|
+
_context78.t1 = _context78["catch"](4);
|
|
8431
|
+
_iterator21.e(_context78.t1);
|
|
8240
8432
|
case 27:
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
return
|
|
8433
|
+
_context78.prev = 27;
|
|
8434
|
+
_iterator21.f();
|
|
8435
|
+
return _context78.finish(27);
|
|
8244
8436
|
case 30:
|
|
8245
8437
|
case "end":
|
|
8246
|
-
return
|
|
8438
|
+
return _context78.stop();
|
|
8247
8439
|
}
|
|
8248
|
-
},
|
|
8440
|
+
}, _callee78, this, [[4, 24, 27, 30], [8, 16]]);
|
|
8249
8441
|
}));
|
|
8250
8442
|
function recomputeAndNotifyBookingQuery() {
|
|
8251
8443
|
return _recomputeAndNotifyBookingQuery.apply(this, arguments);
|
|
@@ -8275,11 +8467,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
8275
8467
|
var allowedProductIds = new Set();
|
|
8276
8468
|
var allowedCollectionIds = new Set();
|
|
8277
8469
|
var hasProductAll = false;
|
|
8278
|
-
var
|
|
8279
|
-
|
|
8470
|
+
var _iterator22 = _createForOfIteratorHelper(activeMenuList),
|
|
8471
|
+
_step22;
|
|
8280
8472
|
try {
|
|
8281
|
-
for (
|
|
8282
|
-
var menu =
|
|
8473
|
+
for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
|
|
8474
|
+
var menu = _step22.value;
|
|
8283
8475
|
var config = menu.partyroom_package;
|
|
8284
8476
|
if (!config) {
|
|
8285
8477
|
console.warn('[Server] 餐牌缺少 partyroom_package 配置:', menu);
|
|
@@ -8339,9 +8531,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
8339
8531
|
|
|
8340
8532
|
// 如果有餐牌允许所有商品,返回所有商品
|
|
8341
8533
|
} catch (err) {
|
|
8342
|
-
|
|
8534
|
+
_iterator22.e(err);
|
|
8343
8535
|
} finally {
|
|
8344
|
-
|
|
8536
|
+
_iterator22.f();
|
|
8345
8537
|
}
|
|
8346
8538
|
if (hasProductAll) {
|
|
8347
8539
|
this.logInfo('getProductScopeByMenuConfig: 返回所有商品 scope(product_all)');
|