@pisell/pisellos 2.2.151 → 2.2.153
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/Discount/index.d.ts +6 -2
- package/dist/modules/Discount/index.js +14 -8
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +3 -1
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.js +267 -213
- package/dist/server/modules/order/index.d.ts +6 -0
- package/dist/server/modules/order/index.js +210 -150
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/ShopDiscount/index.d.ts +2 -1
- package/dist/solution/ShopDiscount/index.js +32 -20
- package/dist/solution/ShopDiscount/types.d.ts +1 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/Discount/index.d.ts +6 -2
- package/lib/modules/Discount/index.js +3 -1
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +1 -1
- package/lib/server/index.d.ts +6 -0
- package/lib/server/index.js +26 -0
- package/lib/server/modules/order/index.d.ts +6 -0
- package/lib/server/modules/order/index.js +32 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/ShopDiscount/index.d.ts +2 -1
- package/lib/solution/ShopDiscount/index.js +10 -4
- package/lib/solution/ShopDiscount/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -1738,6 +1738,60 @@ var Server = /*#__PURE__*/function () {
|
|
|
1738
1738
|
}
|
|
1739
1739
|
return refreshProductsInBackground;
|
|
1740
1740
|
}()
|
|
1741
|
+
/**
|
|
1742
|
+
* 后台静默刷新订单数据
|
|
1743
|
+
* 重新拉取全量 SSE 接口,更新本地数据后触发 onOrdersSyncCompleted
|
|
1744
|
+
* 不影响当前界面展示,适用于切回前台、定时刷新等场景
|
|
1745
|
+
*/
|
|
1746
|
+
)
|
|
1747
|
+
}, {
|
|
1748
|
+
key: "refreshOrdersInBackground",
|
|
1749
|
+
value: (function () {
|
|
1750
|
+
var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1751
|
+
var startTime, duration, _duration3, errorMessage;
|
|
1752
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1753
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1754
|
+
case 0:
|
|
1755
|
+
if (this.order) {
|
|
1756
|
+
_context20.next = 3;
|
|
1757
|
+
break;
|
|
1758
|
+
}
|
|
1759
|
+
this.logWarning('refreshOrdersInBackground: Order 模块未注册');
|
|
1760
|
+
return _context20.abrupt("return");
|
|
1761
|
+
case 3:
|
|
1762
|
+
this.logInfo('refreshOrdersInBackground 开始');
|
|
1763
|
+
startTime = Date.now();
|
|
1764
|
+
_context20.prev = 5;
|
|
1765
|
+
_context20.next = 8;
|
|
1766
|
+
return this.order.silentRefresh();
|
|
1767
|
+
case 8:
|
|
1768
|
+
duration = Date.now() - startTime;
|
|
1769
|
+
this.logInfo('refreshOrdersInBackground 完成', {
|
|
1770
|
+
duration: "".concat(duration, "ms")
|
|
1771
|
+
});
|
|
1772
|
+
_context20.next = 18;
|
|
1773
|
+
break;
|
|
1774
|
+
case 12:
|
|
1775
|
+
_context20.prev = 12;
|
|
1776
|
+
_context20.t0 = _context20["catch"](5);
|
|
1777
|
+
_duration3 = Date.now() - startTime;
|
|
1778
|
+
errorMessage = _context20.t0 instanceof Error ? _context20.t0.message : String(_context20.t0);
|
|
1779
|
+
console.error('[Server] refreshOrdersInBackground 失败:', _context20.t0);
|
|
1780
|
+
this.logError('refreshOrdersInBackground 失败', {
|
|
1781
|
+
duration: "".concat(_duration3, "ms"),
|
|
1782
|
+
error: errorMessage
|
|
1783
|
+
});
|
|
1784
|
+
case 18:
|
|
1785
|
+
case "end":
|
|
1786
|
+
return _context20.stop();
|
|
1787
|
+
}
|
|
1788
|
+
}, _callee20, this, [[5, 12]]);
|
|
1789
|
+
}));
|
|
1790
|
+
function refreshOrdersInBackground() {
|
|
1791
|
+
return _refreshOrdersInBackground.apply(this, arguments);
|
|
1792
|
+
}
|
|
1793
|
+
return refreshOrdersInBackground;
|
|
1794
|
+
}()
|
|
1741
1795
|
/**
|
|
1742
1796
|
* 清空所有server模块的IndexedDB缓存
|
|
1743
1797
|
* @returns Promise<void>
|
|
@@ -1746,10 +1800,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1746
1800
|
}, {
|
|
1747
1801
|
key: "clearAllIndexDB",
|
|
1748
1802
|
value: (function () {
|
|
1749
|
-
var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1803
|
+
var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1750
1804
|
var clearTasks, moduleNames, errorMessage;
|
|
1751
|
-
return _regeneratorRuntime().wrap(function
|
|
1752
|
-
while (1) switch (
|
|
1805
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1806
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1753
1807
|
case 0:
|
|
1754
1808
|
console.log('[Server] 开始清空所有模块的IndexedDB缓存...');
|
|
1755
1809
|
this.logInfo('开始清空所有模块的 IndexedDB 缓存');
|
|
@@ -1784,41 +1838,41 @@ var Server = /*#__PURE__*/function () {
|
|
|
1784
1838
|
moduleNames.push('FloorPlan');
|
|
1785
1839
|
}
|
|
1786
1840
|
if (!(clearTasks.length === 0)) {
|
|
1787
|
-
|
|
1841
|
+
_context21.next = 15;
|
|
1788
1842
|
break;
|
|
1789
1843
|
}
|
|
1790
1844
|
console.warn('[Server] 没有找到已注册的模块,无需清空');
|
|
1791
1845
|
this.logWarning('没有找到已注册的模块,无需清空 IndexedDB');
|
|
1792
|
-
return
|
|
1846
|
+
return _context21.abrupt("return");
|
|
1793
1847
|
case 15:
|
|
1794
1848
|
this.logInfo('准备清空模块缓存', {
|
|
1795
1849
|
moduleNames: moduleNames
|
|
1796
1850
|
});
|
|
1797
|
-
|
|
1798
|
-
|
|
1851
|
+
_context21.prev = 16;
|
|
1852
|
+
_context21.next = 19;
|
|
1799
1853
|
return Promise.all(clearTasks);
|
|
1800
1854
|
case 19:
|
|
1801
1855
|
console.log("[Server] \u2705 \u5DF2\u6210\u529F\u6E05\u7A7A\u6240\u6709\u6A21\u5757\u7684IndexedDB\u7F13\u5B58: ".concat(moduleNames.join(', ')));
|
|
1802
1856
|
this.logInfo('成功清空所有模块的 IndexedDB 缓存', {
|
|
1803
1857
|
moduleNames: moduleNames
|
|
1804
1858
|
});
|
|
1805
|
-
|
|
1859
|
+
_context21.next = 29;
|
|
1806
1860
|
break;
|
|
1807
1861
|
case 23:
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
errorMessage =
|
|
1811
|
-
console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:',
|
|
1862
|
+
_context21.prev = 23;
|
|
1863
|
+
_context21.t0 = _context21["catch"](16);
|
|
1864
|
+
errorMessage = _context21.t0 instanceof Error ? _context21.t0.message : String(_context21.t0);
|
|
1865
|
+
console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context21.t0);
|
|
1812
1866
|
this.logError('清空 IndexedDB 缓存时发生错误', {
|
|
1813
1867
|
moduleNames: moduleNames,
|
|
1814
1868
|
error: errorMessage
|
|
1815
1869
|
});
|
|
1816
|
-
throw
|
|
1870
|
+
throw _context21.t0;
|
|
1817
1871
|
case 29:
|
|
1818
1872
|
case "end":
|
|
1819
|
-
return
|
|
1873
|
+
return _context21.stop();
|
|
1820
1874
|
}
|
|
1821
|
-
},
|
|
1875
|
+
}, _callee21, this, [[16, 23]]);
|
|
1822
1876
|
}));
|
|
1823
1877
|
function clearAllIndexDB() {
|
|
1824
1878
|
return _clearAllIndexDB.apply(this, arguments);
|
|
@@ -1893,10 +1947,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1893
1947
|
}, {
|
|
1894
1948
|
key: "handleRoute",
|
|
1895
1949
|
value: (function () {
|
|
1896
|
-
var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1897
|
-
var startTime, handler, result, duration,
|
|
1898
|
-
return _regeneratorRuntime().wrap(function
|
|
1899
|
-
while (1) switch (
|
|
1950
|
+
var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(method, path, params) {
|
|
1951
|
+
var startTime, handler, result, duration, _duration4, errorMessage;
|
|
1952
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1953
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1900
1954
|
case 0:
|
|
1901
1955
|
startTime = Date.now();
|
|
1902
1956
|
this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5F00\u59CB: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
@@ -1907,7 +1961,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1907
1961
|
});
|
|
1908
1962
|
handler = this.getRouteHandler(method, path);
|
|
1909
1963
|
if (handler) {
|
|
1910
|
-
|
|
1964
|
+
_context22.next = 6;
|
|
1911
1965
|
break;
|
|
1912
1966
|
}
|
|
1913
1967
|
this.logError("\u8DEF\u7531\u672A\u627E\u5230: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
@@ -1916,13 +1970,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
1916
1970
|
});
|
|
1917
1971
|
throw new Error("Route not found: ".concat(method.toUpperCase(), " ").concat(path));
|
|
1918
1972
|
case 6:
|
|
1919
|
-
|
|
1920
|
-
|
|
1973
|
+
_context22.prev = 6;
|
|
1974
|
+
_context22.next = 9;
|
|
1921
1975
|
return handler(_objectSpread(_objectSpread({}, params), {}, {
|
|
1922
1976
|
path: path
|
|
1923
1977
|
}));
|
|
1924
1978
|
case 9:
|
|
1925
|
-
result =
|
|
1979
|
+
result = _context22.sent;
|
|
1926
1980
|
duration = Date.now() - startTime;
|
|
1927
1981
|
this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5B8C\u6210: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
1928
1982
|
method: method.toUpperCase(),
|
|
@@ -1931,26 +1985,26 @@ var Server = /*#__PURE__*/function () {
|
|
|
1931
1985
|
resultCode: result === null || result === void 0 ? void 0 : result.code,
|
|
1932
1986
|
resultStatus: result === null || result === void 0 ? void 0 : result.status
|
|
1933
1987
|
});
|
|
1934
|
-
return
|
|
1988
|
+
return _context22.abrupt("return", result);
|
|
1935
1989
|
case 15:
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
errorMessage =
|
|
1990
|
+
_context22.prev = 15;
|
|
1991
|
+
_context22.t0 = _context22["catch"](6);
|
|
1992
|
+
_duration4 = Date.now() - startTime;
|
|
1993
|
+
errorMessage = _context22.t0 instanceof Error ? _context22.t0.message : String(_context22.t0);
|
|
1940
1994
|
this.logError("\u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
1941
1995
|
method: method.toUpperCase(),
|
|
1942
1996
|
path: path,
|
|
1943
|
-
duration: "".concat(
|
|
1997
|
+
duration: "".concat(_duration4, "ms"),
|
|
1944
1998
|
error: errorMessage,
|
|
1945
1999
|
data: params.data
|
|
1946
2000
|
});
|
|
1947
|
-
console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path),
|
|
1948
|
-
throw
|
|
2001
|
+
console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), _context22.t0);
|
|
2002
|
+
throw _context22.t0;
|
|
1949
2003
|
case 22:
|
|
1950
2004
|
case "end":
|
|
1951
|
-
return
|
|
2005
|
+
return _context22.stop();
|
|
1952
2006
|
}
|
|
1953
|
-
},
|
|
2007
|
+
}, _callee22, this, [[6, 15]]);
|
|
1954
2008
|
}));
|
|
1955
2009
|
function handleRoute(_x21, _x22, _x23) {
|
|
1956
2010
|
return _handleRoute.apply(this, arguments);
|
|
@@ -2441,18 +2495,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
2441
2495
|
}, {
|
|
2442
2496
|
key: "fetchOrderListFromAPI",
|
|
2443
2497
|
value: (function () {
|
|
2444
|
-
var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2498
|
+
var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(data) {
|
|
2445
2499
|
var _this$app4;
|
|
2446
2500
|
var _response$data3, response, payload, list, count, errorMessage;
|
|
2447
|
-
return _regeneratorRuntime().wrap(function
|
|
2448
|
-
while (1) switch (
|
|
2501
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2502
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2449
2503
|
case 0:
|
|
2450
2504
|
if ((_this$app4 = this.app) !== null && _this$app4 !== void 0 && _this$app4.request) {
|
|
2451
|
-
|
|
2505
|
+
_context23.next = 3;
|
|
2452
2506
|
break;
|
|
2453
2507
|
}
|
|
2454
2508
|
this.logError('fetchOrderListFromAPI: app.request 不可用');
|
|
2455
|
-
return
|
|
2509
|
+
return _context23.abrupt("return", {
|
|
2456
2510
|
code: 500,
|
|
2457
2511
|
message: 'app.request 不可用',
|
|
2458
2512
|
data: {
|
|
@@ -2462,17 +2516,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
2462
2516
|
status: false
|
|
2463
2517
|
});
|
|
2464
2518
|
case 3:
|
|
2465
|
-
|
|
2466
|
-
|
|
2519
|
+
_context23.prev = 3;
|
|
2520
|
+
_context23.next = 6;
|
|
2467
2521
|
return this.app.request.post('/shop/order/v2/list', data, {
|
|
2468
2522
|
isShopApi: true
|
|
2469
2523
|
});
|
|
2470
2524
|
case 6:
|
|
2471
|
-
response =
|
|
2525
|
+
response = _context23.sent;
|
|
2472
2526
|
payload = (_response$data3 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data3 !== void 0 ? _response$data3 : response;
|
|
2473
2527
|
list = Array.isArray(payload === null || payload === void 0 ? void 0 : payload.list) ? payload.list : [];
|
|
2474
2528
|
count = typeof (payload === null || payload === void 0 ? void 0 : payload.count) === 'number' ? payload.count : list.length;
|
|
2475
|
-
return
|
|
2529
|
+
return _context23.abrupt("return", {
|
|
2476
2530
|
code: 200,
|
|
2477
2531
|
data: _objectSpread(_objectSpread({}, payload), {}, {
|
|
2478
2532
|
list: list,
|
|
@@ -2482,13 +2536,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
2482
2536
|
status: true
|
|
2483
2537
|
});
|
|
2484
2538
|
case 13:
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
errorMessage =
|
|
2539
|
+
_context23.prev = 13;
|
|
2540
|
+
_context23.t0 = _context23["catch"](3);
|
|
2541
|
+
errorMessage = _context23.t0 instanceof Error ? _context23.t0.message : String(_context23.t0);
|
|
2488
2542
|
this.logError('fetchOrderListFromAPI: 请求失败', {
|
|
2489
2543
|
error: errorMessage
|
|
2490
2544
|
});
|
|
2491
|
-
return
|
|
2545
|
+
return _context23.abrupt("return", {
|
|
2492
2546
|
code: 500,
|
|
2493
2547
|
message: errorMessage,
|
|
2494
2548
|
data: {
|
|
@@ -2499,9 +2553,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
2499
2553
|
});
|
|
2500
2554
|
case 18:
|
|
2501
2555
|
case "end":
|
|
2502
|
-
return
|
|
2556
|
+
return _context23.stop();
|
|
2503
2557
|
}
|
|
2504
|
-
},
|
|
2558
|
+
}, _callee23, this, [[3, 13]]);
|
|
2505
2559
|
}));
|
|
2506
2560
|
function fetchOrderListFromAPI(_x24) {
|
|
2507
2561
|
return _fetchOrderListFromAPI.apply(this, arguments);
|
|
@@ -2515,17 +2569,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
2515
2569
|
}, {
|
|
2516
2570
|
key: "fetchBookingListFromAPI",
|
|
2517
2571
|
value: (function () {
|
|
2518
|
-
var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2572
|
+
var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(data) {
|
|
2519
2573
|
var memoryCacheEnabled, withFields, requestPayload, cacheKey, cached, rawList, bookingResult, _bookingResult$list, errorMessage;
|
|
2520
|
-
return _regeneratorRuntime().wrap(function
|
|
2521
|
-
while (1) switch (
|
|
2574
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2575
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2522
2576
|
case 0:
|
|
2523
2577
|
if (this.order) {
|
|
2524
|
-
|
|
2578
|
+
_context24.next = 3;
|
|
2525
2579
|
break;
|
|
2526
2580
|
}
|
|
2527
2581
|
this.logError('fetchBookingListFromAPI: Order 模块不可用');
|
|
2528
|
-
return
|
|
2582
|
+
return _context24.abrupt("return", {
|
|
2529
2583
|
code: 500,
|
|
2530
2584
|
message: 'Order 模块不可用',
|
|
2531
2585
|
data: {
|
|
@@ -2535,18 +2589,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
2535
2589
|
status: false
|
|
2536
2590
|
});
|
|
2537
2591
|
case 3:
|
|
2538
|
-
|
|
2592
|
+
_context24.prev = 3;
|
|
2539
2593
|
memoryCacheEnabled = this.isBookingRemoteMemoryCacheEnabled(data);
|
|
2540
2594
|
withFields = this.resolveBookingSalesWith(data);
|
|
2541
2595
|
requestPayload = this.normalizeBookingRemoteQueryPayload(data, withFields);
|
|
2542
2596
|
cacheKey = this.buildBookingRemoteCacheKey(requestPayload);
|
|
2543
2597
|
if (!memoryCacheEnabled) {
|
|
2544
|
-
|
|
2598
|
+
_context24.next = 13;
|
|
2545
2599
|
break;
|
|
2546
2600
|
}
|
|
2547
2601
|
cached = this.readBookingRemoteCache(cacheKey);
|
|
2548
2602
|
if (!cached) {
|
|
2549
|
-
|
|
2603
|
+
_context24.next = 13;
|
|
2550
2604
|
break;
|
|
2551
2605
|
}
|
|
2552
2606
|
this.logInfo('fetchBookingListFromAPI: 命中内存缓存', {
|
|
@@ -2554,14 +2608,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
2554
2608
|
listCount: cached.bookingResult.count,
|
|
2555
2609
|
withFields: cached.withFields
|
|
2556
2610
|
});
|
|
2557
|
-
return
|
|
2611
|
+
return _context24.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
|
|
2558
2612
|
cache_hit: true
|
|
2559
2613
|
}));
|
|
2560
2614
|
case 13:
|
|
2561
|
-
|
|
2615
|
+
_context24.next = 15;
|
|
2562
2616
|
return this.order.fetchOrdersBySSE(requestPayload);
|
|
2563
2617
|
case 15:
|
|
2564
|
-
rawList =
|
|
2618
|
+
rawList = _context24.sent;
|
|
2565
2619
|
bookingResult = sortBookings(filterBookingsFromOrders(rawList, data), data); // DEBUG: 挂到 window 上方便排查 SSE → 日历数据丢失问题
|
|
2566
2620
|
if (typeof globalThis !== 'undefined') {
|
|
2567
2621
|
globalThis.__SSE_BOOKING_DEBUG__ = {
|
|
@@ -2608,15 +2662,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
2608
2662
|
cacheKey: cacheKey,
|
|
2609
2663
|
withFields: withFields
|
|
2610
2664
|
});
|
|
2611
|
-
return
|
|
2665
|
+
return _context24.abrupt("return", this.buildBookingResponse(bookingResult));
|
|
2612
2666
|
case 23:
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
errorMessage =
|
|
2667
|
+
_context24.prev = 23;
|
|
2668
|
+
_context24.t0 = _context24["catch"](3);
|
|
2669
|
+
errorMessage = _context24.t0 instanceof Error ? _context24.t0.message : String(_context24.t0);
|
|
2616
2670
|
this.logError('fetchBookingListFromAPI: SSE 请求失败', {
|
|
2617
2671
|
error: errorMessage
|
|
2618
2672
|
});
|
|
2619
|
-
return
|
|
2673
|
+
return _context24.abrupt("return", {
|
|
2620
2674
|
code: 500,
|
|
2621
2675
|
message: errorMessage,
|
|
2622
2676
|
data: {
|
|
@@ -2627,9 +2681,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
2627
2681
|
});
|
|
2628
2682
|
case 28:
|
|
2629
2683
|
case "end":
|
|
2630
|
-
return
|
|
2684
|
+
return _context24.stop();
|
|
2631
2685
|
}
|
|
2632
|
-
},
|
|
2686
|
+
}, _callee24, this, [[3, 23]]);
|
|
2633
2687
|
}));
|
|
2634
2688
|
function fetchBookingListFromAPI(_x25) {
|
|
2635
2689
|
return _fetchBookingListFromAPI.apply(this, arguments);
|
|
@@ -2693,22 +2747,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
2693
2747
|
}, {
|
|
2694
2748
|
key: "handleUpdateLocalOrdersBatch",
|
|
2695
2749
|
value: (function () {
|
|
2696
|
-
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2750
|
+
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(orderIds) {
|
|
2697
2751
|
var _this$app5;
|
|
2698
2752
|
var existedBefore, _iterator11, _step11, id, fetched, message, fetchedMap, _iterator12, _step12, order, oid, freshOrders, succeedIds, failed, _iterator13, _step13, _id, fresh, _message, overwritten, inserted;
|
|
2699
|
-
return _regeneratorRuntime().wrap(function
|
|
2700
|
-
while (1) switch (
|
|
2753
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2754
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2701
2755
|
case 0:
|
|
2702
2756
|
this.logInfo('handleUpdateLocalOrdersBatch: 开始处理', {
|
|
2703
2757
|
count: orderIds.length,
|
|
2704
2758
|
orderIds: orderIds
|
|
2705
2759
|
});
|
|
2706
2760
|
if (this.order) {
|
|
2707
|
-
|
|
2761
|
+
_context25.next = 4;
|
|
2708
2762
|
break;
|
|
2709
2763
|
}
|
|
2710
2764
|
this.logError('handleUpdateLocalOrdersBatch: Order 模块未注册');
|
|
2711
|
-
return
|
|
2765
|
+
return _context25.abrupt("return", {
|
|
2712
2766
|
code: 500,
|
|
2713
2767
|
status: false,
|
|
2714
2768
|
message: 'Order 模块未注册',
|
|
@@ -2716,11 +2770,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2716
2770
|
});
|
|
2717
2771
|
case 4:
|
|
2718
2772
|
if ((_this$app5 = this.app) !== null && _this$app5 !== void 0 && _this$app5.request) {
|
|
2719
|
-
|
|
2773
|
+
_context25.next = 7;
|
|
2720
2774
|
break;
|
|
2721
2775
|
}
|
|
2722
2776
|
this.logError('handleUpdateLocalOrdersBatch: app.request 不可用');
|
|
2723
|
-
return
|
|
2777
|
+
return _context25.abrupt("return", {
|
|
2724
2778
|
code: 500,
|
|
2725
2779
|
status: false,
|
|
2726
2780
|
message: 'app.request 不可用',
|
|
@@ -2743,21 +2797,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
2743
2797
|
_iterator11.f();
|
|
2744
2798
|
}
|
|
2745
2799
|
fetched = [];
|
|
2746
|
-
|
|
2747
|
-
|
|
2800
|
+
_context25.prev = 11;
|
|
2801
|
+
_context25.next = 14;
|
|
2748
2802
|
return this.order.fetchOrdersByHttp(orderIds);
|
|
2749
2803
|
case 14:
|
|
2750
|
-
fetched =
|
|
2751
|
-
|
|
2804
|
+
fetched = _context25.sent;
|
|
2805
|
+
_context25.next = 22;
|
|
2752
2806
|
break;
|
|
2753
2807
|
case 17:
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
message =
|
|
2808
|
+
_context25.prev = 17;
|
|
2809
|
+
_context25.t0 = _context25["catch"](11);
|
|
2810
|
+
message = _context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0);
|
|
2757
2811
|
this.logError('handleUpdateLocalOrdersBatch: 批量拉取失败', {
|
|
2758
2812
|
message: message
|
|
2759
2813
|
});
|
|
2760
|
-
return
|
|
2814
|
+
return _context25.abrupt("return", {
|
|
2761
2815
|
code: 500,
|
|
2762
2816
|
status: false,
|
|
2763
2817
|
message: message,
|
|
@@ -2767,36 +2821,36 @@ var Server = /*#__PURE__*/function () {
|
|
|
2767
2821
|
// 按返回结果中的 order_id 建索引,未命中即视为单笔失败
|
|
2768
2822
|
fetchedMap = new Map();
|
|
2769
2823
|
_iterator12 = _createForOfIteratorHelper(fetched);
|
|
2770
|
-
|
|
2824
|
+
_context25.prev = 24;
|
|
2771
2825
|
_iterator12.s();
|
|
2772
2826
|
case 26:
|
|
2773
2827
|
if ((_step12 = _iterator12.n()).done) {
|
|
2774
|
-
|
|
2828
|
+
_context25.next = 34;
|
|
2775
2829
|
break;
|
|
2776
2830
|
}
|
|
2777
2831
|
order = _step12.value;
|
|
2778
2832
|
oid = order === null || order === void 0 ? void 0 : order.order_id;
|
|
2779
2833
|
if (!(oid === undefined || oid === null)) {
|
|
2780
|
-
|
|
2834
|
+
_context25.next = 31;
|
|
2781
2835
|
break;
|
|
2782
2836
|
}
|
|
2783
|
-
return
|
|
2837
|
+
return _context25.abrupt("continue", 32);
|
|
2784
2838
|
case 31:
|
|
2785
2839
|
fetchedMap.set(String(oid), order);
|
|
2786
2840
|
case 32:
|
|
2787
|
-
|
|
2841
|
+
_context25.next = 26;
|
|
2788
2842
|
break;
|
|
2789
2843
|
case 34:
|
|
2790
|
-
|
|
2844
|
+
_context25.next = 39;
|
|
2791
2845
|
break;
|
|
2792
2846
|
case 36:
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
_iterator12.e(
|
|
2847
|
+
_context25.prev = 36;
|
|
2848
|
+
_context25.t1 = _context25["catch"](24);
|
|
2849
|
+
_iterator12.e(_context25.t1);
|
|
2796
2850
|
case 39:
|
|
2797
|
-
|
|
2851
|
+
_context25.prev = 39;
|
|
2798
2852
|
_iterator12.f();
|
|
2799
|
-
return
|
|
2853
|
+
return _context25.finish(39);
|
|
2800
2854
|
case 42:
|
|
2801
2855
|
freshOrders = [];
|
|
2802
2856
|
succeedIds = [];
|
|
@@ -2822,23 +2876,23 @@ var Server = /*#__PURE__*/function () {
|
|
|
2822
2876
|
_iterator13.f();
|
|
2823
2877
|
}
|
|
2824
2878
|
if (!(freshOrders.length > 0)) {
|
|
2825
|
-
|
|
2879
|
+
_context25.next = 58;
|
|
2826
2880
|
break;
|
|
2827
2881
|
}
|
|
2828
|
-
|
|
2829
|
-
|
|
2882
|
+
_context25.prev = 48;
|
|
2883
|
+
_context25.next = 51;
|
|
2830
2884
|
return this.order.upsertOrdersFromRemote(freshOrders);
|
|
2831
2885
|
case 51:
|
|
2832
|
-
|
|
2886
|
+
_context25.next = 58;
|
|
2833
2887
|
break;
|
|
2834
2888
|
case 53:
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
_message =
|
|
2889
|
+
_context25.prev = 53;
|
|
2890
|
+
_context25.t2 = _context25["catch"](48);
|
|
2891
|
+
_message = _context25.t2 instanceof Error ? _context25.t2.message : String(_context25.t2);
|
|
2838
2892
|
this.logError('handleUpdateLocalOrdersBatch: 合并写入失败', {
|
|
2839
2893
|
message: _message
|
|
2840
2894
|
});
|
|
2841
|
-
return
|
|
2895
|
+
return _context25.abrupt("return", {
|
|
2842
2896
|
code: 500,
|
|
2843
2897
|
status: false,
|
|
2844
2898
|
message: _message,
|
|
@@ -2857,7 +2911,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2857
2911
|
insertedCount: inserted.length,
|
|
2858
2912
|
failedCount: failed.length
|
|
2859
2913
|
});
|
|
2860
|
-
return
|
|
2914
|
+
return _context25.abrupt("return", {
|
|
2861
2915
|
code: 200,
|
|
2862
2916
|
status: true,
|
|
2863
2917
|
message: '',
|
|
@@ -2869,9 +2923,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
2869
2923
|
});
|
|
2870
2924
|
case 62:
|
|
2871
2925
|
case "end":
|
|
2872
|
-
return
|
|
2926
|
+
return _context25.stop();
|
|
2873
2927
|
}
|
|
2874
|
-
},
|
|
2928
|
+
}, _callee25, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
|
|
2875
2929
|
}));
|
|
2876
2930
|
function handleUpdateLocalOrdersBatch(_x26) {
|
|
2877
2931
|
return _handleUpdateLocalOrdersBatch.apply(this, arguments);
|
|
@@ -3051,16 +3105,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
3051
3105
|
}, {
|
|
3052
3106
|
key: "recomputeAndNotifyFloorPlanQuery",
|
|
3053
3107
|
value: (function () {
|
|
3054
|
-
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3108
|
+
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
3055
3109
|
var _iterator15, _step15, _step15$value, subscriberId, sub, result, errorMessage;
|
|
3056
|
-
return _regeneratorRuntime().wrap(function
|
|
3057
|
-
while (1) switch (
|
|
3110
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
3111
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
3058
3112
|
case 0:
|
|
3059
3113
|
if (!(this.floorPlanQuerySubscribers.size === 0)) {
|
|
3060
|
-
|
|
3114
|
+
_context26.next = 2;
|
|
3061
3115
|
break;
|
|
3062
3116
|
}
|
|
3063
|
-
return
|
|
3117
|
+
return _context26.abrupt("return");
|
|
3064
3118
|
case 2:
|
|
3065
3119
|
this.logInfo('recomputeAndNotifyFloorPlanQuery: 开始推送', {
|
|
3066
3120
|
subscriberCount: this.floorPlanQuerySubscribers.size
|
|
@@ -3090,9 +3144,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3090
3144
|
}
|
|
3091
3145
|
case 5:
|
|
3092
3146
|
case "end":
|
|
3093
|
-
return
|
|
3147
|
+
return _context26.stop();
|
|
3094
3148
|
}
|
|
3095
|
-
},
|
|
3149
|
+
}, _callee26, this);
|
|
3096
3150
|
}));
|
|
3097
3151
|
function recomputeAndNotifyFloorPlanQuery() {
|
|
3098
3152
|
return _recomputeAndNotifyFloorPlanQuery.apply(this, arguments);
|
|
@@ -3122,21 +3176,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
3122
3176
|
* filter 逻辑暂为 mock,仅记录参数
|
|
3123
3177
|
*/
|
|
3124
3178
|
function () {
|
|
3125
|
-
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3179
|
+
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(data) {
|
|
3126
3180
|
var rawList, result;
|
|
3127
|
-
return _regeneratorRuntime().wrap(function
|
|
3128
|
-
while (1) switch (
|
|
3181
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
3182
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
3129
3183
|
case 0:
|
|
3130
3184
|
this.logInfo('computeOrderQueryResult: 开始过滤', {
|
|
3131
3185
|
data: data
|
|
3132
3186
|
});
|
|
3133
3187
|
console.log('[Server] computeOrderQueryResult', data);
|
|
3134
3188
|
if (this.order) {
|
|
3135
|
-
|
|
3189
|
+
_context27.next = 5;
|
|
3136
3190
|
break;
|
|
3137
3191
|
}
|
|
3138
3192
|
this.logError('computeOrderQueryResult: Order 模块未注册');
|
|
3139
|
-
return
|
|
3193
|
+
return _context27.abrupt("return", {
|
|
3140
3194
|
code: 500,
|
|
3141
3195
|
message: 'Order 模块未注册',
|
|
3142
3196
|
data: {
|
|
@@ -3160,7 +3214,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3160
3214
|
skip: result.skip,
|
|
3161
3215
|
rejected: result.rejected
|
|
3162
3216
|
});
|
|
3163
|
-
return
|
|
3217
|
+
return _context27.abrupt("return", {
|
|
3164
3218
|
code: 200,
|
|
3165
3219
|
data: result,
|
|
3166
3220
|
message: '',
|
|
@@ -3168,9 +3222,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3168
3222
|
});
|
|
3169
3223
|
case 10:
|
|
3170
3224
|
case "end":
|
|
3171
|
-
return
|
|
3225
|
+
return _context27.stop();
|
|
3172
3226
|
}
|
|
3173
|
-
},
|
|
3227
|
+
}, _callee27, this);
|
|
3174
3228
|
}));
|
|
3175
3229
|
function computeOrderQueryResult(_x27) {
|
|
3176
3230
|
return _computeOrderQueryResult.apply(this, arguments);
|
|
@@ -3185,17 +3239,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
3185
3239
|
}, {
|
|
3186
3240
|
key: "computeBookingQueryResult",
|
|
3187
3241
|
value: (function () {
|
|
3188
|
-
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3242
|
+
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(data) {
|
|
3189
3243
|
var rawOrders, result;
|
|
3190
|
-
return _regeneratorRuntime().wrap(function
|
|
3191
|
-
while (1) switch (
|
|
3244
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
3245
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
3192
3246
|
case 0:
|
|
3193
3247
|
if (this.order) {
|
|
3194
|
-
|
|
3248
|
+
_context28.next = 3;
|
|
3195
3249
|
break;
|
|
3196
3250
|
}
|
|
3197
3251
|
this.logError('computeBookingQueryResult: Order 模块未注册');
|
|
3198
|
-
return
|
|
3252
|
+
return _context28.abrupt("return", {
|
|
3199
3253
|
code: 500,
|
|
3200
3254
|
message: 'Order 模块未注册',
|
|
3201
3255
|
data: {
|
|
@@ -3214,7 +3268,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3214
3268
|
size: result.size,
|
|
3215
3269
|
skip: result.skip
|
|
3216
3270
|
});
|
|
3217
|
-
return
|
|
3271
|
+
return _context28.abrupt("return", {
|
|
3218
3272
|
code: 200,
|
|
3219
3273
|
data: result,
|
|
3220
3274
|
message: '',
|
|
@@ -3222,9 +3276,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3222
3276
|
});
|
|
3223
3277
|
case 8:
|
|
3224
3278
|
case "end":
|
|
3225
|
-
return
|
|
3279
|
+
return _context28.stop();
|
|
3226
3280
|
}
|
|
3227
|
-
},
|
|
3281
|
+
}, _callee28, this);
|
|
3228
3282
|
}));
|
|
3229
3283
|
function computeBookingQueryResult(_x28) {
|
|
3230
3284
|
return _computeBookingQueryResult.apply(this, arguments);
|
|
@@ -3242,12 +3296,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
3242
3296
|
}, {
|
|
3243
3297
|
key: "computeProductQueryResult",
|
|
3244
3298
|
value: (function () {
|
|
3245
|
-
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3299
|
+
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(context, options) {
|
|
3246
3300
|
var _menu_list_ids$length3,
|
|
3247
3301
|
_this6 = this;
|
|
3248
3302
|
var tTotal, menu_list_ids, schedule_date, schedule_datetime, customer_id, product_id, _published$find, pid, _tPrice, _allProductsWithPrice, published, item, activeMenuList, tMenu, menuList, tPrice, allProductsWithPrice, tFilter, filteredProducts, tStatus, beforeStatusCount, tSort;
|
|
3249
|
-
return _regeneratorRuntime().wrap(function
|
|
3250
|
-
while (1) switch (
|
|
3303
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3304
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3251
3305
|
case 0:
|
|
3252
3306
|
tTotal = performance.now();
|
|
3253
3307
|
menu_list_ids = context.menu_list_ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime, customer_id = context.customer_id, product_id = context.product_id;
|
|
@@ -3260,11 +3314,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3260
3314
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3261
3315
|
});
|
|
3262
3316
|
if (this.products) {
|
|
3263
|
-
|
|
3317
|
+
_context29.next = 6;
|
|
3264
3318
|
break;
|
|
3265
3319
|
}
|
|
3266
3320
|
this.logError('computeProductQueryResult: Products 模块未注册');
|
|
3267
|
-
return
|
|
3321
|
+
return _context29.abrupt("return", {
|
|
3268
3322
|
message: 'Products 模块未注册',
|
|
3269
3323
|
data: {
|
|
3270
3324
|
list: [],
|
|
@@ -3273,19 +3327,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
3273
3327
|
});
|
|
3274
3328
|
case 6:
|
|
3275
3329
|
if (!(product_id != null && Number.isFinite(Number(product_id)))) {
|
|
3276
|
-
|
|
3330
|
+
_context29.next = 18;
|
|
3277
3331
|
break;
|
|
3278
3332
|
}
|
|
3279
3333
|
pid = Number(product_id);
|
|
3280
3334
|
_tPrice = performance.now();
|
|
3281
|
-
|
|
3335
|
+
_context29.next = 11;
|
|
3282
3336
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
3283
3337
|
scheduleModule: this.getSchedule()
|
|
3284
3338
|
}, {
|
|
3285
3339
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3286
3340
|
});
|
|
3287
3341
|
case 11:
|
|
3288
|
-
_allProductsWithPrice =
|
|
3342
|
+
_allProductsWithPrice = _context29.sent;
|
|
3289
3343
|
perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice, {
|
|
3290
3344
|
count: _allProductsWithPrice.length,
|
|
3291
3345
|
productId: pid
|
|
@@ -3305,7 +3359,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3305
3359
|
productId: pid,
|
|
3306
3360
|
found: !!item
|
|
3307
3361
|
});
|
|
3308
|
-
return
|
|
3362
|
+
return _context29.abrupt("return", {
|
|
3309
3363
|
code: 200,
|
|
3310
3364
|
data: item,
|
|
3311
3365
|
message: item ? '' : '商品不存在或未发布',
|
|
@@ -3313,11 +3367,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3313
3367
|
});
|
|
3314
3368
|
case 18:
|
|
3315
3369
|
if (this.menu) {
|
|
3316
|
-
|
|
3370
|
+
_context29.next = 21;
|
|
3317
3371
|
break;
|
|
3318
3372
|
}
|
|
3319
3373
|
this.logError('computeProductQueryResult: Menu 模块未注册');
|
|
3320
|
-
return
|
|
3374
|
+
return _context29.abrupt("return", {
|
|
3321
3375
|
message: 'Menu 模块未注册',
|
|
3322
3376
|
data: {
|
|
3323
3377
|
list: [],
|
|
@@ -3326,11 +3380,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3326
3380
|
});
|
|
3327
3381
|
case 21:
|
|
3328
3382
|
if (this.schedule) {
|
|
3329
|
-
|
|
3383
|
+
_context29.next = 24;
|
|
3330
3384
|
break;
|
|
3331
3385
|
}
|
|
3332
3386
|
this.logError('computeProductQueryResult: Schedule 模块未注册');
|
|
3333
|
-
return
|
|
3387
|
+
return _context29.abrupt("return", {
|
|
3334
3388
|
message: 'Schedule 模块未注册',
|
|
3335
3389
|
data: {
|
|
3336
3390
|
list: [],
|
|
@@ -3352,7 +3406,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3352
3406
|
});
|
|
3353
3407
|
}
|
|
3354
3408
|
tPrice = performance.now();
|
|
3355
|
-
|
|
3409
|
+
_context29.next = 29;
|
|
3356
3410
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
3357
3411
|
scheduleModule: this.getSchedule(),
|
|
3358
3412
|
schedule_datetime: schedule_datetime,
|
|
@@ -3361,7 +3415,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3361
3415
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3362
3416
|
});
|
|
3363
3417
|
case 29:
|
|
3364
|
-
allProductsWithPrice =
|
|
3418
|
+
allProductsWithPrice = _context29.sent;
|
|
3365
3419
|
perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
|
|
3366
3420
|
count: allProductsWithPrice.length
|
|
3367
3421
|
});
|
|
@@ -3399,7 +3453,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3399
3453
|
filteredCount: filteredProducts.length,
|
|
3400
3454
|
activeMenuCount: activeMenuList.length
|
|
3401
3455
|
});
|
|
3402
|
-
return
|
|
3456
|
+
return _context29.abrupt("return", {
|
|
3403
3457
|
code: 200,
|
|
3404
3458
|
data: {
|
|
3405
3459
|
list: filteredProducts,
|
|
@@ -3410,9 +3464,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3410
3464
|
});
|
|
3411
3465
|
case 44:
|
|
3412
3466
|
case "end":
|
|
3413
|
-
return
|
|
3467
|
+
return _context29.stop();
|
|
3414
3468
|
}
|
|
3415
|
-
},
|
|
3469
|
+
}, _callee29, this);
|
|
3416
3470
|
}));
|
|
3417
3471
|
function computeProductQueryResult(_x29, _x30) {
|
|
3418
3472
|
return _computeProductQueryResult.apply(this, arguments);
|
|
@@ -3429,70 +3483,70 @@ var Server = /*#__PURE__*/function () {
|
|
|
3429
3483
|
}, {
|
|
3430
3484
|
key: "recomputeAndNotifyProductQuery",
|
|
3431
3485
|
value: (function () {
|
|
3432
|
-
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3486
|
+
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(options) {
|
|
3433
3487
|
var _iterator16, _step16, _step16$value, subscriberId, subscriber, result, errorMessage;
|
|
3434
|
-
return _regeneratorRuntime().wrap(function
|
|
3435
|
-
while (1) switch (
|
|
3488
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3489
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3436
3490
|
case 0:
|
|
3437
3491
|
if (!(this.productQuerySubscribers.size === 0)) {
|
|
3438
|
-
|
|
3492
|
+
_context30.next = 2;
|
|
3439
3493
|
break;
|
|
3440
3494
|
}
|
|
3441
|
-
return
|
|
3495
|
+
return _context30.abrupt("return");
|
|
3442
3496
|
case 2:
|
|
3443
3497
|
this.logInfo('recomputeAndNotifyProductQuery: 开始推送', {
|
|
3444
3498
|
subscriberCount: this.productQuerySubscribers.size,
|
|
3445
3499
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3446
3500
|
});
|
|
3447
3501
|
_iterator16 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
|
|
3448
|
-
|
|
3502
|
+
_context30.prev = 4;
|
|
3449
3503
|
_iterator16.s();
|
|
3450
3504
|
case 6:
|
|
3451
3505
|
if ((_step16 = _iterator16.n()).done) {
|
|
3452
|
-
|
|
3506
|
+
_context30.next = 22;
|
|
3453
3507
|
break;
|
|
3454
3508
|
}
|
|
3455
3509
|
_step16$value = _slicedToArray(_step16.value, 2), subscriberId = _step16$value[0], subscriber = _step16$value[1];
|
|
3456
|
-
|
|
3457
|
-
|
|
3510
|
+
_context30.prev = 8;
|
|
3511
|
+
_context30.next = 11;
|
|
3458
3512
|
return this.computeProductQueryResult(subscriber.context, {
|
|
3459
3513
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3460
3514
|
});
|
|
3461
3515
|
case 11:
|
|
3462
|
-
result =
|
|
3516
|
+
result = _context30.sent;
|
|
3463
3517
|
subscriber.callback(result);
|
|
3464
3518
|
this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
|
|
3465
3519
|
subscriberId: subscriberId
|
|
3466
3520
|
});
|
|
3467
|
-
|
|
3521
|
+
_context30.next = 20;
|
|
3468
3522
|
break;
|
|
3469
3523
|
case 16:
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
errorMessage =
|
|
3524
|
+
_context30.prev = 16;
|
|
3525
|
+
_context30.t0 = _context30["catch"](8);
|
|
3526
|
+
errorMessage = _context30.t0 instanceof Error ? _context30.t0.message : String(_context30.t0);
|
|
3473
3527
|
this.logError('recomputeAndNotifyProductQuery: 推送失败', {
|
|
3474
3528
|
subscriberId: subscriberId,
|
|
3475
3529
|
error: errorMessage
|
|
3476
3530
|
});
|
|
3477
3531
|
case 20:
|
|
3478
|
-
|
|
3532
|
+
_context30.next = 6;
|
|
3479
3533
|
break;
|
|
3480
3534
|
case 22:
|
|
3481
|
-
|
|
3535
|
+
_context30.next = 27;
|
|
3482
3536
|
break;
|
|
3483
3537
|
case 24:
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
_iterator16.e(
|
|
3538
|
+
_context30.prev = 24;
|
|
3539
|
+
_context30.t1 = _context30["catch"](4);
|
|
3540
|
+
_iterator16.e(_context30.t1);
|
|
3487
3541
|
case 27:
|
|
3488
|
-
|
|
3542
|
+
_context30.prev = 27;
|
|
3489
3543
|
_iterator16.f();
|
|
3490
|
-
return
|
|
3544
|
+
return _context30.finish(27);
|
|
3491
3545
|
case 30:
|
|
3492
3546
|
case "end":
|
|
3493
|
-
return
|
|
3547
|
+
return _context30.stop();
|
|
3494
3548
|
}
|
|
3495
|
-
},
|
|
3549
|
+
}, _callee30, this, [[4, 24, 27, 30], [8, 16]]);
|
|
3496
3550
|
}));
|
|
3497
3551
|
function recomputeAndNotifyProductQuery(_x31) {
|
|
3498
3552
|
return _recomputeAndNotifyProductQuery.apply(this, arguments);
|
|
@@ -3506,16 +3560,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
3506
3560
|
}, {
|
|
3507
3561
|
key: "recomputeAndNotifyOrderQuery",
|
|
3508
3562
|
value: (function () {
|
|
3509
|
-
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3563
|
+
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
3510
3564
|
var notifyStartAt, _iterator17, _step17, _step17$value, subscriberId, subscriber, computeStartAt, result, computeEndAt, callbackStartAt, callbackEndAt, errorMessage, notifyEndAt;
|
|
3511
|
-
return _regeneratorRuntime().wrap(function
|
|
3512
|
-
while (1) switch (
|
|
3565
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3566
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3513
3567
|
case 0:
|
|
3514
3568
|
if (!(this.orderQuerySubscribers.size === 0)) {
|
|
3515
|
-
|
|
3569
|
+
_context31.next = 2;
|
|
3516
3570
|
break;
|
|
3517
3571
|
}
|
|
3518
|
-
return
|
|
3572
|
+
return _context31.abrupt("return");
|
|
3519
3573
|
case 2:
|
|
3520
3574
|
notifyStartAt = Date.now();
|
|
3521
3575
|
this.logInfo('recomputeAndNotifyOrderQuery: 开始推送', {
|
|
@@ -3523,20 +3577,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
3523
3577
|
notifyStartAt: new Date(notifyStartAt).toISOString()
|
|
3524
3578
|
});
|
|
3525
3579
|
_iterator17 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
|
|
3526
|
-
|
|
3580
|
+
_context31.prev = 5;
|
|
3527
3581
|
_iterator17.s();
|
|
3528
3582
|
case 7:
|
|
3529
3583
|
if ((_step17 = _iterator17.n()).done) {
|
|
3530
|
-
|
|
3584
|
+
_context31.next = 27;
|
|
3531
3585
|
break;
|
|
3532
3586
|
}
|
|
3533
3587
|
_step17$value = _slicedToArray(_step17.value, 2), subscriberId = _step17$value[0], subscriber = _step17$value[1];
|
|
3534
|
-
|
|
3588
|
+
_context31.prev = 9;
|
|
3535
3589
|
computeStartAt = Date.now();
|
|
3536
|
-
|
|
3590
|
+
_context31.next = 13;
|
|
3537
3591
|
return this.computeOrderQueryResult(subscriber.context);
|
|
3538
3592
|
case 13:
|
|
3539
|
-
result =
|
|
3593
|
+
result = _context31.sent;
|
|
3540
3594
|
computeEndAt = Date.now();
|
|
3541
3595
|
callbackStartAt = Date.now();
|
|
3542
3596
|
subscriber.callback(result);
|
|
@@ -3547,30 +3601,30 @@ var Server = /*#__PURE__*/function () {
|
|
|
3547
3601
|
callbackDurationMs: callbackEndAt - callbackStartAt,
|
|
3548
3602
|
totalDurationMs: callbackEndAt - computeStartAt
|
|
3549
3603
|
});
|
|
3550
|
-
|
|
3604
|
+
_context31.next = 25;
|
|
3551
3605
|
break;
|
|
3552
3606
|
case 21:
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
errorMessage =
|
|
3607
|
+
_context31.prev = 21;
|
|
3608
|
+
_context31.t0 = _context31["catch"](9);
|
|
3609
|
+
errorMessage = _context31.t0 instanceof Error ? _context31.t0.message : String(_context31.t0);
|
|
3556
3610
|
this.logError('recomputeAndNotifyOrderQuery: 推送失败', {
|
|
3557
3611
|
subscriberId: subscriberId,
|
|
3558
3612
|
error: errorMessage
|
|
3559
3613
|
});
|
|
3560
3614
|
case 25:
|
|
3561
|
-
|
|
3615
|
+
_context31.next = 7;
|
|
3562
3616
|
break;
|
|
3563
3617
|
case 27:
|
|
3564
|
-
|
|
3618
|
+
_context31.next = 32;
|
|
3565
3619
|
break;
|
|
3566
3620
|
case 29:
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
_iterator17.e(
|
|
3621
|
+
_context31.prev = 29;
|
|
3622
|
+
_context31.t1 = _context31["catch"](5);
|
|
3623
|
+
_iterator17.e(_context31.t1);
|
|
3570
3624
|
case 32:
|
|
3571
|
-
|
|
3625
|
+
_context31.prev = 32;
|
|
3572
3626
|
_iterator17.f();
|
|
3573
|
-
return
|
|
3627
|
+
return _context31.finish(32);
|
|
3574
3628
|
case 35:
|
|
3575
3629
|
notifyEndAt = Date.now();
|
|
3576
3630
|
this.logInfo('recomputeAndNotifyOrderQuery: 推送完成', {
|
|
@@ -3579,9 +3633,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3579
3633
|
});
|
|
3580
3634
|
case 37:
|
|
3581
3635
|
case "end":
|
|
3582
|
-
return
|
|
3636
|
+
return _context31.stop();
|
|
3583
3637
|
}
|
|
3584
|
-
},
|
|
3638
|
+
}, _callee31, this, [[5, 29, 32, 35], [9, 21]]);
|
|
3585
3639
|
}));
|
|
3586
3640
|
function recomputeAndNotifyOrderQuery() {
|
|
3587
3641
|
return _recomputeAndNotifyOrderQuery.apply(this, arguments);
|
|
@@ -3595,67 +3649,67 @@ var Server = /*#__PURE__*/function () {
|
|
|
3595
3649
|
}, {
|
|
3596
3650
|
key: "recomputeAndNotifyBookingQuery",
|
|
3597
3651
|
value: (function () {
|
|
3598
|
-
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3652
|
+
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
3599
3653
|
var _iterator18, _step18, _step18$value, subscriberId, subscriber, result, errorMessage;
|
|
3600
|
-
return _regeneratorRuntime().wrap(function
|
|
3601
|
-
while (1) switch (
|
|
3654
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3655
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3602
3656
|
case 0:
|
|
3603
3657
|
if (!(this.bookingQuerySubscribers.size === 0)) {
|
|
3604
|
-
|
|
3658
|
+
_context32.next = 2;
|
|
3605
3659
|
break;
|
|
3606
3660
|
}
|
|
3607
|
-
return
|
|
3661
|
+
return _context32.abrupt("return");
|
|
3608
3662
|
case 2:
|
|
3609
3663
|
this.logInfo('recomputeAndNotifyBookingQuery: 开始推送', {
|
|
3610
3664
|
subscriberCount: this.bookingQuerySubscribers.size
|
|
3611
3665
|
});
|
|
3612
3666
|
_iterator18 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
|
|
3613
|
-
|
|
3667
|
+
_context32.prev = 4;
|
|
3614
3668
|
_iterator18.s();
|
|
3615
3669
|
case 6:
|
|
3616
3670
|
if ((_step18 = _iterator18.n()).done) {
|
|
3617
|
-
|
|
3671
|
+
_context32.next = 22;
|
|
3618
3672
|
break;
|
|
3619
3673
|
}
|
|
3620
3674
|
_step18$value = _slicedToArray(_step18.value, 2), subscriberId = _step18$value[0], subscriber = _step18$value[1];
|
|
3621
|
-
|
|
3622
|
-
|
|
3675
|
+
_context32.prev = 8;
|
|
3676
|
+
_context32.next = 11;
|
|
3623
3677
|
return this.computeBookingQueryResult(subscriber.context);
|
|
3624
3678
|
case 11:
|
|
3625
|
-
result =
|
|
3679
|
+
result = _context32.sent;
|
|
3626
3680
|
subscriber.callback(result);
|
|
3627
3681
|
this.logInfo('recomputeAndNotifyBookingQuery: 已推送', {
|
|
3628
3682
|
subscriberId: subscriberId
|
|
3629
3683
|
});
|
|
3630
|
-
|
|
3684
|
+
_context32.next = 20;
|
|
3631
3685
|
break;
|
|
3632
3686
|
case 16:
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
errorMessage =
|
|
3687
|
+
_context32.prev = 16;
|
|
3688
|
+
_context32.t0 = _context32["catch"](8);
|
|
3689
|
+
errorMessage = _context32.t0 instanceof Error ? _context32.t0.message : String(_context32.t0);
|
|
3636
3690
|
this.logError('recomputeAndNotifyBookingQuery: 推送失败', {
|
|
3637
3691
|
subscriberId: subscriberId,
|
|
3638
3692
|
error: errorMessage
|
|
3639
3693
|
});
|
|
3640
3694
|
case 20:
|
|
3641
|
-
|
|
3695
|
+
_context32.next = 6;
|
|
3642
3696
|
break;
|
|
3643
3697
|
case 22:
|
|
3644
|
-
|
|
3698
|
+
_context32.next = 27;
|
|
3645
3699
|
break;
|
|
3646
3700
|
case 24:
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
_iterator18.e(
|
|
3701
|
+
_context32.prev = 24;
|
|
3702
|
+
_context32.t1 = _context32["catch"](4);
|
|
3703
|
+
_iterator18.e(_context32.t1);
|
|
3650
3704
|
case 27:
|
|
3651
|
-
|
|
3705
|
+
_context32.prev = 27;
|
|
3652
3706
|
_iterator18.f();
|
|
3653
|
-
return
|
|
3707
|
+
return _context32.finish(27);
|
|
3654
3708
|
case 30:
|
|
3655
3709
|
case "end":
|
|
3656
|
-
return
|
|
3710
|
+
return _context32.stop();
|
|
3657
3711
|
}
|
|
3658
|
-
},
|
|
3712
|
+
}, _callee32, this, [[4, 24, 27, 30], [8, 16]]);
|
|
3659
3713
|
}));
|
|
3660
3714
|
function recomputeAndNotifyBookingQuery() {
|
|
3661
3715
|
return _recomputeAndNotifyBookingQuery.apply(this, arguments);
|