@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
|
@@ -84,9 +84,7 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
84
84
|
app = appPlugin.getApp();
|
|
85
85
|
this.dbManager = app.dbManager;
|
|
86
86
|
this.logger = app.logger;
|
|
87
|
-
if (this.dbManager) {
|
|
88
|
-
console.log('[Menu] IndexDB Manager 已初始化');
|
|
89
|
-
} else {
|
|
87
|
+
if (this.dbManager) {} else {
|
|
90
88
|
console.warn('[Menu] IndexDB Manager 未找到');
|
|
91
89
|
}
|
|
92
90
|
}
|
|
@@ -262,7 +260,6 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
262
260
|
} finally {
|
|
263
261
|
_iterator2.f();
|
|
264
262
|
}
|
|
265
|
-
console.log("[Menu] Map \u7F13\u5B58\u5DF2\u540C\u6B65\uFF0C\u5171 ".concat(this.store.map.size, " \u4E2A\u9910\u724C"));
|
|
266
263
|
}
|
|
267
264
|
|
|
268
265
|
/**
|
|
@@ -285,33 +282,31 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
285
282
|
|
|
286
283
|
// 同时清空 IndexDB 中的数据
|
|
287
284
|
if (!this.dbManager) {
|
|
288
|
-
_context4.next =
|
|
285
|
+
_context4.next = 16;
|
|
289
286
|
break;
|
|
290
287
|
}
|
|
291
288
|
_context4.prev = 5;
|
|
292
289
|
_context4.next = 8;
|
|
293
290
|
return this.dbManager.clear(INDEXDB_STORE_NAME);
|
|
294
291
|
case 8:
|
|
295
|
-
console.log('[Menu] IndexDB 缓存已清空');
|
|
296
292
|
this.logInfo('IndexDB 缓存已清空');
|
|
297
|
-
_context4.next =
|
|
293
|
+
_context4.next = 16;
|
|
298
294
|
break;
|
|
299
|
-
case
|
|
300
|
-
_context4.prev =
|
|
295
|
+
case 11:
|
|
296
|
+
_context4.prev = 11;
|
|
301
297
|
_context4.t0 = _context4["catch"](5);
|
|
302
298
|
errorMessage = _context4.t0 instanceof Error ? _context4.t0.message : String(_context4.t0);
|
|
303
299
|
console.error('[Menu] 清空 IndexDB 缓存失败:', _context4.t0);
|
|
304
300
|
this.logError('清空 IndexDB 缓存失败', {
|
|
305
301
|
error: errorMessage
|
|
306
302
|
});
|
|
307
|
-
case
|
|
308
|
-
console.log('[Menu] 缓存已清空');
|
|
303
|
+
case 16:
|
|
309
304
|
this.logInfo('缓存清空完成');
|
|
310
|
-
case
|
|
305
|
+
case 17:
|
|
311
306
|
case "end":
|
|
312
307
|
return _context4.stop();
|
|
313
308
|
}
|
|
314
|
-
}, _callee4, this, [[5,
|
|
309
|
+
}, _callee4, this, [[5, 11]]);
|
|
315
310
|
}));
|
|
316
311
|
function clear() {
|
|
317
312
|
return _clear.apply(this, arguments);
|
|
@@ -327,7 +322,7 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
327
322
|
key: "loadMenuFromIndexDB",
|
|
328
323
|
value: (function () {
|
|
329
324
|
var _loadMenuFromIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
330
|
-
var _menuList$length, menuList, errorMessage;
|
|
325
|
+
var startedAt, _menuList$length, menuList, errorMessage;
|
|
331
326
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
332
327
|
while (1) switch (_context5.prev = _context5.next) {
|
|
333
328
|
case 0:
|
|
@@ -338,29 +333,32 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
338
333
|
this.logWarning('loadMenuFromIndexDB: dbManager 不可用');
|
|
339
334
|
return _context5.abrupt("return", []);
|
|
340
335
|
case 3:
|
|
341
|
-
|
|
342
|
-
_context5.
|
|
336
|
+
startedAt = performance.now();
|
|
337
|
+
_context5.prev = 4;
|
|
338
|
+
_context5.next = 7;
|
|
343
339
|
return this.dbManager.getAll(INDEXDB_STORE_NAME);
|
|
344
|
-
case
|
|
340
|
+
case 7:
|
|
345
341
|
menuList = _context5.sent;
|
|
346
342
|
this.logInfo('从 IndexDB 加载餐牌数据', {
|
|
347
|
-
menuCount: (_menuList$length = menuList === null || menuList === void 0 ? void 0 : menuList.length) !== null && _menuList$length !== void 0 ? _menuList$length : 0
|
|
343
|
+
menuCount: (_menuList$length = menuList === null || menuList === void 0 ? void 0 : menuList.length) !== null && _menuList$length !== void 0 ? _menuList$length : 0,
|
|
344
|
+
durationMs: +(performance.now() - startedAt).toFixed(2)
|
|
348
345
|
});
|
|
349
346
|
return _context5.abrupt("return", menuList || []);
|
|
350
|
-
case
|
|
351
|
-
_context5.prev =
|
|
352
|
-
_context5.t0 = _context5["catch"](
|
|
347
|
+
case 12:
|
|
348
|
+
_context5.prev = 12;
|
|
349
|
+
_context5.t0 = _context5["catch"](4);
|
|
353
350
|
errorMessage = _context5.t0 instanceof Error ? _context5.t0.message : String(_context5.t0);
|
|
354
351
|
console.error('[Menu] 从 IndexDB 读取数据失败:', _context5.t0);
|
|
355
352
|
this.logError('从 IndexDB 读取数据失败', {
|
|
353
|
+
durationMs: +(performance.now() - startedAt).toFixed(2),
|
|
356
354
|
error: errorMessage
|
|
357
355
|
});
|
|
358
356
|
return _context5.abrupt("return", []);
|
|
359
|
-
case
|
|
357
|
+
case 18:
|
|
360
358
|
case "end":
|
|
361
359
|
return _context5.stop();
|
|
362
360
|
}
|
|
363
|
-
}, _callee5, this, [[
|
|
361
|
+
}, _callee5, this, [[4, 12]]);
|
|
364
362
|
}));
|
|
365
363
|
function loadMenuFromIndexDB() {
|
|
366
364
|
return _loadMenuFromIndexDB.apply(this, arguments);
|
|
@@ -377,7 +375,7 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
377
375
|
value: (function () {
|
|
378
376
|
var _saveMenuToIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(menuList) {
|
|
379
377
|
var _this2 = this;
|
|
380
|
-
var savePromises, errorMessage;
|
|
378
|
+
var startedAt, clearDurationMs, writeDurationMs, clearStartedAt, writeStartedAt, savePromises, errorMessage;
|
|
381
379
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
382
380
|
while (1) switch (_context6.prev = _context6.next) {
|
|
383
381
|
case 0:
|
|
@@ -388,40 +386,61 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
388
386
|
this.logWarning('saveMenuToIndexDB: dbManager 不可用');
|
|
389
387
|
return _context6.abrupt("return");
|
|
390
388
|
case 3:
|
|
389
|
+
startedAt = performance.now();
|
|
390
|
+
clearDurationMs = 0;
|
|
391
|
+
writeDurationMs = 0;
|
|
391
392
|
this.logInfo('开始保存餐牌数据到 IndexDB', {
|
|
392
393
|
menuCount: menuList.length
|
|
393
394
|
});
|
|
394
|
-
_context6.prev =
|
|
395
|
-
|
|
395
|
+
_context6.prev = 7;
|
|
396
|
+
// 先清空现有的餐牌数据
|
|
397
|
+
clearStartedAt = performance.now();
|
|
398
|
+
_context6.prev = 9;
|
|
399
|
+
_context6.next = 12;
|
|
396
400
|
return this.dbManager.clear(INDEXDB_STORE_NAME);
|
|
397
|
-
case
|
|
401
|
+
case 12:
|
|
402
|
+
_context6.prev = 12;
|
|
403
|
+
clearDurationMs = +(performance.now() - clearStartedAt).toFixed(2);
|
|
404
|
+
return _context6.finish(12);
|
|
405
|
+
case 15:
|
|
398
406
|
// 逐个保存餐牌(每个餐牌是独立的记录)
|
|
407
|
+
writeStartedAt = performance.now();
|
|
399
408
|
savePromises = menuList.map(function (menu) {
|
|
400
409
|
return _this2.dbManager.add(INDEXDB_STORE_NAME, menu);
|
|
401
410
|
});
|
|
402
|
-
_context6.
|
|
411
|
+
_context6.prev = 17;
|
|
412
|
+
_context6.next = 20;
|
|
403
413
|
return Promise.all(savePromises);
|
|
404
|
-
case
|
|
405
|
-
|
|
414
|
+
case 20:
|
|
415
|
+
_context6.prev = 20;
|
|
416
|
+
writeDurationMs = +(performance.now() - writeStartedAt).toFixed(2);
|
|
417
|
+
return _context6.finish(20);
|
|
418
|
+
case 23:
|
|
406
419
|
this.logInfo('餐牌数据已保存到 IndexDB', {
|
|
407
|
-
menuCount: menuList.length
|
|
420
|
+
menuCount: menuList.length,
|
|
421
|
+
clearDurationMs: clearDurationMs,
|
|
422
|
+
writeDurationMs: writeDurationMs,
|
|
423
|
+
totalDurationMs: +(performance.now() - startedAt).toFixed(2)
|
|
408
424
|
});
|
|
409
|
-
_context6.next =
|
|
425
|
+
_context6.next = 31;
|
|
410
426
|
break;
|
|
411
|
-
case
|
|
412
|
-
_context6.prev =
|
|
413
|
-
_context6.t0 = _context6["catch"](
|
|
427
|
+
case 26:
|
|
428
|
+
_context6.prev = 26;
|
|
429
|
+
_context6.t0 = _context6["catch"](7);
|
|
414
430
|
errorMessage = _context6.t0 instanceof Error ? _context6.t0.message : String(_context6.t0);
|
|
415
431
|
console.error('[Menu] 保存数据到 IndexDB 失败:', _context6.t0);
|
|
416
432
|
this.logError('保存数据到 IndexDB 失败', {
|
|
417
433
|
menuCount: menuList.length,
|
|
434
|
+
clearDurationMs: clearDurationMs,
|
|
435
|
+
writeDurationMs: writeDurationMs,
|
|
436
|
+
totalDurationMs: +(performance.now() - startedAt).toFixed(2),
|
|
418
437
|
error: errorMessage
|
|
419
438
|
});
|
|
420
|
-
case
|
|
439
|
+
case 31:
|
|
421
440
|
case "end":
|
|
422
441
|
return _context6.stop();
|
|
423
442
|
}
|
|
424
|
-
}, _callee6, this, [[
|
|
443
|
+
}, _callee6, this, [[7, 26], [9,, 12, 15], [17,, 20, 23]]);
|
|
425
444
|
}));
|
|
426
445
|
function saveMenuToIndexDB(_x4) {
|
|
427
446
|
return _saveMenuToIndexDB.apply(this, arguments);
|
|
@@ -441,19 +460,17 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
441
460
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
442
461
|
while (1) switch (_context7.prev = _context7.next) {
|
|
443
462
|
case 0:
|
|
444
|
-
console.log('[Menu] 开始预加载数据...');
|
|
445
463
|
startTime = Date.now();
|
|
446
464
|
this.logInfo('开始预加载数据');
|
|
447
|
-
_context7.prev =
|
|
448
|
-
_context7.next =
|
|
465
|
+
_context7.prev = 2;
|
|
466
|
+
_context7.next = 5;
|
|
449
467
|
return this.loadMenuFromIndexDB();
|
|
450
|
-
case
|
|
468
|
+
case 5:
|
|
451
469
|
cachedData = _context7.sent;
|
|
452
470
|
if (!(cachedData && cachedData.length > 0)) {
|
|
453
|
-
_context7.next =
|
|
471
|
+
_context7.next = 13;
|
|
454
472
|
break;
|
|
455
473
|
}
|
|
456
|
-
console.log("[Menu] \u4ECE IndexDB \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u6761\u9910\u724C\u6570\u636E"));
|
|
457
474
|
// 将缓存数据放入 store
|
|
458
475
|
this.store.menuList = cloneDeep(cachedData);
|
|
459
476
|
// 同步更新 Map 缓存
|
|
@@ -466,31 +483,30 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
466
483
|
source: 'IndexDB'
|
|
467
484
|
});
|
|
468
485
|
return _context7.abrupt("return");
|
|
469
|
-
case
|
|
470
|
-
console.log('[Menu] IndexDB 中没有缓存数据,从服务器加载...');
|
|
486
|
+
case 13:
|
|
471
487
|
this.logInfo('IndexDB 中没有缓存数据,准备从服务器加载');
|
|
472
|
-
_context7.next =
|
|
488
|
+
_context7.next = 21;
|
|
473
489
|
break;
|
|
474
|
-
case
|
|
475
|
-
_context7.prev =
|
|
476
|
-
_context7.t0 = _context7["catch"](
|
|
490
|
+
case 16:
|
|
491
|
+
_context7.prev = 16;
|
|
492
|
+
_context7.t0 = _context7["catch"](2);
|
|
477
493
|
errorMessage = _context7.t0 instanceof Error ? _context7.t0.message : String(_context7.t0);
|
|
478
494
|
console.warn('[Menu] 从 IndexDB 加载数据失败:', _context7.t0);
|
|
479
495
|
this.logWarning('从 IndexDB 加载数据失败,准备从服务器加载', {
|
|
480
496
|
error: errorMessage
|
|
481
497
|
});
|
|
482
|
-
case
|
|
483
|
-
_context7.next =
|
|
498
|
+
case 21:
|
|
499
|
+
_context7.next = 23;
|
|
484
500
|
return this.loadMenuList();
|
|
485
|
-
case
|
|
501
|
+
case 23:
|
|
486
502
|
menuList = _context7.sent;
|
|
487
503
|
if (!(menuList && menuList.length > 0)) {
|
|
488
|
-
_context7.next =
|
|
504
|
+
_context7.next = 34;
|
|
489
505
|
break;
|
|
490
506
|
}
|
|
491
|
-
_context7.next =
|
|
507
|
+
_context7.next = 27;
|
|
492
508
|
return this.saveMenuToIndexDB(menuList);
|
|
493
|
-
case
|
|
509
|
+
case 27:
|
|
494
510
|
this.store.menuList = cloneDeep(menuList);
|
|
495
511
|
// 同步更新 Map 缓存
|
|
496
512
|
this.syncMenuMap();
|
|
@@ -501,18 +517,18 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
501
517
|
duration: "".concat(_duration2, "ms"),
|
|
502
518
|
source: 'Server'
|
|
503
519
|
});
|
|
504
|
-
_context7.next =
|
|
520
|
+
_context7.next = 36;
|
|
505
521
|
break;
|
|
506
|
-
case
|
|
522
|
+
case 34:
|
|
507
523
|
_duration3 = Date.now() - startTime;
|
|
508
524
|
this.logWarning('预加载完成但未获取到数据', {
|
|
509
525
|
duration: "".concat(_duration3, "ms")
|
|
510
526
|
});
|
|
511
|
-
case
|
|
527
|
+
case 36:
|
|
512
528
|
case "end":
|
|
513
529
|
return _context7.stop();
|
|
514
530
|
}
|
|
515
|
-
}, _callee7, this, [[
|
|
531
|
+
}, _callee7, this, [[2, 16]]);
|
|
516
532
|
}));
|
|
517
533
|
function preload() {
|
|
518
534
|
return _preload.apply(this, arguments);
|
|
@@ -119,14 +119,23 @@ export declare class OrderModule extends BaseModule implements Module {
|
|
|
119
119
|
payment: Record<string, any>;
|
|
120
120
|
previousPayment: Record<string, any>;
|
|
121
121
|
} | null>;
|
|
122
|
-
loadOrdersByServer(
|
|
122
|
+
loadOrdersByServer(options?: {
|
|
123
|
+
trigger?: string;
|
|
124
|
+
}): Promise<OrderData[]>;
|
|
123
125
|
/**
|
|
124
126
|
* 静默全量刷新:后台重新拉取全量 SSE 订单数据并更新本地
|
|
125
127
|
* 拿到完整数据后一次性替换 store,触发订单变更与同步完成事件
|
|
126
128
|
* @returns 刷新后的订单列表
|
|
127
129
|
*/
|
|
128
|
-
silentRefresh(
|
|
130
|
+
silentRefresh(options?: {
|
|
131
|
+
trigger?: string;
|
|
132
|
+
}): Promise<OrderData[]>;
|
|
129
133
|
private normalizeOrderForMemoryList;
|
|
134
|
+
/**
|
|
135
|
+
* 将已经完成集合规范化的订单转换为内存身份,不重复扫描 products/bookings/payments。
|
|
136
|
+
*/
|
|
137
|
+
private prepareNormalizedOrderForMemoryList;
|
|
138
|
+
private prepareNormalizedOrdersForMemoryList;
|
|
130
139
|
private normalizeOrdersForMemoryList;
|
|
131
140
|
private hasRealOrderId;
|
|
132
141
|
private shouldKeepOrderInMemory;
|
|
@@ -291,13 +300,14 @@ export declare class OrderModule extends BaseModule implements Module {
|
|
|
291
300
|
private logDuplicateOrders;
|
|
292
301
|
private compactOrderListByIdentity;
|
|
293
302
|
/**
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
* - 无法解析时退化为自然日窗口
|
|
303
|
+
* 当前订单缓存可复用窗口。
|
|
304
|
+
* start_time 模式使用精确的营业日起止时间;配置缺失或异常时退化为自然日。
|
|
297
305
|
*/
|
|
298
|
-
private
|
|
306
|
+
private getCurrentOrderCacheWindow;
|
|
299
307
|
private hasPulledOrdersToday;
|
|
300
308
|
private markOrderPulledAtNow;
|
|
309
|
+
private clearOrderSnapshotMarker;
|
|
310
|
+
private getCurrentShopId;
|
|
301
311
|
private getStorageItem;
|
|
302
312
|
private setStorageItem;
|
|
303
313
|
private loadOrdersFromSQLite;
|
|
@@ -335,7 +345,7 @@ export declare class OrderModule extends BaseModule implements Module {
|
|
|
335
345
|
* 用于 SSE 全量拉取与营业日窗口裁剪。
|
|
336
346
|
*
|
|
337
347
|
* @example
|
|
338
|
-
* await this.replaceOrdersSnapshotInSQLite(orderList)
|
|
348
|
+
* const { orders, persisted } = await this.replaceOrdersSnapshotInSQLite(orderList, 'refresh')
|
|
339
349
|
*/
|
|
340
350
|
private replaceOrdersSnapshotInSQLite;
|
|
341
351
|
/**
|