@pisell/pisellos 2.3.73 → 2.3.75
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/core/index.d.ts +7 -0
- package/dist/core/index.js +111 -71
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/strategy-example.js +5 -19
- package/dist/modules/Cart/index.js +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +0 -1
- package/dist/modules/Date/index.js +1 -5
- package/dist/modules/Discount/index.js +2 -4
- package/dist/modules/OpenData/index.js +0 -2
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +36 -64
- package/dist/modules/Payment/index.js +97 -162
- package/dist/modules/Quotation/index.d.ts +6 -0
- package/dist/modules/Quotation/index.js +75 -19
- package/dist/modules/Rules/index.js +1 -4
- package/dist/modules/Schedule/index.js +0 -1
- package/dist/modules/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- package/dist/plugins/request.d.ts +1 -0
- package/dist/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.d.ts +8 -2
- package/dist/server/index.js +303 -269
- package/dist/server/modules/floor-plan/index.d.ts +4 -0
- package/dist/server/modules/floor-plan/index.js +240 -98
- package/dist/server/modules/menu/index.js +75 -59
- package/dist/server/modules/order/index.d.ts +17 -7
- package/dist/server/modules/order/index.js +421 -211
- package/dist/server/modules/products/index.d.ts +8 -2
- package/dist/server/modules/products/index.js +191 -117
- package/dist/server/modules/quotation/index.js +29 -38
- package/dist/server/modules/resource/index.js +24 -17
- package/dist/server/modules/schedule/index.js +27 -35
- package/dist/server/utils/product.js +0 -1
- package/dist/solution/BaseSales/index.js +38 -41
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +7 -59
- package/dist/solution/BookingByStep/utils/capacity.js +1 -11
- package/dist/solution/BookingByStep/utils/resources.js +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
- package/dist/solution/BookingTicket/index.js +0 -2
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
- package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
- package/dist/solution/BuyTickets/index.js +9 -12
- package/dist/solution/Checkout/index.js +177 -252
- package/dist/solution/Checkout/utils/index.js +4 -16
- package/dist/solution/RegisterAndLogin/index.js +30 -76
- package/dist/solution/ScanOrder/index.js +50 -60
- package/dist/solution/ShopDiscount/index.js +2 -7
- package/dist/solution/VenueBooking/index.js +45 -55
- package/dist/utils/task.js +15 -18
- package/dist/utils/watch.js +0 -1
- package/lib/apis/picoding.js +2 -0
- package/lib/core/index.d.ts +7 -0
- package/lib/core/index.js +149 -131
- package/lib/effects/index.js +46 -57
- package/lib/index.js +82 -49
- package/lib/model/index.js +14 -21
- package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
- package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
- package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
- package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
- package/lib/model/strategy/adapter/index.js +100 -64
- package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
- package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
- package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
- package/lib/model/strategy/adapter/itemRule/index.js +83 -57
- package/lib/model/strategy/adapter/itemRule/type.js +97 -36
- package/lib/model/strategy/adapter/promotion/adapter.js +91 -69
- package/lib/model/strategy/adapter/promotion/evaluator.js +444 -310
- package/lib/model/strategy/adapter/promotion/examples.js +222 -234
- package/lib/model/strategy/adapter/promotion/index.js +1 -0
- package/lib/model/strategy/adapter/promotion/type.js +243 -36
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -150
- package/lib/model/strategy/adapter/walletPass/example.js +217 -190
- package/lib/model/strategy/adapter/walletPass/index.js +75 -51
- package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
- package/lib/model/strategy/adapter/walletPass/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/utils.js +588 -378
- package/lib/model/strategy/engine.js +270 -168
- package/lib/model/strategy/index.js +49 -34
- package/lib/model/strategy/strategy-example.js +243 -239
- package/lib/model/strategy/type.js +100 -40
- package/lib/modules/Account/index.js +39 -53
- package/lib/modules/Account/types.js +20 -33
- package/lib/modules/AccountList/index.js +116 -154
- package/lib/modules/AccountList/types.js +30 -31
- package/lib/modules/AccountList/utils.js +18 -30
- package/lib/modules/BaseModule.js +23 -42
- package/lib/modules/BookingContext/index.js +158 -136
- package/lib/modules/BookingContext/types.js +46 -32
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +138 -146
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +78 -83
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +170 -150
- package/lib/modules/BookingContext/utils/flexible.js +38 -55
- package/lib/modules/BookingContext/utils/formatResourceList.js +19 -34
- package/lib/modules/BookingContext/utils/index.js +124 -41
- package/lib/modules/BookingContext/utils/noResource.js +58 -70
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +14 -41
- package/lib/modules/BookingContext/utils/productExtend.js +202 -155
- package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
- package/lib/modules/BookingContext/utils/resourceSelection.js +19 -41
- package/lib/modules/BookingContext/utils/resources.js +209 -167
- package/lib/modules/BookingContext/utils/serviceTimes.js +115 -116
- package/lib/modules/BookingContext/utils/timeSlices.js +76 -86
- package/lib/modules/Cart/index.js +170 -124
- package/lib/modules/Cart/types.js +46 -51
- package/lib/modules/Cart/utils/cartAccount.js +40 -39
- package/lib/modules/Cart/utils/cartDate.js +56 -61
- package/lib/modules/Cart/utils/cartDiscount.js +28 -33
- package/lib/modules/Cart/utils/cartNote.js +27 -32
- package/lib/modules/Cart/utils/cartProduct.js +321 -251
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +70 -78
- package/lib/modules/Cart/utils/changePrice.js +22 -50
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.js +235 -172
- package/lib/modules/Customer/types.js +38 -35
- package/lib/modules/Date/index.js +116 -115
- package/lib/modules/Date/types.js +16 -28
- package/lib/modules/Date/utils.js +174 -123
- package/lib/modules/Discount/index.js +122 -127
- package/lib/modules/Discount/types.js +9 -31
- package/lib/modules/Guests/index.js +30 -56
- package/lib/modules/Guests/types.js +23 -33
- package/lib/modules/Holder/index.js +209 -189
- package/lib/modules/Holder/types.js +4 -16
- package/lib/modules/Holder/utils.js +20 -49
- package/lib/modules/OpenData/index.js +70 -76
- package/lib/modules/OpenData/types.js +4 -16
- package/lib/modules/OpenData/utils.js +44 -78
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +1713 -2118
- package/lib/modules/Order/payment-utils.js +77 -120
- package/lib/modules/Order/types.js +88 -35
- package/lib/modules/Order/utils/bundleDiscountHydration.js +41 -74
- package/lib/modules/Order/utils/discountProductLineIdentity.js +142 -100
- package/lib/modules/Order/utils/manualProductDiscount.js +124 -123
- package/lib/modules/Order/utils/orderCollectionIdentity.js +184 -244
- package/lib/modules/Order/utils.js +814 -647
- package/lib/modules/Payment/cash.js +20 -33
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
- package/lib/modules/Payment/eftpos.js +16 -30
- package/lib/modules/Payment/index.js +532 -399
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.js +230 -108
- package/lib/modules/Payment/utils.js +52 -51
- package/lib/modules/Payment/walletpass.js +485 -660
- package/lib/modules/Product/index.js +51 -46
- package/lib/modules/Product/types.js +4 -16
- package/lib/modules/Product/utils.js +32 -33
- package/lib/modules/ProductList/index.js +113 -123
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.d.ts +6 -0
- package/lib/modules/Quotation/index.js +110 -103
- package/lib/modules/Quotation/types.js +4 -16
- package/lib/modules/Resource/index.js +27 -59
- package/lib/modules/Resource/types.js +22 -32
- package/lib/modules/Resource/utils.js +30 -38
- package/lib/modules/ResourcePlanner/index.js +25 -23
- package/lib/modules/ResourcePlanner/localClock.js +54 -119
- package/lib/modules/ResourcePlanner/planner.js +589 -770
- package/lib/modules/ResourcePlanner/types.js +10 -29
- package/lib/modules/Rules/index.js +1218 -959
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.js +85 -90
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.js +355 -430
- package/lib/modules/ScanOrderLogger/index.js +59 -79
- package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
- package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
- package/lib/modules/ScanOrderLogger/types.js +4 -16
- package/lib/modules/Schedule/getDateIsInSchedule.js +334 -163
- package/lib/modules/Schedule/index.js +100 -114
- package/lib/modules/Schedule/type.js +4 -16
- package/lib/modules/Schedule/types.js +4 -16
- package/lib/modules/Schedule/utils.js +433 -291
- package/lib/modules/Step/index.js +40 -52
- package/lib/modules/Step/tyeps.js +4 -16
- package/lib/modules/Summary/index.js +66 -71
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.js +773 -418
- package/lib/modules/SurchargeList/index.js +46 -60
- package/lib/modules/SurchargeList/types.js +4 -16
- package/lib/modules/index.js +245 -63
- package/lib/plugins/app.js +4 -16
- package/lib/plugins/index.js +36 -25
- package/lib/plugins/request.d.ts +1 -0
- package/lib/plugins/request.js +137 -126
- package/lib/plugins/shopStore.js +4 -16
- package/lib/plugins/user.js +4 -16
- package/lib/plugins/window.js +171 -179
- package/lib/server/index.d.ts +8 -2
- package/lib/server/index.js +3083 -2663
- package/lib/server/modules/floor-plan/index.d.ts +4 -0
- package/lib/server/modules/floor-plan/index.js +159 -127
- package/lib/server/modules/floor-plan/types.js +15 -30
- package/lib/server/modules/index.js +106 -68
- package/lib/server/modules/menu/index.js +170 -124
- package/lib/server/modules/menu/types.js +18 -31
- package/lib/server/modules/order/index.d.ts +17 -7
- package/lib/server/modules/order/index.js +916 -977
- package/lib/server/modules/order/types.js +122 -33
- package/lib/server/modules/order/utils/filterBookings.js +219 -194
- package/lib/server/modules/order/utils/filterOrders.js +118 -92
- package/lib/server/modules/payment/index.js +59 -83
- package/lib/server/modules/payment/types.js +4 -16
- package/lib/server/modules/products/index.d.ts +8 -2
- package/lib/server/modules/products/index.js +656 -471
- package/lib/server/modules/products/types.js +44 -34
- package/lib/server/modules/quotation/index.js +137 -172
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.js +225 -186
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.js +135 -123
- package/lib/server/modules/schedule/types.js +14 -21
- package/lib/server/modules/schedule/utils.js +334 -163
- package/lib/server/types.js +4 -16
- package/lib/server/utils/index.js +25 -23
- package/lib/server/utils/product.js +196 -139
- package/lib/server/utils/schedule.js +34 -41
- package/lib/server/utils/small-ticket.js +479 -456
- package/lib/server/utils/time.js +40 -49
- package/lib/solution/BaseSales/index.js +1186 -1410
- package/lib/solution/BaseSales/types.js +42 -38
- package/lib/solution/BaseSales/utils/cartPromotion.js +642 -498
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +85 -105
- package/lib/solution/BaseSales/utils/quotationPrice.js +56 -114
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +108 -145
- package/lib/solution/BaseSales/utils.js +158 -143
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1527 -1340
- package/lib/solution/BookingByStep/types.js +40 -99
- package/lib/solution/BookingByStep/utils/capacity.js +192 -160
- package/lib/solution/BookingByStep/utils/products.js +42 -52
- package/lib/solution/BookingByStep/utils/resources.js +527 -330
- package/lib/solution/BookingByStep/utils/stock.js +65 -44
- package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
- package/lib/solution/BookingTicket/index.js +607 -522
- package/lib/solution/BookingTicket/types.js +99 -77
- package/lib/solution/BookingTicket/utils/addProductDecision.js +226 -189
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +58 -89
- package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -78
- package/lib/solution/BookingTicket/utils/cartView.js +114 -99
- package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +18 -41
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +219 -86
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +168 -116
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +79 -91
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +54 -41
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -81
- package/lib/solution/BookingTicket/utils/scan/index.js +98 -104
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +52 -64
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +56 -58
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +34 -48
- package/lib/solution/BuyTickets/index.js +67 -70
- package/lib/solution/BuyTickets/types.js +22 -38
- package/lib/solution/Checkout/index.js +1451 -1158
- package/lib/solution/Checkout/types.js +91 -61
- package/lib/solution/Checkout/utils/index.js +228 -156
- package/lib/solution/PlaceOrder/index.js +55 -0
- package/lib/solution/RegisterAndLogin/config.js +493 -460
- package/lib/solution/RegisterAndLogin/index.js +633 -630
- package/lib/solution/RegisterAndLogin/types.js +189 -76
- package/lib/solution/RegisterAndLogin/utils.js +183 -125
- package/lib/solution/Sales/index.js +328 -324
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.js +832 -864
- package/lib/solution/ScanOrder/types.js +33 -34
- package/lib/solution/ScanOrder/utils.js +409 -374
- package/lib/solution/ShopDiscount/index.js +226 -232
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +300 -172
- package/lib/solution/UnifiedBookingSales/index.js +1035 -1201
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +99 -159
- package/lib/solution/UnifiedBookingSales/types.js +10 -32
- package/lib/solution/VenueBooking/index.js +811 -879
- package/lib/solution/VenueBooking/types.js +19 -39
- package/lib/solution/VenueBooking/utils/dateSummary.js +27 -56
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.js +94 -107
- package/lib/solution/VenueBooking/utils/timeSlot.js +132 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.js +124 -41
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.js +4 -16
- package/lib/utils/payment-number.js +26 -46
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +81 -47
- package/package.json +2 -1
package/dist/server/index.js
CHANGED
|
@@ -103,6 +103,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
103
103
|
_defineProperty(this, "productQueryScheduleTimers", new Map());
|
|
104
104
|
/** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
|
|
105
105
|
_defineProperty(this, "menuScheduleRefreshInFlight", null);
|
|
106
|
+
/** 启动阶段模块预加载任务;预渲染商品查询复用该任务,避免缓存尚未 ready 时误触发远端自愈。 */
|
|
107
|
+
_defineProperty(this, "startupModulePreloadInFlight", null);
|
|
106
108
|
_defineProperty(this, "lastMenuScheduleRefreshAt", 0);
|
|
107
109
|
_defineProperty(this, "MENU_SCHEDULE_REFRESH_COOLDOWN_MS", 30 * 1000);
|
|
108
110
|
// ---- 订单 / 预约列表查询订阅者 ----
|
|
@@ -289,7 +291,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
289
291
|
while (1) switch (_context3.prev = _context3.next) {
|
|
290
292
|
case 0:
|
|
291
293
|
url = _ref5.url, method = _ref5.method, data = _ref5.data, config = _ref5.config;
|
|
292
|
-
console.log('[Server] handleProductQuery:', url, method, data, config);
|
|
293
294
|
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
295
|
_this$resolveProductQ = _this.resolveProductQueryScheduleContext({
|
|
295
296
|
schedule_date: data.schedule_date,
|
|
@@ -325,7 +326,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
325
326
|
totalSubscribers: _this.productQuerySubscribers.size
|
|
326
327
|
});
|
|
327
328
|
}
|
|
328
|
-
_context3.next =
|
|
329
|
+
_context3.next = 8;
|
|
329
330
|
return _this.computeProductQueryResult({
|
|
330
331
|
menu_list_ids: menu_list_ids,
|
|
331
332
|
ids: ids,
|
|
@@ -335,7 +336,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
335
336
|
extension_type: extension_type,
|
|
336
337
|
strategy_context: strategy_context
|
|
337
338
|
});
|
|
338
|
-
case
|
|
339
|
+
case 8:
|
|
339
340
|
result = _context3.sent;
|
|
340
341
|
if (subscriberId && typeof callback === 'function') {
|
|
341
342
|
_this.syncProductQueryScheduleTimers({
|
|
@@ -345,7 +346,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
345
346
|
});
|
|
346
347
|
}
|
|
347
348
|
return _context3.abrupt("return", result);
|
|
348
|
-
case
|
|
349
|
+
case 11:
|
|
349
350
|
case "end":
|
|
350
351
|
return _context3.stop();
|
|
351
352
|
}
|
|
@@ -369,9 +370,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
369
370
|
pathname = _this.parseRequestPath(url || '', path);
|
|
370
371
|
idMatch = pathname.match(/^\/shop\/product\/query\/(\d+)$/);
|
|
371
372
|
productId = idMatch ? Number(idMatch[1]) : NaN;
|
|
372
|
-
console.log('[Server] handleProductQueryById:', pathname, method, data);
|
|
373
373
|
if (Number.isFinite(productId)) {
|
|
374
|
-
_context4.next =
|
|
374
|
+
_context4.next = 7;
|
|
375
375
|
break;
|
|
376
376
|
}
|
|
377
377
|
_this.logWarning('handleProductQueryById: 无效的商品 id', {
|
|
@@ -385,11 +385,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
385
385
|
item: null
|
|
386
386
|
}
|
|
387
387
|
});
|
|
388
|
-
case
|
|
388
|
+
case 7:
|
|
389
389
|
scheduleDateFromData = data && _typeof(data) === 'object' && typeof data.schedule_date === 'string' ? data.schedule_date.trim() : '';
|
|
390
390
|
schedule_date = scheduleDateFromData || (_this.extractQueryParam(url || '', 'schedule_date') || '').trim() || dayjs().format('YYYY-MM-DD');
|
|
391
391
|
if (schedule_date) {
|
|
392
|
-
_context4.next =
|
|
392
|
+
_context4.next = 12;
|
|
393
393
|
break;
|
|
394
394
|
}
|
|
395
395
|
_this.logWarning('handleProductQueryById: 缺少 schedule_date', {
|
|
@@ -401,7 +401,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
401
401
|
status: false,
|
|
402
402
|
data: null
|
|
403
403
|
});
|
|
404
|
-
case
|
|
404
|
+
case 12:
|
|
405
405
|
scheduleDtFromData = data && _typeof(data) === 'object' && typeof data.schedule_datetime === 'string' ? data.schedule_datetime.trim() : '';
|
|
406
406
|
scheduleDtFromUrl = (_this.extractQueryParam(url || '', 'schedule_datetime') || '').trim();
|
|
407
407
|
scheduleDatetime = scheduleDtFromData || scheduleDtFromUrl || "".concat(schedule_date, "T00:00:00");
|
|
@@ -415,7 +415,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
415
415
|
schedule_datetime: scheduleDatetime,
|
|
416
416
|
product_id: productId
|
|
417
417
|
}));
|
|
418
|
-
case
|
|
418
|
+
case 17:
|
|
419
419
|
case "end":
|
|
420
420
|
return _context4.stop();
|
|
421
421
|
}
|
|
@@ -463,7 +463,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
463
463
|
while (1) switch (_context6.prev = _context6.next) {
|
|
464
464
|
case 0:
|
|
465
465
|
url = _ref13.url, method = _ref13.method, data = _ref13.data, config = _ref13.config;
|
|
466
|
-
console.log('[Server] handleOrderList:', url, method, data, config);
|
|
467
466
|
queryPayload = data && _typeof(data) === 'object' ? _objectSpread({}, data) : {};
|
|
468
467
|
_ref15 = config || {}, callback = _ref15.callback, subscriberId = _ref15.subscriberId;
|
|
469
468
|
useLocal = _this.shouldUseLocalOrderQuery(queryPayload);
|
|
@@ -472,7 +471,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
472
471
|
useLocal: useLocal
|
|
473
472
|
});
|
|
474
473
|
if (!useLocal) {
|
|
475
|
-
_context6.next =
|
|
474
|
+
_context6.next = 8;
|
|
476
475
|
break;
|
|
477
476
|
}
|
|
478
477
|
if (subscriberId && typeof callback === 'function') {
|
|
@@ -486,7 +485,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
486
485
|
});
|
|
487
486
|
}
|
|
488
487
|
return _context6.abrupt("return", _this.computeOrderQueryResult(queryPayload));
|
|
489
|
-
case
|
|
488
|
+
case 8:
|
|
490
489
|
if (subscriberId) {
|
|
491
490
|
_this.orderQuerySubscribers.delete(subscriberId);
|
|
492
491
|
_this.logInfo('handleOrderList: 已清理订阅者(走远端)', {
|
|
@@ -495,7 +494,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
495
494
|
});
|
|
496
495
|
}
|
|
497
496
|
return _context6.abrupt("return", _this.fetchOrderListFromAPI(queryPayload));
|
|
498
|
-
case
|
|
497
|
+
case 10:
|
|
499
498
|
case "end":
|
|
500
499
|
return _context6.stop();
|
|
501
500
|
}
|
|
@@ -638,7 +637,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
638
637
|
while (1) switch (_context11.prev = _context11.next) {
|
|
639
638
|
case 0:
|
|
640
639
|
url = _ref26.url, method = _ref26.method, data = _ref26.data, config = _ref26.config;
|
|
641
|
-
console.log('[Server] handleBookingList:', url, method, data, config);
|
|
642
640
|
queryPayload = data && _typeof(data) === 'object' ? _objectSpread({}, data) : {};
|
|
643
641
|
_ref28 = config || {}, callback = _ref28.callback, subscriberId = _ref28.subscriberId;
|
|
644
642
|
useLocal = _this.shouldUseLocalBookingQuery(queryPayload);
|
|
@@ -647,7 +645,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
647
645
|
useLocal: useLocal
|
|
648
646
|
});
|
|
649
647
|
if (!useLocal) {
|
|
650
|
-
_context11.next =
|
|
648
|
+
_context11.next = 11;
|
|
651
649
|
break;
|
|
652
650
|
}
|
|
653
651
|
if (subscriberId) {
|
|
@@ -664,7 +662,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
664
662
|
});
|
|
665
663
|
}
|
|
666
664
|
return _context11.abrupt("return", _this.computeBookingQueryResult(queryPayload));
|
|
667
|
-
case
|
|
665
|
+
case 11:
|
|
668
666
|
if (subscriberId) {
|
|
669
667
|
_this.bookingQuerySubscribers.delete(subscriberId);
|
|
670
668
|
}
|
|
@@ -690,7 +688,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
690
688
|
});
|
|
691
689
|
}
|
|
692
690
|
return _context11.abrupt("return", _this.fetchBookingListFromAPI(queryPayload));
|
|
693
|
-
case
|
|
691
|
+
case 15:
|
|
694
692
|
case "end":
|
|
695
693
|
return _context11.stop();
|
|
696
694
|
}
|
|
@@ -712,7 +710,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
712
710
|
while (1) switch (_context12.prev = _context12.next) {
|
|
713
711
|
case 0:
|
|
714
712
|
url = _ref29.url, method = _ref29.method, data = _ref29.data, config = _ref29.config;
|
|
715
|
-
console.log('[Server] handleResourceList:', url, method, data, config);
|
|
716
713
|
list = (_this$resource = _this.resource) === null || _this$resource === void 0 ? void 0 : _this$resource.getResources({
|
|
717
714
|
skip: (data === null || data === void 0 ? void 0 : data.skip) || 1,
|
|
718
715
|
num: (data === null || data === void 0 ? void 0 : data.num) || 10
|
|
@@ -729,7 +726,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
729
726
|
message: '',
|
|
730
727
|
status: true
|
|
731
728
|
});
|
|
732
|
-
case
|
|
729
|
+
case 4:
|
|
733
730
|
case "end":
|
|
734
731
|
return _context12.stop();
|
|
735
732
|
}
|
|
@@ -1690,7 +1687,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
1690
1687
|
while (1) switch (_context24.prev = _context24.next) {
|
|
1691
1688
|
case 0:
|
|
1692
1689
|
url = _ref58.url, method = _ref58.method, data = _ref58.data, config = _ref58.config;
|
|
1693
|
-
console.log('[Server] handleGetScheduleTimePoints:', url, method, data, config);
|
|
1694
1690
|
menu_list_ids = data.menu_list_ids;
|
|
1695
1691
|
_this.logInfo('handleGetScheduleTimePoints 开始处理', {
|
|
1696
1692
|
menuListIdsCount: (_menu_list_ids$length = menu_list_ids === null || menu_list_ids === void 0 ? void 0 : menu_list_ids.length) !== null && _menu_list_ids$length !== void 0 ? _menu_list_ids$length : 0,
|
|
@@ -1699,7 +1695,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1699
1695
|
|
|
1700
1696
|
// 检查必要的模块是否已注册
|
|
1701
1697
|
if (_this.menu) {
|
|
1702
|
-
_context24.next =
|
|
1698
|
+
_context24.next = 7;
|
|
1703
1699
|
break;
|
|
1704
1700
|
}
|
|
1705
1701
|
console.error('[Server] Menu 模块未注册');
|
|
@@ -1710,9 +1706,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
1710
1706
|
data: [],
|
|
1711
1707
|
status: false
|
|
1712
1708
|
});
|
|
1713
|
-
case
|
|
1709
|
+
case 7:
|
|
1714
1710
|
if (_this.schedule) {
|
|
1715
|
-
_context24.next =
|
|
1711
|
+
_context24.next = 11;
|
|
1716
1712
|
break;
|
|
1717
1713
|
}
|
|
1718
1714
|
console.error('[Server] Schedule 模块未注册');
|
|
@@ -1723,9 +1719,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
1723
1719
|
data: [],
|
|
1724
1720
|
status: false
|
|
1725
1721
|
});
|
|
1726
|
-
case
|
|
1722
|
+
case 11:
|
|
1727
1723
|
if (!(!menu_list_ids || !Array.isArray(menu_list_ids) || menu_list_ids.length === 0)) {
|
|
1728
|
-
_context24.next =
|
|
1724
|
+
_context24.next = 15;
|
|
1729
1725
|
break;
|
|
1730
1726
|
}
|
|
1731
1727
|
console.error('[Server] menu_list_ids 参数无效');
|
|
@@ -1739,22 +1735,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
1739
1735
|
data: [],
|
|
1740
1736
|
status: false
|
|
1741
1737
|
});
|
|
1742
|
-
case
|
|
1743
|
-
_context24.prev =
|
|
1738
|
+
case 15:
|
|
1739
|
+
_context24.prev = 15;
|
|
1744
1740
|
_this$getMenuSchedule = _this.getMenuScheduleTimePoints(menu_list_ids), menuList = _this$getMenuSchedule.menuList, scheduleIds = _this$getMenuSchedule.scheduleIds, scheduleList = _this$getMenuSchedule.scheduleList, timePoints = _this$getMenuSchedule.timePoints;
|
|
1745
|
-
console.log("[Server] \u627E\u5230 ".concat(menuList.length, " \u4E2A\u9910\u724C"));
|
|
1746
1741
|
_this.logInfo('handleGetScheduleTimePoints: 获取到餐牌列表', {
|
|
1747
1742
|
requestedCount: menu_list_ids.length,
|
|
1748
1743
|
foundCount: menuList.length,
|
|
1749
1744
|
menu_list_ids: menu_list_ids,
|
|
1750
1745
|
menuList: menuList
|
|
1751
1746
|
});
|
|
1752
|
-
console.log("[Server] \u63D0\u53D6\u5230 ".concat(scheduleIds.length, " \u4E2A\u65E5\u7A0BID:"), scheduleIds);
|
|
1753
1747
|
_this.logInfo('handleGetScheduleTimePoints: 提取到日程 IDs', {
|
|
1754
1748
|
scheduleCount: scheduleIds.length
|
|
1755
1749
|
});
|
|
1756
1750
|
if (!(scheduleIds.length === 0)) {
|
|
1757
|
-
_context24.next =
|
|
1751
|
+
_context24.next = 22;
|
|
1758
1752
|
break;
|
|
1759
1753
|
}
|
|
1760
1754
|
_this.logInfo('handleGetScheduleTimePoints: 没有找到相关日程', {
|
|
@@ -1766,13 +1760,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1766
1760
|
data: [],
|
|
1767
1761
|
status: true
|
|
1768
1762
|
});
|
|
1769
|
-
case
|
|
1770
|
-
console.log("[Server] \u627E\u5230 ".concat(scheduleList.length, " \u4E2A\u65E5\u7A0B"));
|
|
1763
|
+
case 22:
|
|
1771
1764
|
_this.logInfo('handleGetScheduleTimePoints: 获取到日程详情', {
|
|
1772
1765
|
requestedCount: scheduleIds.length,
|
|
1773
1766
|
foundCount: scheduleList.length
|
|
1774
1767
|
});
|
|
1775
|
-
console.log("[Server] \u63D0\u53D6\u5230 ".concat(timePoints.length, " \u4E2A\u65F6\u95F4\u70B9:"), timePoints);
|
|
1776
1768
|
_this.logInfo('handleGetScheduleTimePoints 处理完成', {
|
|
1777
1769
|
menuListIdsCount: menu_list_ids.length,
|
|
1778
1770
|
menuCount: menuList.length,
|
|
@@ -1785,9 +1777,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
1785
1777
|
data: timePoints,
|
|
1786
1778
|
status: true
|
|
1787
1779
|
});
|
|
1788
|
-
case
|
|
1789
|
-
_context24.prev =
|
|
1790
|
-
_context24.t0 = _context24["catch"](
|
|
1780
|
+
case 27:
|
|
1781
|
+
_context24.prev = 27;
|
|
1782
|
+
_context24.t0 = _context24["catch"](15);
|
|
1791
1783
|
errorMessage = _context24.t0 instanceof Error ? _context24.t0.message : '未知错误';
|
|
1792
1784
|
console.error('[Server] 获取日程时间点失败:', _context24.t0);
|
|
1793
1785
|
_this.logError('handleGetScheduleTimePoints: 获取日程时间点失败', {
|
|
@@ -1800,11 +1792,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1800
1792
|
data: [],
|
|
1801
1793
|
status: false
|
|
1802
1794
|
});
|
|
1803
|
-
case
|
|
1795
|
+
case 33:
|
|
1804
1796
|
case "end":
|
|
1805
1797
|
return _context24.stop();
|
|
1806
1798
|
}
|
|
1807
|
-
}, _callee24, null, [[
|
|
1799
|
+
}, _callee24, null, [[15, 27]]);
|
|
1808
1800
|
}));
|
|
1809
1801
|
return function (_x24) {
|
|
1810
1802
|
return _ref59.apply(this, arguments);
|
|
@@ -1814,7 +1806,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
1814
1806
|
var appPlugin = core.getPlugin('app');
|
|
1815
1807
|
this.app = (appPlugin === null || appPlugin === void 0 ? void 0 : appPlugin.getApp()) || null;
|
|
1816
1808
|
this.logger = ((_this$app4 = this.app) === null || _this$app4 === void 0 ? void 0 : _this$app4.logger) || null;
|
|
1817
|
-
console.log('[Server] Server 初始化', this.core);
|
|
1818
1809
|
this.logInfo('Server 初始化', {
|
|
1819
1810
|
hasApp: !!this.app,
|
|
1820
1811
|
hasLogger: !!this.logger
|
|
@@ -1875,7 +1866,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
1875
1866
|
});
|
|
1876
1867
|
}
|
|
1877
1868
|
_this2.router[method][path] = handler;
|
|
1878
|
-
console.log("[Server] \uD83D\uDCDD \u6CE8\u518C\u8DEF\u7531: ".concat(method.toUpperCase(), " ").concat(path));
|
|
1879
1869
|
_this2.logInfo("\u6CE8\u518C\u8DEF\u7531", {
|
|
1880
1870
|
method: method.toUpperCase(),
|
|
1881
1871
|
path: path
|
|
@@ -1942,7 +1932,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
1942
1932
|
_context25.next = 3;
|
|
1943
1933
|
return this.core.registerModule(module, options);
|
|
1944
1934
|
case 3:
|
|
1945
|
-
console.log("[Server] \u2705 ".concat(moduleName, " \u6A21\u5757\u5DF2\u6CE8\u518C"));
|
|
1946
1935
|
this.logInfo("\u6A21\u5757\u6CE8\u518C\u6210\u529F: ".concat(moduleName), {
|
|
1947
1936
|
moduleName: moduleName
|
|
1948
1937
|
});
|
|
@@ -1958,7 +1947,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1958
1947
|
});
|
|
1959
1948
|
}
|
|
1960
1949
|
}
|
|
1961
|
-
case
|
|
1950
|
+
case 5:
|
|
1962
1951
|
case "end":
|
|
1963
1952
|
return _context25.stop();
|
|
1964
1953
|
}
|
|
@@ -2048,8 +2037,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
2048
2037
|
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2049
2038
|
while (1) switch (_context27.prev = _context27.next) {
|
|
2050
2039
|
case 0:
|
|
2051
|
-
console.log('[Server] 开始注册模块...');
|
|
2052
|
-
|
|
2053
2040
|
// 如果没有指定模块,则注册所有模块
|
|
2054
2041
|
configs = moduleConfigs || Object.keys(this.moduleRegistry);
|
|
2055
2042
|
this.logInfo('开始批量注册模块', {
|
|
@@ -2058,26 +2045,26 @@ var Server = /*#__PURE__*/function () {
|
|
|
2058
2045
|
});
|
|
2059
2046
|
registeredModules = [];
|
|
2060
2047
|
_iterator2 = _createForOfIteratorHelper(configs);
|
|
2061
|
-
_context27.prev =
|
|
2048
|
+
_context27.prev = 4;
|
|
2062
2049
|
_iterator2.s();
|
|
2063
|
-
case
|
|
2050
|
+
case 6:
|
|
2064
2051
|
if ((_step2 = _iterator2.n()).done) {
|
|
2065
|
-
_context27.next =
|
|
2052
|
+
_context27.next = 24;
|
|
2066
2053
|
break;
|
|
2067
2054
|
}
|
|
2068
2055
|
config = _step2.value;
|
|
2069
2056
|
configName = typeof config === 'string' ? config : config.name;
|
|
2070
|
-
_context27.prev =
|
|
2071
|
-
_context27.next =
|
|
2057
|
+
_context27.prev = 9;
|
|
2058
|
+
_context27.next = 12;
|
|
2072
2059
|
return this.registerModuleByName(config);
|
|
2073
|
-
case
|
|
2060
|
+
case 12:
|
|
2074
2061
|
result = _context27.sent;
|
|
2075
2062
|
registeredModules.push(result);
|
|
2076
|
-
_context27.next =
|
|
2063
|
+
_context27.next = 22;
|
|
2077
2064
|
break;
|
|
2078
|
-
case
|
|
2079
|
-
_context27.prev =
|
|
2080
|
-
_context27.t0 = _context27["catch"](
|
|
2065
|
+
case 16:
|
|
2066
|
+
_context27.prev = 16;
|
|
2067
|
+
_context27.t0 = _context27["catch"](9);
|
|
2081
2068
|
errorMessage = _context27.t0 instanceof Error ? _context27.t0.message : String(_context27.t0);
|
|
2082
2069
|
this.logError("\u6A21\u5757\u6CE8\u518C\u5931\u8D25: ".concat(configName), {
|
|
2083
2070
|
moduleName: configName,
|
|
@@ -2085,22 +2072,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
2085
2072
|
});
|
|
2086
2073
|
console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:", _context27.t0);
|
|
2087
2074
|
throw _context27.t0;
|
|
2088
|
-
case
|
|
2089
|
-
_context27.next =
|
|
2075
|
+
case 22:
|
|
2076
|
+
_context27.next = 6;
|
|
2090
2077
|
break;
|
|
2091
|
-
case
|
|
2092
|
-
_context27.next =
|
|
2078
|
+
case 24:
|
|
2079
|
+
_context27.next = 29;
|
|
2093
2080
|
break;
|
|
2094
|
-
case
|
|
2095
|
-
_context27.prev =
|
|
2096
|
-
_context27.t1 = _context27["catch"](
|
|
2081
|
+
case 26:
|
|
2082
|
+
_context27.prev = 26;
|
|
2083
|
+
_context27.t1 = _context27["catch"](4);
|
|
2097
2084
|
_iterator2.e(_context27.t1);
|
|
2098
|
-
case
|
|
2099
|
-
_context27.prev =
|
|
2085
|
+
case 29:
|
|
2086
|
+
_context27.prev = 29;
|
|
2100
2087
|
_iterator2.f();
|
|
2101
|
-
return _context27.finish(
|
|
2102
|
-
case
|
|
2103
|
-
console.log('[Server] ✅ 所有模块注册完成');
|
|
2088
|
+
return _context27.finish(29);
|
|
2089
|
+
case 32:
|
|
2104
2090
|
this.logInfo('所有模块注册完成', {
|
|
2105
2091
|
registeredCount: registeredModules.length,
|
|
2106
2092
|
moduleNames: registeredModules.map(function (m) {
|
|
@@ -2109,11 +2095,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2109
2095
|
})
|
|
2110
2096
|
});
|
|
2111
2097
|
return _context27.abrupt("return", registeredModules);
|
|
2112
|
-
case
|
|
2098
|
+
case 34:
|
|
2113
2099
|
case "end":
|
|
2114
2100
|
return _context27.stop();
|
|
2115
2101
|
}
|
|
2116
|
-
}, _callee27, this, [[
|
|
2102
|
+
}, _callee27, this, [[4, 26, 29, 32], [9, 16]]);
|
|
2117
2103
|
}));
|
|
2118
2104
|
function registerModules(_x29) {
|
|
2119
2105
|
return _registerModules.apply(this, arguments);
|
|
@@ -2133,7 +2119,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
2133
2119
|
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2134
2120
|
while (1) switch (_context28.prev = _context28.next) {
|
|
2135
2121
|
case 0:
|
|
2136
|
-
console.log('[Server] 开始预加载模块数据...');
|
|
2137
2122
|
modulesToPreload = registeredModules.filter(function (m) {
|
|
2138
2123
|
return m.shouldPreload;
|
|
2139
2124
|
});
|
|
@@ -2144,41 +2129,39 @@ var Server = /*#__PURE__*/function () {
|
|
|
2144
2129
|
});
|
|
2145
2130
|
preloadResults = [];
|
|
2146
2131
|
_iterator3 = _createForOfIteratorHelper(registeredModules);
|
|
2147
|
-
_context28.prev =
|
|
2132
|
+
_context28.prev = 4;
|
|
2148
2133
|
_iterator3.s();
|
|
2149
|
-
case
|
|
2134
|
+
case 6:
|
|
2150
2135
|
if ((_step3 = _iterator3.n()).done) {
|
|
2151
|
-
_context28.next =
|
|
2136
|
+
_context28.next = 36;
|
|
2152
2137
|
break;
|
|
2153
2138
|
}
|
|
2154
2139
|
_step3$value = _step3.value, module = _step3$value.module, config = _step3$value.config, shouldPreload = _step3$value.shouldPreload;
|
|
2155
2140
|
if (shouldPreload) {
|
|
2156
|
-
_context28.next =
|
|
2141
|
+
_context28.next = 11;
|
|
2157
2142
|
break;
|
|
2158
2143
|
}
|
|
2159
|
-
console.log("[Server] \u23ED\uFE0F \u8DF3\u8FC7 ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D"));
|
|
2160
2144
|
this.logInfo("\u8DF3\u8FC7\u6A21\u5757\u9884\u52A0\u8F7D: ".concat(config.name), {
|
|
2161
2145
|
moduleName: config.name,
|
|
2162
2146
|
reason: 'shouldPreload=false'
|
|
2163
2147
|
});
|
|
2164
|
-
return _context28.abrupt("continue",
|
|
2165
|
-
case
|
|
2148
|
+
return _context28.abrupt("continue", 34);
|
|
2149
|
+
case 11:
|
|
2166
2150
|
if (!(typeof module.preload === 'function')) {
|
|
2167
|
-
_context28.next =
|
|
2151
|
+
_context28.next = 33;
|
|
2168
2152
|
break;
|
|
2169
2153
|
}
|
|
2170
2154
|
startTime = Date.now();
|
|
2171
|
-
_context28.prev =
|
|
2155
|
+
_context28.prev = 13;
|
|
2172
2156
|
this.logInfo("\u5F00\u59CB\u9884\u52A0\u8F7D\u6A21\u5757: ".concat(config.name), {
|
|
2173
2157
|
moduleName: config.name
|
|
2174
2158
|
});
|
|
2175
2159
|
options === null || options === void 0 || (_options$onModuleLoad = options.onModuleLoad) === null || _options$onModuleLoad === void 0 || _options$onModuleLoad.call(options, config.name);
|
|
2176
|
-
_context28.next =
|
|
2160
|
+
_context28.next = 18;
|
|
2177
2161
|
return module.preload();
|
|
2178
|
-
case
|
|
2162
|
+
case 18:
|
|
2179
2163
|
options === null || options === void 0 || (_options$onModuleLoad2 = options.onModuleLoadComplete) === null || _options$onModuleLoad2 === void 0 || _options$onModuleLoad2.call(options, config.name);
|
|
2180
2164
|
duration = Date.now() - startTime;
|
|
2181
|
-
console.log("[Server] \u2705 ".concat(config.name, " \u6A21\u5757\u6570\u636E\u5DF2\u9884\u52A0\u8F7D"));
|
|
2182
2165
|
this.logInfo("\u6A21\u5757\u9884\u52A0\u8F7D\u6210\u529F: ".concat(config.name), {
|
|
2183
2166
|
moduleName: config.name,
|
|
2184
2167
|
duration: "".concat(duration, "ms")
|
|
@@ -2187,11 +2170,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2187
2170
|
name: config.name,
|
|
2188
2171
|
success: true
|
|
2189
2172
|
});
|
|
2190
|
-
_context28.next =
|
|
2173
|
+
_context28.next = 31;
|
|
2191
2174
|
break;
|
|
2192
|
-
case
|
|
2193
|
-
_context28.prev =
|
|
2194
|
-
_context28.t0 = _context28["catch"](
|
|
2175
|
+
case 24:
|
|
2176
|
+
_context28.prev = 24;
|
|
2177
|
+
_context28.t0 = _context28["catch"](13);
|
|
2195
2178
|
_duration = Date.now() - startTime;
|
|
2196
2179
|
errorMessage = _context28.t0 instanceof Error ? _context28.t0.message : String(_context28.t0);
|
|
2197
2180
|
console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"), _context28.t0);
|
|
@@ -2205,45 +2188,43 @@ var Server = /*#__PURE__*/function () {
|
|
|
2205
2188
|
success: false,
|
|
2206
2189
|
error: errorMessage
|
|
2207
2190
|
});
|
|
2208
|
-
case
|
|
2209
|
-
_context28.next =
|
|
2191
|
+
case 31:
|
|
2192
|
+
_context28.next = 34;
|
|
2210
2193
|
break;
|
|
2211
|
-
case
|
|
2212
|
-
console.log("[Server] \u26A0\uFE0F ".concat(config.name, " \u6A21\u5757\u672A\u5B9E\u73B0 preload() \u65B9\u6CD5"));
|
|
2194
|
+
case 33:
|
|
2213
2195
|
this.logWarning("\u6A21\u5757\u672A\u5B9E\u73B0 preload \u65B9\u6CD5: ".concat(config.name), {
|
|
2214
2196
|
moduleName: config.name
|
|
2215
2197
|
});
|
|
2216
|
-
case
|
|
2217
|
-
_context28.next =
|
|
2198
|
+
case 34:
|
|
2199
|
+
_context28.next = 6;
|
|
2218
2200
|
break;
|
|
2219
|
-
case
|
|
2220
|
-
_context28.next =
|
|
2201
|
+
case 36:
|
|
2202
|
+
_context28.next = 41;
|
|
2221
2203
|
break;
|
|
2222
|
-
case
|
|
2223
|
-
_context28.prev =
|
|
2224
|
-
_context28.t1 = _context28["catch"](
|
|
2204
|
+
case 38:
|
|
2205
|
+
_context28.prev = 38;
|
|
2206
|
+
_context28.t1 = _context28["catch"](4);
|
|
2225
2207
|
_iterator3.e(_context28.t1);
|
|
2226
|
-
case
|
|
2227
|
-
_context28.prev =
|
|
2208
|
+
case 41:
|
|
2209
|
+
_context28.prev = 41;
|
|
2228
2210
|
_iterator3.f();
|
|
2229
|
-
return _context28.finish(
|
|
2230
|
-
case
|
|
2211
|
+
return _context28.finish(41);
|
|
2212
|
+
case 44:
|
|
2231
2213
|
successCount = preloadResults.filter(function (r) {
|
|
2232
2214
|
return r.success;
|
|
2233
2215
|
}).length;
|
|
2234
2216
|
failCount = preloadResults.filter(function (r) {
|
|
2235
2217
|
return !r.success;
|
|
2236
2218
|
}).length;
|
|
2237
|
-
console.log('[Server] ✅ 所有模块数据预加载完成');
|
|
2238
2219
|
this.logInfo('所有模块预加载完成', {
|
|
2239
2220
|
successCount: successCount,
|
|
2240
2221
|
failCount: failCount
|
|
2241
2222
|
});
|
|
2242
|
-
case
|
|
2223
|
+
case 47:
|
|
2243
2224
|
case "end":
|
|
2244
2225
|
return _context28.stop();
|
|
2245
2226
|
}
|
|
2246
|
-
}, _callee28, this, [[
|
|
2227
|
+
}, _callee28, this, [[4, 38, 41, 44], [13, 24]]);
|
|
2247
2228
|
}));
|
|
2248
2229
|
function preloadModulesData(_x30, _x31) {
|
|
2249
2230
|
return _preloadModulesData.apply(this, arguments);
|
|
@@ -2266,6 +2247,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2266
2247
|
options,
|
|
2267
2248
|
startTime,
|
|
2268
2249
|
registeredModules,
|
|
2250
|
+
preloadTask,
|
|
2269
2251
|
duration,
|
|
2270
2252
|
_args29 = arguments;
|
|
2271
2253
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
@@ -2290,22 +2272,31 @@ var Server = /*#__PURE__*/function () {
|
|
|
2290
2272
|
case 8:
|
|
2291
2273
|
registeredModules = _context29.sent;
|
|
2292
2274
|
if (!autoPreload) {
|
|
2293
|
-
_context29.next =
|
|
2275
|
+
_context29.next = 20;
|
|
2294
2276
|
break;
|
|
2295
2277
|
}
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2278
|
+
preloadTask = this.preloadModulesData(registeredModules, options);
|
|
2279
|
+
this.startupModulePreloadInFlight = preloadTask;
|
|
2280
|
+
_context29.prev = 12;
|
|
2299
2281
|
_context29.next = 15;
|
|
2282
|
+
return preloadTask;
|
|
2283
|
+
case 15:
|
|
2284
|
+
_context29.prev = 15;
|
|
2285
|
+
if (this.startupModulePreloadInFlight === preloadTask) {
|
|
2286
|
+
this.startupModulePreloadInFlight = null;
|
|
2287
|
+
}
|
|
2288
|
+
return _context29.finish(15);
|
|
2289
|
+
case 18:
|
|
2290
|
+
_context29.next = 21;
|
|
2300
2291
|
break;
|
|
2301
|
-
case
|
|
2292
|
+
case 20:
|
|
2302
2293
|
this.logInfo('跳过自动预加载', {
|
|
2303
2294
|
autoPreload: autoPreload
|
|
2304
2295
|
});
|
|
2305
|
-
case
|
|
2306
|
-
_context29.next =
|
|
2296
|
+
case 21:
|
|
2297
|
+
_context29.next = 23;
|
|
2307
2298
|
return this.setupProductsQuotationPriceBridge();
|
|
2308
|
-
case
|
|
2299
|
+
case 23:
|
|
2309
2300
|
// 监听 ProductsModule 同步完成事件,重新计算并推送查询结果
|
|
2310
2301
|
this.core.effects.on(ProductsHooks.onProductsSyncCompleted, function (payload) {
|
|
2311
2302
|
_this3.recomputeAndNotifyProductQuery({
|
|
@@ -2331,11 +2322,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2331
2322
|
registeredModuleCount: registeredModules.length
|
|
2332
2323
|
});
|
|
2333
2324
|
return _context29.abrupt("return", registeredModules);
|
|
2334
|
-
case
|
|
2325
|
+
case 29:
|
|
2335
2326
|
case "end":
|
|
2336
2327
|
return _context29.stop();
|
|
2337
2328
|
}
|
|
2338
|
-
}, _callee29, this);
|
|
2329
|
+
}, _callee29, this, [[12,, 15, 18]]);
|
|
2339
2330
|
}));
|
|
2340
2331
|
function initialize(_x32) {
|
|
2341
2332
|
return _initialize.apply(this, arguments);
|
|
@@ -2717,6 +2708,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2717
2708
|
key: "setupProductsQuotationPriceBridge",
|
|
2718
2709
|
value: (function () {
|
|
2719
2710
|
var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2711
|
+
var _this5 = this;
|
|
2720
2712
|
var _this$core$context, errorMessage;
|
|
2721
2713
|
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2722
2714
|
while (1) switch (_context33.prev = _context33.next) {
|
|
@@ -2736,31 +2728,42 @@ var Server = /*#__PURE__*/function () {
|
|
|
2736
2728
|
return _context33.abrupt("return");
|
|
2737
2729
|
case 6:
|
|
2738
2730
|
_context33.prev = 6;
|
|
2739
|
-
_context33.next = 9;
|
|
2740
|
-
return this.schedule.loadAllSchedule();
|
|
2741
|
-
case 9:
|
|
2742
2731
|
this.products.clearPriceCache();
|
|
2743
|
-
_context33.next =
|
|
2732
|
+
_context33.next = 10;
|
|
2744
2733
|
return this.products.setupQuotationPriceBridge({
|
|
2745
2734
|
scheduleModule: this.schedule,
|
|
2746
|
-
channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel
|
|
2735
|
+
channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel,
|
|
2736
|
+
onQuotationUpdated: function onQuotationUpdated() {
|
|
2737
|
+
void _this5.recomputeAndNotifyProductQuery();
|
|
2738
|
+
}
|
|
2739
|
+
});
|
|
2740
|
+
case 10:
|
|
2741
|
+
// Schedule 已在模块 preload 阶段加载完成。价格桥接先使用本地数据,
|
|
2742
|
+
// 远端刷新转为后台校准,避免二次启动重复阻塞请求。
|
|
2743
|
+
void this.schedule.loadAllSchedule().then(function () {
|
|
2744
|
+
var _this5$products;
|
|
2745
|
+
(_this5$products = _this5.products) === null || _this5$products === void 0 || _this5$products.clearPriceCache();
|
|
2746
|
+
void _this5.recomputeAndNotifyProductQuery();
|
|
2747
|
+
}).catch(function (error) {
|
|
2748
|
+
_this5.logWarning('Products 报价单价格桥接后台刷新 Schedule 失败,继续使用本地数据', {
|
|
2749
|
+
error: error instanceof Error ? error.message : String(error)
|
|
2750
|
+
});
|
|
2747
2751
|
});
|
|
2748
|
-
case 12:
|
|
2749
2752
|
this.logInfo('Products 报价单价格桥接初始化完成');
|
|
2750
|
-
_context33.next =
|
|
2753
|
+
_context33.next = 18;
|
|
2751
2754
|
break;
|
|
2752
|
-
case
|
|
2753
|
-
_context33.prev =
|
|
2755
|
+
case 14:
|
|
2756
|
+
_context33.prev = 14;
|
|
2754
2757
|
_context33.t0 = _context33["catch"](6);
|
|
2755
2758
|
errorMessage = _context33.t0 instanceof Error ? _context33.t0.message : String(_context33.t0);
|
|
2756
2759
|
this.logError('Products 报价单价格桥接初始化失败', {
|
|
2757
2760
|
error: errorMessage
|
|
2758
2761
|
});
|
|
2759
|
-
case
|
|
2762
|
+
case 18:
|
|
2760
2763
|
case "end":
|
|
2761
2764
|
return _context33.stop();
|
|
2762
2765
|
}
|
|
2763
|
-
}, _callee33, this, [[6,
|
|
2766
|
+
}, _callee33, this, [[6, 14]]);
|
|
2764
2767
|
}));
|
|
2765
2768
|
function setupProductsQuotationPriceBridge() {
|
|
2766
2769
|
return _setupProductsQuotationPriceBridge.apply(this, arguments);
|
|
@@ -2830,44 +2833,58 @@ var Server = /*#__PURE__*/function () {
|
|
|
2830
2833
|
key: "refreshProductsInBackground",
|
|
2831
2834
|
value: (function () {
|
|
2832
2835
|
var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2833
|
-
var
|
|
2836
|
+
var options,
|
|
2837
|
+
trigger,
|
|
2838
|
+
startTime,
|
|
2839
|
+
duration,
|
|
2840
|
+
_duration2,
|
|
2841
|
+
errorMessage,
|
|
2842
|
+
_args34 = arguments;
|
|
2834
2843
|
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2835
2844
|
while (1) switch (_context34.prev = _context34.next) {
|
|
2836
2845
|
case 0:
|
|
2846
|
+
options = _args34.length > 0 && _args34[0] !== undefined ? _args34[0] : {};
|
|
2837
2847
|
if (this.products) {
|
|
2838
|
-
_context34.next =
|
|
2848
|
+
_context34.next = 4;
|
|
2839
2849
|
break;
|
|
2840
2850
|
}
|
|
2841
2851
|
this.logWarning('refreshProductsInBackground: Products 模块未注册');
|
|
2842
2852
|
return _context34.abrupt("return");
|
|
2843
|
-
case
|
|
2844
|
-
|
|
2853
|
+
case 4:
|
|
2854
|
+
trigger = options.trigger || 'background';
|
|
2855
|
+
this.logInfo('refreshProductsInBackground 开始', {
|
|
2856
|
+
trigger: trigger
|
|
2857
|
+
});
|
|
2845
2858
|
startTime = Date.now();
|
|
2846
|
-
_context34.prev =
|
|
2847
|
-
_context34.next =
|
|
2848
|
-
return this.products.silentRefresh(
|
|
2849
|
-
|
|
2859
|
+
_context34.prev = 7;
|
|
2860
|
+
_context34.next = 10;
|
|
2861
|
+
return this.products.silentRefresh({
|
|
2862
|
+
trigger: trigger
|
|
2863
|
+
});
|
|
2864
|
+
case 10:
|
|
2850
2865
|
duration = Date.now() - startTime;
|
|
2851
2866
|
this.logInfo('refreshProductsInBackground 完成', {
|
|
2867
|
+
trigger: trigger,
|
|
2852
2868
|
duration: "".concat(duration, "ms")
|
|
2853
2869
|
});
|
|
2854
|
-
_context34.next =
|
|
2870
|
+
_context34.next = 20;
|
|
2855
2871
|
break;
|
|
2856
|
-
case
|
|
2857
|
-
_context34.prev =
|
|
2858
|
-
_context34.t0 = _context34["catch"](
|
|
2872
|
+
case 14:
|
|
2873
|
+
_context34.prev = 14;
|
|
2874
|
+
_context34.t0 = _context34["catch"](7);
|
|
2859
2875
|
_duration2 = Date.now() - startTime;
|
|
2860
2876
|
errorMessage = _context34.t0 instanceof Error ? _context34.t0.message : String(_context34.t0);
|
|
2861
2877
|
console.error('[Server] refreshProductsInBackground 失败:', _context34.t0);
|
|
2862
2878
|
this.logError('refreshProductsInBackground 失败', {
|
|
2879
|
+
trigger: trigger,
|
|
2863
2880
|
duration: "".concat(_duration2, "ms"),
|
|
2864
2881
|
error: errorMessage
|
|
2865
2882
|
});
|
|
2866
|
-
case
|
|
2883
|
+
case 20:
|
|
2867
2884
|
case "end":
|
|
2868
2885
|
return _context34.stop();
|
|
2869
2886
|
}
|
|
2870
|
-
}, _callee34, this, [[
|
|
2887
|
+
}, _callee34, this, [[7, 14]]);
|
|
2871
2888
|
}));
|
|
2872
2889
|
function refreshProductsInBackground() {
|
|
2873
2890
|
return _refreshProductsInBackground.apply(this, arguments);
|
|
@@ -2884,44 +2901,58 @@ var Server = /*#__PURE__*/function () {
|
|
|
2884
2901
|
key: "refreshOrdersInBackground",
|
|
2885
2902
|
value: (function () {
|
|
2886
2903
|
var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2887
|
-
var
|
|
2904
|
+
var options,
|
|
2905
|
+
trigger,
|
|
2906
|
+
startTime,
|
|
2907
|
+
duration,
|
|
2908
|
+
_duration3,
|
|
2909
|
+
errorMessage,
|
|
2910
|
+
_args35 = arguments;
|
|
2888
2911
|
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2889
2912
|
while (1) switch (_context35.prev = _context35.next) {
|
|
2890
2913
|
case 0:
|
|
2914
|
+
options = _args35.length > 0 && _args35[0] !== undefined ? _args35[0] : {};
|
|
2891
2915
|
if (this.order) {
|
|
2892
|
-
_context35.next =
|
|
2916
|
+
_context35.next = 4;
|
|
2893
2917
|
break;
|
|
2894
2918
|
}
|
|
2895
2919
|
this.logWarning('refreshOrdersInBackground: Order 模块未注册');
|
|
2896
2920
|
return _context35.abrupt("return");
|
|
2897
|
-
case
|
|
2898
|
-
|
|
2921
|
+
case 4:
|
|
2922
|
+
trigger = options.trigger || 'background';
|
|
2923
|
+
this.logInfo('refreshOrdersInBackground 开始', {
|
|
2924
|
+
trigger: trigger
|
|
2925
|
+
});
|
|
2899
2926
|
startTime = Date.now();
|
|
2900
|
-
_context35.prev =
|
|
2901
|
-
_context35.next =
|
|
2902
|
-
return this.order.silentRefresh(
|
|
2903
|
-
|
|
2927
|
+
_context35.prev = 7;
|
|
2928
|
+
_context35.next = 10;
|
|
2929
|
+
return this.order.silentRefresh({
|
|
2930
|
+
trigger: trigger
|
|
2931
|
+
});
|
|
2932
|
+
case 10:
|
|
2904
2933
|
duration = Date.now() - startTime;
|
|
2905
2934
|
this.logInfo('refreshOrdersInBackground 完成', {
|
|
2935
|
+
trigger: trigger,
|
|
2906
2936
|
duration: "".concat(duration, "ms")
|
|
2907
2937
|
});
|
|
2908
|
-
_context35.next =
|
|
2938
|
+
_context35.next = 20;
|
|
2909
2939
|
break;
|
|
2910
|
-
case
|
|
2911
|
-
_context35.prev =
|
|
2912
|
-
_context35.t0 = _context35["catch"](
|
|
2940
|
+
case 14:
|
|
2941
|
+
_context35.prev = 14;
|
|
2942
|
+
_context35.t0 = _context35["catch"](7);
|
|
2913
2943
|
_duration3 = Date.now() - startTime;
|
|
2914
2944
|
errorMessage = _context35.t0 instanceof Error ? _context35.t0.message : String(_context35.t0);
|
|
2915
2945
|
console.error('[Server] refreshOrdersInBackground 失败:', _context35.t0);
|
|
2916
2946
|
this.logError('refreshOrdersInBackground 失败', {
|
|
2947
|
+
trigger: trigger,
|
|
2917
2948
|
duration: "".concat(_duration3, "ms"),
|
|
2918
2949
|
error: errorMessage
|
|
2919
2950
|
});
|
|
2920
|
-
case
|
|
2951
|
+
case 20:
|
|
2921
2952
|
case "end":
|
|
2922
2953
|
return _context35.stop();
|
|
2923
2954
|
}
|
|
2924
|
-
}, _callee35, this, [[
|
|
2955
|
+
}, _callee35, this, [[7, 14]]);
|
|
2925
2956
|
}));
|
|
2926
2957
|
function refreshOrdersInBackground() {
|
|
2927
2958
|
return _refreshOrdersInBackground.apply(this, arguments);
|
|
@@ -3022,7 +3053,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
3022
3053
|
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3023
3054
|
while (1) switch (_context37.prev = _context37.next) {
|
|
3024
3055
|
case 0:
|
|
3025
|
-
console.log('[Server] 开始清空所有模块的IndexedDB缓存...');
|
|
3026
3056
|
this.logInfo('开始清空所有模块的 IndexedDB 缓存');
|
|
3027
3057
|
clearTasks = [];
|
|
3028
3058
|
moduleNames = []; // 收集所有模块的清空任务
|
|
@@ -3055,29 +3085,28 @@ var Server = /*#__PURE__*/function () {
|
|
|
3055
3085
|
moduleNames.push('FloorPlan');
|
|
3056
3086
|
}
|
|
3057
3087
|
if (!(clearTasks.length === 0)) {
|
|
3058
|
-
_context37.next =
|
|
3088
|
+
_context37.next = 14;
|
|
3059
3089
|
break;
|
|
3060
3090
|
}
|
|
3061
3091
|
console.warn('[Server] 没有找到已注册的模块,无需清空');
|
|
3062
3092
|
this.logWarning('没有找到已注册的模块,无需清空 IndexedDB');
|
|
3063
3093
|
return _context37.abrupt("return");
|
|
3064
|
-
case
|
|
3094
|
+
case 14:
|
|
3065
3095
|
this.logInfo('准备清空模块缓存', {
|
|
3066
3096
|
moduleNames: moduleNames
|
|
3067
3097
|
});
|
|
3068
|
-
_context37.prev =
|
|
3069
|
-
_context37.next =
|
|
3098
|
+
_context37.prev = 15;
|
|
3099
|
+
_context37.next = 18;
|
|
3070
3100
|
return Promise.all(clearTasks);
|
|
3071
|
-
case
|
|
3072
|
-
console.log("[Server] \u2705 \u5DF2\u6210\u529F\u6E05\u7A7A\u6240\u6709\u6A21\u5757\u7684IndexedDB\u7F13\u5B58: ".concat(moduleNames.join(', ')));
|
|
3101
|
+
case 18:
|
|
3073
3102
|
this.logInfo('成功清空所有模块的 IndexedDB 缓存', {
|
|
3074
3103
|
moduleNames: moduleNames
|
|
3075
3104
|
});
|
|
3076
|
-
_context37.next =
|
|
3105
|
+
_context37.next = 27;
|
|
3077
3106
|
break;
|
|
3078
|
-
case
|
|
3079
|
-
_context37.prev =
|
|
3080
|
-
_context37.t0 = _context37["catch"](
|
|
3107
|
+
case 21:
|
|
3108
|
+
_context37.prev = 21;
|
|
3109
|
+
_context37.t0 = _context37["catch"](15);
|
|
3081
3110
|
errorMessage = _context37.t0 instanceof Error ? _context37.t0.message : String(_context37.t0);
|
|
3082
3111
|
console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context37.t0);
|
|
3083
3112
|
this.logError('清空 IndexedDB 缓存时发生错误', {
|
|
@@ -3085,11 +3114,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3085
3114
|
error: errorMessage
|
|
3086
3115
|
});
|
|
3087
3116
|
throw _context37.t0;
|
|
3088
|
-
case
|
|
3117
|
+
case 27:
|
|
3089
3118
|
case "end":
|
|
3090
3119
|
return _context37.stop();
|
|
3091
3120
|
}
|
|
3092
|
-
}, _callee37, this, [[
|
|
3121
|
+
}, _callee37, this, [[15, 21]]);
|
|
3093
3122
|
}));
|
|
3094
3123
|
function clearAllIndexDB() {
|
|
3095
3124
|
return _clearAllIndexDB.apply(this, arguments);
|
|
@@ -3235,10 +3264,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3235
3264
|
}, {
|
|
3236
3265
|
key: "getAllRoutes",
|
|
3237
3266
|
value: function getAllRoutes() {
|
|
3238
|
-
var
|
|
3267
|
+
var _this6 = this;
|
|
3239
3268
|
var routes = [];
|
|
3240
3269
|
['get', 'post', 'put', 'remove'].forEach(function (method) {
|
|
3241
|
-
Object.keys(
|
|
3270
|
+
Object.keys(_this6.router[method]).forEach(function (path) {
|
|
3242
3271
|
routes.push({
|
|
3243
3272
|
method: method,
|
|
3244
3273
|
path: path
|
|
@@ -3256,7 +3285,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
3256
3285
|
}, {
|
|
3257
3286
|
key: "registerServerRoutes",
|
|
3258
3287
|
value: function registerServerRoutes() {
|
|
3259
|
-
console.log('[Server] 注册 Server 层业务路由...');
|
|
3260
3288
|
this.registerRoutes([{
|
|
3261
3289
|
method: 'post',
|
|
3262
3290
|
path: '/shop/product/query',
|
|
@@ -3368,7 +3396,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3368
3396
|
key: "getPaymentRouteModule",
|
|
3369
3397
|
value: function () {
|
|
3370
3398
|
var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3371
|
-
var
|
|
3399
|
+
var _this7 = this;
|
|
3372
3400
|
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3373
3401
|
while (1) switch (_context40.prev = _context40.next) {
|
|
3374
3402
|
case 0:
|
|
@@ -3397,13 +3425,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
3397
3425
|
case 0:
|
|
3398
3426
|
module = new PaymentServerModule('server_payment_route', '1.0.0');
|
|
3399
3427
|
_context39.next = 3;
|
|
3400
|
-
return module.initialize(
|
|
3428
|
+
return module.initialize(_this7.core, {
|
|
3401
3429
|
store: {
|
|
3402
3430
|
payMethods: []
|
|
3403
3431
|
}
|
|
3404
3432
|
});
|
|
3405
3433
|
case 3:
|
|
3406
|
-
|
|
3434
|
+
_this7.paymentRouteModule = module;
|
|
3407
3435
|
return _context39.abrupt("return", module);
|
|
3408
3436
|
case 5:
|
|
3409
3437
|
case "end":
|
|
@@ -3411,7 +3439,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3411
3439
|
}
|
|
3412
3440
|
}, _callee39);
|
|
3413
3441
|
}))().finally(function () {
|
|
3414
|
-
|
|
3442
|
+
_this7.paymentRouteModuleInFlight = undefined;
|
|
3415
3443
|
});
|
|
3416
3444
|
return _context40.abrupt("return", this.paymentRouteModuleInFlight);
|
|
3417
3445
|
case 8:
|
|
@@ -3587,7 +3615,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3587
3615
|
}, {
|
|
3588
3616
|
key: "scheduleSubscriberTimePointReloads",
|
|
3589
3617
|
value: function scheduleSubscriberTimePointReloads(subscriberId, timePoints) {
|
|
3590
|
-
var
|
|
3618
|
+
var _this8 = this;
|
|
3591
3619
|
var subscriber = this.productQuerySubscribers.get(subscriberId);
|
|
3592
3620
|
if (!subscriber || !timePoints.length) return;
|
|
3593
3621
|
var scheduleDate = subscriber.context.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
@@ -3608,7 +3636,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3608
3636
|
setInterval(function () {
|
|
3609
3637
|
var currentTime = dayjs().format('hh:mm');
|
|
3610
3638
|
if (timePoints.includes(currentTime)) {
|
|
3611
|
-
|
|
3639
|
+
_this8.onScheduleTimePointTimerFire(subscriberId);
|
|
3612
3640
|
}
|
|
3613
3641
|
}, 60000);
|
|
3614
3642
|
if (timerIds.length > 0) {
|
|
@@ -3777,7 +3805,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3777
3805
|
key: "refreshMenuScheduleCacheAfterEmptyResult",
|
|
3778
3806
|
value: (function () {
|
|
3779
3807
|
var _refreshMenuScheduleCacheAfterEmptyResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
|
|
3780
|
-
var
|
|
3808
|
+
var _this9 = this;
|
|
3781
3809
|
var now;
|
|
3782
3810
|
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3783
3811
|
while (1) switch (_context44.prev = _context44.next) {
|
|
@@ -3800,11 +3828,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3800
3828
|
this.menuScheduleRefreshInFlight = Promise.all([this.menu.loadMenuList(), this.schedule.loadAllSchedule()]).then(function () {
|
|
3801
3829
|
return undefined;
|
|
3802
3830
|
}).catch(function (error) {
|
|
3803
|
-
|
|
3831
|
+
_this9.logWarning('刷新菜单/日程缓存失败,继续使用现有缓存', {
|
|
3804
3832
|
error: error instanceof Error ? error.message : String(error)
|
|
3805
3833
|
});
|
|
3806
3834
|
}).finally(function () {
|
|
3807
|
-
|
|
3835
|
+
_this9.menuScheduleRefreshInFlight = null;
|
|
3808
3836
|
});
|
|
3809
3837
|
}
|
|
3810
3838
|
_context44.next = 8;
|
|
@@ -3990,10 +4018,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3990
4018
|
}, {
|
|
3991
4019
|
key: "stripSalesSearchPageParams",
|
|
3992
4020
|
value: function stripSalesSearchPageParams(value) {
|
|
3993
|
-
var
|
|
4021
|
+
var _this10 = this;
|
|
3994
4022
|
if (Array.isArray(value)) {
|
|
3995
4023
|
return value.map(function (item) {
|
|
3996
|
-
return
|
|
4024
|
+
return _this10.stripSalesSearchPageParams(item);
|
|
3997
4025
|
});
|
|
3998
4026
|
}
|
|
3999
4027
|
if (!value || _typeof(value) !== 'object') return value;
|
|
@@ -4031,12 +4059,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
4031
4059
|
key: "extractSalesSearchOrderIds",
|
|
4032
4060
|
value: function extractSalesSearchOrderIds(kind, result) {
|
|
4033
4061
|
var _this$findSalesSearch,
|
|
4034
|
-
|
|
4062
|
+
_this11 = this;
|
|
4035
4063
|
var data = this.extractSalesSearchResponseData(result);
|
|
4036
4064
|
var list = kind === 'aggregate' ? (_this$findSalesSearch = this.findSalesSearchAggregateGroup(data)) === null || _this$findSalesSearch === void 0 ? void 0 : _this$findSalesSearch.list : data === null || data === void 0 ? void 0 : data.list;
|
|
4037
4065
|
if (!Array.isArray(list)) return [];
|
|
4038
4066
|
return list.map(function (item) {
|
|
4039
|
-
return
|
|
4067
|
+
return _this11.getSalesSearchOrderId(item);
|
|
4040
4068
|
}).filter(function (id) {
|
|
4041
4069
|
return !!id;
|
|
4042
4070
|
});
|
|
@@ -4203,11 +4231,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4203
4231
|
}, {
|
|
4204
4232
|
key: "stableSerialize",
|
|
4205
4233
|
value: function stableSerialize(value) {
|
|
4206
|
-
var
|
|
4234
|
+
var _this12 = this;
|
|
4207
4235
|
if (value === null || value === undefined) return 'null';
|
|
4208
4236
|
if (Array.isArray(value)) {
|
|
4209
4237
|
return "[".concat(value.map(function (item) {
|
|
4210
|
-
return
|
|
4238
|
+
return _this12.stableSerialize(item);
|
|
4211
4239
|
}).join(','), "]");
|
|
4212
4240
|
}
|
|
4213
4241
|
if (_typeof(value) === 'object') {
|
|
@@ -4216,7 +4244,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4216
4244
|
return obj[k] !== undefined;
|
|
4217
4245
|
}).sort();
|
|
4218
4246
|
return "{".concat(keys.map(function (k) {
|
|
4219
|
-
return "".concat(JSON.stringify(k), ":").concat(
|
|
4247
|
+
return "".concat(JSON.stringify(k), ":").concat(_this12.stableSerialize(obj[k]));
|
|
4220
4248
|
}).join(','), "}");
|
|
4221
4249
|
}
|
|
4222
4250
|
return JSON.stringify(value);
|
|
@@ -4756,7 +4784,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4756
4784
|
key: "runLocalPaymentUpdateInQueue",
|
|
4757
4785
|
value: function () {
|
|
4758
4786
|
var _runLocalPaymentUpdateInQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(key, task, context) {
|
|
4759
|
-
var
|
|
4787
|
+
var _this13 = this;
|
|
4760
4788
|
var queuedAt, hasPreviousTask, previous, current, tail, _data, result, released;
|
|
4761
4789
|
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
4762
4790
|
while (1) switch (_context50.prev = _context50.next) {
|
|
@@ -4775,7 +4803,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4775
4803
|
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4776
4804
|
while (1) switch (_context49.prev = _context49.next) {
|
|
4777
4805
|
case 0:
|
|
4778
|
-
|
|
4806
|
+
_this13.logInfo('handleUpdateLocalPayment: 串行队列开始执行', _objectSpread(_objectSpread({}, context), {}, {
|
|
4779
4807
|
queue_key: key,
|
|
4780
4808
|
queue_wait_ms: Date.now() - queuedAt
|
|
4781
4809
|
}));
|
|
@@ -6168,7 +6196,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6168
6196
|
key: "handlePendingSyncCheckoutOrder",
|
|
6169
6197
|
value: function () {
|
|
6170
6198
|
var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
|
|
6171
|
-
var
|
|
6199
|
+
var _this14 = this;
|
|
6172
6200
|
var backendPath, data, title, reason, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
|
|
6173
6201
|
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
6174
6202
|
while (1) switch (_context63.prev = _context63.next) {
|
|
@@ -6221,7 +6249,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6221
6249
|
});
|
|
6222
6250
|
changeGivenAmount = pendingOrder === null || pendingOrder === void 0 || (_pendingOrder$payment = pendingOrder.payments) === null || _pendingOrder$payment === void 0 ? void 0 : _pendingOrder$payment.reduce(function (sum, payment) {
|
|
6223
6251
|
var _payment$metadata;
|
|
6224
|
-
return sum +
|
|
6252
|
+
return sum + _this14.toAmountNumber(payment === null || payment === void 0 || (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.change_given_amount);
|
|
6225
6253
|
}, 0);
|
|
6226
6254
|
return _context63.abrupt("return", {
|
|
6227
6255
|
code: 200,
|
|
@@ -6361,13 +6389,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6361
6389
|
}, {
|
|
6362
6390
|
key: "sumPaidOrderPayments",
|
|
6363
6391
|
value: function sumPaidOrderPayments(payments) {
|
|
6364
|
-
var
|
|
6392
|
+
var _this15 = this;
|
|
6365
6393
|
if (!Array.isArray(payments)) return 0;
|
|
6366
6394
|
return payments.reduce(function (sum, payment) {
|
|
6367
6395
|
var _payment$amount;
|
|
6368
6396
|
var status = String((payment === null || payment === void 0 ? void 0 : payment.status) || '').toLowerCase();
|
|
6369
6397
|
if (status !== 'paid') return sum;
|
|
6370
|
-
return sum +
|
|
6398
|
+
return sum + _this15.toAmountNumber((_payment$amount = payment === null || payment === void 0 ? void 0 : payment.amount) !== null && _payment$amount !== void 0 ? _payment$amount : payment === null || payment === void 0 ? void 0 : payment.origin_amount);
|
|
6371
6399
|
}, 0);
|
|
6372
6400
|
}
|
|
6373
6401
|
}, {
|
|
@@ -6383,7 +6411,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6383
6411
|
value: function () {
|
|
6384
6412
|
var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(order) {
|
|
6385
6413
|
var _this$products3,
|
|
6386
|
-
|
|
6414
|
+
_this16 = this;
|
|
6387
6415
|
var products, productIdSet, productIds, entries;
|
|
6388
6416
|
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
|
6389
6417
|
while (1) switch (_context66.prev = _context66.next) {
|
|
@@ -6416,20 +6444,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
6416
6444
|
_context66.next = 8;
|
|
6417
6445
|
return Promise.all(productIds.map( /*#__PURE__*/function () {
|
|
6418
6446
|
var _ref68 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(id) {
|
|
6419
|
-
var
|
|
6447
|
+
var _this16$products, _this16$products$getP, product;
|
|
6420
6448
|
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
|
6421
6449
|
while (1) switch (_context65.prev = _context65.next) {
|
|
6422
6450
|
case 0:
|
|
6423
6451
|
_context65.prev = 0;
|
|
6424
6452
|
_context65.next = 3;
|
|
6425
|
-
return (
|
|
6453
|
+
return (_this16$products = _this16.products) === null || _this16$products === void 0 || (_this16$products$getP = _this16$products.getProductById) === null || _this16$products$getP === void 0 ? void 0 : _this16$products$getP.call(_this16$products, Number(id));
|
|
6426
6454
|
case 3:
|
|
6427
6455
|
product = _context65.sent;
|
|
6428
6456
|
return _context65.abrupt("return", product ? [String(id), product] : null);
|
|
6429
6457
|
case 7:
|
|
6430
6458
|
_context65.prev = 7;
|
|
6431
6459
|
_context65.t0 = _context65["catch"](0);
|
|
6432
|
-
|
|
6460
|
+
_this16.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
|
|
6433
6461
|
product_id: id,
|
|
6434
6462
|
error: _context65.t0 instanceof Error ? _context65.t0.message : String(_context65.t0)
|
|
6435
6463
|
});
|
|
@@ -6580,7 +6608,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6580
6608
|
key: "withSalesDetailProductSnapshots",
|
|
6581
6609
|
value: function () {
|
|
6582
6610
|
var _withSalesDetailProductSnapshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(order) {
|
|
6583
|
-
var
|
|
6611
|
+
var _this17 = this;
|
|
6584
6612
|
var products, snapshotMap, hasChanged, enrichedProducts, enrichedOrder;
|
|
6585
6613
|
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
|
6586
6614
|
while (1) switch (_context68.prev = _context68.next) {
|
|
@@ -6604,8 +6632,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
6604
6632
|
case 8:
|
|
6605
6633
|
hasChanged = false;
|
|
6606
6634
|
enrichedProducts = products.map(function (product) {
|
|
6607
|
-
var productWithBundleSnapshots =
|
|
6608
|
-
var nextProduct =
|
|
6635
|
+
var productWithBundleSnapshots = _this17.withBundleCatalogSnapshots(product, snapshotMap);
|
|
6636
|
+
var nextProduct = _this17.withProductCatalogSnapshots(productWithBundleSnapshots, snapshotMap);
|
|
6609
6637
|
if (nextProduct !== product) hasChanged = true;
|
|
6610
6638
|
return nextProduct;
|
|
6611
6639
|
});
|
|
@@ -6633,13 +6661,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6633
6661
|
}, {
|
|
6634
6662
|
key: "withPendingSyncProductTitles",
|
|
6635
6663
|
value: function withPendingSyncProductTitles(order, productMap) {
|
|
6636
|
-
var
|
|
6664
|
+
var _this18 = this;
|
|
6637
6665
|
var products = Array.isArray(order.products) ? order.products : null;
|
|
6638
6666
|
if (!(products !== null && products !== void 0 && products.length)) return order;
|
|
6639
6667
|
return _objectSpread(_objectSpread({}, order), {}, {
|
|
6640
6668
|
products: products.map(function (product) {
|
|
6641
6669
|
return _objectSpread(_objectSpread({}, product), {}, {
|
|
6642
|
-
product_title:
|
|
6670
|
+
product_title: _this18.buildProductTitleSnapshot(product, productMap)
|
|
6643
6671
|
});
|
|
6644
6672
|
})
|
|
6645
6673
|
});
|
|
@@ -6650,7 +6678,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6650
6678
|
var _product$product_id4,
|
|
6651
6679
|
_product$product,
|
|
6652
6680
|
_fallbackProduct$prod,
|
|
6653
|
-
|
|
6681
|
+
_this19 = this;
|
|
6654
6682
|
var productId = (_product$product_id4 = product.product_id) !== null && _product$product_id4 !== void 0 ? _product$product_id4 : product.id;
|
|
6655
6683
|
var fallbackProduct = productId !== undefined && productId !== null ? productMap[productId] || productMap[String(productId)] : null;
|
|
6656
6684
|
var ownTitle = product.product_title || product.title || product.name || ((_product$product = product.product) === null || _product$product === void 0 ? void 0 : _product$product.title);
|
|
@@ -6658,7 +6686,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6658
6686
|
var currentLocale = this.getProductTitleSnapshotCurrentLocale();
|
|
6659
6687
|
var autoTitle = this.resolveFirstProductTitleValue(ownTitle) || this.resolveFirstProductTitleValue(fallbackTitle);
|
|
6660
6688
|
return PRODUCT_TITLE_SNAPSHOT_KEYS.reduce(function (snapshot, key) {
|
|
6661
|
-
snapshot[key] =
|
|
6689
|
+
snapshot[key] = _this19.resolveProductTitleValue(ownTitle, key, currentLocale) || _this19.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === 'auto' || key === 'original' ? autoTitle : null);
|
|
6662
6690
|
return snapshot;
|
|
6663
6691
|
}, {});
|
|
6664
6692
|
}
|
|
@@ -6757,14 +6785,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
6757
6785
|
key: "enrichPaymentNamesByCode",
|
|
6758
6786
|
value: function () {
|
|
6759
6787
|
var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(order) {
|
|
6760
|
-
var
|
|
6788
|
+
var _this20 = this;
|
|
6761
6789
|
var payments, hasMissingName, paymentModule, payMethods, nameByCode, _iterator12, _step12, method, codeKey, name, hasResolvedName, enrichedPayments;
|
|
6762
6790
|
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
|
6763
6791
|
while (1) switch (_context69.prev = _context69.next) {
|
|
6764
6792
|
case 0:
|
|
6765
6793
|
payments = Array.isArray(order === null || order === void 0 ? void 0 : order.payments) ? order.payments : [];
|
|
6766
6794
|
hasMissingName = payments.some(function (payment) {
|
|
6767
|
-
return
|
|
6795
|
+
return _this20.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this20.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
|
|
6768
6796
|
});
|
|
6769
6797
|
if (hasMissingName) {
|
|
6770
6798
|
_context69.next = 4;
|
|
@@ -6797,9 +6825,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
6797
6825
|
}
|
|
6798
6826
|
hasResolvedName = false;
|
|
6799
6827
|
enrichedPayments = payments.map(function (payment) {
|
|
6800
|
-
if (!
|
|
6801
|
-
if (!
|
|
6802
|
-
var name = nameByCode.get(
|
|
6828
|
+
if (!_this20.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name)) return payment;
|
|
6829
|
+
if (!_this20.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code)) return payment;
|
|
6830
|
+
var name = nameByCode.get(_this20.getPaymentCodeKey(payment === null || payment === void 0 ? void 0 : payment.code));
|
|
6803
6831
|
if (!name) return payment;
|
|
6804
6832
|
hasResolvedName = true;
|
|
6805
6833
|
return _objectSpread(_objectSpread({}, payment), {}, {
|
|
@@ -7381,10 +7409,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
7381
7409
|
value: function extractBackendErrorResponse(error) {
|
|
7382
7410
|
var _error$response3,
|
|
7383
7411
|
_error$response4,
|
|
7384
|
-
|
|
7412
|
+
_this21 = this;
|
|
7385
7413
|
var candidates = [error === null || error === void 0 || (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data, error === null || error === void 0 ? void 0 : error.data, error === null || error === void 0 || (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.body, error === null || error === void 0 ? void 0 : error.body];
|
|
7386
7414
|
return candidates.find(function (candidate) {
|
|
7387
|
-
return
|
|
7415
|
+
return _this21.isExplicitBackendErrorResponse(candidate);
|
|
7388
7416
|
}) || null;
|
|
7389
7417
|
}
|
|
7390
7418
|
}, {
|
|
@@ -7582,9 +7610,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
7582
7610
|
this.logInfo('computeOrderQueryResult: 开始过滤', {
|
|
7583
7611
|
data: data
|
|
7584
7612
|
});
|
|
7585
|
-
console.log('[Server] computeOrderQueryResult', data);
|
|
7586
7613
|
if (this.order) {
|
|
7587
|
-
_context73.next =
|
|
7614
|
+
_context73.next = 4;
|
|
7588
7615
|
break;
|
|
7589
7616
|
}
|
|
7590
7617
|
this.logError('computeOrderQueryResult: Order 模块未注册');
|
|
@@ -7597,7 +7624,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7597
7624
|
},
|
|
7598
7625
|
status: false
|
|
7599
7626
|
});
|
|
7600
|
-
case
|
|
7627
|
+
case 4:
|
|
7601
7628
|
rawList = this.order.getOrders();
|
|
7602
7629
|
this.logInfo('computeOrderQueryResult: 本地订单数量', {
|
|
7603
7630
|
rawCount: rawList.length
|
|
@@ -7624,7 +7651,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7624
7651
|
message: '',
|
|
7625
7652
|
status: true
|
|
7626
7653
|
});
|
|
7627
|
-
case
|
|
7654
|
+
case 10:
|
|
7628
7655
|
case "end":
|
|
7629
7656
|
return _context73.stop();
|
|
7630
7657
|
}
|
|
@@ -7745,8 +7772,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
7745
7772
|
value: (function () {
|
|
7746
7773
|
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(context, options) {
|
|
7747
7774
|
var _menu_list_ids$length3,
|
|
7748
|
-
|
|
7749
|
-
var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, extension_type, product_id, strategy_context, queryIds, formatterContext, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, extensionFilteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, _tPrice3, _filteredProducts2, _tStatus, _beforeStatusCount, _tExtensionType, _beforeExtensionTypeCount, _tSort, activeMenuList, tMenu, getActiveMenus, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tExtensionType, beforeExtensionTypeCount, tSort;
|
|
7775
|
+
_this22 = this;
|
|
7776
|
+
var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, extension_type, product_id, strategy_context, queryIds, startupPreloadTask, formatterContext, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, extensionFilteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, _tPrice3, _filteredProducts2, _tStatus, _beforeStatusCount, _tExtensionType, _beforeExtensionTypeCount, _tSort, activeMenuList, tMenu, getActiveMenus, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tExtensionType, beforeExtensionTypeCount, tSort;
|
|
7750
7777
|
return _regeneratorRuntime().wrap(function _callee75$(_context75) {
|
|
7751
7778
|
while (1) switch (_context75.prev = _context75.next) {
|
|
7752
7779
|
case 0:
|
|
@@ -7757,12 +7784,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
7757
7784
|
}).filter(function (id) {
|
|
7758
7785
|
return Number.isFinite(id);
|
|
7759
7786
|
}) : [];
|
|
7760
|
-
formatterContext = this.buildProductFormatterContext({
|
|
7761
|
-
schedule_date: schedule_date,
|
|
7762
|
-
schedule_datetime: schedule_datetime,
|
|
7763
|
-
customer_id: customer_id,
|
|
7764
|
-
strategy_context: strategy_context
|
|
7765
|
-
});
|
|
7766
7787
|
this.logInfo('computeProductQueryResult 开始', {
|
|
7767
7788
|
menuListIdsCount: (_menu_list_ids$length3 = menu_list_ids === null || menu_list_ids === void 0 ? void 0 : menu_list_ids.length) !== null && _menu_list_ids$length3 !== void 0 ? _menu_list_ids$length3 : 0,
|
|
7768
7789
|
ids: queryIds,
|
|
@@ -7774,28 +7795,48 @@ var Server = /*#__PURE__*/function () {
|
|
|
7774
7795
|
strategyContextKeys: strategy_context ? Object.keys(strategy_context) : [],
|
|
7775
7796
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
7776
7797
|
});
|
|
7777
|
-
|
|
7798
|
+
|
|
7799
|
+
// 预渲染可能在 PisellOS 顺序 preload 尚未完成时发起商品查询。此时 Menu/Schedule
|
|
7800
|
+
// 暂时为空不代表缓存失效;等待当前 preload 后再按原逻辑查询,避免并发远端刷新先 clear
|
|
7801
|
+
// SQLite/IndexDB,造成 preload 读到空数据并重复请求。正常运行期该字段为 null,不增加等待。
|
|
7802
|
+
startupPreloadTask = this.startupModulePreloadInFlight;
|
|
7803
|
+
if (!startupPreloadTask) {
|
|
7778
7804
|
_context75.next = 8;
|
|
7779
7805
|
break;
|
|
7780
7806
|
}
|
|
7807
|
+
_context75.next = 8;
|
|
7808
|
+
return startupPreloadTask;
|
|
7809
|
+
case 8:
|
|
7810
|
+
// Menu/Schedule preload 会替换 store 中的数组;必须在等待完成后再读取,
|
|
7811
|
+
// 避免 formatterContext 持有预加载前的空数组快照。
|
|
7812
|
+
formatterContext = this.buildProductFormatterContext({
|
|
7813
|
+
schedule_date: schedule_date,
|
|
7814
|
+
schedule_datetime: schedule_datetime,
|
|
7815
|
+
customer_id: customer_id,
|
|
7816
|
+
strategy_context: strategy_context
|
|
7817
|
+
});
|
|
7818
|
+
if (this.products) {
|
|
7819
|
+
_context75.next = 12;
|
|
7820
|
+
break;
|
|
7821
|
+
}
|
|
7781
7822
|
this.logError('computeProductQueryResult: Products 模块未注册');
|
|
7782
7823
|
return _context75.abrupt("return", {
|
|
7783
7824
|
message: 'Products 模块未注册',
|
|
7784
7825
|
data: this.buildProductQueryResultPayload([], 0)
|
|
7785
7826
|
});
|
|
7786
|
-
case
|
|
7827
|
+
case 12:
|
|
7787
7828
|
if (!(queryIds.length > 0)) {
|
|
7788
|
-
_context75.next =
|
|
7829
|
+
_context75.next = 24;
|
|
7789
7830
|
break;
|
|
7790
7831
|
}
|
|
7791
7832
|
uniqueIds = Array.from(new Set(queryIds));
|
|
7792
7833
|
_tPrice = performance.now();
|
|
7793
|
-
_context75.next =
|
|
7834
|
+
_context75.next = 17;
|
|
7794
7835
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
7795
7836
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
|
|
7796
7837
|
productIds: uniqueIds
|
|
7797
7838
|
});
|
|
7798
|
-
case
|
|
7839
|
+
case 17:
|
|
7799
7840
|
productsWithPrice = _context75.sent;
|
|
7800
7841
|
perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
|
|
7801
7842
|
count: productsWithPrice.length,
|
|
@@ -7822,18 +7863,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
7822
7863
|
message: '',
|
|
7823
7864
|
status: true
|
|
7824
7865
|
});
|
|
7825
|
-
case
|
|
7866
|
+
case 24:
|
|
7826
7867
|
if (!(product_id != null && Number.isFinite(Number(product_id)))) {
|
|
7827
|
-
_context75.next =
|
|
7868
|
+
_context75.next = 36;
|
|
7828
7869
|
break;
|
|
7829
7870
|
}
|
|
7830
7871
|
pid = Number(product_id);
|
|
7831
7872
|
_tPrice2 = performance.now();
|
|
7832
|
-
_context75.next =
|
|
7873
|
+
_context75.next = 29;
|
|
7833
7874
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
7834
7875
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
7835
7876
|
});
|
|
7836
|
-
case
|
|
7877
|
+
case 29:
|
|
7837
7878
|
allProductsWithPrice = _context75.sent;
|
|
7838
7879
|
perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
|
|
7839
7880
|
count: allProductsWithPrice.length,
|
|
@@ -7860,17 +7901,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
7860
7901
|
message: item ? '' : '商品不存在或未发布',
|
|
7861
7902
|
status: true
|
|
7862
7903
|
});
|
|
7863
|
-
case
|
|
7904
|
+
case 36:
|
|
7864
7905
|
if (!this.shouldQueryProductsByExtensionTypes(extension_type)) {
|
|
7865
|
-
_context75.next =
|
|
7906
|
+
_context75.next = 56;
|
|
7866
7907
|
break;
|
|
7867
7908
|
}
|
|
7868
7909
|
_tPrice3 = performance.now();
|
|
7869
|
-
_context75.next =
|
|
7910
|
+
_context75.next = 40;
|
|
7870
7911
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
7871
7912
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
7872
7913
|
});
|
|
7873
|
-
case
|
|
7914
|
+
case 40:
|
|
7874
7915
|
_filteredProducts2 = _context75.sent;
|
|
7875
7916
|
perfMark('computeQuery.getProductsWithPrice(extensionType)', performance.now() - _tPrice3, {
|
|
7876
7917
|
count: _filteredProducts2.length,
|
|
@@ -7916,9 +7957,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
7916
7957
|
message: '',
|
|
7917
7958
|
status: true
|
|
7918
7959
|
});
|
|
7919
|
-
case
|
|
7960
|
+
case 56:
|
|
7920
7961
|
if (this.menu) {
|
|
7921
|
-
_context75.next =
|
|
7962
|
+
_context75.next = 59;
|
|
7922
7963
|
break;
|
|
7923
7964
|
}
|
|
7924
7965
|
this.logError('computeProductQueryResult: Menu 模块未注册');
|
|
@@ -7926,9 +7967,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
7926
7967
|
message: 'Menu 模块未注册',
|
|
7927
7968
|
data: this.buildProductQueryResultPayload([], 0)
|
|
7928
7969
|
});
|
|
7929
|
-
case
|
|
7970
|
+
case 59:
|
|
7930
7971
|
if (this.schedule) {
|
|
7931
|
-
_context75.next =
|
|
7972
|
+
_context75.next = 62;
|
|
7932
7973
|
break;
|
|
7933
7974
|
}
|
|
7934
7975
|
this.logError('computeProductQueryResult: Schedule 模块未注册');
|
|
@@ -7936,41 +7977,41 @@ var Server = /*#__PURE__*/function () {
|
|
|
7936
7977
|
message: 'Schedule 模块未注册',
|
|
7937
7978
|
data: this.buildProductQueryResultPayload([], 0)
|
|
7938
7979
|
});
|
|
7939
|
-
case
|
|
7980
|
+
case 62:
|
|
7940
7981
|
activeMenuList = [];
|
|
7941
7982
|
if (!(menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0)) {
|
|
7942
|
-
_context75.next =
|
|
7983
|
+
_context75.next = 75;
|
|
7943
7984
|
break;
|
|
7944
7985
|
}
|
|
7945
7986
|
tMenu = performance.now();
|
|
7946
7987
|
getActiveMenus = function getActiveMenus() {
|
|
7947
|
-
return
|
|
7948
|
-
var
|
|
7949
|
-
return ((
|
|
7988
|
+
return _this22.menu.getMenuByIds(menu_list_ids).filter(function (menu) {
|
|
7989
|
+
var _this22$schedule;
|
|
7990
|
+
return ((_this22$schedule = _this22.schedule) === null || _this22$schedule === void 0 ? void 0 : _this22$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
|
|
7950
7991
|
});
|
|
7951
7992
|
};
|
|
7952
7993
|
activeMenuList = getActiveMenus();
|
|
7953
7994
|
_context75.t0 = !activeMenuList.length;
|
|
7954
7995
|
if (!_context75.t0) {
|
|
7955
|
-
_context75.next =
|
|
7996
|
+
_context75.next = 72;
|
|
7956
7997
|
break;
|
|
7957
7998
|
}
|
|
7958
|
-
_context75.next =
|
|
7999
|
+
_context75.next = 71;
|
|
7959
8000
|
return this.refreshMenuScheduleCacheAfterEmptyResult();
|
|
7960
|
-
case
|
|
8001
|
+
case 71:
|
|
7961
8002
|
_context75.t0 = _context75.sent;
|
|
7962
|
-
case
|
|
8003
|
+
case 72:
|
|
7963
8004
|
if (!_context75.t0) {
|
|
7964
|
-
_context75.next =
|
|
8005
|
+
_context75.next = 74;
|
|
7965
8006
|
break;
|
|
7966
8007
|
}
|
|
7967
8008
|
activeMenuList = getActiveMenus();
|
|
7968
|
-
case
|
|
8009
|
+
case 74:
|
|
7969
8010
|
perfMark('computeQuery.filterActiveMenu', performance.now() - tMenu, {
|
|
7970
8011
|
totalMenu: menu_list_ids.length,
|
|
7971
8012
|
activeMenu: activeMenuList.length
|
|
7972
8013
|
});
|
|
7973
|
-
case
|
|
8014
|
+
case 75:
|
|
7974
8015
|
tFilter = performance.now();
|
|
7975
8016
|
productScope = this.getProductScopeByMenuConfig(activeMenuList);
|
|
7976
8017
|
scopedProductIds = this.products.getProductIdsByScope(productScope);
|
|
@@ -7981,21 +8022,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
7981
8022
|
});
|
|
7982
8023
|
tPrice = performance.now();
|
|
7983
8024
|
if (!(scopedProductIds.length > 0)) {
|
|
7984
|
-
_context75.next =
|
|
8025
|
+
_context75.next = 86;
|
|
7985
8026
|
break;
|
|
7986
8027
|
}
|
|
7987
|
-
_context75.next =
|
|
8028
|
+
_context75.next = 83;
|
|
7988
8029
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
7989
8030
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
|
|
7990
8031
|
productIds: productScope.isAllProducts ? undefined : scopedProductIds
|
|
7991
8032
|
});
|
|
7992
|
-
case
|
|
8033
|
+
case 83:
|
|
7993
8034
|
_context75.t1 = _context75.sent;
|
|
7994
|
-
_context75.next =
|
|
8035
|
+
_context75.next = 87;
|
|
7995
8036
|
break;
|
|
7996
|
-
case
|
|
8037
|
+
case 86:
|
|
7997
8038
|
_context75.t1 = [];
|
|
7998
|
-
case
|
|
8039
|
+
case 87:
|
|
7999
8040
|
filteredProducts = _context75.t1;
|
|
8000
8041
|
perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
|
|
8001
8042
|
count: filteredProducts.length,
|
|
@@ -8043,7 +8084,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
8043
8084
|
message: '',
|
|
8044
8085
|
status: true
|
|
8045
8086
|
});
|
|
8046
|
-
case
|
|
8087
|
+
case 103:
|
|
8047
8088
|
case "end":
|
|
8048
8089
|
return _context75.stop();
|
|
8049
8090
|
}
|
|
@@ -8255,7 +8296,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
8255
8296
|
}, {
|
|
8256
8297
|
key: "notifySalesSearchSubscribers",
|
|
8257
8298
|
value: function notifySalesSearchSubscribers(payload) {
|
|
8258
|
-
var
|
|
8299
|
+
var _this23 = this;
|
|
8259
8300
|
if (this.salesSearchSubscribers.size === 0) return;
|
|
8260
8301
|
var changedOrders = this.extractChangedOrdersFromPayload(payload);
|
|
8261
8302
|
if (changedOrders.length === 0) {
|
|
@@ -8273,21 +8314,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
8273
8314
|
subscriber = _step20$value[1];
|
|
8274
8315
|
try {
|
|
8275
8316
|
var changedVisibleOrders = changedOrders.filter(function (order) {
|
|
8276
|
-
var orderId =
|
|
8317
|
+
var orderId = _this23.getSalesSearchOrderId(order);
|
|
8277
8318
|
return !!orderId && subscriber.visibleOrderIds.has(orderId);
|
|
8278
8319
|
});
|
|
8279
8320
|
if (changedVisibleOrders.length === 0) {
|
|
8280
8321
|
return 1; // continue
|
|
8281
8322
|
}
|
|
8282
|
-
subscriber.callback(
|
|
8283
|
-
|
|
8323
|
+
subscriber.callback(_this23.buildSalesSearchDeltaResponse(subscriber, changedVisibleOrders));
|
|
8324
|
+
_this23.logInfo('notifySalesSearchSubscribers: 已推送 delta', {
|
|
8284
8325
|
subscriberId: subscriberId,
|
|
8285
8326
|
kind: subscriber.kind,
|
|
8286
8327
|
count: changedVisibleOrders.length
|
|
8287
8328
|
});
|
|
8288
8329
|
} catch (error) {
|
|
8289
8330
|
var errorMessage = error instanceof Error ? error.message : String(error);
|
|
8290
|
-
|
|
8331
|
+
_this23.logError('notifySalesSearchSubscribers: 推送失败', {
|
|
8291
8332
|
subscriberId: subscriberId,
|
|
8292
8333
|
error: errorMessage
|
|
8293
8334
|
});
|
|
@@ -8454,7 +8495,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
8454
8495
|
key: "getProductScopeByMenuConfig",
|
|
8455
8496
|
value: function getProductScopeByMenuConfig(activeMenuList) {
|
|
8456
8497
|
if (!activeMenuList || activeMenuList.length === 0) {
|
|
8457
|
-
console.log('[Server] 没有生效的餐牌,返回空数组');
|
|
8458
8498
|
this.logInfo('getProductScopeByMenuConfig: 没有生效的餐牌,返回空数组', {
|
|
8459
8499
|
activeMenuCount: 0
|
|
8460
8500
|
});
|
|
@@ -8485,7 +8525,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
8485
8525
|
|
|
8486
8526
|
// 如果有任何一个餐牌是 product_all,则返回所有商品
|
|
8487
8527
|
if (config.type === 'product_all') {
|
|
8488
|
-
console.log('[Server] 餐牌允许所有商品:', menu.name);
|
|
8489
8528
|
this.logInfo('getProductScopeByMenuConfig: 餐牌允许所有商品', {
|
|
8490
8529
|
menuId: menu.form_record_id,
|
|
8491
8530
|
menuName: menu.name,
|
|
@@ -8503,7 +8542,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
8503
8542
|
productIds.forEach(function (id) {
|
|
8504
8543
|
return id && allowedProductIds.add(id);
|
|
8505
8544
|
});
|
|
8506
|
-
console.log('[Server] 餐牌允许指定商品 (product_ids):', menu.name, productIds);
|
|
8507
8545
|
this.logInfo('getProductScopeByMenuConfig: 餐牌允许指定商品', {
|
|
8508
8546
|
menuId: menu.form_record_id,
|
|
8509
8547
|
menuName: menu.name,
|
|
@@ -8520,7 +8558,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
8520
8558
|
collectionIds.forEach(function (id) {
|
|
8521
8559
|
return id && allowedCollectionIds.add(id);
|
|
8522
8560
|
});
|
|
8523
|
-
console.log('[Server] 餐牌允许商品集合 (product_collection):', menu.name, collectionIds);
|
|
8524
8561
|
this.logInfo('getProductScopeByMenuConfig: 餐牌允许商品集合', {
|
|
8525
8562
|
menuId: menu.form_record_id,
|
|
8526
8563
|
menuName: menu.name,
|
|
@@ -8545,7 +8582,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
8545
8582
|
|
|
8546
8583
|
// 如果没有收集到任何商品 ID 和集合 ID,返回空数组
|
|
8547
8584
|
if (allowedProductIds.size === 0 && allowedCollectionIds.size === 0) {
|
|
8548
|
-
console.log('[Server] 没有允许的商品和集合');
|
|
8549
8585
|
this.logWarning('getProductScopeByMenuConfig: 没有允许的商品和集合', {
|
|
8550
8586
|
activeMenuCount: activeMenuList.length
|
|
8551
8587
|
});
|
|
@@ -8556,8 +8592,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
8556
8592
|
}
|
|
8557
8593
|
var allowedProductIdsArray = Array.from(allowedProductIds);
|
|
8558
8594
|
var allowedCollectionIdsArray = Array.from(allowedCollectionIds);
|
|
8559
|
-
console.log('[Server] 允许的商品 IDs:', allowedProductIdsArray);
|
|
8560
|
-
console.log('[Server] 允许的集合 IDs:', allowedCollectionIdsArray);
|
|
8561
8595
|
this.logInfo('getProductScopeByMenuConfig: 收集到的允许规则', {
|
|
8562
8596
|
allowedProductCount: allowedProductIds.size,
|
|
8563
8597
|
allowedCollectionCount: allowedCollectionIds.size
|