@pisell/pisellos 2.2.147 → 2.2.149
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/apis/picoding.d.ts +0 -0
- package/dist/apis/picoding.js +1 -0
- package/dist/model/strategy/adapter/index.d.ts +2 -0
- package/dist/model/strategy/adapter/index.js +3 -1
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +67 -0
- package/dist/model/strategy/adapter/itemRule/adapter.js +483 -0
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
- package/dist/model/strategy/adapter/itemRule/evaluator.js +169 -0
- package/dist/model/strategy/adapter/itemRule/examples.d.ts +79 -0
- package/dist/model/strategy/adapter/itemRule/examples.js +382 -0
- package/dist/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/dist/model/strategy/adapter/itemRule/index.js +5 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts +225 -0
- package/dist/model/strategy/adapter/itemRule/type.js +101 -0
- package/dist/modules/Cart/types.d.ts +2 -0
- package/dist/modules/Cart/utils/cartProduct.js +22 -1
- package/dist/modules/Cart/utils/changePrice.js +6 -0
- package/dist/modules/Date/index.d.ts +1 -1
- package/dist/modules/Date/index.js +16 -8
- package/dist/modules/Date/types.d.ts +3 -1
- package/dist/modules/OpenData/index.d.ts +24 -0
- package/dist/modules/OpenData/index.js +173 -0
- package/dist/modules/OpenData/types.d.ts +73 -0
- package/dist/modules/OpenData/types.js +1 -0
- package/dist/modules/OpenData/utils.d.ts +2 -0
- package/dist/modules/OpenData/utils.js +75 -0
- package/dist/modules/Order/index.d.ts +171 -1
- package/dist/modules/Order/index.js +2052 -112
- package/dist/modules/Order/types.d.ts +441 -20
- package/dist/modules/Order/types.js +23 -0
- package/dist/modules/Order/utils.d.ts +120 -0
- package/dist/modules/Order/utils.js +653 -2
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.js +2 -1
- package/dist/modules/Quotation/index.d.ts +8 -1
- package/dist/modules/Quotation/index.js +40 -10
- package/dist/modules/Quotation/types.d.ts +5 -0
- package/dist/modules/Rules/index.d.ts +3 -1
- package/dist/modules/Rules/index.js +136 -50
- package/dist/modules/Rules/types.d.ts +6 -0
- package/dist/modules/Rules/types.js +8 -0
- package/dist/modules/SalesSummary/index.d.ts +70 -0
- package/dist/modules/SalesSummary/index.js +175 -0
- package/dist/modules/SalesSummary/types.d.ts +64 -0
- package/dist/modules/SalesSummary/types.js +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +34 -0
- package/dist/modules/SalesSummary/utils.js +488 -0
- package/dist/modules/ScanOrderLogger/index.d.ts +21 -0
- package/dist/modules/ScanOrderLogger/index.js +161 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.js +203 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
- package/dist/modules/ScanOrderLogger/types.d.ts +52 -0
- package/dist/modules/ScanOrderLogger/types.js +1 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +7 -7
- package/dist/modules/Schedule/index.d.ts +4 -13
- package/dist/modules/Schedule/index.js +6 -23
- package/dist/modules/Schedule/utils.d.ts +1 -1
- package/dist/modules/Summary/index.d.ts +3 -0
- package/dist/modules/Summary/index.js +134 -15
- package/dist/modules/Summary/types.d.ts +7 -0
- package/dist/modules/Summary/utils.d.ts +104 -1
- package/dist/modules/Summary/utils.js +1116 -13
- package/dist/modules/index.d.ts +4 -0
- package/dist/modules/index.js +5 -1
- package/dist/server/index.d.ts +41 -4
- package/dist/server/index.js +900 -405
- package/dist/server/modules/order/index.d.ts +10 -2
- package/dist/server/modules/order/index.js +251 -196
- package/dist/server/modules/products/index.d.ts +26 -0
- package/dist/server/modules/products/index.js +618 -338
- package/dist/server/modules/products/types.d.ts +5 -1
- package/dist/solution/BaseSales/index.d.ts +175 -0
- package/dist/solution/BaseSales/index.js +1293 -0
- package/dist/solution/BaseSales/types.d.ts +305 -0
- package/dist/solution/BaseSales/types.js +38 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +143 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +159 -0
- package/dist/solution/BaseSales/utils.d.ts +40 -0
- package/dist/solution/BaseSales/utils.js +222 -0
- package/dist/solution/BookingByStep/index.d.ts +14 -0
- package/dist/solution/BookingByStep/index.js +699 -212
- package/dist/solution/BookingByStep/types.d.ts +3 -1
- package/dist/solution/BookingByStep/types.js +5 -1
- package/dist/solution/BookingByStep/utils/capacity.js +1 -1
- package/dist/solution/BookingByStep/utils/resources.js +6 -1
- package/dist/solution/BookingTicket/index.d.ts +113 -15
- package/dist/solution/BookingTicket/index.js +534 -196
- package/dist/solution/BookingTicket/types.d.ts +69 -6
- package/dist/solution/BookingTicket/types.js +40 -9
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +37 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +66 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +26 -0
- package/dist/solution/BookingTicket/utils/cartView.js +84 -0
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +1 -0
- package/dist/solution/ScanOrder/index.d.ts +146 -0
- package/dist/solution/ScanOrder/index.js +3029 -0
- package/dist/solution/ScanOrder/types.d.ts +305 -0
- package/dist/solution/ScanOrder/types.js +35 -0
- package/dist/solution/ScanOrder/utils.d.ts +167 -0
- package/dist/solution/ScanOrder/utils.js +768 -0
- package/dist/solution/ShopDiscount/index.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +9 -5
- package/dist/solution/ShopDiscount/types.d.ts +4 -0
- package/dist/solution/VenueBooking/index.d.ts +197 -0
- package/dist/solution/VenueBooking/index.js +3411 -0
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/dist/solution/VenueBooking/types.d.ts +153 -0
- package/dist/solution/VenueBooking/types.js +21 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +104 -0
- package/dist/solution/VenueBooking/utils/resource.d.ts +14 -0
- package/dist/solution/VenueBooking/utils/resource.js +130 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +34 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +224 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +453 -0
- package/dist/solution/VenueBooking/utils.d.ts +1 -0
- package/dist/solution/VenueBooking/utils.js +1 -0
- package/dist/solution/index.d.ts +3 -0
- package/dist/solution/index.js +4 -1
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/apis/picoding.js +0 -0
- package/lib/model/strategy/adapter/index.d.ts +2 -0
- package/lib/model/strategy/adapter/index.js +6 -0
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +67 -0
- package/lib/model/strategy/adapter/itemRule/adapter.js +377 -0
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
- package/lib/model/strategy/adapter/itemRule/evaluator.js +124 -0
- package/lib/model/strategy/adapter/itemRule/examples.d.ts +79 -0
- package/lib/model/strategy/adapter/itemRule/examples.js +316 -0
- package/lib/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/lib/model/strategy/adapter/itemRule/index.js +60 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +225 -0
- package/lib/model/strategy/adapter/itemRule/type.js +46 -0
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/Cart/types.d.ts +2 -0
- package/lib/modules/Cart/utils/cartProduct.js +17 -1
- package/lib/modules/Cart/utils/changePrice.js +5 -0
- package/lib/modules/Date/index.d.ts +1 -1
- package/lib/modules/Date/index.js +7 -1
- package/lib/modules/Date/types.d.ts +3 -1
- package/lib/modules/OpenData/index.d.ts +24 -0
- package/lib/modules/OpenData/index.js +119 -0
- package/lib/modules/OpenData/types.d.ts +73 -0
- package/lib/modules/OpenData/types.js +17 -0
- package/lib/modules/OpenData/utils.d.ts +2 -0
- package/lib/modules/OpenData/utils.js +111 -0
- package/lib/modules/Order/index.d.ts +171 -1
- package/lib/modules/Order/index.js +1396 -5
- package/lib/modules/Order/types.d.ts +441 -20
- package/lib/modules/Order/types.js +1 -0
- package/lib/modules/Order/utils.d.ts +120 -0
- package/lib/modules/Order/utils.js +562 -2
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.js +2 -1
- package/lib/modules/Quotation/index.d.ts +8 -1
- package/lib/modules/Quotation/index.js +33 -4
- package/lib/modules/Quotation/types.d.ts +5 -0
- package/lib/modules/Rules/index.d.ts +3 -1
- package/lib/modules/Rules/index.js +46 -6
- package/lib/modules/Rules/types.d.ts +6 -0
- package/lib/modules/Rules/types.js +11 -2
- package/lib/modules/SalesSummary/index.d.ts +70 -0
- package/lib/modules/SalesSummary/index.js +106 -0
- package/lib/modules/SalesSummary/types.d.ts +64 -0
- package/lib/modules/SalesSummary/types.js +17 -0
- package/lib/modules/SalesSummary/utils.d.ts +34 -0
- package/lib/modules/SalesSummary/utils.js +430 -0
- package/lib/modules/ScanOrderLogger/index.d.ts +21 -0
- package/lib/modules/ScanOrderLogger/index.js +135 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.js +148 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
- package/lib/modules/ScanOrderLogger/types.d.ts +52 -0
- package/lib/modules/ScanOrderLogger/types.js +17 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +5 -5
- package/lib/modules/Schedule/index.d.ts +4 -13
- package/lib/modules/Schedule/index.js +4 -15
- package/lib/modules/Schedule/utils.d.ts +1 -1
- package/lib/modules/Summary/index.d.ts +3 -0
- package/lib/modules/Summary/index.js +61 -2
- package/lib/modules/Summary/types.d.ts +7 -0
- package/lib/modules/Summary/utils.d.ts +104 -1
- package/lib/modules/Summary/utils.js +659 -8
- package/lib/modules/index.d.ts +4 -0
- package/lib/modules/index.js +9 -1
- package/lib/server/index.d.ts +41 -4
- package/lib/server/index.js +272 -10
- package/lib/server/modules/order/index.d.ts +10 -2
- package/lib/server/modules/order/index.js +31 -4
- package/lib/server/modules/products/index.d.ts +26 -0
- package/lib/server/modules/products/index.js +174 -22
- package/lib/server/modules/products/types.d.ts +5 -1
- package/lib/solution/BaseSales/index.d.ts +175 -0
- package/lib/solution/BaseSales/index.js +655 -0
- package/lib/solution/BaseSales/types.d.ts +305 -0
- package/lib/solution/BaseSales/types.js +40 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +143 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +160 -0
- package/lib/solution/BaseSales/utils.d.ts +40 -0
- package/lib/solution/BaseSales/utils.js +200 -0
- package/lib/solution/BookingByStep/index.d.ts +14 -0
- package/lib/solution/BookingByStep/index.js +469 -91
- package/lib/solution/BookingByStep/types.d.ts +3 -1
- package/lib/solution/BookingByStep/types.js +10 -0
- package/lib/solution/BookingByStep/utils/capacity.js +1 -1
- package/lib/solution/BookingByStep/utils/resources.js +5 -2
- package/lib/solution/BookingTicket/index.d.ts +113 -15
- package/lib/solution/BookingTicket/index.js +253 -61
- package/lib/solution/BookingTicket/types.d.ts +69 -6
- package/lib/solution/BookingTicket/types.js +16 -14
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +37 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +65 -0
- package/lib/solution/BookingTicket/utils/cartView.d.ts +26 -0
- package/lib/solution/BookingTicket/utils/cartView.js +103 -0
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/ScanOrder/index.d.ts +146 -0
- package/lib/solution/ScanOrder/index.js +1820 -0
- package/lib/solution/ScanOrder/types.d.ts +305 -0
- package/lib/solution/ScanOrder/types.js +36 -0
- package/lib/solution/ScanOrder/utils.d.ts +167 -0
- package/lib/solution/ScanOrder/utils.js +639 -0
- package/lib/solution/ShopDiscount/index.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +9 -4
- package/lib/solution/ShopDiscount/types.d.ts +4 -0
- package/lib/solution/VenueBooking/index.d.ts +197 -0
- package/lib/solution/VenueBooking/index.js +1892 -0
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/lib/solution/VenueBooking/types.d.ts +153 -0
- package/lib/solution/VenueBooking/types.js +44 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +110 -0
- package/lib/solution/VenueBooking/utils/resource.d.ts +14 -0
- package/lib/solution/VenueBooking/utils/resource.js +91 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +34 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +225 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +339 -0
- package/lib/solution/VenueBooking/utils.d.ts +1 -0
- package/lib/solution/VenueBooking/utils.js +69 -0
- package/lib/solution/index.d.ts +3 -0
- package/lib/solution/index.js +7 -1
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -55,7 +55,7 @@ import { filterBookingsFromOrders, sortBookings } from "./modules/order/utils/fi
|
|
|
55
55
|
var Server = /*#__PURE__*/function () {
|
|
56
56
|
function Server(core) {
|
|
57
57
|
var _this = this,
|
|
58
|
-
_this$
|
|
58
|
+
_this$app3;
|
|
59
59
|
_classCallCheck(this, Server);
|
|
60
60
|
_defineProperty(this, "core", void 0);
|
|
61
61
|
_defineProperty(this, "app", void 0);
|
|
@@ -168,18 +168,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
168
168
|
*/
|
|
169
169
|
_defineProperty(this, "handleProductQuery", /*#__PURE__*/function () {
|
|
170
170
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
171
|
-
var url, method, data, config, menu_list_ids, schedule_datetime, schedule_date, _ref3, callback, subscriberId;
|
|
171
|
+
var url, method, data, config, menu_list_ids, schedule_datetime, schedule_date, customer_id, _ref3, callback, subscriberId;
|
|
172
172
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
173
173
|
while (1) switch (_context.prev = _context.next) {
|
|
174
174
|
case 0:
|
|
175
175
|
url = _ref.url, method = _ref.method, data = _ref.data, config = _ref.config;
|
|
176
176
|
console.log('[Server] handleProductQuery:', url, method, data, config);
|
|
177
|
-
menu_list_ids = data.menu_list_ids, schedule_datetime = data.schedule_datetime, schedule_date = data.schedule_date;
|
|
177
|
+
menu_list_ids = data.menu_list_ids, schedule_datetime = data.schedule_datetime, schedule_date = data.schedule_date, customer_id = data.customer_id;
|
|
178
178
|
_ref3 = config || {}, callback = _ref3.callback, subscriberId = _ref3.subscriberId;
|
|
179
179
|
_this.logInfo('handleProductQuery: 开始处理商品查询请求', {
|
|
180
180
|
menu_list_ids: menu_list_ids,
|
|
181
181
|
schedule_datetime: schedule_datetime,
|
|
182
|
-
schedule_date: schedule_date
|
|
182
|
+
schedule_date: schedule_date,
|
|
183
|
+
customer_id: customer_id
|
|
183
184
|
});
|
|
184
185
|
|
|
185
186
|
// 存储订阅者:后续 pubsub 数据变更时可通过 callback 推送最新结果
|
|
@@ -189,7 +190,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
189
190
|
context: {
|
|
190
191
|
menu_list_ids: menu_list_ids,
|
|
191
192
|
schedule_date: schedule_date,
|
|
192
|
-
schedule_datetime: schedule_datetime
|
|
193
|
+
schedule_datetime: schedule_datetime,
|
|
194
|
+
customer_id: customer_id
|
|
193
195
|
}
|
|
194
196
|
});
|
|
195
197
|
_this.logInfo('handleProductQuery: 已注册订阅者', {
|
|
@@ -200,7 +202,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
200
202
|
return _context.abrupt("return", _this.computeProductQueryResult({
|
|
201
203
|
menu_list_ids: menu_list_ids,
|
|
202
204
|
schedule_date: schedule_date,
|
|
203
|
-
schedule_datetime: schedule_datetime
|
|
205
|
+
schedule_datetime: schedule_datetime,
|
|
206
|
+
customer_id: customer_id
|
|
204
207
|
}));
|
|
205
208
|
case 7:
|
|
206
209
|
case "end":
|
|
@@ -513,19 +516,34 @@ var Server = /*#__PURE__*/function () {
|
|
|
513
516
|
};
|
|
514
517
|
}());
|
|
515
518
|
/**
|
|
516
|
-
* 代理刷新 /
|
|
517
|
-
* -
|
|
518
|
-
*
|
|
519
|
-
*
|
|
519
|
+
* 代理刷新 / 合并订单到本地(单笔 / 批量二合一):
|
|
520
|
+
* - 入参(GET query 或 data 任一):
|
|
521
|
+
* - `order_id`:单笔模式,原有行为
|
|
522
|
+
* - `order_ids`:批量模式,逗号分隔的 id 列表(如 `?order_ids=1,2,3`),数组也兼容
|
|
523
|
+
* - 同时存在时优先批量
|
|
524
|
+
* - 单笔流程:后端 /order/sales/{id}?with[]=all → 本地有则覆盖、无则 merge → 落 SQLite → emit onOrdersChanged
|
|
525
|
+
* - 批量流程:并发拉取每笔详情 → 一次性 `upsertOrdersFromRemote` 合并写入 → 仅 emit 一次 onOrdersChanged,
|
|
526
|
+
* 单笔失败不影响其他成功项;返回 { overwritten, inserted, failed }
|
|
527
|
+
* - 监听级联:onOrdersChanged 触发订单 / 预约 / bookingRemoteCache 三路订阅者推送
|
|
528
|
+
*
|
|
529
|
+
* @example 单笔:GET /update/localOrder?order_id=96971
|
|
530
|
+
* @example 批量:GET /update/localOrder?order_ids=96971,96972,96973
|
|
520
531
|
*/
|
|
521
532
|
_defineProperty(this, "handleUpdateLocalOrder", /*#__PURE__*/function () {
|
|
522
533
|
var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref20) {
|
|
523
534
|
var _ref22, _this$app;
|
|
524
|
-
var url, data, rawOrderId, orderId, backendPath, _response$data, response, fresh, exists, _yield$_this$order$ov, overwritten, errorMessage;
|
|
535
|
+
var url, data, batchIds, rawOrderId, orderId, backendPath, _response$data, response, fresh, exists, _yield$_this$order$ov, overwritten, errorMessage;
|
|
525
536
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
526
537
|
while (1) switch (_context8.prev = _context8.next) {
|
|
527
538
|
case 0:
|
|
528
539
|
url = _ref20.url, data = _ref20.data;
|
|
540
|
+
batchIds = _this.parseOrderIdsParam(url, data);
|
|
541
|
+
if (!(batchIds.length > 0)) {
|
|
542
|
+
_context8.next = 4;
|
|
543
|
+
break;
|
|
544
|
+
}
|
|
545
|
+
return _context8.abrupt("return", _this.handleUpdateLocalOrdersBatch(batchIds));
|
|
546
|
+
case 4:
|
|
529
547
|
rawOrderId = (_ref22 = data && _typeof(data) === 'object' ? data.order_id : undefined) !== null && _ref22 !== void 0 ? _ref22 : _this.extractQueryParam(url, 'order_id');
|
|
530
548
|
orderId = rawOrderId === undefined || rawOrderId === null || rawOrderId === '' ? null : String(rawOrderId).trim();
|
|
531
549
|
_this.logInfo('handleUpdateLocalOrder: 开始处理', {
|
|
@@ -533,7 +551,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
533
551
|
orderId: orderId
|
|
534
552
|
});
|
|
535
553
|
if (orderId) {
|
|
536
|
-
_context8.next =
|
|
554
|
+
_context8.next = 10;
|
|
537
555
|
break;
|
|
538
556
|
}
|
|
539
557
|
_this.logWarning('handleUpdateLocalOrder: order_id 缺失', {
|
|
@@ -546,9 +564,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
546
564
|
message: 'order_id 缺失',
|
|
547
565
|
data: null
|
|
548
566
|
});
|
|
549
|
-
case
|
|
567
|
+
case 10:
|
|
550
568
|
if (_this.order) {
|
|
551
|
-
_context8.next =
|
|
569
|
+
_context8.next = 13;
|
|
552
570
|
break;
|
|
553
571
|
}
|
|
554
572
|
_this.logError('handleUpdateLocalOrder: Order 模块未注册');
|
|
@@ -558,9 +576,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
558
576
|
message: 'Order 模块未注册',
|
|
559
577
|
data: null
|
|
560
578
|
});
|
|
561
|
-
case
|
|
579
|
+
case 13:
|
|
562
580
|
if ((_this$app = _this.app) !== null && _this$app !== void 0 && _this$app.request) {
|
|
563
|
-
_context8.next =
|
|
581
|
+
_context8.next = 16;
|
|
564
582
|
break;
|
|
565
583
|
}
|
|
566
584
|
_this.logError('handleUpdateLocalOrder: app.request 不可用');
|
|
@@ -570,18 +588,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
570
588
|
message: 'app.request 不可用',
|
|
571
589
|
data: null
|
|
572
590
|
});
|
|
573
|
-
case
|
|
591
|
+
case 16:
|
|
574
592
|
backendPath = "/shop/order/sales/".concat(encodeURIComponent(orderId), "?with%5B%5D=all");
|
|
575
|
-
_context8.prev =
|
|
576
|
-
_context8.next =
|
|
593
|
+
_context8.prev = 17;
|
|
594
|
+
_context8.next = 20;
|
|
577
595
|
return _this.app.request.get(backendPath, undefined, {
|
|
578
596
|
isShopApi: true
|
|
579
597
|
});
|
|
580
|
-
case
|
|
598
|
+
case 20:
|
|
581
599
|
response = _context8.sent;
|
|
582
600
|
fresh = (_response$data = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data !== void 0 ? _response$data : response;
|
|
583
601
|
if (!(!fresh || _typeof(fresh) !== 'object' || fresh.order_id == null)) {
|
|
584
|
-
_context8.next =
|
|
602
|
+
_context8.next = 25;
|
|
585
603
|
break;
|
|
586
604
|
}
|
|
587
605
|
_this.logError('handleUpdateLocalOrder: 后端返回订单为空', {
|
|
@@ -594,15 +612,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
594
612
|
message: '后端返回订单为空',
|
|
595
613
|
data: null
|
|
596
614
|
});
|
|
597
|
-
case
|
|
615
|
+
case 25:
|
|
598
616
|
exists = !!_this.order.getOrderByOrderId(orderId);
|
|
599
617
|
if (!exists) {
|
|
600
|
-
_context8.next =
|
|
618
|
+
_context8.next = 33;
|
|
601
619
|
break;
|
|
602
620
|
}
|
|
603
|
-
_context8.next =
|
|
621
|
+
_context8.next = 29;
|
|
604
622
|
return _this.order.overwriteExistingOrder(fresh);
|
|
605
|
-
case
|
|
623
|
+
case 29:
|
|
606
624
|
_yield$_this$order$ov = _context8.sent;
|
|
607
625
|
overwritten = _yield$_this$order$ov.overwritten;
|
|
608
626
|
_this.logInfo('handleUpdateLocalOrder: 覆盖完成', {
|
|
@@ -619,10 +637,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
619
637
|
order_id: orderId
|
|
620
638
|
}
|
|
621
639
|
});
|
|
622
|
-
case
|
|
623
|
-
_context8.next =
|
|
640
|
+
case 33:
|
|
641
|
+
_context8.next = 35;
|
|
624
642
|
return _this.order.upsertOrdersFromRemote([fresh]);
|
|
625
|
-
case
|
|
643
|
+
case 35:
|
|
626
644
|
_this.logInfo('handleUpdateLocalOrder: 本地合并新订单完成', {
|
|
627
645
|
orderId: orderId
|
|
628
646
|
});
|
|
@@ -636,9 +654,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
636
654
|
order_id: orderId
|
|
637
655
|
}
|
|
638
656
|
});
|
|
639
|
-
case
|
|
640
|
-
_context8.prev =
|
|
641
|
-
_context8.t0 = _context8["catch"](
|
|
657
|
+
case 39:
|
|
658
|
+
_context8.prev = 39;
|
|
659
|
+
_context8.t0 = _context8["catch"](17);
|
|
642
660
|
errorMessage = _context8.t0 instanceof Error ? _context8.t0.message : String(_context8.t0);
|
|
643
661
|
_this.logError('handleUpdateLocalOrder: 请求失败', {
|
|
644
662
|
orderId: orderId,
|
|
@@ -651,30 +669,181 @@ var Server = /*#__PURE__*/function () {
|
|
|
651
669
|
message: errorMessage,
|
|
652
670
|
data: null
|
|
653
671
|
});
|
|
654
|
-
case
|
|
672
|
+
case 44:
|
|
655
673
|
case "end":
|
|
656
674
|
return _context8.stop();
|
|
657
675
|
}
|
|
658
|
-
}, _callee8, null, [[
|
|
676
|
+
}, _callee8, null, [[17, 39]]);
|
|
659
677
|
}));
|
|
660
678
|
return function (_x8) {
|
|
661
679
|
return _ref21.apply(this, arguments);
|
|
662
680
|
};
|
|
663
681
|
}());
|
|
682
|
+
_defineProperty(this, "handleOrderSalesDetail", /*#__PURE__*/function () {
|
|
683
|
+
var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref23) {
|
|
684
|
+
var _this$app2;
|
|
685
|
+
var url, data, path, requestPath, orderId, localOrder, backendPath, _response$data2, response, fresh, savedOrder, errorMessage;
|
|
686
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
687
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
688
|
+
case 0:
|
|
689
|
+
url = _ref23.url, data = _ref23.data, path = _ref23.path;
|
|
690
|
+
requestPath = _this.parseRequestPath(url, path);
|
|
691
|
+
orderId = _this.extractOrderSalesDetailId(requestPath);
|
|
692
|
+
_this.logInfo('handleOrderSalesDetail: 开始处理', {
|
|
693
|
+
url: url,
|
|
694
|
+
path: requestPath,
|
|
695
|
+
orderId: orderId
|
|
696
|
+
});
|
|
697
|
+
if (orderId) {
|
|
698
|
+
_context9.next = 7;
|
|
699
|
+
break;
|
|
700
|
+
}
|
|
701
|
+
_this.logWarning('handleOrderSalesDetail: order_id 缺失', {
|
|
702
|
+
url: url,
|
|
703
|
+
path: requestPath
|
|
704
|
+
});
|
|
705
|
+
return _context9.abrupt("return", {
|
|
706
|
+
code: 400,
|
|
707
|
+
status: false,
|
|
708
|
+
message: 'order_id 缺失',
|
|
709
|
+
data: null
|
|
710
|
+
});
|
|
711
|
+
case 7:
|
|
712
|
+
if (_this.order) {
|
|
713
|
+
_context9.next = 10;
|
|
714
|
+
break;
|
|
715
|
+
}
|
|
716
|
+
_this.logError('handleOrderSalesDetail: Order 模块未注册');
|
|
717
|
+
return _context9.abrupt("return", {
|
|
718
|
+
code: 500,
|
|
719
|
+
status: false,
|
|
720
|
+
message: 'Order 模块未注册',
|
|
721
|
+
data: null
|
|
722
|
+
});
|
|
723
|
+
case 10:
|
|
724
|
+
_context9.next = 12;
|
|
725
|
+
return _this.order.getLocalOrderByOrderId(orderId);
|
|
726
|
+
case 12:
|
|
727
|
+
localOrder = _context9.sent;
|
|
728
|
+
if (!localOrder) {
|
|
729
|
+
_context9.next = 16;
|
|
730
|
+
break;
|
|
731
|
+
}
|
|
732
|
+
_this.logInfo('handleOrderSalesDetail: 命中本地订单', {
|
|
733
|
+
orderId: orderId
|
|
734
|
+
});
|
|
735
|
+
return _context9.abrupt("return", {
|
|
736
|
+
code: 200,
|
|
737
|
+
status: true,
|
|
738
|
+
message: '',
|
|
739
|
+
data: localOrder
|
|
740
|
+
});
|
|
741
|
+
case 16:
|
|
742
|
+
if ((_this$app2 = _this.app) !== null && _this$app2 !== void 0 && _this$app2.request) {
|
|
743
|
+
_context9.next = 19;
|
|
744
|
+
break;
|
|
745
|
+
}
|
|
746
|
+
_this.logError('handleOrderSalesDetail: app.request 不可用');
|
|
747
|
+
return _context9.abrupt("return", {
|
|
748
|
+
code: 500,
|
|
749
|
+
status: false,
|
|
750
|
+
message: 'app.request 不可用',
|
|
751
|
+
data: null
|
|
752
|
+
});
|
|
753
|
+
case 19:
|
|
754
|
+
backendPath = _this.buildOrderSalesDetailBackendPath(orderId, data);
|
|
755
|
+
_context9.prev = 20;
|
|
756
|
+
_context9.next = 23;
|
|
757
|
+
return _this.app.request.get(backendPath, undefined, {
|
|
758
|
+
isShopApi: true
|
|
759
|
+
});
|
|
760
|
+
case 23:
|
|
761
|
+
response = _context9.sent;
|
|
762
|
+
fresh = (_response$data2 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data2 !== void 0 ? _response$data2 : response;
|
|
763
|
+
if (!(!fresh || _typeof(fresh) !== 'object' || fresh.order_id == null)) {
|
|
764
|
+
_context9.next = 28;
|
|
765
|
+
break;
|
|
766
|
+
}
|
|
767
|
+
_this.logError('handleOrderSalesDetail: 后端返回订单为空', {
|
|
768
|
+
orderId: orderId,
|
|
769
|
+
backendPath: backendPath
|
|
770
|
+
});
|
|
771
|
+
return _context9.abrupt("return", {
|
|
772
|
+
code: 500,
|
|
773
|
+
status: false,
|
|
774
|
+
message: '后端返回订单为空',
|
|
775
|
+
data: null
|
|
776
|
+
});
|
|
777
|
+
case 28:
|
|
778
|
+
_context9.next = 30;
|
|
779
|
+
return _this.order.upsertOrdersFromRemote([fresh]);
|
|
780
|
+
case 30:
|
|
781
|
+
_context9.next = 32;
|
|
782
|
+
return _this.order.getLocalOrderByOrderId(orderId);
|
|
783
|
+
case 32:
|
|
784
|
+
savedOrder = _context9.sent;
|
|
785
|
+
if (savedOrder) {
|
|
786
|
+
_context9.next = 36;
|
|
787
|
+
break;
|
|
788
|
+
}
|
|
789
|
+
_this.logError('handleOrderSalesDetail: 订单写入后回读失败', {
|
|
790
|
+
orderId: orderId
|
|
791
|
+
});
|
|
792
|
+
return _context9.abrupt("return", {
|
|
793
|
+
code: 500,
|
|
794
|
+
status: false,
|
|
795
|
+
message: '订单写入后回读失败',
|
|
796
|
+
data: null
|
|
797
|
+
});
|
|
798
|
+
case 36:
|
|
799
|
+
_this.logInfo('handleOrderSalesDetail: 远端订单已同步到本地', {
|
|
800
|
+
orderId: orderId
|
|
801
|
+
});
|
|
802
|
+
return _context9.abrupt("return", {
|
|
803
|
+
code: 200,
|
|
804
|
+
status: true,
|
|
805
|
+
message: '',
|
|
806
|
+
data: savedOrder
|
|
807
|
+
});
|
|
808
|
+
case 40:
|
|
809
|
+
_context9.prev = 40;
|
|
810
|
+
_context9.t0 = _context9["catch"](20);
|
|
811
|
+
errorMessage = _context9.t0 instanceof Error ? _context9.t0.message : String(_context9.t0);
|
|
812
|
+
_this.logError('handleOrderSalesDetail: 请求失败', {
|
|
813
|
+
orderId: orderId,
|
|
814
|
+
backendPath: backendPath,
|
|
815
|
+
error: errorMessage
|
|
816
|
+
});
|
|
817
|
+
return _context9.abrupt("return", {
|
|
818
|
+
code: 500,
|
|
819
|
+
status: false,
|
|
820
|
+
message: errorMessage,
|
|
821
|
+
data: null
|
|
822
|
+
});
|
|
823
|
+
case 45:
|
|
824
|
+
case "end":
|
|
825
|
+
return _context9.stop();
|
|
826
|
+
}
|
|
827
|
+
}, _callee9, null, [[20, 40]]);
|
|
828
|
+
}));
|
|
829
|
+
return function (_x9) {
|
|
830
|
+
return _ref24.apply(this, arguments);
|
|
831
|
+
};
|
|
832
|
+
}());
|
|
664
833
|
/**
|
|
665
834
|
* GET /shop/schedule/floor-plan* 前缀路由:读本地 store;支持 subscriberId + callback 订阅更新
|
|
666
835
|
*/
|
|
667
836
|
_defineProperty(this, "handleFloorPlanGet", /*#__PURE__*/function () {
|
|
668
|
-
var
|
|
669
|
-
var url, data, config, routePath, base, path, _subscriberId,
|
|
670
|
-
return _regeneratorRuntime().wrap(function
|
|
671
|
-
while (1) switch (
|
|
837
|
+
var _ref26 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref25) {
|
|
838
|
+
var url, data, config, routePath, base, path, _subscriberId, _ref27, callback, subscriberId, ctx;
|
|
839
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
840
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
672
841
|
case 0:
|
|
673
|
-
url =
|
|
842
|
+
url = _ref25.url, data = _ref25.data, config = _ref25.config, routePath = _ref25.path;
|
|
674
843
|
base = '/shop/schedule/floor-plan';
|
|
675
844
|
path = _this.parseRequestPath(url, routePath);
|
|
676
845
|
if (!(path === "".concat(base, "/unsubscribe"))) {
|
|
677
|
-
|
|
846
|
+
_context10.next = 7;
|
|
678
847
|
break;
|
|
679
848
|
}
|
|
680
849
|
_subscriberId = data === null || data === void 0 ? void 0 : data.subscriberId;
|
|
@@ -685,19 +854,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
685
854
|
remaining: _this.floorPlanQuerySubscribers.size
|
|
686
855
|
});
|
|
687
856
|
}
|
|
688
|
-
return
|
|
857
|
+
return _context10.abrupt("return", {
|
|
689
858
|
code: 200,
|
|
690
859
|
message: 'ok',
|
|
691
860
|
status: true
|
|
692
861
|
});
|
|
693
862
|
case 7:
|
|
694
|
-
|
|
863
|
+
_ref27 = config || {}, callback = _ref27.callback, subscriberId = _ref27.subscriberId;
|
|
695
864
|
ctx = _this.resolveFloorPlanQueryContext(path, base);
|
|
696
865
|
if (ctx) {
|
|
697
|
-
|
|
866
|
+
_context10.next = 11;
|
|
698
867
|
break;
|
|
699
868
|
}
|
|
700
|
-
return
|
|
869
|
+
return _context10.abrupt("return", {
|
|
701
870
|
status: false,
|
|
702
871
|
code: 404,
|
|
703
872
|
message: 'Not Found',
|
|
@@ -715,28 +884,28 @@ var Server = /*#__PURE__*/function () {
|
|
|
715
884
|
total: _this.floorPlanQuerySubscribers.size
|
|
716
885
|
});
|
|
717
886
|
}
|
|
718
|
-
return
|
|
887
|
+
return _context10.abrupt("return", _this.computeFloorPlanQueryResult(ctx));
|
|
719
888
|
case 13:
|
|
720
889
|
case "end":
|
|
721
|
-
return
|
|
890
|
+
return _context10.stop();
|
|
722
891
|
}
|
|
723
|
-
},
|
|
892
|
+
}, _callee10);
|
|
724
893
|
}));
|
|
725
|
-
return function (
|
|
726
|
-
return
|
|
894
|
+
return function (_x10) {
|
|
895
|
+
return _ref26.apply(this, arguments);
|
|
727
896
|
};
|
|
728
897
|
}());
|
|
729
898
|
/**
|
|
730
899
|
* 取消预约列表查询订阅(HTTP 路由入口)
|
|
731
900
|
*/
|
|
732
901
|
_defineProperty(this, "handleUnsubscribeBookingQuery", /*#__PURE__*/function () {
|
|
733
|
-
var
|
|
734
|
-
var data,
|
|
735
|
-
return _regeneratorRuntime().wrap(function
|
|
736
|
-
while (1) switch (
|
|
902
|
+
var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref28) {
|
|
903
|
+
var data, _ref30, subscriberId;
|
|
904
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
905
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
737
906
|
case 0:
|
|
738
|
-
data =
|
|
739
|
-
|
|
907
|
+
data = _ref28.data;
|
|
908
|
+
_ref30 = data || {}, subscriberId = _ref30.subscriberId;
|
|
740
909
|
if (subscriberId) {
|
|
741
910
|
_this.bookingQuerySubscribers.delete(subscriberId);
|
|
742
911
|
_this.bookingRemoteQuerySubscribers.delete(subscriberId);
|
|
@@ -746,19 +915,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
746
915
|
remainingRemote: _this.bookingRemoteQuerySubscribers.size
|
|
747
916
|
});
|
|
748
917
|
}
|
|
749
|
-
return
|
|
918
|
+
return _context11.abrupt("return", {
|
|
750
919
|
code: 200,
|
|
751
920
|
message: 'ok',
|
|
752
921
|
status: true
|
|
753
922
|
});
|
|
754
923
|
case 4:
|
|
755
924
|
case "end":
|
|
756
|
-
return
|
|
925
|
+
return _context11.stop();
|
|
757
926
|
}
|
|
758
|
-
},
|
|
927
|
+
}, _callee11);
|
|
759
928
|
}));
|
|
760
|
-
return function (
|
|
761
|
-
return
|
|
929
|
+
return function (_x11) {
|
|
930
|
+
return _ref29.apply(this, arguments);
|
|
762
931
|
};
|
|
763
932
|
}());
|
|
764
933
|
/**
|
|
@@ -766,13 +935,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
766
935
|
* 通过餐牌ID列表获取所有相关日程的时间段点
|
|
767
936
|
*/
|
|
768
937
|
_defineProperty(this, "handleGetScheduleTimePoints", /*#__PURE__*/function () {
|
|
769
|
-
var
|
|
938
|
+
var _ref32 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref31) {
|
|
770
939
|
var _menu_list_ids$length;
|
|
771
940
|
var url, method, data, config, menu_list_ids, _menu_list_ids$length2, menuList, scheduleIds, scheduleList, timePoints, errorMessage;
|
|
772
|
-
return _regeneratorRuntime().wrap(function
|
|
773
|
-
while (1) switch (
|
|
941
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
942
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
774
943
|
case 0:
|
|
775
|
-
url =
|
|
944
|
+
url = _ref31.url, method = _ref31.method, data = _ref31.data, config = _ref31.config;
|
|
776
945
|
console.log('[Server] handleGetScheduleTimePoints:', url, method, data, config);
|
|
777
946
|
menu_list_ids = data.menu_list_ids;
|
|
778
947
|
_this.logInfo('handleGetScheduleTimePoints 开始处理', {
|
|
@@ -782,12 +951,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
782
951
|
|
|
783
952
|
// 检查必要的模块是否已注册
|
|
784
953
|
if (_this.menu) {
|
|
785
|
-
|
|
954
|
+
_context12.next = 8;
|
|
786
955
|
break;
|
|
787
956
|
}
|
|
788
957
|
console.error('[Server] Menu 模块未注册');
|
|
789
958
|
_this.logError('handleGetScheduleTimePoints: Menu 模块未注册');
|
|
790
|
-
return
|
|
959
|
+
return _context12.abrupt("return", {
|
|
791
960
|
code: 500,
|
|
792
961
|
message: 'Menu 模块未注册',
|
|
793
962
|
data: [],
|
|
@@ -795,12 +964,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
795
964
|
});
|
|
796
965
|
case 8:
|
|
797
966
|
if (_this.schedule) {
|
|
798
|
-
|
|
967
|
+
_context12.next = 12;
|
|
799
968
|
break;
|
|
800
969
|
}
|
|
801
970
|
console.error('[Server] Schedule 模块未注册');
|
|
802
971
|
_this.logError('handleGetScheduleTimePoints: Schedule 模块未注册');
|
|
803
|
-
return
|
|
972
|
+
return _context12.abrupt("return", {
|
|
804
973
|
code: 500,
|
|
805
974
|
message: 'Schedule 模块未注册',
|
|
806
975
|
data: [],
|
|
@@ -808,7 +977,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
808
977
|
});
|
|
809
978
|
case 12:
|
|
810
979
|
if (!(!menu_list_ids || !Array.isArray(menu_list_ids) || menu_list_ids.length === 0)) {
|
|
811
|
-
|
|
980
|
+
_context12.next = 16;
|
|
812
981
|
break;
|
|
813
982
|
}
|
|
814
983
|
console.error('[Server] menu_list_ids 参数无效');
|
|
@@ -816,14 +985,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
816
985
|
menuListIdsCount: (_menu_list_ids$length2 = menu_list_ids === null || menu_list_ids === void 0 ? void 0 : menu_list_ids.length) !== null && _menu_list_ids$length2 !== void 0 ? _menu_list_ids$length2 : 0,
|
|
817
986
|
menu_list_ids: menu_list_ids
|
|
818
987
|
});
|
|
819
|
-
return
|
|
988
|
+
return _context12.abrupt("return", {
|
|
820
989
|
code: 400,
|
|
821
990
|
message: 'menu_list_ids 参数无效',
|
|
822
991
|
data: [],
|
|
823
992
|
status: false
|
|
824
993
|
});
|
|
825
994
|
case 16:
|
|
826
|
-
|
|
995
|
+
_context12.prev = 16;
|
|
827
996
|
// 1. 获取餐牌列表
|
|
828
997
|
menuList = _this.menu.getMenuByIds(menu_list_ids);
|
|
829
998
|
console.log("[Server] \u627E\u5230 ".concat(menuList.length, " \u4E2A\u9910\u724C"));
|
|
@@ -841,13 +1010,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
841
1010
|
scheduleCount: scheduleIds.length
|
|
842
1011
|
});
|
|
843
1012
|
if (!(scheduleIds.length === 0)) {
|
|
844
|
-
|
|
1013
|
+
_context12.next = 26;
|
|
845
1014
|
break;
|
|
846
1015
|
}
|
|
847
1016
|
_this.logInfo('handleGetScheduleTimePoints: 没有找到相关日程', {
|
|
848
1017
|
menuListIdsCount: menu_list_ids.length
|
|
849
1018
|
});
|
|
850
|
-
return
|
|
1019
|
+
return _context12.abrupt("return", {
|
|
851
1020
|
code: 200,
|
|
852
1021
|
message: '没有找到相关日程',
|
|
853
1022
|
data: [],
|
|
@@ -871,22 +1040,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
871
1040
|
scheduleCount: scheduleList.length,
|
|
872
1041
|
timePointCount: timePoints.length
|
|
873
1042
|
});
|
|
874
|
-
return
|
|
1043
|
+
return _context12.abrupt("return", {
|
|
875
1044
|
code: 200,
|
|
876
1045
|
message: '获取成功',
|
|
877
1046
|
data: timePoints,
|
|
878
1047
|
status: true
|
|
879
1048
|
});
|
|
880
1049
|
case 35:
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
errorMessage =
|
|
884
|
-
console.error('[Server] 获取日程时间点失败:',
|
|
1050
|
+
_context12.prev = 35;
|
|
1051
|
+
_context12.t0 = _context12["catch"](16);
|
|
1052
|
+
errorMessage = _context12.t0 instanceof Error ? _context12.t0.message : '未知错误';
|
|
1053
|
+
console.error('[Server] 获取日程时间点失败:', _context12.t0);
|
|
885
1054
|
_this.logError('handleGetScheduleTimePoints: 获取日程时间点失败', {
|
|
886
1055
|
menuListIdsCount: menu_list_ids.length,
|
|
887
1056
|
error: errorMessage
|
|
888
1057
|
});
|
|
889
|
-
return
|
|
1058
|
+
return _context12.abrupt("return", {
|
|
890
1059
|
code: 500,
|
|
891
1060
|
message: "\u83B7\u53D6\u5931\u8D25: ".concat(errorMessage),
|
|
892
1061
|
data: [],
|
|
@@ -894,18 +1063,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
894
1063
|
});
|
|
895
1064
|
case 41:
|
|
896
1065
|
case "end":
|
|
897
|
-
return
|
|
1066
|
+
return _context12.stop();
|
|
898
1067
|
}
|
|
899
|
-
},
|
|
1068
|
+
}, _callee12, null, [[16, 35]]);
|
|
900
1069
|
}));
|
|
901
|
-
return function (
|
|
902
|
-
return
|
|
1070
|
+
return function (_x12) {
|
|
1071
|
+
return _ref32.apply(this, arguments);
|
|
903
1072
|
};
|
|
904
1073
|
}());
|
|
905
1074
|
this.core = core;
|
|
906
1075
|
var appPlugin = core.getPlugin('app');
|
|
907
1076
|
this.app = (appPlugin === null || appPlugin === void 0 ? void 0 : appPlugin.getApp()) || null;
|
|
908
|
-
this.logger = ((_this$
|
|
1077
|
+
this.logger = ((_this$app3 = this.app) === null || _this$app3 === void 0 ? void 0 : _this$app3.logger) || null;
|
|
909
1078
|
console.log('[Server] Server 初始化', this.core);
|
|
910
1079
|
this.logInfo('Server 初始化', {
|
|
911
1080
|
hasApp: !!this.app,
|
|
@@ -996,10 +1165,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
996
1165
|
}, {
|
|
997
1166
|
key: "registerModuleWithRoutes",
|
|
998
1167
|
value: (function () {
|
|
999
|
-
var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1168
|
+
var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(module, options, moduleName) {
|
|
1000
1169
|
var routes;
|
|
1001
|
-
return _regeneratorRuntime().wrap(function
|
|
1002
|
-
while (1) switch (
|
|
1170
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1171
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1003
1172
|
case 0:
|
|
1004
1173
|
this.logInfo("\u5F00\u59CB\u6CE8\u518C\u6A21\u5757: ".concat(moduleName), {
|
|
1005
1174
|
moduleName: moduleName,
|
|
@@ -1007,7 +1176,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1007
1176
|
});
|
|
1008
1177
|
|
|
1009
1178
|
// 注册模块到 Core
|
|
1010
|
-
|
|
1179
|
+
_context13.next = 3;
|
|
1011
1180
|
return this.core.registerModule(module, options);
|
|
1012
1181
|
case 3:
|
|
1013
1182
|
console.log("[Server] \u2705 ".concat(moduleName, " \u6A21\u5757\u5DF2\u6CE8\u518C"));
|
|
@@ -1028,11 +1197,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1028
1197
|
}
|
|
1029
1198
|
case 6:
|
|
1030
1199
|
case "end":
|
|
1031
|
-
return
|
|
1200
|
+
return _context13.stop();
|
|
1032
1201
|
}
|
|
1033
|
-
},
|
|
1202
|
+
}, _callee13, this);
|
|
1034
1203
|
}));
|
|
1035
|
-
function registerModuleWithRoutes(
|
|
1204
|
+
function registerModuleWithRoutes(_x13, _x14, _x15) {
|
|
1036
1205
|
return _registerModuleWithRoutes.apply(this, arguments);
|
|
1037
1206
|
}
|
|
1038
1207
|
return registerModuleWithRoutes;
|
|
@@ -1045,10 +1214,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1045
1214
|
}, {
|
|
1046
1215
|
key: "registerModuleByName",
|
|
1047
1216
|
value: (function () {
|
|
1048
|
-
var _registerModuleByName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1217
|
+
var _registerModuleByName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(moduleConfig) {
|
|
1049
1218
|
var moduleName, shouldPreload, customConfig, registryConfig, ModuleClass, moduleInstance, moduleOptions;
|
|
1050
|
-
return _regeneratorRuntime().wrap(function
|
|
1051
|
-
while (1) switch (
|
|
1219
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1220
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1052
1221
|
case 0:
|
|
1053
1222
|
// 解析配置
|
|
1054
1223
|
moduleName = typeof moduleConfig === 'string' ? moduleConfig : moduleConfig.name;
|
|
@@ -1063,7 +1232,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1063
1232
|
// 查找模块配置
|
|
1064
1233
|
registryConfig = this.moduleRegistry[moduleName];
|
|
1065
1234
|
if (registryConfig) {
|
|
1066
|
-
|
|
1235
|
+
_context14.next = 8;
|
|
1067
1236
|
break;
|
|
1068
1237
|
}
|
|
1069
1238
|
this.logError("\u672A\u627E\u5230\u6A21\u5757\u914D\u7F6E: ".concat(moduleName), {
|
|
@@ -1077,7 +1246,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1077
1246
|
moduleOptions = _objectSpread({
|
|
1078
1247
|
store: _objectSpread({}, registryConfig.defaultStore)
|
|
1079
1248
|
}, customConfig); // 注册模块和路由
|
|
1080
|
-
|
|
1249
|
+
_context14.next = 13;
|
|
1081
1250
|
return this.registerModuleWithRoutes(moduleInstance, moduleOptions, moduleName.charAt(0).toUpperCase() + moduleName.slice(1));
|
|
1082
1251
|
case 13:
|
|
1083
1252
|
// 保存模块实例
|
|
@@ -1087,18 +1256,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
1087
1256
|
shouldPreload: shouldPreload,
|
|
1088
1257
|
version: registryConfig.version
|
|
1089
1258
|
});
|
|
1090
|
-
return
|
|
1259
|
+
return _context14.abrupt("return", {
|
|
1091
1260
|
module: moduleInstance,
|
|
1092
1261
|
config: registryConfig,
|
|
1093
1262
|
shouldPreload: shouldPreload
|
|
1094
1263
|
});
|
|
1095
1264
|
case 16:
|
|
1096
1265
|
case "end":
|
|
1097
|
-
return
|
|
1266
|
+
return _context14.stop();
|
|
1098
1267
|
}
|
|
1099
|
-
},
|
|
1268
|
+
}, _callee14, this);
|
|
1100
1269
|
}));
|
|
1101
|
-
function registerModuleByName(
|
|
1270
|
+
function registerModuleByName(_x16) {
|
|
1102
1271
|
return _registerModuleByName.apply(this, arguments);
|
|
1103
1272
|
}
|
|
1104
1273
|
return registerModuleByName;
|
|
@@ -1111,10 +1280,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1111
1280
|
}, {
|
|
1112
1281
|
key: "registerModules",
|
|
1113
1282
|
value: (function () {
|
|
1114
|
-
var _registerModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1283
|
+
var _registerModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(moduleConfigs) {
|
|
1115
1284
|
var configs, registeredModules, _iterator2, _step2, config, configName, result, errorMessage;
|
|
1116
|
-
return _regeneratorRuntime().wrap(function
|
|
1117
|
-
while (1) switch (
|
|
1285
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1286
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1118
1287
|
case 0:
|
|
1119
1288
|
console.log('[Server] 开始注册模块...');
|
|
1120
1289
|
|
|
@@ -1126,47 +1295,47 @@ var Server = /*#__PURE__*/function () {
|
|
|
1126
1295
|
});
|
|
1127
1296
|
registeredModules = [];
|
|
1128
1297
|
_iterator2 = _createForOfIteratorHelper(configs);
|
|
1129
|
-
|
|
1298
|
+
_context15.prev = 5;
|
|
1130
1299
|
_iterator2.s();
|
|
1131
1300
|
case 7:
|
|
1132
1301
|
if ((_step2 = _iterator2.n()).done) {
|
|
1133
|
-
|
|
1302
|
+
_context15.next = 25;
|
|
1134
1303
|
break;
|
|
1135
1304
|
}
|
|
1136
1305
|
config = _step2.value;
|
|
1137
1306
|
configName = typeof config === 'string' ? config : config.name;
|
|
1138
|
-
|
|
1139
|
-
|
|
1307
|
+
_context15.prev = 10;
|
|
1308
|
+
_context15.next = 13;
|
|
1140
1309
|
return this.registerModuleByName(config);
|
|
1141
1310
|
case 13:
|
|
1142
|
-
result =
|
|
1311
|
+
result = _context15.sent;
|
|
1143
1312
|
registeredModules.push(result);
|
|
1144
|
-
|
|
1313
|
+
_context15.next = 23;
|
|
1145
1314
|
break;
|
|
1146
1315
|
case 17:
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
errorMessage =
|
|
1316
|
+
_context15.prev = 17;
|
|
1317
|
+
_context15.t0 = _context15["catch"](10);
|
|
1318
|
+
errorMessage = _context15.t0 instanceof Error ? _context15.t0.message : String(_context15.t0);
|
|
1150
1319
|
this.logError("\u6A21\u5757\u6CE8\u518C\u5931\u8D25: ".concat(configName), {
|
|
1151
1320
|
moduleName: configName,
|
|
1152
1321
|
error: errorMessage
|
|
1153
1322
|
});
|
|
1154
|
-
console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:",
|
|
1155
|
-
throw
|
|
1323
|
+
console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:", _context15.t0);
|
|
1324
|
+
throw _context15.t0;
|
|
1156
1325
|
case 23:
|
|
1157
|
-
|
|
1326
|
+
_context15.next = 7;
|
|
1158
1327
|
break;
|
|
1159
1328
|
case 25:
|
|
1160
|
-
|
|
1329
|
+
_context15.next = 30;
|
|
1161
1330
|
break;
|
|
1162
1331
|
case 27:
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
_iterator2.e(
|
|
1332
|
+
_context15.prev = 27;
|
|
1333
|
+
_context15.t1 = _context15["catch"](5);
|
|
1334
|
+
_iterator2.e(_context15.t1);
|
|
1166
1335
|
case 30:
|
|
1167
|
-
|
|
1336
|
+
_context15.prev = 30;
|
|
1168
1337
|
_iterator2.f();
|
|
1169
|
-
return
|
|
1338
|
+
return _context15.finish(30);
|
|
1170
1339
|
case 33:
|
|
1171
1340
|
console.log('[Server] ✅ 所有模块注册完成');
|
|
1172
1341
|
this.logInfo('所有模块注册完成', {
|
|
@@ -1176,14 +1345,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
1176
1345
|
return m === null || m === void 0 || (_m$config = m.config) === null || _m$config === void 0 ? void 0 : _m$config.name;
|
|
1177
1346
|
})
|
|
1178
1347
|
});
|
|
1179
|
-
return
|
|
1348
|
+
return _context15.abrupt("return", registeredModules);
|
|
1180
1349
|
case 36:
|
|
1181
1350
|
case "end":
|
|
1182
|
-
return
|
|
1351
|
+
return _context15.stop();
|
|
1183
1352
|
}
|
|
1184
|
-
},
|
|
1353
|
+
}, _callee15, this, [[5, 27, 30, 33], [10, 17]]);
|
|
1185
1354
|
}));
|
|
1186
|
-
function registerModules(
|
|
1355
|
+
function registerModules(_x17) {
|
|
1187
1356
|
return _registerModules.apply(this, arguments);
|
|
1188
1357
|
}
|
|
1189
1358
|
return registerModules;
|
|
@@ -1196,10 +1365,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1196
1365
|
}, {
|
|
1197
1366
|
key: "preloadModulesData",
|
|
1198
1367
|
value: (function () {
|
|
1199
|
-
var _preloadModulesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1368
|
+
var _preloadModulesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(registeredModules, options) {
|
|
1200
1369
|
var modulesToPreload, preloadResults, _iterator3, _step3, _step3$value, module, config, shouldPreload, startTime, _options$onModuleLoad, _options$onModuleLoad2, duration, _duration, errorMessage, successCount, failCount;
|
|
1201
|
-
return _regeneratorRuntime().wrap(function
|
|
1202
|
-
while (1) switch (
|
|
1370
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1371
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1203
1372
|
case 0:
|
|
1204
1373
|
console.log('[Server] 开始预加载模块数据...');
|
|
1205
1374
|
modulesToPreload = registeredModules.filter(function (m) {
|
|
@@ -1212,16 +1381,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
1212
1381
|
});
|
|
1213
1382
|
preloadResults = [];
|
|
1214
1383
|
_iterator3 = _createForOfIteratorHelper(registeredModules);
|
|
1215
|
-
|
|
1384
|
+
_context16.prev = 5;
|
|
1216
1385
|
_iterator3.s();
|
|
1217
1386
|
case 7:
|
|
1218
1387
|
if ((_step3 = _iterator3.n()).done) {
|
|
1219
|
-
|
|
1388
|
+
_context16.next = 40;
|
|
1220
1389
|
break;
|
|
1221
1390
|
}
|
|
1222
1391
|
_step3$value = _step3.value, module = _step3$value.module, config = _step3$value.config, shouldPreload = _step3$value.shouldPreload;
|
|
1223
1392
|
if (shouldPreload) {
|
|
1224
|
-
|
|
1393
|
+
_context16.next = 13;
|
|
1225
1394
|
break;
|
|
1226
1395
|
}
|
|
1227
1396
|
console.log("[Server] \u23ED\uFE0F \u8DF3\u8FC7 ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D"));
|
|
@@ -1229,19 +1398,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
1229
1398
|
moduleName: config.name,
|
|
1230
1399
|
reason: 'shouldPreload=false'
|
|
1231
1400
|
});
|
|
1232
|
-
return
|
|
1401
|
+
return _context16.abrupt("continue", 38);
|
|
1233
1402
|
case 13:
|
|
1234
1403
|
if (!(typeof module.preload === 'function')) {
|
|
1235
|
-
|
|
1404
|
+
_context16.next = 36;
|
|
1236
1405
|
break;
|
|
1237
1406
|
}
|
|
1238
1407
|
startTime = Date.now();
|
|
1239
|
-
|
|
1408
|
+
_context16.prev = 15;
|
|
1240
1409
|
this.logInfo("\u5F00\u59CB\u9884\u52A0\u8F7D\u6A21\u5757: ".concat(config.name), {
|
|
1241
1410
|
moduleName: config.name
|
|
1242
1411
|
});
|
|
1243
1412
|
options === null || options === void 0 || (_options$onModuleLoad = options.onModuleLoad) === null || _options$onModuleLoad === void 0 || _options$onModuleLoad.call(options, config.name);
|
|
1244
|
-
|
|
1413
|
+
_context16.next = 20;
|
|
1245
1414
|
return module.preload();
|
|
1246
1415
|
case 20:
|
|
1247
1416
|
options === null || options === void 0 || (_options$onModuleLoad2 = options.onModuleLoadComplete) === null || _options$onModuleLoad2 === void 0 || _options$onModuleLoad2.call(options, config.name);
|
|
@@ -1255,14 +1424,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
1255
1424
|
name: config.name,
|
|
1256
1425
|
success: true
|
|
1257
1426
|
});
|
|
1258
|
-
|
|
1427
|
+
_context16.next = 34;
|
|
1259
1428
|
break;
|
|
1260
1429
|
case 27:
|
|
1261
|
-
|
|
1262
|
-
|
|
1430
|
+
_context16.prev = 27;
|
|
1431
|
+
_context16.t0 = _context16["catch"](15);
|
|
1263
1432
|
_duration = Date.now() - startTime;
|
|
1264
|
-
errorMessage =
|
|
1265
|
-
console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"),
|
|
1433
|
+
errorMessage = _context16.t0 instanceof Error ? _context16.t0.message : String(_context16.t0);
|
|
1434
|
+
console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"), _context16.t0);
|
|
1266
1435
|
this.logError("\u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25: ".concat(config.name), {
|
|
1267
1436
|
moduleName: config.name,
|
|
1268
1437
|
duration: "".concat(_duration, "ms"),
|
|
@@ -1274,7 +1443,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1274
1443
|
error: errorMessage
|
|
1275
1444
|
});
|
|
1276
1445
|
case 34:
|
|
1277
|
-
|
|
1446
|
+
_context16.next = 38;
|
|
1278
1447
|
break;
|
|
1279
1448
|
case 36:
|
|
1280
1449
|
console.log("[Server] \u26A0\uFE0F ".concat(config.name, " \u6A21\u5757\u672A\u5B9E\u73B0 preload() \u65B9\u6CD5"));
|
|
@@ -1282,19 +1451,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
1282
1451
|
moduleName: config.name
|
|
1283
1452
|
});
|
|
1284
1453
|
case 38:
|
|
1285
|
-
|
|
1454
|
+
_context16.next = 7;
|
|
1286
1455
|
break;
|
|
1287
1456
|
case 40:
|
|
1288
|
-
|
|
1457
|
+
_context16.next = 45;
|
|
1289
1458
|
break;
|
|
1290
1459
|
case 42:
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
_iterator3.e(
|
|
1460
|
+
_context16.prev = 42;
|
|
1461
|
+
_context16.t1 = _context16["catch"](5);
|
|
1462
|
+
_iterator3.e(_context16.t1);
|
|
1294
1463
|
case 45:
|
|
1295
|
-
|
|
1464
|
+
_context16.prev = 45;
|
|
1296
1465
|
_iterator3.f();
|
|
1297
|
-
return
|
|
1466
|
+
return _context16.finish(45);
|
|
1298
1467
|
case 48:
|
|
1299
1468
|
successCount = preloadResults.filter(function (r) {
|
|
1300
1469
|
return r.success;
|
|
@@ -1309,11 +1478,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1309
1478
|
});
|
|
1310
1479
|
case 52:
|
|
1311
1480
|
case "end":
|
|
1312
|
-
return
|
|
1481
|
+
return _context16.stop();
|
|
1313
1482
|
}
|
|
1314
|
-
},
|
|
1483
|
+
}, _callee16, this, [[5, 42, 45, 48], [15, 27]]);
|
|
1315
1484
|
}));
|
|
1316
|
-
function preloadModulesData(
|
|
1485
|
+
function preloadModulesData(_x18, _x19) {
|
|
1317
1486
|
return _preloadModulesData.apply(this, arguments);
|
|
1318
1487
|
}
|
|
1319
1488
|
return preloadModulesData;
|
|
@@ -1327,7 +1496,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1327
1496
|
}, {
|
|
1328
1497
|
key: "initialize",
|
|
1329
1498
|
value: (function () {
|
|
1330
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1499
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(moduleConfigs) {
|
|
1331
1500
|
var _moduleConfigs$length,
|
|
1332
1501
|
_this3 = this;
|
|
1333
1502
|
var autoPreload,
|
|
@@ -1335,12 +1504,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
1335
1504
|
startTime,
|
|
1336
1505
|
registeredModules,
|
|
1337
1506
|
duration,
|
|
1338
|
-
|
|
1339
|
-
return _regeneratorRuntime().wrap(function
|
|
1340
|
-
while (1) switch (
|
|
1507
|
+
_args17 = arguments;
|
|
1508
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1509
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1341
1510
|
case 0:
|
|
1342
|
-
autoPreload =
|
|
1343
|
-
options =
|
|
1511
|
+
autoPreload = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : true;
|
|
1512
|
+
options = _args17.length > 2 ? _args17[2] : undefined;
|
|
1344
1513
|
startTime = Date.now();
|
|
1345
1514
|
this.logInfo('Server 初始化开始', {
|
|
1346
1515
|
moduleConfigCount: (_moduleConfigs$length = moduleConfigs === null || moduleConfigs === void 0 ? void 0 : moduleConfigs.length) !== null && _moduleConfigs$length !== void 0 ? _moduleConfigs$length : 'all',
|
|
@@ -1352,24 +1521,27 @@ var Server = /*#__PURE__*/function () {
|
|
|
1352
1521
|
this.registerServerRoutes();
|
|
1353
1522
|
|
|
1354
1523
|
// 注册模块
|
|
1355
|
-
|
|
1524
|
+
_context17.next = 7;
|
|
1356
1525
|
return this.registerModules(moduleConfigs);
|
|
1357
1526
|
case 7:
|
|
1358
|
-
registeredModules =
|
|
1527
|
+
registeredModules = _context17.sent;
|
|
1359
1528
|
if (!autoPreload) {
|
|
1360
|
-
|
|
1529
|
+
_context17.next = 13;
|
|
1361
1530
|
break;
|
|
1362
1531
|
}
|
|
1363
|
-
|
|
1532
|
+
_context17.next = 11;
|
|
1364
1533
|
return this.preloadModulesData(registeredModules, options);
|
|
1365
1534
|
case 11:
|
|
1366
|
-
|
|
1535
|
+
_context17.next = 14;
|
|
1367
1536
|
break;
|
|
1368
1537
|
case 13:
|
|
1369
1538
|
this.logInfo('跳过自动预加载', {
|
|
1370
1539
|
autoPreload: autoPreload
|
|
1371
1540
|
});
|
|
1372
1541
|
case 14:
|
|
1542
|
+
_context17.next = 16;
|
|
1543
|
+
return this.setupProductsQuotationPriceBridge();
|
|
1544
|
+
case 16:
|
|
1373
1545
|
// 监听 ProductsModule 同步完成事件,重新计算并推送查询结果
|
|
1374
1546
|
this.core.effects.on(ProductsHooks.onProductsSyncCompleted, function (payload) {
|
|
1375
1547
|
_this3.recomputeAndNotifyProductQuery({
|
|
@@ -1393,18 +1565,72 @@ var Server = /*#__PURE__*/function () {
|
|
|
1393
1565
|
duration: "".concat(duration, "ms"),
|
|
1394
1566
|
registeredModuleCount: registeredModules.length
|
|
1395
1567
|
});
|
|
1396
|
-
return
|
|
1397
|
-
case
|
|
1568
|
+
return _context17.abrupt("return", registeredModules);
|
|
1569
|
+
case 22:
|
|
1398
1570
|
case "end":
|
|
1399
|
-
return
|
|
1571
|
+
return _context17.stop();
|
|
1400
1572
|
}
|
|
1401
|
-
},
|
|
1573
|
+
}, _callee17, this);
|
|
1402
1574
|
}));
|
|
1403
|
-
function initialize(
|
|
1575
|
+
function initialize(_x20) {
|
|
1404
1576
|
return _initialize.apply(this, arguments);
|
|
1405
1577
|
}
|
|
1406
1578
|
return initialize;
|
|
1407
1579
|
}()
|
|
1580
|
+
/**
|
|
1581
|
+
* 将普通层 QuotationModule 的报价单计算能力桥接到 Server Products 模块。
|
|
1582
|
+
*/
|
|
1583
|
+
)
|
|
1584
|
+
}, {
|
|
1585
|
+
key: "setupProductsQuotationPriceBridge",
|
|
1586
|
+
value: (function () {
|
|
1587
|
+
var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1588
|
+
var _this$core$context, errorMessage;
|
|
1589
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1590
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1591
|
+
case 0:
|
|
1592
|
+
if (this.products) {
|
|
1593
|
+
_context18.next = 3;
|
|
1594
|
+
break;
|
|
1595
|
+
}
|
|
1596
|
+
this.logWarning('setupProductsQuotationPriceBridge: Products 模块未注册');
|
|
1597
|
+
return _context18.abrupt("return");
|
|
1598
|
+
case 3:
|
|
1599
|
+
if (this.schedule) {
|
|
1600
|
+
_context18.next = 6;
|
|
1601
|
+
break;
|
|
1602
|
+
}
|
|
1603
|
+
this.logWarning('setupProductsQuotationPriceBridge: Schedule 模块未注册');
|
|
1604
|
+
return _context18.abrupt("return");
|
|
1605
|
+
case 6:
|
|
1606
|
+
_context18.prev = 6;
|
|
1607
|
+
_context18.next = 9;
|
|
1608
|
+
return this.products.setupQuotationPriceBridge({
|
|
1609
|
+
scheduleModule: this.schedule,
|
|
1610
|
+
channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel
|
|
1611
|
+
});
|
|
1612
|
+
case 9:
|
|
1613
|
+
this.logInfo('Products 报价单价格桥接初始化完成');
|
|
1614
|
+
_context18.next = 16;
|
|
1615
|
+
break;
|
|
1616
|
+
case 12:
|
|
1617
|
+
_context18.prev = 12;
|
|
1618
|
+
_context18.t0 = _context18["catch"](6);
|
|
1619
|
+
errorMessage = _context18.t0 instanceof Error ? _context18.t0.message : String(_context18.t0);
|
|
1620
|
+
this.logError('Products 报价单价格桥接初始化失败', {
|
|
1621
|
+
error: errorMessage
|
|
1622
|
+
});
|
|
1623
|
+
case 16:
|
|
1624
|
+
case "end":
|
|
1625
|
+
return _context18.stop();
|
|
1626
|
+
}
|
|
1627
|
+
}, _callee18, this, [[6, 12]]);
|
|
1628
|
+
}));
|
|
1629
|
+
function setupProductsQuotationPriceBridge() {
|
|
1630
|
+
return _setupProductsQuotationPriceBridge.apply(this, arguments);
|
|
1631
|
+
}
|
|
1632
|
+
return setupProductsQuotationPriceBridge;
|
|
1633
|
+
}()
|
|
1408
1634
|
/**
|
|
1409
1635
|
* 获取 Products 模块实例
|
|
1410
1636
|
*/
|
|
@@ -1467,45 +1693,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
1467
1693
|
}, {
|
|
1468
1694
|
key: "refreshProductsInBackground",
|
|
1469
1695
|
value: (function () {
|
|
1470
|
-
var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1696
|
+
var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1471
1697
|
var startTime, duration, _duration2, errorMessage;
|
|
1472
|
-
return _regeneratorRuntime().wrap(function
|
|
1473
|
-
while (1) switch (
|
|
1698
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1699
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1474
1700
|
case 0:
|
|
1475
1701
|
if (this.products) {
|
|
1476
|
-
|
|
1702
|
+
_context19.next = 3;
|
|
1477
1703
|
break;
|
|
1478
1704
|
}
|
|
1479
1705
|
this.logWarning('refreshProductsInBackground: Products 模块未注册');
|
|
1480
|
-
return
|
|
1706
|
+
return _context19.abrupt("return");
|
|
1481
1707
|
case 3:
|
|
1482
1708
|
this.logInfo('refreshProductsInBackground 开始');
|
|
1483
1709
|
startTime = Date.now();
|
|
1484
|
-
|
|
1485
|
-
|
|
1710
|
+
_context19.prev = 5;
|
|
1711
|
+
_context19.next = 8;
|
|
1486
1712
|
return this.products.silentRefresh();
|
|
1487
1713
|
case 8:
|
|
1488
1714
|
duration = Date.now() - startTime;
|
|
1489
1715
|
this.logInfo('refreshProductsInBackground 完成', {
|
|
1490
1716
|
duration: "".concat(duration, "ms")
|
|
1491
1717
|
});
|
|
1492
|
-
|
|
1718
|
+
_context19.next = 18;
|
|
1493
1719
|
break;
|
|
1494
1720
|
case 12:
|
|
1495
|
-
|
|
1496
|
-
|
|
1721
|
+
_context19.prev = 12;
|
|
1722
|
+
_context19.t0 = _context19["catch"](5);
|
|
1497
1723
|
_duration2 = Date.now() - startTime;
|
|
1498
|
-
errorMessage =
|
|
1499
|
-
console.error('[Server] refreshProductsInBackground 失败:',
|
|
1724
|
+
errorMessage = _context19.t0 instanceof Error ? _context19.t0.message : String(_context19.t0);
|
|
1725
|
+
console.error('[Server] refreshProductsInBackground 失败:', _context19.t0);
|
|
1500
1726
|
this.logError('refreshProductsInBackground 失败', {
|
|
1501
1727
|
duration: "".concat(_duration2, "ms"),
|
|
1502
1728
|
error: errorMessage
|
|
1503
1729
|
});
|
|
1504
1730
|
case 18:
|
|
1505
1731
|
case "end":
|
|
1506
|
-
return
|
|
1732
|
+
return _context19.stop();
|
|
1507
1733
|
}
|
|
1508
|
-
},
|
|
1734
|
+
}, _callee19, this, [[5, 12]]);
|
|
1509
1735
|
}));
|
|
1510
1736
|
function refreshProductsInBackground() {
|
|
1511
1737
|
return _refreshProductsInBackground.apply(this, arguments);
|
|
@@ -1520,10 +1746,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1520
1746
|
}, {
|
|
1521
1747
|
key: "clearAllIndexDB",
|
|
1522
1748
|
value: (function () {
|
|
1523
|
-
var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1749
|
+
var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1524
1750
|
var clearTasks, moduleNames, errorMessage;
|
|
1525
|
-
return _regeneratorRuntime().wrap(function
|
|
1526
|
-
while (1) switch (
|
|
1751
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1752
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1527
1753
|
case 0:
|
|
1528
1754
|
console.log('[Server] 开始清空所有模块的IndexedDB缓存...');
|
|
1529
1755
|
this.logInfo('开始清空所有模块的 IndexedDB 缓存');
|
|
@@ -1558,41 +1784,41 @@ var Server = /*#__PURE__*/function () {
|
|
|
1558
1784
|
moduleNames.push('FloorPlan');
|
|
1559
1785
|
}
|
|
1560
1786
|
if (!(clearTasks.length === 0)) {
|
|
1561
|
-
|
|
1787
|
+
_context20.next = 15;
|
|
1562
1788
|
break;
|
|
1563
1789
|
}
|
|
1564
1790
|
console.warn('[Server] 没有找到已注册的模块,无需清空');
|
|
1565
1791
|
this.logWarning('没有找到已注册的模块,无需清空 IndexedDB');
|
|
1566
|
-
return
|
|
1792
|
+
return _context20.abrupt("return");
|
|
1567
1793
|
case 15:
|
|
1568
1794
|
this.logInfo('准备清空模块缓存', {
|
|
1569
1795
|
moduleNames: moduleNames
|
|
1570
1796
|
});
|
|
1571
|
-
|
|
1572
|
-
|
|
1797
|
+
_context20.prev = 16;
|
|
1798
|
+
_context20.next = 19;
|
|
1573
1799
|
return Promise.all(clearTasks);
|
|
1574
1800
|
case 19:
|
|
1575
1801
|
console.log("[Server] \u2705 \u5DF2\u6210\u529F\u6E05\u7A7A\u6240\u6709\u6A21\u5757\u7684IndexedDB\u7F13\u5B58: ".concat(moduleNames.join(', ')));
|
|
1576
1802
|
this.logInfo('成功清空所有模块的 IndexedDB 缓存', {
|
|
1577
1803
|
moduleNames: moduleNames
|
|
1578
1804
|
});
|
|
1579
|
-
|
|
1805
|
+
_context20.next = 29;
|
|
1580
1806
|
break;
|
|
1581
1807
|
case 23:
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
errorMessage =
|
|
1585
|
-
console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:',
|
|
1808
|
+
_context20.prev = 23;
|
|
1809
|
+
_context20.t0 = _context20["catch"](16);
|
|
1810
|
+
errorMessage = _context20.t0 instanceof Error ? _context20.t0.message : String(_context20.t0);
|
|
1811
|
+
console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context20.t0);
|
|
1586
1812
|
this.logError('清空 IndexedDB 缓存时发生错误', {
|
|
1587
1813
|
moduleNames: moduleNames,
|
|
1588
1814
|
error: errorMessage
|
|
1589
1815
|
});
|
|
1590
|
-
throw
|
|
1816
|
+
throw _context20.t0;
|
|
1591
1817
|
case 29:
|
|
1592
1818
|
case "end":
|
|
1593
|
-
return
|
|
1819
|
+
return _context20.stop();
|
|
1594
1820
|
}
|
|
1595
|
-
},
|
|
1821
|
+
}, _callee20, this, [[16, 23]]);
|
|
1596
1822
|
}));
|
|
1597
1823
|
function clearAllIndexDB() {
|
|
1598
1824
|
return _clearAllIndexDB.apply(this, arguments);
|
|
@@ -1667,10 +1893,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1667
1893
|
}, {
|
|
1668
1894
|
key: "handleRoute",
|
|
1669
1895
|
value: (function () {
|
|
1670
|
-
var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1896
|
+
var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(method, path, params) {
|
|
1671
1897
|
var startTime, handler, result, duration, _duration3, errorMessage;
|
|
1672
|
-
return _regeneratorRuntime().wrap(function
|
|
1673
|
-
while (1) switch (
|
|
1898
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1899
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1674
1900
|
case 0:
|
|
1675
1901
|
startTime = Date.now();
|
|
1676
1902
|
this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5F00\u59CB: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
@@ -1681,7 +1907,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1681
1907
|
});
|
|
1682
1908
|
handler = this.getRouteHandler(method, path);
|
|
1683
1909
|
if (handler) {
|
|
1684
|
-
|
|
1910
|
+
_context21.next = 6;
|
|
1685
1911
|
break;
|
|
1686
1912
|
}
|
|
1687
1913
|
this.logError("\u8DEF\u7531\u672A\u627E\u5230: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
@@ -1690,13 +1916,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
1690
1916
|
});
|
|
1691
1917
|
throw new Error("Route not found: ".concat(method.toUpperCase(), " ").concat(path));
|
|
1692
1918
|
case 6:
|
|
1693
|
-
|
|
1694
|
-
|
|
1919
|
+
_context21.prev = 6;
|
|
1920
|
+
_context21.next = 9;
|
|
1695
1921
|
return handler(_objectSpread(_objectSpread({}, params), {}, {
|
|
1696
1922
|
path: path
|
|
1697
1923
|
}));
|
|
1698
1924
|
case 9:
|
|
1699
|
-
result =
|
|
1925
|
+
result = _context21.sent;
|
|
1700
1926
|
duration = Date.now() - startTime;
|
|
1701
1927
|
this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5B8C\u6210: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
1702
1928
|
method: method.toUpperCase(),
|
|
@@ -1705,12 +1931,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
1705
1931
|
resultCode: result === null || result === void 0 ? void 0 : result.code,
|
|
1706
1932
|
resultStatus: result === null || result === void 0 ? void 0 : result.status
|
|
1707
1933
|
});
|
|
1708
|
-
return
|
|
1934
|
+
return _context21.abrupt("return", result);
|
|
1709
1935
|
case 15:
|
|
1710
|
-
|
|
1711
|
-
|
|
1936
|
+
_context21.prev = 15;
|
|
1937
|
+
_context21.t0 = _context21["catch"](6);
|
|
1712
1938
|
_duration3 = Date.now() - startTime;
|
|
1713
|
-
errorMessage =
|
|
1939
|
+
errorMessage = _context21.t0 instanceof Error ? _context21.t0.message : String(_context21.t0);
|
|
1714
1940
|
this.logError("\u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
1715
1941
|
method: method.toUpperCase(),
|
|
1716
1942
|
path: path,
|
|
@@ -1718,15 +1944,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
1718
1944
|
error: errorMessage,
|
|
1719
1945
|
data: params.data
|
|
1720
1946
|
});
|
|
1721
|
-
console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path),
|
|
1722
|
-
throw
|
|
1947
|
+
console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), _context21.t0);
|
|
1948
|
+
throw _context21.t0;
|
|
1723
1949
|
case 22:
|
|
1724
1950
|
case "end":
|
|
1725
|
-
return
|
|
1951
|
+
return _context21.stop();
|
|
1726
1952
|
}
|
|
1727
|
-
},
|
|
1953
|
+
}, _callee21, this, [[6, 15]]);
|
|
1728
1954
|
}));
|
|
1729
|
-
function handleRoute(
|
|
1955
|
+
function handleRoute(_x21, _x22, _x23) {
|
|
1730
1956
|
return _handleRoute.apply(this, arguments);
|
|
1731
1957
|
}
|
|
1732
1958
|
return handleRoute;
|
|
@@ -1798,6 +2024,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1798
2024
|
handler: this.handleUpdateLocalOrder.bind(this)
|
|
1799
2025
|
}]);
|
|
1800
2026
|
this.registerPrefixRoutes([{
|
|
2027
|
+
method: 'get',
|
|
2028
|
+
prefix: '/shop/order/sales',
|
|
2029
|
+
handler: this.handleOrderSalesDetail.bind(this)
|
|
2030
|
+
}, {
|
|
1801
2031
|
method: 'get',
|
|
1802
2032
|
prefix: '/shop/schedule/floor-plan',
|
|
1803
2033
|
handler: this.handleFloorPlanGet.bind(this)
|
|
@@ -2211,18 +2441,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
2211
2441
|
}, {
|
|
2212
2442
|
key: "fetchOrderListFromAPI",
|
|
2213
2443
|
value: (function () {
|
|
2214
|
-
var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2215
|
-
var _this$
|
|
2216
|
-
var _response$
|
|
2217
|
-
return _regeneratorRuntime().wrap(function
|
|
2218
|
-
while (1) switch (
|
|
2444
|
+
var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(data) {
|
|
2445
|
+
var _this$app4;
|
|
2446
|
+
var _response$data3, response, payload, list, count, errorMessage;
|
|
2447
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2448
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2219
2449
|
case 0:
|
|
2220
|
-
if ((_this$
|
|
2221
|
-
|
|
2450
|
+
if ((_this$app4 = this.app) !== null && _this$app4 !== void 0 && _this$app4.request) {
|
|
2451
|
+
_context22.next = 3;
|
|
2222
2452
|
break;
|
|
2223
2453
|
}
|
|
2224
2454
|
this.logError('fetchOrderListFromAPI: app.request 不可用');
|
|
2225
|
-
return
|
|
2455
|
+
return _context22.abrupt("return", {
|
|
2226
2456
|
code: 500,
|
|
2227
2457
|
message: 'app.request 不可用',
|
|
2228
2458
|
data: {
|
|
@@ -2232,17 +2462,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
2232
2462
|
status: false
|
|
2233
2463
|
});
|
|
2234
2464
|
case 3:
|
|
2235
|
-
|
|
2236
|
-
|
|
2465
|
+
_context22.prev = 3;
|
|
2466
|
+
_context22.next = 6;
|
|
2237
2467
|
return this.app.request.post('/shop/order/v2/list', data, {
|
|
2238
2468
|
isShopApi: true
|
|
2239
2469
|
});
|
|
2240
2470
|
case 6:
|
|
2241
|
-
response =
|
|
2242
|
-
payload = (_response$
|
|
2471
|
+
response = _context22.sent;
|
|
2472
|
+
payload = (_response$data3 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data3 !== void 0 ? _response$data3 : response;
|
|
2243
2473
|
list = Array.isArray(payload === null || payload === void 0 ? void 0 : payload.list) ? payload.list : [];
|
|
2244
2474
|
count = typeof (payload === null || payload === void 0 ? void 0 : payload.count) === 'number' ? payload.count : list.length;
|
|
2245
|
-
return
|
|
2475
|
+
return _context22.abrupt("return", {
|
|
2246
2476
|
code: 200,
|
|
2247
2477
|
data: _objectSpread(_objectSpread({}, payload), {}, {
|
|
2248
2478
|
list: list,
|
|
@@ -2252,13 +2482,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
2252
2482
|
status: true
|
|
2253
2483
|
});
|
|
2254
2484
|
case 13:
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
errorMessage =
|
|
2485
|
+
_context22.prev = 13;
|
|
2486
|
+
_context22.t0 = _context22["catch"](3);
|
|
2487
|
+
errorMessage = _context22.t0 instanceof Error ? _context22.t0.message : String(_context22.t0);
|
|
2258
2488
|
this.logError('fetchOrderListFromAPI: 请求失败', {
|
|
2259
2489
|
error: errorMessage
|
|
2260
2490
|
});
|
|
2261
|
-
return
|
|
2491
|
+
return _context22.abrupt("return", {
|
|
2262
2492
|
code: 500,
|
|
2263
2493
|
message: errorMessage,
|
|
2264
2494
|
data: {
|
|
@@ -2269,11 +2499,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2269
2499
|
});
|
|
2270
2500
|
case 18:
|
|
2271
2501
|
case "end":
|
|
2272
|
-
return
|
|
2502
|
+
return _context22.stop();
|
|
2273
2503
|
}
|
|
2274
|
-
},
|
|
2504
|
+
}, _callee22, this, [[3, 13]]);
|
|
2275
2505
|
}));
|
|
2276
|
-
function fetchOrderListFromAPI(
|
|
2506
|
+
function fetchOrderListFromAPI(_x24) {
|
|
2277
2507
|
return _fetchOrderListFromAPI.apply(this, arguments);
|
|
2278
2508
|
}
|
|
2279
2509
|
return fetchOrderListFromAPI;
|
|
@@ -2285,17 +2515,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
2285
2515
|
}, {
|
|
2286
2516
|
key: "fetchBookingListFromAPI",
|
|
2287
2517
|
value: (function () {
|
|
2288
|
-
var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2518
|
+
var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(data) {
|
|
2289
2519
|
var memoryCacheEnabled, withFields, requestPayload, cacheKey, cached, rawList, bookingResult, _bookingResult$list, errorMessage;
|
|
2290
|
-
return _regeneratorRuntime().wrap(function
|
|
2291
|
-
while (1) switch (
|
|
2520
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2521
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2292
2522
|
case 0:
|
|
2293
2523
|
if (this.order) {
|
|
2294
|
-
|
|
2524
|
+
_context23.next = 3;
|
|
2295
2525
|
break;
|
|
2296
2526
|
}
|
|
2297
2527
|
this.logError('fetchBookingListFromAPI: Order 模块不可用');
|
|
2298
|
-
return
|
|
2528
|
+
return _context23.abrupt("return", {
|
|
2299
2529
|
code: 500,
|
|
2300
2530
|
message: 'Order 模块不可用',
|
|
2301
2531
|
data: {
|
|
@@ -2305,18 +2535,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
2305
2535
|
status: false
|
|
2306
2536
|
});
|
|
2307
2537
|
case 3:
|
|
2308
|
-
|
|
2538
|
+
_context23.prev = 3;
|
|
2309
2539
|
memoryCacheEnabled = this.isBookingRemoteMemoryCacheEnabled(data);
|
|
2310
2540
|
withFields = this.resolveBookingSalesWith(data);
|
|
2311
2541
|
requestPayload = this.normalizeBookingRemoteQueryPayload(data, withFields);
|
|
2312
2542
|
cacheKey = this.buildBookingRemoteCacheKey(requestPayload);
|
|
2313
2543
|
if (!memoryCacheEnabled) {
|
|
2314
|
-
|
|
2544
|
+
_context23.next = 13;
|
|
2315
2545
|
break;
|
|
2316
2546
|
}
|
|
2317
2547
|
cached = this.readBookingRemoteCache(cacheKey);
|
|
2318
2548
|
if (!cached) {
|
|
2319
|
-
|
|
2549
|
+
_context23.next = 13;
|
|
2320
2550
|
break;
|
|
2321
2551
|
}
|
|
2322
2552
|
this.logInfo('fetchBookingListFromAPI: 命中内存缓存', {
|
|
@@ -2324,14 +2554,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
2324
2554
|
listCount: cached.bookingResult.count,
|
|
2325
2555
|
withFields: cached.withFields
|
|
2326
2556
|
});
|
|
2327
|
-
return
|
|
2557
|
+
return _context23.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
|
|
2328
2558
|
cache_hit: true
|
|
2329
2559
|
}));
|
|
2330
2560
|
case 13:
|
|
2331
|
-
|
|
2561
|
+
_context23.next = 15;
|
|
2332
2562
|
return this.order.fetchOrdersBySSE(requestPayload);
|
|
2333
2563
|
case 15:
|
|
2334
|
-
rawList =
|
|
2564
|
+
rawList = _context23.sent;
|
|
2335
2565
|
bookingResult = sortBookings(filterBookingsFromOrders(rawList, data), data); // DEBUG: 挂到 window 上方便排查 SSE → 日历数据丢失问题
|
|
2336
2566
|
if (typeof globalThis !== 'undefined') {
|
|
2337
2567
|
globalThis.__SSE_BOOKING_DEBUG__ = {
|
|
@@ -2378,15 +2608,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
2378
2608
|
cacheKey: cacheKey,
|
|
2379
2609
|
withFields: withFields
|
|
2380
2610
|
});
|
|
2381
|
-
return
|
|
2611
|
+
return _context23.abrupt("return", this.buildBookingResponse(bookingResult));
|
|
2382
2612
|
case 23:
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
errorMessage =
|
|
2613
|
+
_context23.prev = 23;
|
|
2614
|
+
_context23.t0 = _context23["catch"](3);
|
|
2615
|
+
errorMessage = _context23.t0 instanceof Error ? _context23.t0.message : String(_context23.t0);
|
|
2386
2616
|
this.logError('fetchBookingListFromAPI: SSE 请求失败', {
|
|
2387
2617
|
error: errorMessage
|
|
2388
2618
|
});
|
|
2389
|
-
return
|
|
2619
|
+
return _context23.abrupt("return", {
|
|
2390
2620
|
code: 500,
|
|
2391
2621
|
message: errorMessage,
|
|
2392
2622
|
data: {
|
|
@@ -2397,22 +2627,264 @@ var Server = /*#__PURE__*/function () {
|
|
|
2397
2627
|
});
|
|
2398
2628
|
case 28:
|
|
2399
2629
|
case "end":
|
|
2400
|
-
return
|
|
2630
|
+
return _context23.stop();
|
|
2401
2631
|
}
|
|
2402
|
-
},
|
|
2632
|
+
}, _callee23, this, [[3, 23]]);
|
|
2403
2633
|
}));
|
|
2404
|
-
function fetchBookingListFromAPI(
|
|
2634
|
+
function fetchBookingListFromAPI(_x25) {
|
|
2405
2635
|
return _fetchBookingListFromAPI.apply(this, arguments);
|
|
2406
2636
|
}
|
|
2407
2637
|
return fetchBookingListFromAPI;
|
|
2408
2638
|
}())
|
|
2409
2639
|
}, {
|
|
2410
|
-
key: "
|
|
2640
|
+
key: "parseOrderIdsParam",
|
|
2411
2641
|
value:
|
|
2642
|
+
/**
|
|
2643
|
+
* 解析 order_ids 入参,兼容 url query / data 字段、字符串(csv) / 数组两种形态。
|
|
2644
|
+
* 自动 trim、去空、按字符串去重,输出归一化后的字符串数组。
|
|
2645
|
+
*
|
|
2646
|
+
* @example
|
|
2647
|
+
* // url: /update/localOrder?order_ids=1,2,2,, → ['1','2']
|
|
2648
|
+
* this.parseOrderIdsParam(url, undefined)
|
|
2649
|
+
*
|
|
2650
|
+
* @example
|
|
2651
|
+
* // data: { order_ids: [1, '2', null] } → ['1','2']
|
|
2652
|
+
* this.parseOrderIdsParam('', { order_ids: [1, '2', null] })
|
|
2653
|
+
*/
|
|
2654
|
+
function parseOrderIdsParam(url, data) {
|
|
2655
|
+
var collected = [];
|
|
2656
|
+
var pushRaw = function pushRaw(raw) {
|
|
2657
|
+
if (raw === undefined || raw === null) return;
|
|
2658
|
+
if (Array.isArray(raw)) {
|
|
2659
|
+
raw.forEach(pushRaw);
|
|
2660
|
+
return;
|
|
2661
|
+
}
|
|
2662
|
+
var str = String(raw).trim();
|
|
2663
|
+
if (!str) return;
|
|
2664
|
+
// csv 兼容:单个字符串值里也允许逗号分隔
|
|
2665
|
+
str.split(',').forEach(function (piece) {
|
|
2666
|
+
var v = piece.trim();
|
|
2667
|
+
if (v) collected.push(v);
|
|
2668
|
+
});
|
|
2669
|
+
};
|
|
2670
|
+
if (data && _typeof(data) === 'object') {
|
|
2671
|
+
pushRaw(data.order_ids);
|
|
2672
|
+
}
|
|
2673
|
+
pushRaw(this.extractQueryParam(url, 'order_ids'));
|
|
2674
|
+
var seen = new Set();
|
|
2675
|
+
var result = [];
|
|
2676
|
+
for (var _i = 0, _collected = collected; _i < _collected.length; _i++) {
|
|
2677
|
+
var id = _collected[_i];
|
|
2678
|
+
if (seen.has(id)) continue;
|
|
2679
|
+
seen.add(id);
|
|
2680
|
+
result.push(id);
|
|
2681
|
+
}
|
|
2682
|
+
return result;
|
|
2683
|
+
}
|
|
2684
|
+
|
|
2685
|
+
/**
|
|
2686
|
+
* 批量代理刷新 / 合并订单到本地:并发拉详情 → 单次合并 → 单次 emit。
|
|
2687
|
+
* - 单笔失败不影响其他成功项
|
|
2688
|
+
* - 没有任何成功项时不触发 emit / 落库
|
|
2689
|
+
*
|
|
2690
|
+
* @example
|
|
2691
|
+
* await this.handleUpdateLocalOrdersBatch(['96971', '96972'])
|
|
2692
|
+
*/
|
|
2693
|
+
}, {
|
|
2694
|
+
key: "handleUpdateLocalOrdersBatch",
|
|
2695
|
+
value: (function () {
|
|
2696
|
+
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(orderIds) {
|
|
2697
|
+
var _this$app5;
|
|
2698
|
+
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 _callee24$(_context24) {
|
|
2700
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2701
|
+
case 0:
|
|
2702
|
+
this.logInfo('handleUpdateLocalOrdersBatch: 开始处理', {
|
|
2703
|
+
count: orderIds.length,
|
|
2704
|
+
orderIds: orderIds
|
|
2705
|
+
});
|
|
2706
|
+
if (this.order) {
|
|
2707
|
+
_context24.next = 4;
|
|
2708
|
+
break;
|
|
2709
|
+
}
|
|
2710
|
+
this.logError('handleUpdateLocalOrdersBatch: Order 模块未注册');
|
|
2711
|
+
return _context24.abrupt("return", {
|
|
2712
|
+
code: 500,
|
|
2713
|
+
status: false,
|
|
2714
|
+
message: 'Order 模块未注册',
|
|
2715
|
+
data: null
|
|
2716
|
+
});
|
|
2717
|
+
case 4:
|
|
2718
|
+
if ((_this$app5 = this.app) !== null && _this$app5 !== void 0 && _this$app5.request) {
|
|
2719
|
+
_context24.next = 7;
|
|
2720
|
+
break;
|
|
2721
|
+
}
|
|
2722
|
+
this.logError('handleUpdateLocalOrdersBatch: app.request 不可用');
|
|
2723
|
+
return _context24.abrupt("return", {
|
|
2724
|
+
code: 500,
|
|
2725
|
+
status: false,
|
|
2726
|
+
message: 'app.request 不可用',
|
|
2727
|
+
data: null
|
|
2728
|
+
});
|
|
2729
|
+
case 7:
|
|
2730
|
+
// 拉取前先记录"本地是否已存在",用于区分 overwritten / inserted
|
|
2731
|
+
existedBefore = new Map();
|
|
2732
|
+
_iterator11 = _createForOfIteratorHelper(orderIds);
|
|
2733
|
+
try {
|
|
2734
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
2735
|
+
id = _step11.value;
|
|
2736
|
+
existedBefore.set(id, !!this.order.getOrderByOrderId(id));
|
|
2737
|
+
}
|
|
2738
|
+
|
|
2739
|
+
// 走 orderDataSource 的批量 HTTP 通道,一次请求拉回多笔详情
|
|
2740
|
+
} catch (err) {
|
|
2741
|
+
_iterator11.e(err);
|
|
2742
|
+
} finally {
|
|
2743
|
+
_iterator11.f();
|
|
2744
|
+
}
|
|
2745
|
+
fetched = [];
|
|
2746
|
+
_context24.prev = 11;
|
|
2747
|
+
_context24.next = 14;
|
|
2748
|
+
return this.order.fetchOrdersByHttp(orderIds);
|
|
2749
|
+
case 14:
|
|
2750
|
+
fetched = _context24.sent;
|
|
2751
|
+
_context24.next = 22;
|
|
2752
|
+
break;
|
|
2753
|
+
case 17:
|
|
2754
|
+
_context24.prev = 17;
|
|
2755
|
+
_context24.t0 = _context24["catch"](11);
|
|
2756
|
+
message = _context24.t0 instanceof Error ? _context24.t0.message : String(_context24.t0);
|
|
2757
|
+
this.logError('handleUpdateLocalOrdersBatch: 批量拉取失败', {
|
|
2758
|
+
message: message
|
|
2759
|
+
});
|
|
2760
|
+
return _context24.abrupt("return", {
|
|
2761
|
+
code: 500,
|
|
2762
|
+
status: false,
|
|
2763
|
+
message: message,
|
|
2764
|
+
data: null
|
|
2765
|
+
});
|
|
2766
|
+
case 22:
|
|
2767
|
+
// 按返回结果中的 order_id 建索引,未命中即视为单笔失败
|
|
2768
|
+
fetchedMap = new Map();
|
|
2769
|
+
_iterator12 = _createForOfIteratorHelper(fetched);
|
|
2770
|
+
_context24.prev = 24;
|
|
2771
|
+
_iterator12.s();
|
|
2772
|
+
case 26:
|
|
2773
|
+
if ((_step12 = _iterator12.n()).done) {
|
|
2774
|
+
_context24.next = 34;
|
|
2775
|
+
break;
|
|
2776
|
+
}
|
|
2777
|
+
order = _step12.value;
|
|
2778
|
+
oid = order === null || order === void 0 ? void 0 : order.order_id;
|
|
2779
|
+
if (!(oid === undefined || oid === null)) {
|
|
2780
|
+
_context24.next = 31;
|
|
2781
|
+
break;
|
|
2782
|
+
}
|
|
2783
|
+
return _context24.abrupt("continue", 32);
|
|
2784
|
+
case 31:
|
|
2785
|
+
fetchedMap.set(String(oid), order);
|
|
2786
|
+
case 32:
|
|
2787
|
+
_context24.next = 26;
|
|
2788
|
+
break;
|
|
2789
|
+
case 34:
|
|
2790
|
+
_context24.next = 39;
|
|
2791
|
+
break;
|
|
2792
|
+
case 36:
|
|
2793
|
+
_context24.prev = 36;
|
|
2794
|
+
_context24.t1 = _context24["catch"](24);
|
|
2795
|
+
_iterator12.e(_context24.t1);
|
|
2796
|
+
case 39:
|
|
2797
|
+
_context24.prev = 39;
|
|
2798
|
+
_iterator12.f();
|
|
2799
|
+
return _context24.finish(39);
|
|
2800
|
+
case 42:
|
|
2801
|
+
freshOrders = [];
|
|
2802
|
+
succeedIds = [];
|
|
2803
|
+
failed = [];
|
|
2804
|
+
_iterator13 = _createForOfIteratorHelper(orderIds);
|
|
2805
|
+
try {
|
|
2806
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
2807
|
+
_id = _step13.value;
|
|
2808
|
+
fresh = fetchedMap.get(_id);
|
|
2809
|
+
if (fresh) {
|
|
2810
|
+
freshOrders.push(fresh);
|
|
2811
|
+
succeedIds.push(_id);
|
|
2812
|
+
} else {
|
|
2813
|
+
failed.push({
|
|
2814
|
+
order_id: _id,
|
|
2815
|
+
message: '后端未返回该订单详情'
|
|
2816
|
+
});
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
} catch (err) {
|
|
2820
|
+
_iterator13.e(err);
|
|
2821
|
+
} finally {
|
|
2822
|
+
_iterator13.f();
|
|
2823
|
+
}
|
|
2824
|
+
if (!(freshOrders.length > 0)) {
|
|
2825
|
+
_context24.next = 58;
|
|
2826
|
+
break;
|
|
2827
|
+
}
|
|
2828
|
+
_context24.prev = 48;
|
|
2829
|
+
_context24.next = 51;
|
|
2830
|
+
return this.order.upsertOrdersFromRemote(freshOrders);
|
|
2831
|
+
case 51:
|
|
2832
|
+
_context24.next = 58;
|
|
2833
|
+
break;
|
|
2834
|
+
case 53:
|
|
2835
|
+
_context24.prev = 53;
|
|
2836
|
+
_context24.t2 = _context24["catch"](48);
|
|
2837
|
+
_message = _context24.t2 instanceof Error ? _context24.t2.message : String(_context24.t2);
|
|
2838
|
+
this.logError('handleUpdateLocalOrdersBatch: 合并写入失败', {
|
|
2839
|
+
message: _message
|
|
2840
|
+
});
|
|
2841
|
+
return _context24.abrupt("return", {
|
|
2842
|
+
code: 500,
|
|
2843
|
+
status: false,
|
|
2844
|
+
message: _message,
|
|
2845
|
+
data: null
|
|
2846
|
+
});
|
|
2847
|
+
case 58:
|
|
2848
|
+
overwritten = succeedIds.filter(function (id) {
|
|
2849
|
+
return existedBefore.get(id);
|
|
2850
|
+
});
|
|
2851
|
+
inserted = succeedIds.filter(function (id) {
|
|
2852
|
+
return !existedBefore.get(id);
|
|
2853
|
+
});
|
|
2854
|
+
this.logInfo('handleUpdateLocalOrdersBatch: 完成', {
|
|
2855
|
+
total: orderIds.length,
|
|
2856
|
+
overwrittenCount: overwritten.length,
|
|
2857
|
+
insertedCount: inserted.length,
|
|
2858
|
+
failedCount: failed.length
|
|
2859
|
+
});
|
|
2860
|
+
return _context24.abrupt("return", {
|
|
2861
|
+
code: 200,
|
|
2862
|
+
status: true,
|
|
2863
|
+
message: '',
|
|
2864
|
+
data: {
|
|
2865
|
+
overwritten: overwritten,
|
|
2866
|
+
inserted: inserted,
|
|
2867
|
+
failed: failed
|
|
2868
|
+
}
|
|
2869
|
+
});
|
|
2870
|
+
case 62:
|
|
2871
|
+
case "end":
|
|
2872
|
+
return _context24.stop();
|
|
2873
|
+
}
|
|
2874
|
+
}, _callee24, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
|
|
2875
|
+
}));
|
|
2876
|
+
function handleUpdateLocalOrdersBatch(_x26) {
|
|
2877
|
+
return _handleUpdateLocalOrdersBatch.apply(this, arguments);
|
|
2878
|
+
}
|
|
2879
|
+
return handleUpdateLocalOrdersBatch;
|
|
2880
|
+
}()
|
|
2412
2881
|
/**
|
|
2413
2882
|
* 从 url 中解析指定 query 参数,兼容相对路径与绝对路径
|
|
2414
2883
|
*/
|
|
2415
|
-
|
|
2884
|
+
)
|
|
2885
|
+
}, {
|
|
2886
|
+
key: "extractQueryParam",
|
|
2887
|
+
value: function extractQueryParam(url, key) {
|
|
2416
2888
|
if (!url) return null;
|
|
2417
2889
|
try {
|
|
2418
2890
|
var target = url.startsWith('http') ? new URL(url) : new URL(url, 'http://placeholder.local');
|
|
@@ -2422,11 +2894,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2422
2894
|
var queryIndex = url.indexOf('?');
|
|
2423
2895
|
if (queryIndex < 0) return null;
|
|
2424
2896
|
var query = url.slice(queryIndex + 1);
|
|
2425
|
-
var
|
|
2426
|
-
|
|
2897
|
+
var _iterator14 = _createForOfIteratorHelper(query.split('&')),
|
|
2898
|
+
_step14;
|
|
2427
2899
|
try {
|
|
2428
|
-
for (
|
|
2429
|
-
var pair =
|
|
2900
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
2901
|
+
var pair = _step14.value;
|
|
2430
2902
|
if (!pair) continue;
|
|
2431
2903
|
var _pair$split = pair.split('='),
|
|
2432
2904
|
_pair$split2 = _slicedToArray(_pair$split, 2),
|
|
@@ -2442,13 +2914,33 @@ var Server = /*#__PURE__*/function () {
|
|
|
2442
2914
|
}
|
|
2443
2915
|
}
|
|
2444
2916
|
} catch (err) {
|
|
2445
|
-
|
|
2917
|
+
_iterator14.e(err);
|
|
2446
2918
|
} finally {
|
|
2447
|
-
|
|
2919
|
+
_iterator14.f();
|
|
2448
2920
|
}
|
|
2449
2921
|
return null;
|
|
2450
2922
|
}
|
|
2451
2923
|
}
|
|
2924
|
+
}, {
|
|
2925
|
+
key: "extractOrderSalesDetailId",
|
|
2926
|
+
value: function extractOrderSalesDetailId(url) {
|
|
2927
|
+
var path = this.parseRequestPath(url);
|
|
2928
|
+
var match = path.match(/^\/shop\/order\/sales\/([^/?#]+)$/);
|
|
2929
|
+
return match !== null && match !== void 0 && match[1] ? decodeURIComponent(match[1]) : null;
|
|
2930
|
+
}
|
|
2931
|
+
}, {
|
|
2932
|
+
key: "buildOrderSalesDetailBackendPath",
|
|
2933
|
+
value: function buildOrderSalesDetailBackendPath(orderId, data) {
|
|
2934
|
+
var rawWith = data && _typeof(data) === 'object' ? data.with : undefined;
|
|
2935
|
+
var withFields = Array.isArray(rawWith) && rawWith.length > 0 ? rawWith : ['products', 'scheduleEvents'];
|
|
2936
|
+
var searchParams = new URLSearchParams();
|
|
2937
|
+
withFields.forEach(function (field) {
|
|
2938
|
+
if (field === undefined || field === null || field === '') return;
|
|
2939
|
+
searchParams.append('with[]', String(field));
|
|
2940
|
+
});
|
|
2941
|
+
var query = searchParams.toString();
|
|
2942
|
+
return "/shop/order/sales/".concat(encodeURIComponent(orderId)).concat(query ? "?".concat(query) : '');
|
|
2943
|
+
}
|
|
2452
2944
|
|
|
2453
2945
|
/**
|
|
2454
2946
|
* 从 url 或路由 path 解析 pathname(不含 query,去掉末尾 /)
|
|
@@ -2559,24 +3051,24 @@ var Server = /*#__PURE__*/function () {
|
|
|
2559
3051
|
}, {
|
|
2560
3052
|
key: "recomputeAndNotifyFloorPlanQuery",
|
|
2561
3053
|
value: (function () {
|
|
2562
|
-
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2563
|
-
var
|
|
2564
|
-
return _regeneratorRuntime().wrap(function
|
|
2565
|
-
while (1) switch (
|
|
3054
|
+
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
3055
|
+
var _iterator15, _step15, _step15$value, subscriberId, sub, result, errorMessage;
|
|
3056
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
3057
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2566
3058
|
case 0:
|
|
2567
3059
|
if (!(this.floorPlanQuerySubscribers.size === 0)) {
|
|
2568
|
-
|
|
3060
|
+
_context25.next = 2;
|
|
2569
3061
|
break;
|
|
2570
3062
|
}
|
|
2571
|
-
return
|
|
3063
|
+
return _context25.abrupt("return");
|
|
2572
3064
|
case 2:
|
|
2573
3065
|
this.logInfo('recomputeAndNotifyFloorPlanQuery: 开始推送', {
|
|
2574
3066
|
subscriberCount: this.floorPlanQuerySubscribers.size
|
|
2575
3067
|
});
|
|
2576
|
-
|
|
3068
|
+
_iterator15 = _createForOfIteratorHelper(this.floorPlanQuerySubscribers.entries());
|
|
2577
3069
|
try {
|
|
2578
|
-
for (
|
|
2579
|
-
|
|
3070
|
+
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
|
3071
|
+
_step15$value = _slicedToArray(_step15.value, 2), subscriberId = _step15$value[0], sub = _step15$value[1];
|
|
2580
3072
|
try {
|
|
2581
3073
|
result = this.computeFloorPlanQueryResult(sub.context);
|
|
2582
3074
|
sub.callback(result);
|
|
@@ -2592,15 +3084,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
2592
3084
|
}
|
|
2593
3085
|
}
|
|
2594
3086
|
} catch (err) {
|
|
2595
|
-
|
|
3087
|
+
_iterator15.e(err);
|
|
2596
3088
|
} finally {
|
|
2597
|
-
|
|
3089
|
+
_iterator15.f();
|
|
2598
3090
|
}
|
|
2599
3091
|
case 5:
|
|
2600
3092
|
case "end":
|
|
2601
|
-
return
|
|
3093
|
+
return _context25.stop();
|
|
2602
3094
|
}
|
|
2603
|
-
},
|
|
3095
|
+
}, _callee25, this);
|
|
2604
3096
|
}));
|
|
2605
3097
|
function recomputeAndNotifyFloorPlanQuery() {
|
|
2606
3098
|
return _recomputeAndNotifyFloorPlanQuery.apply(this, arguments);
|
|
@@ -2630,21 +3122,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
2630
3122
|
* filter 逻辑暂为 mock,仅记录参数
|
|
2631
3123
|
*/
|
|
2632
3124
|
function () {
|
|
2633
|
-
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3125
|
+
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(data) {
|
|
2634
3126
|
var rawList, result;
|
|
2635
|
-
return _regeneratorRuntime().wrap(function
|
|
2636
|
-
while (1) switch (
|
|
3127
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
3128
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2637
3129
|
case 0:
|
|
2638
3130
|
this.logInfo('computeOrderQueryResult: 开始过滤', {
|
|
2639
3131
|
data: data
|
|
2640
3132
|
});
|
|
2641
3133
|
console.log('[Server] computeOrderQueryResult', data);
|
|
2642
3134
|
if (this.order) {
|
|
2643
|
-
|
|
3135
|
+
_context26.next = 5;
|
|
2644
3136
|
break;
|
|
2645
3137
|
}
|
|
2646
3138
|
this.logError('computeOrderQueryResult: Order 模块未注册');
|
|
2647
|
-
return
|
|
3139
|
+
return _context26.abrupt("return", {
|
|
2648
3140
|
code: 500,
|
|
2649
3141
|
message: 'Order 模块未注册',
|
|
2650
3142
|
data: {
|
|
@@ -2668,7 +3160,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2668
3160
|
skip: result.skip,
|
|
2669
3161
|
rejected: result.rejected
|
|
2670
3162
|
});
|
|
2671
|
-
return
|
|
3163
|
+
return _context26.abrupt("return", {
|
|
2672
3164
|
code: 200,
|
|
2673
3165
|
data: result,
|
|
2674
3166
|
message: '',
|
|
@@ -2676,11 +3168,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2676
3168
|
});
|
|
2677
3169
|
case 10:
|
|
2678
3170
|
case "end":
|
|
2679
|
-
return
|
|
3171
|
+
return _context26.stop();
|
|
2680
3172
|
}
|
|
2681
|
-
},
|
|
3173
|
+
}, _callee26, this);
|
|
2682
3174
|
}));
|
|
2683
|
-
function computeOrderQueryResult(
|
|
3175
|
+
function computeOrderQueryResult(_x27) {
|
|
2684
3176
|
return _computeOrderQueryResult.apply(this, arguments);
|
|
2685
3177
|
}
|
|
2686
3178
|
return computeOrderQueryResult;
|
|
@@ -2693,17 +3185,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
2693
3185
|
}, {
|
|
2694
3186
|
key: "computeBookingQueryResult",
|
|
2695
3187
|
value: (function () {
|
|
2696
|
-
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3188
|
+
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(data) {
|
|
2697
3189
|
var rawOrders, result;
|
|
2698
|
-
return _regeneratorRuntime().wrap(function
|
|
2699
|
-
while (1) switch (
|
|
3190
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
3191
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2700
3192
|
case 0:
|
|
2701
3193
|
if (this.order) {
|
|
2702
|
-
|
|
3194
|
+
_context27.next = 3;
|
|
2703
3195
|
break;
|
|
2704
3196
|
}
|
|
2705
3197
|
this.logError('computeBookingQueryResult: Order 模块未注册');
|
|
2706
|
-
return
|
|
3198
|
+
return _context27.abrupt("return", {
|
|
2707
3199
|
code: 500,
|
|
2708
3200
|
message: 'Order 模块未注册',
|
|
2709
3201
|
data: {
|
|
@@ -2722,7 +3214,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2722
3214
|
size: result.size,
|
|
2723
3215
|
skip: result.skip
|
|
2724
3216
|
});
|
|
2725
|
-
return
|
|
3217
|
+
return _context27.abrupt("return", {
|
|
2726
3218
|
code: 200,
|
|
2727
3219
|
data: result,
|
|
2728
3220
|
message: '',
|
|
@@ -2730,11 +3222,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2730
3222
|
});
|
|
2731
3223
|
case 8:
|
|
2732
3224
|
case "end":
|
|
2733
|
-
return
|
|
3225
|
+
return _context27.stop();
|
|
2734
3226
|
}
|
|
2735
|
-
},
|
|
3227
|
+
}, _callee27, this);
|
|
2736
3228
|
}));
|
|
2737
|
-
function computeBookingQueryResult(
|
|
3229
|
+
function computeBookingQueryResult(_x28) {
|
|
2738
3230
|
return _computeBookingQueryResult.apply(this, arguments);
|
|
2739
3231
|
}
|
|
2740
3232
|
return computeBookingQueryResult;
|
|
@@ -2750,28 +3242,29 @@ var Server = /*#__PURE__*/function () {
|
|
|
2750
3242
|
}, {
|
|
2751
3243
|
key: "computeProductQueryResult",
|
|
2752
3244
|
value: (function () {
|
|
2753
|
-
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3245
|
+
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(context, options) {
|
|
2754
3246
|
var _menu_list_ids$length3,
|
|
2755
3247
|
_this6 = this;
|
|
2756
|
-
var tTotal, menu_list_ids, schedule_date, schedule_datetime, product_id, _published$find, pid, _tPrice, _allProductsWithPrice, published, item, activeMenuList, tMenu, menuList, tPrice, allProductsWithPrice, tFilter, filteredProducts, tStatus, beforeStatusCount, tSort;
|
|
2757
|
-
return _regeneratorRuntime().wrap(function
|
|
2758
|
-
while (1) switch (
|
|
3248
|
+
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 _callee28$(_context28) {
|
|
3250
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2759
3251
|
case 0:
|
|
2760
3252
|
tTotal = performance.now();
|
|
2761
|
-
menu_list_ids = context.menu_list_ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime, product_id = context.product_id;
|
|
3253
|
+
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;
|
|
2762
3254
|
this.logInfo('computeProductQueryResult 开始', {
|
|
2763
3255
|
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,
|
|
2764
3256
|
schedule_datetime: schedule_datetime,
|
|
2765
3257
|
schedule_date: schedule_date,
|
|
3258
|
+
customer_id: customer_id,
|
|
2766
3259
|
product_id: product_id,
|
|
2767
3260
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
2768
3261
|
});
|
|
2769
3262
|
if (this.products) {
|
|
2770
|
-
|
|
3263
|
+
_context28.next = 6;
|
|
2771
3264
|
break;
|
|
2772
3265
|
}
|
|
2773
3266
|
this.logError('computeProductQueryResult: Products 模块未注册');
|
|
2774
|
-
return
|
|
3267
|
+
return _context28.abrupt("return", {
|
|
2775
3268
|
message: 'Products 模块未注册',
|
|
2776
3269
|
data: {
|
|
2777
3270
|
list: [],
|
|
@@ -2780,19 +3273,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
2780
3273
|
});
|
|
2781
3274
|
case 6:
|
|
2782
3275
|
if (!(product_id != null && Number.isFinite(Number(product_id)))) {
|
|
2783
|
-
|
|
3276
|
+
_context28.next = 18;
|
|
2784
3277
|
break;
|
|
2785
3278
|
}
|
|
2786
3279
|
pid = Number(product_id);
|
|
2787
3280
|
_tPrice = performance.now();
|
|
2788
|
-
|
|
3281
|
+
_context28.next = 11;
|
|
2789
3282
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
2790
3283
|
scheduleModule: this.getSchedule()
|
|
2791
3284
|
}, {
|
|
2792
3285
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
2793
3286
|
});
|
|
2794
3287
|
case 11:
|
|
2795
|
-
_allProductsWithPrice =
|
|
3288
|
+
_allProductsWithPrice = _context28.sent;
|
|
2796
3289
|
perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice, {
|
|
2797
3290
|
count: _allProductsWithPrice.length,
|
|
2798
3291
|
productId: pid
|
|
@@ -2812,7 +3305,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2812
3305
|
productId: pid,
|
|
2813
3306
|
found: !!item
|
|
2814
3307
|
});
|
|
2815
|
-
return
|
|
3308
|
+
return _context28.abrupt("return", {
|
|
2816
3309
|
code: 200,
|
|
2817
3310
|
data: item,
|
|
2818
3311
|
message: item ? '' : '商品不存在或未发布',
|
|
@@ -2820,11 +3313,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2820
3313
|
});
|
|
2821
3314
|
case 18:
|
|
2822
3315
|
if (this.menu) {
|
|
2823
|
-
|
|
3316
|
+
_context28.next = 21;
|
|
2824
3317
|
break;
|
|
2825
3318
|
}
|
|
2826
3319
|
this.logError('computeProductQueryResult: Menu 模块未注册');
|
|
2827
|
-
return
|
|
3320
|
+
return _context28.abrupt("return", {
|
|
2828
3321
|
message: 'Menu 模块未注册',
|
|
2829
3322
|
data: {
|
|
2830
3323
|
list: [],
|
|
@@ -2833,11 +3326,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2833
3326
|
});
|
|
2834
3327
|
case 21:
|
|
2835
3328
|
if (this.schedule) {
|
|
2836
|
-
|
|
3329
|
+
_context28.next = 24;
|
|
2837
3330
|
break;
|
|
2838
3331
|
}
|
|
2839
3332
|
this.logError('computeProductQueryResult: Schedule 模块未注册');
|
|
2840
|
-
return
|
|
3333
|
+
return _context28.abrupt("return", {
|
|
2841
3334
|
message: 'Schedule 模块未注册',
|
|
2842
3335
|
data: {
|
|
2843
3336
|
list: [],
|
|
@@ -2859,14 +3352,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
2859
3352
|
});
|
|
2860
3353
|
}
|
|
2861
3354
|
tPrice = performance.now();
|
|
2862
|
-
|
|
3355
|
+
_context28.next = 29;
|
|
2863
3356
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
2864
|
-
scheduleModule: this.getSchedule()
|
|
3357
|
+
scheduleModule: this.getSchedule(),
|
|
3358
|
+
schedule_datetime: schedule_datetime,
|
|
3359
|
+
customer_id: customer_id
|
|
2865
3360
|
}, {
|
|
2866
3361
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
2867
3362
|
});
|
|
2868
3363
|
case 29:
|
|
2869
|
-
allProductsWithPrice =
|
|
3364
|
+
allProductsWithPrice = _context28.sent;
|
|
2870
3365
|
perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
|
|
2871
3366
|
count: allProductsWithPrice.length
|
|
2872
3367
|
});
|
|
@@ -2904,7 +3399,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2904
3399
|
filteredCount: filteredProducts.length,
|
|
2905
3400
|
activeMenuCount: activeMenuList.length
|
|
2906
3401
|
});
|
|
2907
|
-
return
|
|
3402
|
+
return _context28.abrupt("return", {
|
|
2908
3403
|
code: 200,
|
|
2909
3404
|
data: {
|
|
2910
3405
|
list: filteredProducts,
|
|
@@ -2915,11 +3410,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2915
3410
|
});
|
|
2916
3411
|
case 44:
|
|
2917
3412
|
case "end":
|
|
2918
|
-
return
|
|
3413
|
+
return _context28.stop();
|
|
2919
3414
|
}
|
|
2920
|
-
},
|
|
3415
|
+
}, _callee28, this);
|
|
2921
3416
|
}));
|
|
2922
|
-
function computeProductQueryResult(
|
|
3417
|
+
function computeProductQueryResult(_x29, _x30) {
|
|
2923
3418
|
return _computeProductQueryResult.apply(this, arguments);
|
|
2924
3419
|
}
|
|
2925
3420
|
return computeProductQueryResult;
|
|
@@ -2934,72 +3429,72 @@ var Server = /*#__PURE__*/function () {
|
|
|
2934
3429
|
}, {
|
|
2935
3430
|
key: "recomputeAndNotifyProductQuery",
|
|
2936
3431
|
value: (function () {
|
|
2937
|
-
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2938
|
-
var
|
|
2939
|
-
return _regeneratorRuntime().wrap(function
|
|
2940
|
-
while (1) switch (
|
|
3432
|
+
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(options) {
|
|
3433
|
+
var _iterator16, _step16, _step16$value, subscriberId, subscriber, result, errorMessage;
|
|
3434
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3435
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2941
3436
|
case 0:
|
|
2942
3437
|
if (!(this.productQuerySubscribers.size === 0)) {
|
|
2943
|
-
|
|
3438
|
+
_context29.next = 2;
|
|
2944
3439
|
break;
|
|
2945
3440
|
}
|
|
2946
|
-
return
|
|
3441
|
+
return _context29.abrupt("return");
|
|
2947
3442
|
case 2:
|
|
2948
3443
|
this.logInfo('recomputeAndNotifyProductQuery: 开始推送', {
|
|
2949
3444
|
subscriberCount: this.productQuerySubscribers.size,
|
|
2950
3445
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
2951
3446
|
});
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
3447
|
+
_iterator16 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
|
|
3448
|
+
_context29.prev = 4;
|
|
3449
|
+
_iterator16.s();
|
|
2955
3450
|
case 6:
|
|
2956
|
-
if ((
|
|
2957
|
-
|
|
3451
|
+
if ((_step16 = _iterator16.n()).done) {
|
|
3452
|
+
_context29.next = 22;
|
|
2958
3453
|
break;
|
|
2959
3454
|
}
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
3455
|
+
_step16$value = _slicedToArray(_step16.value, 2), subscriberId = _step16$value[0], subscriber = _step16$value[1];
|
|
3456
|
+
_context29.prev = 8;
|
|
3457
|
+
_context29.next = 11;
|
|
2963
3458
|
return this.computeProductQueryResult(subscriber.context, {
|
|
2964
3459
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
2965
3460
|
});
|
|
2966
3461
|
case 11:
|
|
2967
|
-
result =
|
|
3462
|
+
result = _context29.sent;
|
|
2968
3463
|
subscriber.callback(result);
|
|
2969
3464
|
this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
|
|
2970
3465
|
subscriberId: subscriberId
|
|
2971
3466
|
});
|
|
2972
|
-
|
|
3467
|
+
_context29.next = 20;
|
|
2973
3468
|
break;
|
|
2974
3469
|
case 16:
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
errorMessage =
|
|
3470
|
+
_context29.prev = 16;
|
|
3471
|
+
_context29.t0 = _context29["catch"](8);
|
|
3472
|
+
errorMessage = _context29.t0 instanceof Error ? _context29.t0.message : String(_context29.t0);
|
|
2978
3473
|
this.logError('recomputeAndNotifyProductQuery: 推送失败', {
|
|
2979
3474
|
subscriberId: subscriberId,
|
|
2980
3475
|
error: errorMessage
|
|
2981
3476
|
});
|
|
2982
3477
|
case 20:
|
|
2983
|
-
|
|
3478
|
+
_context29.next = 6;
|
|
2984
3479
|
break;
|
|
2985
3480
|
case 22:
|
|
2986
|
-
|
|
3481
|
+
_context29.next = 27;
|
|
2987
3482
|
break;
|
|
2988
3483
|
case 24:
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
3484
|
+
_context29.prev = 24;
|
|
3485
|
+
_context29.t1 = _context29["catch"](4);
|
|
3486
|
+
_iterator16.e(_context29.t1);
|
|
2992
3487
|
case 27:
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
return
|
|
3488
|
+
_context29.prev = 27;
|
|
3489
|
+
_iterator16.f();
|
|
3490
|
+
return _context29.finish(27);
|
|
2996
3491
|
case 30:
|
|
2997
3492
|
case "end":
|
|
2998
|
-
return
|
|
3493
|
+
return _context29.stop();
|
|
2999
3494
|
}
|
|
3000
|
-
},
|
|
3495
|
+
}, _callee29, this, [[4, 24, 27, 30], [8, 16]]);
|
|
3001
3496
|
}));
|
|
3002
|
-
function recomputeAndNotifyProductQuery(
|
|
3497
|
+
function recomputeAndNotifyProductQuery(_x31) {
|
|
3003
3498
|
return _recomputeAndNotifyProductQuery.apply(this, arguments);
|
|
3004
3499
|
}
|
|
3005
3500
|
return recomputeAndNotifyProductQuery;
|
|
@@ -3011,37 +3506,37 @@ var Server = /*#__PURE__*/function () {
|
|
|
3011
3506
|
}, {
|
|
3012
3507
|
key: "recomputeAndNotifyOrderQuery",
|
|
3013
3508
|
value: (function () {
|
|
3014
|
-
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3015
|
-
var notifyStartAt,
|
|
3016
|
-
return _regeneratorRuntime().wrap(function
|
|
3017
|
-
while (1) switch (
|
|
3509
|
+
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
3510
|
+
var notifyStartAt, _iterator17, _step17, _step17$value, subscriberId, subscriber, computeStartAt, result, computeEndAt, callbackStartAt, callbackEndAt, errorMessage, notifyEndAt;
|
|
3511
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3512
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3018
3513
|
case 0:
|
|
3019
3514
|
if (!(this.orderQuerySubscribers.size === 0)) {
|
|
3020
|
-
|
|
3515
|
+
_context30.next = 2;
|
|
3021
3516
|
break;
|
|
3022
3517
|
}
|
|
3023
|
-
return
|
|
3518
|
+
return _context30.abrupt("return");
|
|
3024
3519
|
case 2:
|
|
3025
3520
|
notifyStartAt = Date.now();
|
|
3026
3521
|
this.logInfo('recomputeAndNotifyOrderQuery: 开始推送', {
|
|
3027
3522
|
subscriberCount: this.orderQuerySubscribers.size,
|
|
3028
3523
|
notifyStartAt: new Date(notifyStartAt).toISOString()
|
|
3029
3524
|
});
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3525
|
+
_iterator17 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
|
|
3526
|
+
_context30.prev = 5;
|
|
3527
|
+
_iterator17.s();
|
|
3033
3528
|
case 7:
|
|
3034
|
-
if ((
|
|
3035
|
-
|
|
3529
|
+
if ((_step17 = _iterator17.n()).done) {
|
|
3530
|
+
_context30.next = 27;
|
|
3036
3531
|
break;
|
|
3037
3532
|
}
|
|
3038
|
-
|
|
3039
|
-
|
|
3533
|
+
_step17$value = _slicedToArray(_step17.value, 2), subscriberId = _step17$value[0], subscriber = _step17$value[1];
|
|
3534
|
+
_context30.prev = 9;
|
|
3040
3535
|
computeStartAt = Date.now();
|
|
3041
|
-
|
|
3536
|
+
_context30.next = 13;
|
|
3042
3537
|
return this.computeOrderQueryResult(subscriber.context);
|
|
3043
3538
|
case 13:
|
|
3044
|
-
result =
|
|
3539
|
+
result = _context30.sent;
|
|
3045
3540
|
computeEndAt = Date.now();
|
|
3046
3541
|
callbackStartAt = Date.now();
|
|
3047
3542
|
subscriber.callback(result);
|
|
@@ -3052,30 +3547,30 @@ var Server = /*#__PURE__*/function () {
|
|
|
3052
3547
|
callbackDurationMs: callbackEndAt - callbackStartAt,
|
|
3053
3548
|
totalDurationMs: callbackEndAt - computeStartAt
|
|
3054
3549
|
});
|
|
3055
|
-
|
|
3550
|
+
_context30.next = 25;
|
|
3056
3551
|
break;
|
|
3057
3552
|
case 21:
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
errorMessage =
|
|
3553
|
+
_context30.prev = 21;
|
|
3554
|
+
_context30.t0 = _context30["catch"](9);
|
|
3555
|
+
errorMessage = _context30.t0 instanceof Error ? _context30.t0.message : String(_context30.t0);
|
|
3061
3556
|
this.logError('recomputeAndNotifyOrderQuery: 推送失败', {
|
|
3062
3557
|
subscriberId: subscriberId,
|
|
3063
3558
|
error: errorMessage
|
|
3064
3559
|
});
|
|
3065
3560
|
case 25:
|
|
3066
|
-
|
|
3561
|
+
_context30.next = 7;
|
|
3067
3562
|
break;
|
|
3068
3563
|
case 27:
|
|
3069
|
-
|
|
3564
|
+
_context30.next = 32;
|
|
3070
3565
|
break;
|
|
3071
3566
|
case 29:
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3567
|
+
_context30.prev = 29;
|
|
3568
|
+
_context30.t1 = _context30["catch"](5);
|
|
3569
|
+
_iterator17.e(_context30.t1);
|
|
3075
3570
|
case 32:
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
return
|
|
3571
|
+
_context30.prev = 32;
|
|
3572
|
+
_iterator17.f();
|
|
3573
|
+
return _context30.finish(32);
|
|
3079
3574
|
case 35:
|
|
3080
3575
|
notifyEndAt = Date.now();
|
|
3081
3576
|
this.logInfo('recomputeAndNotifyOrderQuery: 推送完成', {
|
|
@@ -3084,9 +3579,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3084
3579
|
});
|
|
3085
3580
|
case 37:
|
|
3086
3581
|
case "end":
|
|
3087
|
-
return
|
|
3582
|
+
return _context30.stop();
|
|
3088
3583
|
}
|
|
3089
|
-
},
|
|
3584
|
+
}, _callee30, this, [[5, 29, 32, 35], [9, 21]]);
|
|
3090
3585
|
}));
|
|
3091
3586
|
function recomputeAndNotifyOrderQuery() {
|
|
3092
3587
|
return _recomputeAndNotifyOrderQuery.apply(this, arguments);
|
|
@@ -3100,67 +3595,67 @@ var Server = /*#__PURE__*/function () {
|
|
|
3100
3595
|
}, {
|
|
3101
3596
|
key: "recomputeAndNotifyBookingQuery",
|
|
3102
3597
|
value: (function () {
|
|
3103
|
-
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3104
|
-
var
|
|
3105
|
-
return _regeneratorRuntime().wrap(function
|
|
3106
|
-
while (1) switch (
|
|
3598
|
+
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
3599
|
+
var _iterator18, _step18, _step18$value, subscriberId, subscriber, result, errorMessage;
|
|
3600
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3601
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3107
3602
|
case 0:
|
|
3108
3603
|
if (!(this.bookingQuerySubscribers.size === 0)) {
|
|
3109
|
-
|
|
3604
|
+
_context31.next = 2;
|
|
3110
3605
|
break;
|
|
3111
3606
|
}
|
|
3112
|
-
return
|
|
3607
|
+
return _context31.abrupt("return");
|
|
3113
3608
|
case 2:
|
|
3114
3609
|
this.logInfo('recomputeAndNotifyBookingQuery: 开始推送', {
|
|
3115
3610
|
subscriberCount: this.bookingQuerySubscribers.size
|
|
3116
3611
|
});
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3612
|
+
_iterator18 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
|
|
3613
|
+
_context31.prev = 4;
|
|
3614
|
+
_iterator18.s();
|
|
3120
3615
|
case 6:
|
|
3121
|
-
if ((
|
|
3122
|
-
|
|
3616
|
+
if ((_step18 = _iterator18.n()).done) {
|
|
3617
|
+
_context31.next = 22;
|
|
3123
3618
|
break;
|
|
3124
3619
|
}
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3620
|
+
_step18$value = _slicedToArray(_step18.value, 2), subscriberId = _step18$value[0], subscriber = _step18$value[1];
|
|
3621
|
+
_context31.prev = 8;
|
|
3622
|
+
_context31.next = 11;
|
|
3128
3623
|
return this.computeBookingQueryResult(subscriber.context);
|
|
3129
3624
|
case 11:
|
|
3130
|
-
result =
|
|
3625
|
+
result = _context31.sent;
|
|
3131
3626
|
subscriber.callback(result);
|
|
3132
3627
|
this.logInfo('recomputeAndNotifyBookingQuery: 已推送', {
|
|
3133
3628
|
subscriberId: subscriberId
|
|
3134
3629
|
});
|
|
3135
|
-
|
|
3630
|
+
_context31.next = 20;
|
|
3136
3631
|
break;
|
|
3137
3632
|
case 16:
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
errorMessage =
|
|
3633
|
+
_context31.prev = 16;
|
|
3634
|
+
_context31.t0 = _context31["catch"](8);
|
|
3635
|
+
errorMessage = _context31.t0 instanceof Error ? _context31.t0.message : String(_context31.t0);
|
|
3141
3636
|
this.logError('recomputeAndNotifyBookingQuery: 推送失败', {
|
|
3142
3637
|
subscriberId: subscriberId,
|
|
3143
3638
|
error: errorMessage
|
|
3144
3639
|
});
|
|
3145
3640
|
case 20:
|
|
3146
|
-
|
|
3641
|
+
_context31.next = 6;
|
|
3147
3642
|
break;
|
|
3148
3643
|
case 22:
|
|
3149
|
-
|
|
3644
|
+
_context31.next = 27;
|
|
3150
3645
|
break;
|
|
3151
3646
|
case 24:
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3647
|
+
_context31.prev = 24;
|
|
3648
|
+
_context31.t1 = _context31["catch"](4);
|
|
3649
|
+
_iterator18.e(_context31.t1);
|
|
3155
3650
|
case 27:
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
return
|
|
3651
|
+
_context31.prev = 27;
|
|
3652
|
+
_iterator18.f();
|
|
3653
|
+
return _context31.finish(27);
|
|
3159
3654
|
case 30:
|
|
3160
3655
|
case "end":
|
|
3161
|
-
return
|
|
3656
|
+
return _context31.stop();
|
|
3162
3657
|
}
|
|
3163
|
-
},
|
|
3658
|
+
}, _callee31, this, [[4, 24, 27, 30], [8, 16]]);
|
|
3164
3659
|
}));
|
|
3165
3660
|
function recomputeAndNotifyBookingQuery() {
|
|
3166
3661
|
return _recomputeAndNotifyBookingQuery.apply(this, arguments);
|
|
@@ -3192,11 +3687,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3192
3687
|
var allowedProductIds = new Set();
|
|
3193
3688
|
var allowedCollectionIds = new Set();
|
|
3194
3689
|
var hasProductAll = false;
|
|
3195
|
-
var
|
|
3196
|
-
|
|
3690
|
+
var _iterator19 = _createForOfIteratorHelper(activeMenuList),
|
|
3691
|
+
_step19;
|
|
3197
3692
|
try {
|
|
3198
|
-
for (
|
|
3199
|
-
var menu =
|
|
3693
|
+
for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
|
|
3694
|
+
var menu = _step19.value;
|
|
3200
3695
|
var config = menu.partyroom_package;
|
|
3201
3696
|
if (!config) {
|
|
3202
3697
|
console.warn('[Server] 餐牌缺少 partyroom_package 配置:', menu);
|
|
@@ -3256,9 +3751,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3256
3751
|
|
|
3257
3752
|
// 如果有餐牌允许所有商品,返回所有商品
|
|
3258
3753
|
} catch (err) {
|
|
3259
|
-
|
|
3754
|
+
_iterator19.e(err);
|
|
3260
3755
|
} finally {
|
|
3261
|
-
|
|
3756
|
+
_iterator19.f();
|
|
3262
3757
|
}
|
|
3263
3758
|
if (hasProductAll) {
|
|
3264
3759
|
this.logInfo('filterProductsByMenuConfig: 返回所有商品(product_all)', {
|