@pisell/pisellos 2.2.97 → 2.2.99
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/model/strategy/adapter/walletPass/type.d.ts +2 -2
- package/dist/model/strategy/adapter/walletPass/utils.js +70 -57
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/server/index.d.ts +30 -0
- package/dist/server/index.js +660 -330
- package/dist/server/modules/floor-plan/index.d.ts +39 -0
- package/dist/server/modules/floor-plan/index.js +595 -0
- package/dist/server/modules/floor-plan/types.d.ts +43 -0
- package/dist/server/modules/floor-plan/types.js +13 -0
- package/dist/server/modules/index.d.ts +3 -0
- package/dist/server/modules/index.js +4 -0
- package/dist/server/modules/order/types.d.ts +13 -1
- package/dist/server/modules/order/types.js +2 -1
- package/dist/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/dist/server/modules/order/utils/filterBookings.js +64 -4
- package/dist/server/modules/resource/index.d.ts +0 -5
- package/dist/server/modules/resource/index.js +186 -269
- package/dist/server/types.d.ts +2 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/Sales/index.d.ts +2 -1
- package/dist/solution/Sales/index.js +23 -10
- package/dist/solution/Sales/types.d.ts +1 -1
- package/lib/model/strategy/adapter/walletPass/type.d.ts +2 -2
- package/lib/model/strategy/adapter/walletPass/utils.js +58 -51
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/server/index.d.ts +30 -0
- package/lib/server/index.js +202 -9
- package/lib/server/modules/floor-plan/index.d.ts +39 -0
- package/lib/server/modules/floor-plan/index.js +327 -0
- package/lib/server/modules/floor-plan/types.d.ts +43 -0
- package/lib/server/modules/floor-plan/types.js +34 -0
- package/lib/server/modules/index.d.ts +3 -0
- package/lib/server/modules/index.js +6 -0
- package/lib/server/modules/order/types.d.ts +13 -1
- package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/lib/server/modules/order/utils/filterBookings.js +69 -3
- package/lib/server/modules/resource/index.d.ts +0 -5
- package/lib/server/modules/resource/index.js +60 -73
- package/lib/server/types.d.ts +2 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/Sales/index.d.ts +2 -1
- package/lib/solution/Sales/index.js +11 -4
- package/lib/solution/Sales/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -23,6 +23,8 @@ import { MenuModule } from "./modules/menu";
|
|
|
23
23
|
import { QuotationModule } from "./modules/quotation";
|
|
24
24
|
import { ScheduleModuleEx } from "./modules/schedule";
|
|
25
25
|
import { ResourceModule } from "./modules/resource";
|
|
26
|
+
import { FloorPlanModule } from "./modules/floor-plan";
|
|
27
|
+
import { FloorPlanHooks } from "./modules/floor-plan/types";
|
|
26
28
|
import { extractScheduleIdsFromMenus, extractTimePointsFromSchedules } from "./utils/schedule";
|
|
27
29
|
import { ProductsHooks } from "./modules/products/types";
|
|
28
30
|
import { perfMark } from "./utils/product";
|
|
@@ -38,6 +40,8 @@ import { filterBookingsFromOrders, sortBookings } from "./modules/order/utils/fi
|
|
|
38
40
|
/** 订单列表查询订阅者 */
|
|
39
41
|
|
|
40
42
|
/** 预约列表查询订阅者 */
|
|
43
|
+
|
|
44
|
+
/** 平面图 GET 查询订阅者(列表 / id 详情 / code 详情) */
|
|
41
45
|
/**
|
|
42
46
|
* Server 类
|
|
43
47
|
* 用于注册和管理服务端模块
|
|
@@ -59,6 +63,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
59
63
|
_defineProperty(this, "schedule", void 0);
|
|
60
64
|
_defineProperty(this, "resource", void 0);
|
|
61
65
|
_defineProperty(this, "order", void 0);
|
|
66
|
+
_defineProperty(this, "floor_plan", void 0);
|
|
67
|
+
/** GET 前缀路由(最长前缀优先匹配) */
|
|
68
|
+
_defineProperty(this, "prefixRouterGet", []);
|
|
62
69
|
// 路由注册表
|
|
63
70
|
_defineProperty(this, "router", {
|
|
64
71
|
get: {},
|
|
@@ -71,6 +78,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
71
78
|
// ---- 订单 / 预约列表查询订阅者 ----
|
|
72
79
|
_defineProperty(this, "orderQuerySubscribers", new Map());
|
|
73
80
|
_defineProperty(this, "bookingQuerySubscribers", new Map());
|
|
81
|
+
_defineProperty(this, "floorPlanQuerySubscribers", new Map());
|
|
74
82
|
// 模块注册表 - 定义所有可用的模块配置
|
|
75
83
|
_defineProperty(this, "moduleRegistry", {
|
|
76
84
|
products: {
|
|
@@ -131,6 +139,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
131
139
|
map: new Map(),
|
|
132
140
|
bookings: []
|
|
133
141
|
}
|
|
142
|
+
},
|
|
143
|
+
floor_plan: {
|
|
144
|
+
name: 'floor_plan',
|
|
145
|
+
moduleClass: FloorPlanModule,
|
|
146
|
+
moduleName: 'server_floor_plan',
|
|
147
|
+
version: '1.0.0',
|
|
148
|
+
defaultStore: {
|
|
149
|
+
list: [],
|
|
150
|
+
map: new Map(),
|
|
151
|
+
codeMap: new Map()
|
|
152
|
+
}
|
|
134
153
|
}
|
|
135
154
|
});
|
|
136
155
|
/**
|
|
@@ -371,16 +390,81 @@ var Server = /*#__PURE__*/function () {
|
|
|
371
390
|
};
|
|
372
391
|
}());
|
|
373
392
|
/**
|
|
374
|
-
*
|
|
393
|
+
* GET /shop/schedule/floor-plan* 前缀路由:读本地 store;支持 subscriberId + callback 订阅更新
|
|
375
394
|
*/
|
|
376
|
-
_defineProperty(this, "
|
|
395
|
+
_defineProperty(this, "handleFloorPlanGet", /*#__PURE__*/function () {
|
|
377
396
|
var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref18) {
|
|
378
|
-
var data, _ref20, subscriberId;
|
|
397
|
+
var url, data, config, routePath, base, path, _subscriberId, _ref20, callback, subscriberId, ctx;
|
|
379
398
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
380
399
|
while (1) switch (_context7.prev = _context7.next) {
|
|
381
400
|
case 0:
|
|
382
|
-
data = _ref18.data;
|
|
383
|
-
|
|
401
|
+
url = _ref18.url, data = _ref18.data, config = _ref18.config, routePath = _ref18.path;
|
|
402
|
+
base = '/shop/schedule/floor-plan';
|
|
403
|
+
path = _this.parseRequestPath(url, routePath);
|
|
404
|
+
if (!(path === "".concat(base, "/unsubscribe"))) {
|
|
405
|
+
_context7.next = 7;
|
|
406
|
+
break;
|
|
407
|
+
}
|
|
408
|
+
_subscriberId = data === null || data === void 0 ? void 0 : data.subscriberId;
|
|
409
|
+
if (_subscriberId) {
|
|
410
|
+
_this.floorPlanQuerySubscribers.delete(_subscriberId);
|
|
411
|
+
_this.logInfo('handleFloorPlanGet: 已取消订阅', {
|
|
412
|
+
subscriberId: _subscriberId,
|
|
413
|
+
remaining: _this.floorPlanQuerySubscribers.size
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
return _context7.abrupt("return", {
|
|
417
|
+
code: 200,
|
|
418
|
+
message: 'ok',
|
|
419
|
+
status: true
|
|
420
|
+
});
|
|
421
|
+
case 7:
|
|
422
|
+
_ref20 = config || {}, callback = _ref20.callback, subscriberId = _ref20.subscriberId;
|
|
423
|
+
ctx = _this.resolveFloorPlanQueryContext(path, base);
|
|
424
|
+
if (ctx) {
|
|
425
|
+
_context7.next = 11;
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
return _context7.abrupt("return", {
|
|
429
|
+
status: false,
|
|
430
|
+
code: 404,
|
|
431
|
+
message: 'Not Found',
|
|
432
|
+
data: null
|
|
433
|
+
});
|
|
434
|
+
case 11:
|
|
435
|
+
if (subscriberId && typeof callback === 'function') {
|
|
436
|
+
_this.floorPlanQuerySubscribers.set(subscriberId, {
|
|
437
|
+
callback: callback,
|
|
438
|
+
context: ctx
|
|
439
|
+
});
|
|
440
|
+
_this.logInfo('handleFloorPlanGet: 已注册订阅者', {
|
|
441
|
+
subscriberId: subscriberId,
|
|
442
|
+
kind: ctx.kind,
|
|
443
|
+
total: _this.floorPlanQuerySubscribers.size
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
return _context7.abrupt("return", _this.computeFloorPlanQueryResult(ctx));
|
|
447
|
+
case 13:
|
|
448
|
+
case "end":
|
|
449
|
+
return _context7.stop();
|
|
450
|
+
}
|
|
451
|
+
}, _callee7);
|
|
452
|
+
}));
|
|
453
|
+
return function (_x7) {
|
|
454
|
+
return _ref19.apply(this, arguments);
|
|
455
|
+
};
|
|
456
|
+
}());
|
|
457
|
+
/**
|
|
458
|
+
* 取消预约列表查询订阅(HTTP 路由入口)
|
|
459
|
+
*/
|
|
460
|
+
_defineProperty(this, "handleUnsubscribeBookingQuery", /*#__PURE__*/function () {
|
|
461
|
+
var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref21) {
|
|
462
|
+
var data, _ref23, subscriberId;
|
|
463
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
464
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
465
|
+
case 0:
|
|
466
|
+
data = _ref21.data;
|
|
467
|
+
_ref23 = data || {}, subscriberId = _ref23.subscriberId;
|
|
384
468
|
if (subscriberId) {
|
|
385
469
|
_this.bookingQuerySubscribers.delete(subscriberId);
|
|
386
470
|
_this.logInfo('handleUnsubscribeBookingQuery: 已移除订阅者', {
|
|
@@ -388,19 +472,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
388
472
|
remaining: _this.bookingQuerySubscribers.size
|
|
389
473
|
});
|
|
390
474
|
}
|
|
391
|
-
return
|
|
475
|
+
return _context8.abrupt("return", {
|
|
392
476
|
code: 200,
|
|
393
477
|
message: 'ok',
|
|
394
478
|
status: true
|
|
395
479
|
});
|
|
396
480
|
case 4:
|
|
397
481
|
case "end":
|
|
398
|
-
return
|
|
482
|
+
return _context8.stop();
|
|
399
483
|
}
|
|
400
|
-
},
|
|
484
|
+
}, _callee8);
|
|
401
485
|
}));
|
|
402
|
-
return function (
|
|
403
|
-
return
|
|
486
|
+
return function (_x8) {
|
|
487
|
+
return _ref22.apply(this, arguments);
|
|
404
488
|
};
|
|
405
489
|
}());
|
|
406
490
|
/**
|
|
@@ -408,13 +492,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
408
492
|
* 通过餐牌ID列表获取所有相关日程的时间段点
|
|
409
493
|
*/
|
|
410
494
|
_defineProperty(this, "handleGetScheduleTimePoints", /*#__PURE__*/function () {
|
|
411
|
-
var
|
|
495
|
+
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref24) {
|
|
412
496
|
var _menu_list_ids$length;
|
|
413
497
|
var url, method, data, config, menu_list_ids, _menu_list_ids$length2, menuList, scheduleIds, scheduleList, timePoints, errorMessage;
|
|
414
|
-
return _regeneratorRuntime().wrap(function
|
|
415
|
-
while (1) switch (
|
|
498
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
499
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
416
500
|
case 0:
|
|
417
|
-
url =
|
|
501
|
+
url = _ref24.url, method = _ref24.method, data = _ref24.data, config = _ref24.config;
|
|
418
502
|
console.log('[Server] handleGetScheduleTimePoints:', url, method, data, config);
|
|
419
503
|
menu_list_ids = data.menu_list_ids;
|
|
420
504
|
_this.logInfo('handleGetScheduleTimePoints 开始处理', {
|
|
@@ -424,12 +508,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
424
508
|
|
|
425
509
|
// 检查必要的模块是否已注册
|
|
426
510
|
if (_this.menu) {
|
|
427
|
-
|
|
511
|
+
_context9.next = 8;
|
|
428
512
|
break;
|
|
429
513
|
}
|
|
430
514
|
console.error('[Server] Menu 模块未注册');
|
|
431
515
|
_this.logError('handleGetScheduleTimePoints: Menu 模块未注册');
|
|
432
|
-
return
|
|
516
|
+
return _context9.abrupt("return", {
|
|
433
517
|
code: 500,
|
|
434
518
|
message: 'Menu 模块未注册',
|
|
435
519
|
data: [],
|
|
@@ -437,12 +521,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
437
521
|
});
|
|
438
522
|
case 8:
|
|
439
523
|
if (_this.schedule) {
|
|
440
|
-
|
|
524
|
+
_context9.next = 12;
|
|
441
525
|
break;
|
|
442
526
|
}
|
|
443
527
|
console.error('[Server] Schedule 模块未注册');
|
|
444
528
|
_this.logError('handleGetScheduleTimePoints: Schedule 模块未注册');
|
|
445
|
-
return
|
|
529
|
+
return _context9.abrupt("return", {
|
|
446
530
|
code: 500,
|
|
447
531
|
message: 'Schedule 模块未注册',
|
|
448
532
|
data: [],
|
|
@@ -450,7 +534,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
450
534
|
});
|
|
451
535
|
case 12:
|
|
452
536
|
if (!(!menu_list_ids || !Array.isArray(menu_list_ids) || menu_list_ids.length === 0)) {
|
|
453
|
-
|
|
537
|
+
_context9.next = 16;
|
|
454
538
|
break;
|
|
455
539
|
}
|
|
456
540
|
console.error('[Server] menu_list_ids 参数无效');
|
|
@@ -458,14 +542,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
458
542
|
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,
|
|
459
543
|
menu_list_ids: menu_list_ids
|
|
460
544
|
});
|
|
461
|
-
return
|
|
545
|
+
return _context9.abrupt("return", {
|
|
462
546
|
code: 400,
|
|
463
547
|
message: 'menu_list_ids 参数无效',
|
|
464
548
|
data: [],
|
|
465
549
|
status: false
|
|
466
550
|
});
|
|
467
551
|
case 16:
|
|
468
|
-
|
|
552
|
+
_context9.prev = 16;
|
|
469
553
|
// 1. 获取餐牌列表
|
|
470
554
|
menuList = _this.menu.getMenuByIds(menu_list_ids);
|
|
471
555
|
console.log("[Server] \u627E\u5230 ".concat(menuList.length, " \u4E2A\u9910\u724C"));
|
|
@@ -483,13 +567,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
483
567
|
scheduleCount: scheduleIds.length
|
|
484
568
|
});
|
|
485
569
|
if (!(scheduleIds.length === 0)) {
|
|
486
|
-
|
|
570
|
+
_context9.next = 26;
|
|
487
571
|
break;
|
|
488
572
|
}
|
|
489
573
|
_this.logInfo('handleGetScheduleTimePoints: 没有找到相关日程', {
|
|
490
574
|
menuListIdsCount: menu_list_ids.length
|
|
491
575
|
});
|
|
492
|
-
return
|
|
576
|
+
return _context9.abrupt("return", {
|
|
493
577
|
code: 200,
|
|
494
578
|
message: '没有找到相关日程',
|
|
495
579
|
data: [],
|
|
@@ -513,22 +597,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
513
597
|
scheduleCount: scheduleList.length,
|
|
514
598
|
timePointCount: timePoints.length
|
|
515
599
|
});
|
|
516
|
-
return
|
|
600
|
+
return _context9.abrupt("return", {
|
|
517
601
|
code: 200,
|
|
518
602
|
message: '获取成功',
|
|
519
603
|
data: timePoints,
|
|
520
604
|
status: true
|
|
521
605
|
});
|
|
522
606
|
case 35:
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
errorMessage =
|
|
526
|
-
console.error('[Server] 获取日程时间点失败:',
|
|
607
|
+
_context9.prev = 35;
|
|
608
|
+
_context9.t0 = _context9["catch"](16);
|
|
609
|
+
errorMessage = _context9.t0 instanceof Error ? _context9.t0.message : '未知错误';
|
|
610
|
+
console.error('[Server] 获取日程时间点失败:', _context9.t0);
|
|
527
611
|
_this.logError('handleGetScheduleTimePoints: 获取日程时间点失败', {
|
|
528
612
|
menuListIdsCount: menu_list_ids.length,
|
|
529
613
|
error: errorMessage
|
|
530
614
|
});
|
|
531
|
-
return
|
|
615
|
+
return _context9.abrupt("return", {
|
|
532
616
|
code: 500,
|
|
533
617
|
message: "\u83B7\u53D6\u5931\u8D25: ".concat(errorMessage),
|
|
534
618
|
data: [],
|
|
@@ -536,12 +620,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
536
620
|
});
|
|
537
621
|
case 41:
|
|
538
622
|
case "end":
|
|
539
|
-
return
|
|
623
|
+
return _context9.stop();
|
|
540
624
|
}
|
|
541
|
-
},
|
|
625
|
+
}, _callee9, null, [[16, 35]]);
|
|
542
626
|
}));
|
|
543
|
-
return function (
|
|
544
|
-
return
|
|
627
|
+
return function (_x9) {
|
|
628
|
+
return _ref25.apply(this, arguments);
|
|
545
629
|
};
|
|
546
630
|
}());
|
|
547
631
|
this.core = core;
|
|
@@ -593,6 +677,42 @@ var Server = /*#__PURE__*/function () {
|
|
|
593
677
|
});
|
|
594
678
|
}
|
|
595
679
|
|
|
680
|
+
/**
|
|
681
|
+
* 注册前缀路由(仅 GET)。匹配规则:path === prefix 或 path 以 prefix + '/' 开头;最长前缀优先。
|
|
682
|
+
*/
|
|
683
|
+
}, {
|
|
684
|
+
key: "registerPrefixRoutes",
|
|
685
|
+
value: function registerPrefixRoutes(routes) {
|
|
686
|
+
var _iterator = _createForOfIteratorHelper(routes),
|
|
687
|
+
_step;
|
|
688
|
+
try {
|
|
689
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
690
|
+
var r = _step.value;
|
|
691
|
+
if (r.method !== 'get') {
|
|
692
|
+
this.logWarning('registerPrefixRoutes: 当前仅支持 GET', {
|
|
693
|
+
method: r.method,
|
|
694
|
+
prefix: r.prefix
|
|
695
|
+
});
|
|
696
|
+
continue;
|
|
697
|
+
}
|
|
698
|
+
this.prefixRouterGet.push({
|
|
699
|
+
prefix: r.prefix,
|
|
700
|
+
handler: r.handler
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
} catch (err) {
|
|
704
|
+
_iterator.e(err);
|
|
705
|
+
} finally {
|
|
706
|
+
_iterator.f();
|
|
707
|
+
}
|
|
708
|
+
this.prefixRouterGet.sort(function (a, b) {
|
|
709
|
+
return b.prefix.length - a.prefix.length;
|
|
710
|
+
});
|
|
711
|
+
this.logInfo('前缀 GET 路由已更新', {
|
|
712
|
+
count: this.prefixRouterGet.length
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
|
|
596
716
|
/**
|
|
597
717
|
* 注册单个模块并自动注册其路由
|
|
598
718
|
* @param module 模块实例
|
|
@@ -602,10 +722,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
602
722
|
}, {
|
|
603
723
|
key: "registerModuleWithRoutes",
|
|
604
724
|
value: (function () {
|
|
605
|
-
var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
725
|
+
var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(module, options, moduleName) {
|
|
606
726
|
var routes;
|
|
607
|
-
return _regeneratorRuntime().wrap(function
|
|
608
|
-
while (1) switch (
|
|
727
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
728
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
609
729
|
case 0:
|
|
610
730
|
this.logInfo("\u5F00\u59CB\u6CE8\u518C\u6A21\u5757: ".concat(moduleName), {
|
|
611
731
|
moduleName: moduleName,
|
|
@@ -613,7 +733,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
613
733
|
});
|
|
614
734
|
|
|
615
735
|
// 注册模块到 Core
|
|
616
|
-
|
|
736
|
+
_context10.next = 3;
|
|
617
737
|
return this.core.registerModule(module, options);
|
|
618
738
|
case 3:
|
|
619
739
|
console.log("[Server] \u2705 ".concat(moduleName, " \u6A21\u5757\u5DF2\u6CE8\u518C"));
|
|
@@ -634,11 +754,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
634
754
|
}
|
|
635
755
|
case 6:
|
|
636
756
|
case "end":
|
|
637
|
-
return
|
|
757
|
+
return _context10.stop();
|
|
638
758
|
}
|
|
639
|
-
},
|
|
759
|
+
}, _callee10, this);
|
|
640
760
|
}));
|
|
641
|
-
function registerModuleWithRoutes(
|
|
761
|
+
function registerModuleWithRoutes(_x10, _x11, _x12) {
|
|
642
762
|
return _registerModuleWithRoutes.apply(this, arguments);
|
|
643
763
|
}
|
|
644
764
|
return registerModuleWithRoutes;
|
|
@@ -651,10 +771,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
651
771
|
}, {
|
|
652
772
|
key: "registerModuleByName",
|
|
653
773
|
value: (function () {
|
|
654
|
-
var _registerModuleByName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
774
|
+
var _registerModuleByName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(moduleConfig) {
|
|
655
775
|
var moduleName, shouldPreload, customConfig, registryConfig, ModuleClass, moduleInstance, moduleOptions;
|
|
656
|
-
return _regeneratorRuntime().wrap(function
|
|
657
|
-
while (1) switch (
|
|
776
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
777
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
658
778
|
case 0:
|
|
659
779
|
// 解析配置
|
|
660
780
|
moduleName = typeof moduleConfig === 'string' ? moduleConfig : moduleConfig.name;
|
|
@@ -669,7 +789,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
669
789
|
// 查找模块配置
|
|
670
790
|
registryConfig = this.moduleRegistry[moduleName];
|
|
671
791
|
if (registryConfig) {
|
|
672
|
-
|
|
792
|
+
_context11.next = 8;
|
|
673
793
|
break;
|
|
674
794
|
}
|
|
675
795
|
this.logError("\u672A\u627E\u5230\u6A21\u5757\u914D\u7F6E: ".concat(moduleName), {
|
|
@@ -683,7 +803,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
683
803
|
moduleOptions = _objectSpread({
|
|
684
804
|
store: _objectSpread({}, registryConfig.defaultStore)
|
|
685
805
|
}, customConfig); // 注册模块和路由
|
|
686
|
-
|
|
806
|
+
_context11.next = 13;
|
|
687
807
|
return this.registerModuleWithRoutes(moduleInstance, moduleOptions, moduleName.charAt(0).toUpperCase() + moduleName.slice(1));
|
|
688
808
|
case 13:
|
|
689
809
|
// 保存模块实例
|
|
@@ -693,18 +813,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
693
813
|
shouldPreload: shouldPreload,
|
|
694
814
|
version: registryConfig.version
|
|
695
815
|
});
|
|
696
|
-
return
|
|
816
|
+
return _context11.abrupt("return", {
|
|
697
817
|
module: moduleInstance,
|
|
698
818
|
config: registryConfig,
|
|
699
819
|
shouldPreload: shouldPreload
|
|
700
820
|
});
|
|
701
821
|
case 16:
|
|
702
822
|
case "end":
|
|
703
|
-
return
|
|
823
|
+
return _context11.stop();
|
|
704
824
|
}
|
|
705
|
-
},
|
|
825
|
+
}, _callee11, this);
|
|
706
826
|
}));
|
|
707
|
-
function registerModuleByName(
|
|
827
|
+
function registerModuleByName(_x13) {
|
|
708
828
|
return _registerModuleByName.apply(this, arguments);
|
|
709
829
|
}
|
|
710
830
|
return registerModuleByName;
|
|
@@ -717,10 +837,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
717
837
|
}, {
|
|
718
838
|
key: "registerModules",
|
|
719
839
|
value: (function () {
|
|
720
|
-
var _registerModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
721
|
-
var configs, registeredModules,
|
|
722
|
-
return _regeneratorRuntime().wrap(function
|
|
723
|
-
while (1) switch (
|
|
840
|
+
var _registerModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(moduleConfigs) {
|
|
841
|
+
var configs, registeredModules, _iterator2, _step2, config, configName, result, errorMessage;
|
|
842
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
843
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
724
844
|
case 0:
|
|
725
845
|
console.log('[Server] 开始注册模块...');
|
|
726
846
|
|
|
@@ -731,48 +851,48 @@ var Server = /*#__PURE__*/function () {
|
|
|
731
851
|
totalCount: configs.length
|
|
732
852
|
});
|
|
733
853
|
registeredModules = [];
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
854
|
+
_iterator2 = _createForOfIteratorHelper(configs);
|
|
855
|
+
_context12.prev = 5;
|
|
856
|
+
_iterator2.s();
|
|
737
857
|
case 7:
|
|
738
|
-
if ((
|
|
739
|
-
|
|
858
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
859
|
+
_context12.next = 25;
|
|
740
860
|
break;
|
|
741
861
|
}
|
|
742
|
-
config =
|
|
862
|
+
config = _step2.value;
|
|
743
863
|
configName = typeof config === 'string' ? config : config.name;
|
|
744
|
-
|
|
745
|
-
|
|
864
|
+
_context12.prev = 10;
|
|
865
|
+
_context12.next = 13;
|
|
746
866
|
return this.registerModuleByName(config);
|
|
747
867
|
case 13:
|
|
748
|
-
result =
|
|
868
|
+
result = _context12.sent;
|
|
749
869
|
registeredModules.push(result);
|
|
750
|
-
|
|
870
|
+
_context12.next = 23;
|
|
751
871
|
break;
|
|
752
872
|
case 17:
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
errorMessage =
|
|
873
|
+
_context12.prev = 17;
|
|
874
|
+
_context12.t0 = _context12["catch"](10);
|
|
875
|
+
errorMessage = _context12.t0 instanceof Error ? _context12.t0.message : String(_context12.t0);
|
|
756
876
|
this.logError("\u6A21\u5757\u6CE8\u518C\u5931\u8D25: ".concat(configName), {
|
|
757
877
|
moduleName: configName,
|
|
758
878
|
error: errorMessage
|
|
759
879
|
});
|
|
760
|
-
console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:",
|
|
761
|
-
throw
|
|
880
|
+
console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:", _context12.t0);
|
|
881
|
+
throw _context12.t0;
|
|
762
882
|
case 23:
|
|
763
|
-
|
|
883
|
+
_context12.next = 7;
|
|
764
884
|
break;
|
|
765
885
|
case 25:
|
|
766
|
-
|
|
886
|
+
_context12.next = 30;
|
|
767
887
|
break;
|
|
768
888
|
case 27:
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
889
|
+
_context12.prev = 27;
|
|
890
|
+
_context12.t1 = _context12["catch"](5);
|
|
891
|
+
_iterator2.e(_context12.t1);
|
|
772
892
|
case 30:
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
return
|
|
893
|
+
_context12.prev = 30;
|
|
894
|
+
_iterator2.f();
|
|
895
|
+
return _context12.finish(30);
|
|
776
896
|
case 33:
|
|
777
897
|
console.log('[Server] ✅ 所有模块注册完成');
|
|
778
898
|
this.logInfo('所有模块注册完成', {
|
|
@@ -782,14 +902,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
782
902
|
return m === null || m === void 0 || (_m$config = m.config) === null || _m$config === void 0 ? void 0 : _m$config.name;
|
|
783
903
|
})
|
|
784
904
|
});
|
|
785
|
-
return
|
|
905
|
+
return _context12.abrupt("return", registeredModules);
|
|
786
906
|
case 36:
|
|
787
907
|
case "end":
|
|
788
|
-
return
|
|
908
|
+
return _context12.stop();
|
|
789
909
|
}
|
|
790
|
-
},
|
|
910
|
+
}, _callee12, this, [[5, 27, 30, 33], [10, 17]]);
|
|
791
911
|
}));
|
|
792
|
-
function registerModules(
|
|
912
|
+
function registerModules(_x14) {
|
|
793
913
|
return _registerModules.apply(this, arguments);
|
|
794
914
|
}
|
|
795
915
|
return registerModules;
|
|
@@ -802,10 +922,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
802
922
|
}, {
|
|
803
923
|
key: "preloadModulesData",
|
|
804
924
|
value: (function () {
|
|
805
|
-
var _preloadModulesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
806
|
-
var modulesToPreload, preloadResults,
|
|
807
|
-
return _regeneratorRuntime().wrap(function
|
|
808
|
-
while (1) switch (
|
|
925
|
+
var _preloadModulesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(registeredModules, options) {
|
|
926
|
+
var modulesToPreload, preloadResults, _iterator3, _step3, _step3$value, module, config, shouldPreload, startTime, _options$onModuleLoad, _options$onModuleLoad2, duration, _duration, errorMessage, successCount, failCount;
|
|
927
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
928
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
809
929
|
case 0:
|
|
810
930
|
console.log('[Server] 开始预加载模块数据...');
|
|
811
931
|
modulesToPreload = registeredModules.filter(function (m) {
|
|
@@ -817,17 +937,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
817
937
|
modulesToPreload: modulesToPreload
|
|
818
938
|
});
|
|
819
939
|
preloadResults = [];
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
940
|
+
_iterator3 = _createForOfIteratorHelper(registeredModules);
|
|
941
|
+
_context13.prev = 5;
|
|
942
|
+
_iterator3.s();
|
|
823
943
|
case 7:
|
|
824
|
-
if ((
|
|
825
|
-
|
|
944
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
945
|
+
_context13.next = 40;
|
|
826
946
|
break;
|
|
827
947
|
}
|
|
828
|
-
|
|
948
|
+
_step3$value = _step3.value, module = _step3$value.module, config = _step3$value.config, shouldPreload = _step3$value.shouldPreload;
|
|
829
949
|
if (shouldPreload) {
|
|
830
|
-
|
|
950
|
+
_context13.next = 13;
|
|
831
951
|
break;
|
|
832
952
|
}
|
|
833
953
|
console.log("[Server] \u23ED\uFE0F \u8DF3\u8FC7 ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D"));
|
|
@@ -835,19 +955,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
835
955
|
moduleName: config.name,
|
|
836
956
|
reason: 'shouldPreload=false'
|
|
837
957
|
});
|
|
838
|
-
return
|
|
958
|
+
return _context13.abrupt("continue", 38);
|
|
839
959
|
case 13:
|
|
840
960
|
if (!(typeof module.preload === 'function')) {
|
|
841
|
-
|
|
961
|
+
_context13.next = 36;
|
|
842
962
|
break;
|
|
843
963
|
}
|
|
844
964
|
startTime = Date.now();
|
|
845
|
-
|
|
965
|
+
_context13.prev = 15;
|
|
846
966
|
this.logInfo("\u5F00\u59CB\u9884\u52A0\u8F7D\u6A21\u5757: ".concat(config.name), {
|
|
847
967
|
moduleName: config.name
|
|
848
968
|
});
|
|
849
969
|
options === null || options === void 0 || (_options$onModuleLoad = options.onModuleLoad) === null || _options$onModuleLoad === void 0 || _options$onModuleLoad.call(options, config.name);
|
|
850
|
-
|
|
970
|
+
_context13.next = 20;
|
|
851
971
|
return module.preload();
|
|
852
972
|
case 20:
|
|
853
973
|
options === null || options === void 0 || (_options$onModuleLoad2 = options.onModuleLoadComplete) === null || _options$onModuleLoad2 === void 0 || _options$onModuleLoad2.call(options, config.name);
|
|
@@ -861,14 +981,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
861
981
|
name: config.name,
|
|
862
982
|
success: true
|
|
863
983
|
});
|
|
864
|
-
|
|
984
|
+
_context13.next = 34;
|
|
865
985
|
break;
|
|
866
986
|
case 27:
|
|
867
|
-
|
|
868
|
-
|
|
987
|
+
_context13.prev = 27;
|
|
988
|
+
_context13.t0 = _context13["catch"](15);
|
|
869
989
|
_duration = Date.now() - startTime;
|
|
870
|
-
errorMessage =
|
|
871
|
-
console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"),
|
|
990
|
+
errorMessage = _context13.t0 instanceof Error ? _context13.t0.message : String(_context13.t0);
|
|
991
|
+
console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"), _context13.t0);
|
|
872
992
|
this.logError("\u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25: ".concat(config.name), {
|
|
873
993
|
moduleName: config.name,
|
|
874
994
|
duration: "".concat(_duration, "ms"),
|
|
@@ -880,7 +1000,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
880
1000
|
error: errorMessage
|
|
881
1001
|
});
|
|
882
1002
|
case 34:
|
|
883
|
-
|
|
1003
|
+
_context13.next = 38;
|
|
884
1004
|
break;
|
|
885
1005
|
case 36:
|
|
886
1006
|
console.log("[Server] \u26A0\uFE0F ".concat(config.name, " \u6A21\u5757\u672A\u5B9E\u73B0 preload() \u65B9\u6CD5"));
|
|
@@ -888,19 +1008,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
888
1008
|
moduleName: config.name
|
|
889
1009
|
});
|
|
890
1010
|
case 38:
|
|
891
|
-
|
|
1011
|
+
_context13.next = 7;
|
|
892
1012
|
break;
|
|
893
1013
|
case 40:
|
|
894
|
-
|
|
1014
|
+
_context13.next = 45;
|
|
895
1015
|
break;
|
|
896
1016
|
case 42:
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
1017
|
+
_context13.prev = 42;
|
|
1018
|
+
_context13.t1 = _context13["catch"](5);
|
|
1019
|
+
_iterator3.e(_context13.t1);
|
|
900
1020
|
case 45:
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
return
|
|
1021
|
+
_context13.prev = 45;
|
|
1022
|
+
_iterator3.f();
|
|
1023
|
+
return _context13.finish(45);
|
|
904
1024
|
case 48:
|
|
905
1025
|
successCount = preloadResults.filter(function (r) {
|
|
906
1026
|
return r.success;
|
|
@@ -915,11 +1035,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
915
1035
|
});
|
|
916
1036
|
case 52:
|
|
917
1037
|
case "end":
|
|
918
|
-
return
|
|
1038
|
+
return _context13.stop();
|
|
919
1039
|
}
|
|
920
|
-
},
|
|
1040
|
+
}, _callee13, this, [[5, 42, 45, 48], [15, 27]]);
|
|
921
1041
|
}));
|
|
922
|
-
function preloadModulesData(
|
|
1042
|
+
function preloadModulesData(_x15, _x16) {
|
|
923
1043
|
return _preloadModulesData.apply(this, arguments);
|
|
924
1044
|
}
|
|
925
1045
|
return preloadModulesData;
|
|
@@ -933,7 +1053,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
933
1053
|
}, {
|
|
934
1054
|
key: "initialize",
|
|
935
1055
|
value: (function () {
|
|
936
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1056
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(moduleConfigs) {
|
|
937
1057
|
var _moduleConfigs$length,
|
|
938
1058
|
_this3 = this;
|
|
939
1059
|
var autoPreload,
|
|
@@ -941,12 +1061,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
941
1061
|
startTime,
|
|
942
1062
|
registeredModules,
|
|
943
1063
|
duration,
|
|
944
|
-
|
|
945
|
-
return _regeneratorRuntime().wrap(function
|
|
946
|
-
while (1) switch (
|
|
1064
|
+
_args14 = arguments;
|
|
1065
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1066
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
947
1067
|
case 0:
|
|
948
|
-
autoPreload =
|
|
949
|
-
options =
|
|
1068
|
+
autoPreload = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : true;
|
|
1069
|
+
options = _args14.length > 2 ? _args14[2] : undefined;
|
|
950
1070
|
startTime = Date.now();
|
|
951
1071
|
this.logInfo('Server 初始化开始', {
|
|
952
1072
|
moduleConfigCount: (_moduleConfigs$length = moduleConfigs === null || moduleConfigs === void 0 ? void 0 : moduleConfigs.length) !== null && _moduleConfigs$length !== void 0 ? _moduleConfigs$length : 'all',
|
|
@@ -958,18 +1078,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
958
1078
|
this.registerServerRoutes();
|
|
959
1079
|
|
|
960
1080
|
// 注册模块
|
|
961
|
-
|
|
1081
|
+
_context14.next = 7;
|
|
962
1082
|
return this.registerModules(moduleConfigs);
|
|
963
1083
|
case 7:
|
|
964
|
-
registeredModules =
|
|
1084
|
+
registeredModules = _context14.sent;
|
|
965
1085
|
if (!autoPreload) {
|
|
966
|
-
|
|
1086
|
+
_context14.next = 13;
|
|
967
1087
|
break;
|
|
968
1088
|
}
|
|
969
|
-
|
|
1089
|
+
_context14.next = 11;
|
|
970
1090
|
return this.preloadModulesData(registeredModules, options);
|
|
971
1091
|
case 11:
|
|
972
|
-
|
|
1092
|
+
_context14.next = 14;
|
|
973
1093
|
break;
|
|
974
1094
|
case 13:
|
|
975
1095
|
this.logInfo('跳过自动预加载', {
|
|
@@ -983,6 +1103,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
983
1103
|
});
|
|
984
1104
|
});
|
|
985
1105
|
|
|
1106
|
+
// 平面图:本地列表任意变更(预加载、pubsub 同步)时,向 GET 订阅者推送最新列表/详情
|
|
1107
|
+
this.core.effects.on(FloorPlanHooks.onFloorPlansChanged, function () {
|
|
1108
|
+
void _this3.recomputeAndNotifyFloorPlanQuery();
|
|
1109
|
+
});
|
|
1110
|
+
|
|
986
1111
|
// 订单 / 预约本地数据变更时,向订阅者推送最新列表
|
|
987
1112
|
this.core.effects.on(OrderHooks.onOrdersChanged, function () {
|
|
988
1113
|
_this3.recomputeAndNotifyOrderQuery();
|
|
@@ -993,14 +1118,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
993
1118
|
duration: "".concat(duration, "ms"),
|
|
994
1119
|
registeredModuleCount: registeredModules.length
|
|
995
1120
|
});
|
|
996
|
-
return
|
|
997
|
-
case
|
|
1121
|
+
return _context14.abrupt("return", registeredModules);
|
|
1122
|
+
case 20:
|
|
998
1123
|
case "end":
|
|
999
|
-
return
|
|
1124
|
+
return _context14.stop();
|
|
1000
1125
|
}
|
|
1001
|
-
},
|
|
1126
|
+
}, _callee14, this);
|
|
1002
1127
|
}));
|
|
1003
|
-
function initialize(
|
|
1128
|
+
function initialize(_x17) {
|
|
1004
1129
|
return _initialize.apply(this, arguments);
|
|
1005
1130
|
}
|
|
1006
1131
|
return initialize;
|
|
@@ -1055,6 +1180,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1055
1180
|
if (this.schedule) modules.push('schedule');
|
|
1056
1181
|
if (this.resource) modules.push('resource');
|
|
1057
1182
|
if (this.order) modules.push('order');
|
|
1183
|
+
if (this.floor_plan) modules.push('floor_plan');
|
|
1058
1184
|
return modules;
|
|
1059
1185
|
}
|
|
1060
1186
|
|
|
@@ -1066,45 +1192,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
1066
1192
|
}, {
|
|
1067
1193
|
key: "refreshProductsInBackground",
|
|
1068
1194
|
value: (function () {
|
|
1069
|
-
var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1195
|
+
var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1070
1196
|
var startTime, duration, _duration2, errorMessage;
|
|
1071
|
-
return _regeneratorRuntime().wrap(function
|
|
1072
|
-
while (1) switch (
|
|
1197
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1198
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1073
1199
|
case 0:
|
|
1074
1200
|
if (this.products) {
|
|
1075
|
-
|
|
1201
|
+
_context15.next = 3;
|
|
1076
1202
|
break;
|
|
1077
1203
|
}
|
|
1078
1204
|
this.logWarning('refreshProductsInBackground: Products 模块未注册');
|
|
1079
|
-
return
|
|
1205
|
+
return _context15.abrupt("return");
|
|
1080
1206
|
case 3:
|
|
1081
1207
|
this.logInfo('refreshProductsInBackground 开始');
|
|
1082
1208
|
startTime = Date.now();
|
|
1083
|
-
|
|
1084
|
-
|
|
1209
|
+
_context15.prev = 5;
|
|
1210
|
+
_context15.next = 8;
|
|
1085
1211
|
return this.products.silentRefresh();
|
|
1086
1212
|
case 8:
|
|
1087
1213
|
duration = Date.now() - startTime;
|
|
1088
1214
|
this.logInfo('refreshProductsInBackground 完成', {
|
|
1089
1215
|
duration: "".concat(duration, "ms")
|
|
1090
1216
|
});
|
|
1091
|
-
|
|
1217
|
+
_context15.next = 18;
|
|
1092
1218
|
break;
|
|
1093
1219
|
case 12:
|
|
1094
|
-
|
|
1095
|
-
|
|
1220
|
+
_context15.prev = 12;
|
|
1221
|
+
_context15.t0 = _context15["catch"](5);
|
|
1096
1222
|
_duration2 = Date.now() - startTime;
|
|
1097
|
-
errorMessage =
|
|
1098
|
-
console.error('[Server] refreshProductsInBackground 失败:',
|
|
1223
|
+
errorMessage = _context15.t0 instanceof Error ? _context15.t0.message : String(_context15.t0);
|
|
1224
|
+
console.error('[Server] refreshProductsInBackground 失败:', _context15.t0);
|
|
1099
1225
|
this.logError('refreshProductsInBackground 失败', {
|
|
1100
1226
|
duration: "".concat(_duration2, "ms"),
|
|
1101
1227
|
error: errorMessage
|
|
1102
1228
|
});
|
|
1103
1229
|
case 18:
|
|
1104
1230
|
case "end":
|
|
1105
|
-
return
|
|
1231
|
+
return _context15.stop();
|
|
1106
1232
|
}
|
|
1107
|
-
},
|
|
1233
|
+
}, _callee15, this, [[5, 12]]);
|
|
1108
1234
|
}));
|
|
1109
1235
|
function refreshProductsInBackground() {
|
|
1110
1236
|
return _refreshProductsInBackground.apply(this, arguments);
|
|
@@ -1119,10 +1245,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1119
1245
|
}, {
|
|
1120
1246
|
key: "clearAllIndexDB",
|
|
1121
1247
|
value: (function () {
|
|
1122
|
-
var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1248
|
+
var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1123
1249
|
var clearTasks, moduleNames, errorMessage;
|
|
1124
|
-
return _regeneratorRuntime().wrap(function
|
|
1125
|
-
while (1) switch (
|
|
1250
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1251
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1126
1252
|
case 0:
|
|
1127
1253
|
console.log('[Server] 开始清空所有模块的IndexedDB缓存...');
|
|
1128
1254
|
this.logInfo('开始清空所有模块的 IndexedDB 缓存');
|
|
@@ -1152,42 +1278,46 @@ var Server = /*#__PURE__*/function () {
|
|
|
1152
1278
|
clearTasks.push(this.order.clear());
|
|
1153
1279
|
moduleNames.push('Order');
|
|
1154
1280
|
}
|
|
1281
|
+
if (this.floor_plan) {
|
|
1282
|
+
clearTasks.push(this.floor_plan.clear());
|
|
1283
|
+
moduleNames.push('FloorPlan');
|
|
1284
|
+
}
|
|
1155
1285
|
if (!(clearTasks.length === 0)) {
|
|
1156
|
-
|
|
1286
|
+
_context16.next = 15;
|
|
1157
1287
|
break;
|
|
1158
1288
|
}
|
|
1159
1289
|
console.warn('[Server] 没有找到已注册的模块,无需清空');
|
|
1160
1290
|
this.logWarning('没有找到已注册的模块,无需清空 IndexedDB');
|
|
1161
|
-
return
|
|
1162
|
-
case
|
|
1291
|
+
return _context16.abrupt("return");
|
|
1292
|
+
case 15:
|
|
1163
1293
|
this.logInfo('准备清空模块缓存', {
|
|
1164
1294
|
moduleNames: moduleNames
|
|
1165
1295
|
});
|
|
1166
|
-
|
|
1167
|
-
|
|
1296
|
+
_context16.prev = 16;
|
|
1297
|
+
_context16.next = 19;
|
|
1168
1298
|
return Promise.all(clearTasks);
|
|
1169
|
-
case
|
|
1299
|
+
case 19:
|
|
1170
1300
|
console.log("[Server] \u2705 \u5DF2\u6210\u529F\u6E05\u7A7A\u6240\u6709\u6A21\u5757\u7684IndexedDB\u7F13\u5B58: ".concat(moduleNames.join(', ')));
|
|
1171
1301
|
this.logInfo('成功清空所有模块的 IndexedDB 缓存', {
|
|
1172
1302
|
moduleNames: moduleNames
|
|
1173
1303
|
});
|
|
1174
|
-
|
|
1304
|
+
_context16.next = 29;
|
|
1175
1305
|
break;
|
|
1176
|
-
case
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
errorMessage =
|
|
1180
|
-
console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:',
|
|
1306
|
+
case 23:
|
|
1307
|
+
_context16.prev = 23;
|
|
1308
|
+
_context16.t0 = _context16["catch"](16);
|
|
1309
|
+
errorMessage = _context16.t0 instanceof Error ? _context16.t0.message : String(_context16.t0);
|
|
1310
|
+
console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context16.t0);
|
|
1181
1311
|
this.logError('清空 IndexedDB 缓存时发生错误', {
|
|
1182
1312
|
moduleNames: moduleNames,
|
|
1183
1313
|
error: errorMessage
|
|
1184
1314
|
});
|
|
1185
|
-
throw
|
|
1186
|
-
case
|
|
1315
|
+
throw _context16.t0;
|
|
1316
|
+
case 29:
|
|
1187
1317
|
case "end":
|
|
1188
|
-
return
|
|
1318
|
+
return _context16.stop();
|
|
1189
1319
|
}
|
|
1190
|
-
},
|
|
1320
|
+
}, _callee16, this, [[16, 23]]);
|
|
1191
1321
|
}));
|
|
1192
1322
|
function clearAllIndexDB() {
|
|
1193
1323
|
return _clearAllIndexDB.apply(this, arguments);
|
|
@@ -1213,7 +1343,29 @@ var Server = /*#__PURE__*/function () {
|
|
|
1213
1343
|
key: "getRouteHandler",
|
|
1214
1344
|
value: function getRouteHandler(method, path) {
|
|
1215
1345
|
var _this$router$method;
|
|
1216
|
-
|
|
1346
|
+
var exact = (_this$router$method = this.router[method]) === null || _this$router$method === void 0 ? void 0 : _this$router$method[path];
|
|
1347
|
+
if (exact) {
|
|
1348
|
+
return exact;
|
|
1349
|
+
}
|
|
1350
|
+
if (method === 'get' && this.prefixRouterGet.length > 0) {
|
|
1351
|
+
var _iterator4 = _createForOfIteratorHelper(this.prefixRouterGet),
|
|
1352
|
+
_step4;
|
|
1353
|
+
try {
|
|
1354
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1355
|
+
var _step4$value = _step4.value,
|
|
1356
|
+
prefix = _step4$value.prefix,
|
|
1357
|
+
handler = _step4$value.handler;
|
|
1358
|
+
if (path === prefix || path.startsWith("".concat(prefix, "/"))) {
|
|
1359
|
+
return handler;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
} catch (err) {
|
|
1363
|
+
_iterator4.e(err);
|
|
1364
|
+
} finally {
|
|
1365
|
+
_iterator4.f();
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
return undefined;
|
|
1217
1369
|
}
|
|
1218
1370
|
|
|
1219
1371
|
/**
|
|
@@ -1224,9 +1376,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1224
1376
|
}, {
|
|
1225
1377
|
key: "hasRoute",
|
|
1226
1378
|
value: function hasRoute(method, path) {
|
|
1227
|
-
|
|
1228
|
-
console.log(method, path, 'method, path');
|
|
1229
|
-
return !!((_this$router$method2 = this.router[method]) !== null && _this$router$method2 !== void 0 && _this$router$method2[path]);
|
|
1379
|
+
return !!this.getRouteHandler(method, path);
|
|
1230
1380
|
}
|
|
1231
1381
|
|
|
1232
1382
|
/**
|
|
@@ -1238,10 +1388,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1238
1388
|
}, {
|
|
1239
1389
|
key: "handleRoute",
|
|
1240
1390
|
value: (function () {
|
|
1241
|
-
var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1391
|
+
var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(method, path, params) {
|
|
1242
1392
|
var startTime, handler, result, duration, _duration3, errorMessage;
|
|
1243
|
-
return _regeneratorRuntime().wrap(function
|
|
1244
|
-
while (1) switch (
|
|
1393
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1394
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1245
1395
|
case 0:
|
|
1246
1396
|
startTime = Date.now();
|
|
1247
1397
|
this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5F00\u59CB: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
@@ -1252,7 +1402,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1252
1402
|
});
|
|
1253
1403
|
handler = this.getRouteHandler(method, path);
|
|
1254
1404
|
if (handler) {
|
|
1255
|
-
|
|
1405
|
+
_context17.next = 6;
|
|
1256
1406
|
break;
|
|
1257
1407
|
}
|
|
1258
1408
|
this.logError("\u8DEF\u7531\u672A\u627E\u5230: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
@@ -1261,11 +1411,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
1261
1411
|
});
|
|
1262
1412
|
throw new Error("Route not found: ".concat(method.toUpperCase(), " ").concat(path));
|
|
1263
1413
|
case 6:
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
return handler(params)
|
|
1414
|
+
_context17.prev = 6;
|
|
1415
|
+
_context17.next = 9;
|
|
1416
|
+
return handler(_objectSpread(_objectSpread({}, params), {}, {
|
|
1417
|
+
path: path
|
|
1418
|
+
}));
|
|
1267
1419
|
case 9:
|
|
1268
|
-
result =
|
|
1420
|
+
result = _context17.sent;
|
|
1269
1421
|
duration = Date.now() - startTime;
|
|
1270
1422
|
this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5B8C\u6210: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
1271
1423
|
method: method.toUpperCase(),
|
|
@@ -1274,12 +1426,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
1274
1426
|
resultCode: result === null || result === void 0 ? void 0 : result.code,
|
|
1275
1427
|
resultStatus: result === null || result === void 0 ? void 0 : result.status
|
|
1276
1428
|
});
|
|
1277
|
-
return
|
|
1429
|
+
return _context17.abrupt("return", result);
|
|
1278
1430
|
case 15:
|
|
1279
|
-
|
|
1280
|
-
|
|
1431
|
+
_context17.prev = 15;
|
|
1432
|
+
_context17.t0 = _context17["catch"](6);
|
|
1281
1433
|
_duration3 = Date.now() - startTime;
|
|
1282
|
-
errorMessage =
|
|
1434
|
+
errorMessage = _context17.t0 instanceof Error ? _context17.t0.message : String(_context17.t0);
|
|
1283
1435
|
this.logError("\u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
1284
1436
|
method: method.toUpperCase(),
|
|
1285
1437
|
path: path,
|
|
@@ -1287,15 +1439,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
1287
1439
|
error: errorMessage,
|
|
1288
1440
|
data: params.data
|
|
1289
1441
|
});
|
|
1290
|
-
console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path),
|
|
1291
|
-
throw
|
|
1442
|
+
console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), _context17.t0);
|
|
1443
|
+
throw _context17.t0;
|
|
1292
1444
|
case 22:
|
|
1293
1445
|
case "end":
|
|
1294
|
-
return
|
|
1446
|
+
return _context17.stop();
|
|
1295
1447
|
}
|
|
1296
|
-
},
|
|
1448
|
+
}, _callee17, this, [[6, 15]]);
|
|
1297
1449
|
}));
|
|
1298
|
-
function handleRoute(
|
|
1450
|
+
function handleRoute(_x18, _x19, _x20) {
|
|
1299
1451
|
return _handleRoute.apply(this, arguments);
|
|
1300
1452
|
}
|
|
1301
1453
|
return handleRoute;
|
|
@@ -1362,6 +1514,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1362
1514
|
path: '/shop/form/resource/page',
|
|
1363
1515
|
handler: this.handleResourceList.bind(this)
|
|
1364
1516
|
}]);
|
|
1517
|
+
this.registerPrefixRoutes([{
|
|
1518
|
+
method: 'get',
|
|
1519
|
+
prefix: '/shop/schedule/floor-plan',
|
|
1520
|
+
handler: this.handleFloorPlanGet.bind(this)
|
|
1521
|
+
}]);
|
|
1365
1522
|
}
|
|
1366
1523
|
|
|
1367
1524
|
/**
|
|
@@ -1398,18 +1555,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
1398
1555
|
}, {
|
|
1399
1556
|
key: "fetchBookingListFromAPI",
|
|
1400
1557
|
value: (function () {
|
|
1401
|
-
var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1558
|
+
var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(data) {
|
|
1402
1559
|
var _this$app2;
|
|
1403
|
-
var
|
|
1404
|
-
return _regeneratorRuntime().wrap(function
|
|
1405
|
-
while (1) switch (
|
|
1560
|
+
var _ref26, _response$data$list, _response$data, response, rawList, list, errorMessage;
|
|
1561
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1562
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1406
1563
|
case 0:
|
|
1407
1564
|
if ((_this$app2 = this.app) !== null && _this$app2 !== void 0 && _this$app2.request) {
|
|
1408
|
-
|
|
1565
|
+
_context18.next = 3;
|
|
1409
1566
|
break;
|
|
1410
1567
|
}
|
|
1411
1568
|
this.logError('fetchBookingListFromAPI: app.request 不可用');
|
|
1412
|
-
return
|
|
1569
|
+
return _context18.abrupt("return", {
|
|
1413
1570
|
code: 500,
|
|
1414
1571
|
message: 'app.request 不可用',
|
|
1415
1572
|
data: {
|
|
@@ -1419,8 +1576,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
1419
1576
|
status: false
|
|
1420
1577
|
});
|
|
1421
1578
|
case 3:
|
|
1422
|
-
|
|
1423
|
-
|
|
1579
|
+
_context18.prev = 3;
|
|
1580
|
+
_context18.next = 6;
|
|
1424
1581
|
return this.app.request.get('/shop/order/sales', _objectSpread(_objectSpread({}, data), {}, {
|
|
1425
1582
|
form_record_ids: undefined,
|
|
1426
1583
|
with: ["all"]
|
|
@@ -1428,14 +1585,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
1428
1585
|
isShopApi: true
|
|
1429
1586
|
});
|
|
1430
1587
|
case 6:
|
|
1431
|
-
response =
|
|
1432
|
-
rawList = (
|
|
1588
|
+
response = _context18.sent;
|
|
1589
|
+
rawList = (_ref26 = (_response$data$list = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list) !== null && _response$data$list !== void 0 ? _response$data$list : response === null || response === void 0 ? void 0 : response.list) !== null && _ref26 !== void 0 ? _ref26 : [];
|
|
1433
1590
|
list = filterBookingsFromOrders(rawList, data);
|
|
1434
1591
|
this.logInfo('fetchBookingListFromAPI: API 返回并拆分完成', {
|
|
1435
1592
|
rawCount: rawList.length,
|
|
1436
1593
|
flattenedCount: list.count
|
|
1437
1594
|
});
|
|
1438
|
-
return
|
|
1595
|
+
return _context18.abrupt("return", {
|
|
1439
1596
|
code: 200,
|
|
1440
1597
|
data: _objectSpread(_objectSpread({}, response.data), {}, {
|
|
1441
1598
|
list: (list === null || list === void 0 ? void 0 : list.list) || []
|
|
@@ -1444,13 +1601,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
1444
1601
|
status: true
|
|
1445
1602
|
});
|
|
1446
1603
|
case 13:
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
errorMessage =
|
|
1604
|
+
_context18.prev = 13;
|
|
1605
|
+
_context18.t0 = _context18["catch"](3);
|
|
1606
|
+
errorMessage = _context18.t0 instanceof Error ? _context18.t0.message : String(_context18.t0);
|
|
1450
1607
|
this.logError('fetchBookingListFromAPI: 请求失败', {
|
|
1451
1608
|
error: errorMessage
|
|
1452
1609
|
});
|
|
1453
|
-
return
|
|
1610
|
+
return _context18.abrupt("return", {
|
|
1454
1611
|
code: 500,
|
|
1455
1612
|
message: errorMessage,
|
|
1456
1613
|
data: {
|
|
@@ -1461,15 +1618,188 @@ var Server = /*#__PURE__*/function () {
|
|
|
1461
1618
|
});
|
|
1462
1619
|
case 18:
|
|
1463
1620
|
case "end":
|
|
1464
|
-
return
|
|
1621
|
+
return _context18.stop();
|
|
1465
1622
|
}
|
|
1466
|
-
},
|
|
1623
|
+
}, _callee18, this, [[3, 13]]);
|
|
1467
1624
|
}));
|
|
1468
|
-
function fetchBookingListFromAPI(
|
|
1625
|
+
function fetchBookingListFromAPI(_x21) {
|
|
1469
1626
|
return _fetchBookingListFromAPI.apply(this, arguments);
|
|
1470
1627
|
}
|
|
1471
1628
|
return fetchBookingListFromAPI;
|
|
1472
1629
|
}())
|
|
1630
|
+
}, {
|
|
1631
|
+
key: "parseRequestPath",
|
|
1632
|
+
value:
|
|
1633
|
+
/**
|
|
1634
|
+
* 从 url 或路由 path 解析 pathname(不含 query,去掉末尾 /)
|
|
1635
|
+
*/
|
|
1636
|
+
function parseRequestPath(url, routePath) {
|
|
1637
|
+
var raw = routePath || url;
|
|
1638
|
+
var noQuery = raw.split('?')[0] || '';
|
|
1639
|
+
try {
|
|
1640
|
+
var pathname = url.startsWith('http') ? new URL(url).pathname : noQuery;
|
|
1641
|
+
return pathname.replace(/\/$/, '') || pathname;
|
|
1642
|
+
} catch (_unused) {
|
|
1643
|
+
return noQuery.replace(/\/$/, '');
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
* 解析平面图 GET 路径为查询上下文
|
|
1649
|
+
*/
|
|
1650
|
+
}, {
|
|
1651
|
+
key: "resolveFloorPlanQueryContext",
|
|
1652
|
+
value: function resolveFloorPlanQueryContext(path, base) {
|
|
1653
|
+
if (path === base) {
|
|
1654
|
+
return {
|
|
1655
|
+
kind: 'list'
|
|
1656
|
+
};
|
|
1657
|
+
}
|
|
1658
|
+
if (!path.startsWith("".concat(base, "/"))) {
|
|
1659
|
+
return null;
|
|
1660
|
+
}
|
|
1661
|
+
var after = path.slice(base.length + 1);
|
|
1662
|
+
if (after === 'unsubscribe') {
|
|
1663
|
+
return null;
|
|
1664
|
+
}
|
|
1665
|
+
if (after.startsWith('code/')) {
|
|
1666
|
+
var code = decodeURIComponent(after.slice('code/'.length));
|
|
1667
|
+
if (!code) return null;
|
|
1668
|
+
return {
|
|
1669
|
+
kind: 'code',
|
|
1670
|
+
code: code
|
|
1671
|
+
};
|
|
1672
|
+
}
|
|
1673
|
+
if (/^\d+$/.test(after)) {
|
|
1674
|
+
return {
|
|
1675
|
+
kind: 'id',
|
|
1676
|
+
id: after
|
|
1677
|
+
};
|
|
1678
|
+
}
|
|
1679
|
+
return null;
|
|
1680
|
+
}
|
|
1681
|
+
}, {
|
|
1682
|
+
key: "computeFloorPlanQueryResult",
|
|
1683
|
+
value: function computeFloorPlanQueryResult(context) {
|
|
1684
|
+
if (!this.floor_plan) {
|
|
1685
|
+
return {
|
|
1686
|
+
status: false,
|
|
1687
|
+
code: 500,
|
|
1688
|
+
message: 'Floor plan 模块未注册',
|
|
1689
|
+
data: null
|
|
1690
|
+
};
|
|
1691
|
+
}
|
|
1692
|
+
if (context.kind === 'list') {
|
|
1693
|
+
return {
|
|
1694
|
+
status: true,
|
|
1695
|
+
code: 200,
|
|
1696
|
+
message: '',
|
|
1697
|
+
data: this.floor_plan.getSortedList()
|
|
1698
|
+
};
|
|
1699
|
+
}
|
|
1700
|
+
if (context.kind === 'id') {
|
|
1701
|
+
var _item = this.floor_plan.getById(context.id);
|
|
1702
|
+
if (!_item) {
|
|
1703
|
+
return {
|
|
1704
|
+
status: false,
|
|
1705
|
+
code: 404,
|
|
1706
|
+
message: 'Not Found',
|
|
1707
|
+
data: null
|
|
1708
|
+
};
|
|
1709
|
+
}
|
|
1710
|
+
return {
|
|
1711
|
+
status: true,
|
|
1712
|
+
code: 200,
|
|
1713
|
+
message: '',
|
|
1714
|
+
data: _item
|
|
1715
|
+
};
|
|
1716
|
+
}
|
|
1717
|
+
var item = this.floor_plan.getByCode(context.code);
|
|
1718
|
+
if (!item) {
|
|
1719
|
+
return {
|
|
1720
|
+
status: false,
|
|
1721
|
+
code: 404,
|
|
1722
|
+
message: 'Not Found',
|
|
1723
|
+
data: null
|
|
1724
|
+
};
|
|
1725
|
+
}
|
|
1726
|
+
return {
|
|
1727
|
+
status: true,
|
|
1728
|
+
code: 200,
|
|
1729
|
+
message: '',
|
|
1730
|
+
data: item
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
/**
|
|
1735
|
+
* 平面图数据变更后向所有 GET 订阅者推送最新结果
|
|
1736
|
+
*/
|
|
1737
|
+
}, {
|
|
1738
|
+
key: "recomputeAndNotifyFloorPlanQuery",
|
|
1739
|
+
value: (function () {
|
|
1740
|
+
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1741
|
+
var _iterator5, _step5, _step5$value, subscriberId, sub, result, errorMessage;
|
|
1742
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1743
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1744
|
+
case 0:
|
|
1745
|
+
if (!(this.floorPlanQuerySubscribers.size === 0)) {
|
|
1746
|
+
_context19.next = 2;
|
|
1747
|
+
break;
|
|
1748
|
+
}
|
|
1749
|
+
return _context19.abrupt("return");
|
|
1750
|
+
case 2:
|
|
1751
|
+
this.logInfo('recomputeAndNotifyFloorPlanQuery: 开始推送', {
|
|
1752
|
+
subscriberCount: this.floorPlanQuerySubscribers.size
|
|
1753
|
+
});
|
|
1754
|
+
_iterator5 = _createForOfIteratorHelper(this.floorPlanQuerySubscribers.entries());
|
|
1755
|
+
try {
|
|
1756
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
1757
|
+
_step5$value = _slicedToArray(_step5.value, 2), subscriberId = _step5$value[0], sub = _step5$value[1];
|
|
1758
|
+
try {
|
|
1759
|
+
result = this.computeFloorPlanQueryResult(sub.context);
|
|
1760
|
+
sub.callback(result);
|
|
1761
|
+
this.logInfo('recomputeAndNotifyFloorPlanQuery: 已推送', {
|
|
1762
|
+
subscriberId: subscriberId
|
|
1763
|
+
});
|
|
1764
|
+
} catch (error) {
|
|
1765
|
+
errorMessage = error instanceof Error ? error.message : String(error);
|
|
1766
|
+
this.logError('recomputeAndNotifyFloorPlanQuery: 推送失败', {
|
|
1767
|
+
subscriberId: subscriberId,
|
|
1768
|
+
error: errorMessage
|
|
1769
|
+
});
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
} catch (err) {
|
|
1773
|
+
_iterator5.e(err);
|
|
1774
|
+
} finally {
|
|
1775
|
+
_iterator5.f();
|
|
1776
|
+
}
|
|
1777
|
+
case 5:
|
|
1778
|
+
case "end":
|
|
1779
|
+
return _context19.stop();
|
|
1780
|
+
}
|
|
1781
|
+
}, _callee19, this);
|
|
1782
|
+
}));
|
|
1783
|
+
function recomputeAndNotifyFloorPlanQuery() {
|
|
1784
|
+
return _recomputeAndNotifyFloorPlanQuery.apply(this, arguments);
|
|
1785
|
+
}
|
|
1786
|
+
return recomputeAndNotifyFloorPlanQuery;
|
|
1787
|
+
}()
|
|
1788
|
+
/**
|
|
1789
|
+
* 取消平面图 GET 订阅(也可走 GET .../unsubscribe + subscriberId)
|
|
1790
|
+
*/
|
|
1791
|
+
)
|
|
1792
|
+
}, {
|
|
1793
|
+
key: "removeFloorPlanQuerySubscriber",
|
|
1794
|
+
value: function removeFloorPlanQuerySubscriber(subscriberId) {
|
|
1795
|
+
if (subscriberId) {
|
|
1796
|
+
this.floorPlanQuerySubscribers.delete(subscriberId);
|
|
1797
|
+
this.logInfo('removeFloorPlanQuerySubscriber: 已移除', {
|
|
1798
|
+
subscriberId: subscriberId,
|
|
1799
|
+
remaining: this.floorPlanQuerySubscribers.size
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1473
1803
|
}, {
|
|
1474
1804
|
key: "computeOrderQueryResult",
|
|
1475
1805
|
value: (
|
|
@@ -1478,21 +1808,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
1478
1808
|
* filter 逻辑暂为 mock,仅记录参数
|
|
1479
1809
|
*/
|
|
1480
1810
|
function () {
|
|
1481
|
-
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1811
|
+
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(data) {
|
|
1482
1812
|
var rawList, result;
|
|
1483
|
-
return _regeneratorRuntime().wrap(function
|
|
1484
|
-
while (1) switch (
|
|
1813
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1814
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1485
1815
|
case 0:
|
|
1486
1816
|
this.logInfo('computeOrderQueryResult: 开始过滤', {
|
|
1487
1817
|
data: data
|
|
1488
1818
|
});
|
|
1489
1819
|
console.log('[Server] computeOrderQueryResult', data);
|
|
1490
1820
|
if (this.order) {
|
|
1491
|
-
|
|
1821
|
+
_context20.next = 5;
|
|
1492
1822
|
break;
|
|
1493
1823
|
}
|
|
1494
1824
|
this.logError('computeOrderQueryResult: Order 模块未注册');
|
|
1495
|
-
return
|
|
1825
|
+
return _context20.abrupt("return", {
|
|
1496
1826
|
code: 500,
|
|
1497
1827
|
message: 'Order 模块未注册',
|
|
1498
1828
|
data: {
|
|
@@ -1515,7 +1845,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1515
1845
|
size: result.size,
|
|
1516
1846
|
skip: result.skip
|
|
1517
1847
|
});
|
|
1518
|
-
return
|
|
1848
|
+
return _context20.abrupt("return", {
|
|
1519
1849
|
code: 200,
|
|
1520
1850
|
data: result,
|
|
1521
1851
|
message: '',
|
|
@@ -1523,11 +1853,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1523
1853
|
});
|
|
1524
1854
|
case 10:
|
|
1525
1855
|
case "end":
|
|
1526
|
-
return
|
|
1856
|
+
return _context20.stop();
|
|
1527
1857
|
}
|
|
1528
|
-
},
|
|
1858
|
+
}, _callee20, this);
|
|
1529
1859
|
}));
|
|
1530
|
-
function computeOrderQueryResult(
|
|
1860
|
+
function computeOrderQueryResult(_x22) {
|
|
1531
1861
|
return _computeOrderQueryResult.apply(this, arguments);
|
|
1532
1862
|
}
|
|
1533
1863
|
return computeOrderQueryResult;
|
|
@@ -1540,17 +1870,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
1540
1870
|
}, {
|
|
1541
1871
|
key: "computeBookingQueryResult",
|
|
1542
1872
|
value: (function () {
|
|
1543
|
-
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1873
|
+
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(data) {
|
|
1544
1874
|
var rawOrders, result;
|
|
1545
|
-
return _regeneratorRuntime().wrap(function
|
|
1546
|
-
while (1) switch (
|
|
1875
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1876
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1547
1877
|
case 0:
|
|
1548
1878
|
if (this.order) {
|
|
1549
|
-
|
|
1879
|
+
_context21.next = 3;
|
|
1550
1880
|
break;
|
|
1551
1881
|
}
|
|
1552
1882
|
this.logError('computeBookingQueryResult: Order 模块未注册');
|
|
1553
|
-
return
|
|
1883
|
+
return _context21.abrupt("return", {
|
|
1554
1884
|
code: 500,
|
|
1555
1885
|
message: 'Order 模块未注册',
|
|
1556
1886
|
data: {
|
|
@@ -1569,7 +1899,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1569
1899
|
size: result.size,
|
|
1570
1900
|
skip: result.skip
|
|
1571
1901
|
});
|
|
1572
|
-
return
|
|
1902
|
+
return _context21.abrupt("return", {
|
|
1573
1903
|
code: 200,
|
|
1574
1904
|
data: result,
|
|
1575
1905
|
message: '',
|
|
@@ -1577,11 +1907,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1577
1907
|
});
|
|
1578
1908
|
case 8:
|
|
1579
1909
|
case "end":
|
|
1580
|
-
return
|
|
1910
|
+
return _context21.stop();
|
|
1581
1911
|
}
|
|
1582
|
-
},
|
|
1912
|
+
}, _callee21, this);
|
|
1583
1913
|
}));
|
|
1584
|
-
function computeBookingQueryResult(
|
|
1914
|
+
function computeBookingQueryResult(_x23) {
|
|
1585
1915
|
return _computeBookingQueryResult.apply(this, arguments);
|
|
1586
1916
|
}
|
|
1587
1917
|
return computeBookingQueryResult;
|
|
@@ -1597,12 +1927,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
1597
1927
|
}, {
|
|
1598
1928
|
key: "computeProductQueryResult",
|
|
1599
1929
|
value: (function () {
|
|
1600
|
-
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1930
|
+
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(context, options) {
|
|
1601
1931
|
var _menu_list_ids$length3,
|
|
1602
1932
|
_this5 = this;
|
|
1603
1933
|
var tTotal, menu_list_ids, schedule_date, schedule_datetime, activeMenuList, tMenu, menuList, tPrice, allProductsWithPrice, tFilter, filteredProducts, tStatus, beforeStatusCount, tSort;
|
|
1604
|
-
return _regeneratorRuntime().wrap(function
|
|
1605
|
-
while (1) switch (
|
|
1934
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1935
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1606
1936
|
case 0:
|
|
1607
1937
|
tTotal = performance.now();
|
|
1608
1938
|
menu_list_ids = context.menu_list_ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime;
|
|
@@ -1613,11 +1943,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1613
1943
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
1614
1944
|
});
|
|
1615
1945
|
if (this.products) {
|
|
1616
|
-
|
|
1946
|
+
_context22.next = 6;
|
|
1617
1947
|
break;
|
|
1618
1948
|
}
|
|
1619
1949
|
this.logError('computeProductQueryResult: Products 模块未注册');
|
|
1620
|
-
return
|
|
1950
|
+
return _context22.abrupt("return", {
|
|
1621
1951
|
message: 'Products 模块未注册',
|
|
1622
1952
|
data: {
|
|
1623
1953
|
list: [],
|
|
@@ -1626,11 +1956,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1626
1956
|
});
|
|
1627
1957
|
case 6:
|
|
1628
1958
|
if (this.menu) {
|
|
1629
|
-
|
|
1959
|
+
_context22.next = 9;
|
|
1630
1960
|
break;
|
|
1631
1961
|
}
|
|
1632
1962
|
this.logError('computeProductQueryResult: Menu 模块未注册');
|
|
1633
|
-
return
|
|
1963
|
+
return _context22.abrupt("return", {
|
|
1634
1964
|
message: 'Menu 模块未注册',
|
|
1635
1965
|
data: {
|
|
1636
1966
|
list: [],
|
|
@@ -1639,11 +1969,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1639
1969
|
});
|
|
1640
1970
|
case 9:
|
|
1641
1971
|
if (this.schedule) {
|
|
1642
|
-
|
|
1972
|
+
_context22.next = 12;
|
|
1643
1973
|
break;
|
|
1644
1974
|
}
|
|
1645
1975
|
this.logError('computeProductQueryResult: Schedule 模块未注册');
|
|
1646
|
-
return
|
|
1976
|
+
return _context22.abrupt("return", {
|
|
1647
1977
|
message: 'Schedule 模块未注册',
|
|
1648
1978
|
data: {
|
|
1649
1979
|
list: [],
|
|
@@ -1665,14 +1995,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
1665
1995
|
});
|
|
1666
1996
|
}
|
|
1667
1997
|
tPrice = performance.now();
|
|
1668
|
-
|
|
1998
|
+
_context22.next = 17;
|
|
1669
1999
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
1670
2000
|
scheduleModule: this.getSchedule()
|
|
1671
2001
|
}, {
|
|
1672
2002
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
1673
2003
|
});
|
|
1674
2004
|
case 17:
|
|
1675
|
-
allProductsWithPrice =
|
|
2005
|
+
allProductsWithPrice = _context22.sent;
|
|
1676
2006
|
perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
|
|
1677
2007
|
count: allProductsWithPrice.length
|
|
1678
2008
|
});
|
|
@@ -1710,7 +2040,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1710
2040
|
filteredCount: filteredProducts.length,
|
|
1711
2041
|
activeMenuCount: activeMenuList.length
|
|
1712
2042
|
});
|
|
1713
|
-
return
|
|
2043
|
+
return _context22.abrupt("return", {
|
|
1714
2044
|
code: 200,
|
|
1715
2045
|
data: {
|
|
1716
2046
|
list: filteredProducts,
|
|
@@ -1721,11 +2051,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1721
2051
|
});
|
|
1722
2052
|
case 32:
|
|
1723
2053
|
case "end":
|
|
1724
|
-
return
|
|
2054
|
+
return _context22.stop();
|
|
1725
2055
|
}
|
|
1726
|
-
},
|
|
2056
|
+
}, _callee22, this);
|
|
1727
2057
|
}));
|
|
1728
|
-
function computeProductQueryResult(
|
|
2058
|
+
function computeProductQueryResult(_x24, _x25) {
|
|
1729
2059
|
return _computeProductQueryResult.apply(this, arguments);
|
|
1730
2060
|
}
|
|
1731
2061
|
return computeProductQueryResult;
|
|
@@ -1740,72 +2070,72 @@ var Server = /*#__PURE__*/function () {
|
|
|
1740
2070
|
}, {
|
|
1741
2071
|
key: "recomputeAndNotifyProductQuery",
|
|
1742
2072
|
value: (function () {
|
|
1743
|
-
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1744
|
-
var
|
|
1745
|
-
return _regeneratorRuntime().wrap(function
|
|
1746
|
-
while (1) switch (
|
|
2073
|
+
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(options) {
|
|
2074
|
+
var _iterator6, _step6, _step6$value, subscriberId, subscriber, result, errorMessage;
|
|
2075
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2076
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1747
2077
|
case 0:
|
|
1748
2078
|
if (!(this.productQuerySubscribers.size === 0)) {
|
|
1749
|
-
|
|
2079
|
+
_context23.next = 2;
|
|
1750
2080
|
break;
|
|
1751
2081
|
}
|
|
1752
|
-
return
|
|
2082
|
+
return _context23.abrupt("return");
|
|
1753
2083
|
case 2:
|
|
1754
2084
|
this.logInfo('recomputeAndNotifyProductQuery: 开始推送', {
|
|
1755
2085
|
subscriberCount: this.productQuerySubscribers.size,
|
|
1756
2086
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
1757
2087
|
});
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
2088
|
+
_iterator6 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
|
|
2089
|
+
_context23.prev = 4;
|
|
2090
|
+
_iterator6.s();
|
|
1761
2091
|
case 6:
|
|
1762
|
-
if ((
|
|
1763
|
-
|
|
2092
|
+
if ((_step6 = _iterator6.n()).done) {
|
|
2093
|
+
_context23.next = 22;
|
|
1764
2094
|
break;
|
|
1765
2095
|
}
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
2096
|
+
_step6$value = _slicedToArray(_step6.value, 2), subscriberId = _step6$value[0], subscriber = _step6$value[1];
|
|
2097
|
+
_context23.prev = 8;
|
|
2098
|
+
_context23.next = 11;
|
|
1769
2099
|
return this.computeProductQueryResult(subscriber.context, {
|
|
1770
2100
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
1771
2101
|
});
|
|
1772
2102
|
case 11:
|
|
1773
|
-
result =
|
|
2103
|
+
result = _context23.sent;
|
|
1774
2104
|
subscriber.callback(result);
|
|
1775
2105
|
this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
|
|
1776
2106
|
subscriberId: subscriberId
|
|
1777
2107
|
});
|
|
1778
|
-
|
|
2108
|
+
_context23.next = 20;
|
|
1779
2109
|
break;
|
|
1780
2110
|
case 16:
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
errorMessage =
|
|
2111
|
+
_context23.prev = 16;
|
|
2112
|
+
_context23.t0 = _context23["catch"](8);
|
|
2113
|
+
errorMessage = _context23.t0 instanceof Error ? _context23.t0.message : String(_context23.t0);
|
|
1784
2114
|
this.logError('recomputeAndNotifyProductQuery: 推送失败', {
|
|
1785
2115
|
subscriberId: subscriberId,
|
|
1786
2116
|
error: errorMessage
|
|
1787
2117
|
});
|
|
1788
2118
|
case 20:
|
|
1789
|
-
|
|
2119
|
+
_context23.next = 6;
|
|
1790
2120
|
break;
|
|
1791
2121
|
case 22:
|
|
1792
|
-
|
|
2122
|
+
_context23.next = 27;
|
|
1793
2123
|
break;
|
|
1794
2124
|
case 24:
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
2125
|
+
_context23.prev = 24;
|
|
2126
|
+
_context23.t1 = _context23["catch"](4);
|
|
2127
|
+
_iterator6.e(_context23.t1);
|
|
1798
2128
|
case 27:
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
return
|
|
2129
|
+
_context23.prev = 27;
|
|
2130
|
+
_iterator6.f();
|
|
2131
|
+
return _context23.finish(27);
|
|
1802
2132
|
case 30:
|
|
1803
2133
|
case "end":
|
|
1804
|
-
return
|
|
2134
|
+
return _context23.stop();
|
|
1805
2135
|
}
|
|
1806
|
-
},
|
|
2136
|
+
}, _callee23, this, [[4, 24, 27, 30], [8, 16]]);
|
|
1807
2137
|
}));
|
|
1808
|
-
function recomputeAndNotifyProductQuery(
|
|
2138
|
+
function recomputeAndNotifyProductQuery(_x26) {
|
|
1809
2139
|
return _recomputeAndNotifyProductQuery.apply(this, arguments);
|
|
1810
2140
|
}
|
|
1811
2141
|
return recomputeAndNotifyProductQuery;
|
|
@@ -1817,67 +2147,67 @@ var Server = /*#__PURE__*/function () {
|
|
|
1817
2147
|
}, {
|
|
1818
2148
|
key: "recomputeAndNotifyOrderQuery",
|
|
1819
2149
|
value: (function () {
|
|
1820
|
-
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1821
|
-
var
|
|
1822
|
-
return _regeneratorRuntime().wrap(function
|
|
1823
|
-
while (1) switch (
|
|
2150
|
+
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
2151
|
+
var _iterator7, _step7, _step7$value, subscriberId, subscriber, result, errorMessage;
|
|
2152
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2153
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1824
2154
|
case 0:
|
|
1825
2155
|
if (!(this.orderQuerySubscribers.size === 0)) {
|
|
1826
|
-
|
|
2156
|
+
_context24.next = 2;
|
|
1827
2157
|
break;
|
|
1828
2158
|
}
|
|
1829
|
-
return
|
|
2159
|
+
return _context24.abrupt("return");
|
|
1830
2160
|
case 2:
|
|
1831
2161
|
this.logInfo('recomputeAndNotifyOrderQuery: 开始推送', {
|
|
1832
2162
|
subscriberCount: this.orderQuerySubscribers.size
|
|
1833
2163
|
});
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
2164
|
+
_iterator7 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
|
|
2165
|
+
_context24.prev = 4;
|
|
2166
|
+
_iterator7.s();
|
|
1837
2167
|
case 6:
|
|
1838
|
-
if ((
|
|
1839
|
-
|
|
2168
|
+
if ((_step7 = _iterator7.n()).done) {
|
|
2169
|
+
_context24.next = 22;
|
|
1840
2170
|
break;
|
|
1841
2171
|
}
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
2172
|
+
_step7$value = _slicedToArray(_step7.value, 2), subscriberId = _step7$value[0], subscriber = _step7$value[1];
|
|
2173
|
+
_context24.prev = 8;
|
|
2174
|
+
_context24.next = 11;
|
|
1845
2175
|
return this.computeOrderQueryResult(subscriber.context);
|
|
1846
2176
|
case 11:
|
|
1847
|
-
result =
|
|
2177
|
+
result = _context24.sent;
|
|
1848
2178
|
subscriber.callback(result);
|
|
1849
2179
|
this.logInfo('recomputeAndNotifyOrderQuery: 已推送', {
|
|
1850
2180
|
subscriberId: subscriberId
|
|
1851
2181
|
});
|
|
1852
|
-
|
|
2182
|
+
_context24.next = 20;
|
|
1853
2183
|
break;
|
|
1854
2184
|
case 16:
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
errorMessage =
|
|
2185
|
+
_context24.prev = 16;
|
|
2186
|
+
_context24.t0 = _context24["catch"](8);
|
|
2187
|
+
errorMessage = _context24.t0 instanceof Error ? _context24.t0.message : String(_context24.t0);
|
|
1858
2188
|
this.logError('recomputeAndNotifyOrderQuery: 推送失败', {
|
|
1859
2189
|
subscriberId: subscriberId,
|
|
1860
2190
|
error: errorMessage
|
|
1861
2191
|
});
|
|
1862
2192
|
case 20:
|
|
1863
|
-
|
|
2193
|
+
_context24.next = 6;
|
|
1864
2194
|
break;
|
|
1865
2195
|
case 22:
|
|
1866
|
-
|
|
2196
|
+
_context24.next = 27;
|
|
1867
2197
|
break;
|
|
1868
2198
|
case 24:
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
2199
|
+
_context24.prev = 24;
|
|
2200
|
+
_context24.t1 = _context24["catch"](4);
|
|
2201
|
+
_iterator7.e(_context24.t1);
|
|
1872
2202
|
case 27:
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
return
|
|
2203
|
+
_context24.prev = 27;
|
|
2204
|
+
_iterator7.f();
|
|
2205
|
+
return _context24.finish(27);
|
|
1876
2206
|
case 30:
|
|
1877
2207
|
case "end":
|
|
1878
|
-
return
|
|
2208
|
+
return _context24.stop();
|
|
1879
2209
|
}
|
|
1880
|
-
},
|
|
2210
|
+
}, _callee24, this, [[4, 24, 27, 30], [8, 16]]);
|
|
1881
2211
|
}));
|
|
1882
2212
|
function recomputeAndNotifyOrderQuery() {
|
|
1883
2213
|
return _recomputeAndNotifyOrderQuery.apply(this, arguments);
|
|
@@ -1891,67 +2221,67 @@ var Server = /*#__PURE__*/function () {
|
|
|
1891
2221
|
}, {
|
|
1892
2222
|
key: "recomputeAndNotifyBookingQuery",
|
|
1893
2223
|
value: (function () {
|
|
1894
|
-
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1895
|
-
var
|
|
1896
|
-
return _regeneratorRuntime().wrap(function
|
|
1897
|
-
while (1) switch (
|
|
2224
|
+
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
2225
|
+
var _iterator8, _step8, _step8$value, subscriberId, subscriber, result, errorMessage;
|
|
2226
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2227
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1898
2228
|
case 0:
|
|
1899
2229
|
if (!(this.bookingQuerySubscribers.size === 0)) {
|
|
1900
|
-
|
|
2230
|
+
_context25.next = 2;
|
|
1901
2231
|
break;
|
|
1902
2232
|
}
|
|
1903
|
-
return
|
|
2233
|
+
return _context25.abrupt("return");
|
|
1904
2234
|
case 2:
|
|
1905
2235
|
this.logInfo('recomputeAndNotifyBookingQuery: 开始推送', {
|
|
1906
2236
|
subscriberCount: this.bookingQuerySubscribers.size
|
|
1907
2237
|
});
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
2238
|
+
_iterator8 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
|
|
2239
|
+
_context25.prev = 4;
|
|
2240
|
+
_iterator8.s();
|
|
1911
2241
|
case 6:
|
|
1912
|
-
if ((
|
|
1913
|
-
|
|
2242
|
+
if ((_step8 = _iterator8.n()).done) {
|
|
2243
|
+
_context25.next = 22;
|
|
1914
2244
|
break;
|
|
1915
2245
|
}
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
2246
|
+
_step8$value = _slicedToArray(_step8.value, 2), subscriberId = _step8$value[0], subscriber = _step8$value[1];
|
|
2247
|
+
_context25.prev = 8;
|
|
2248
|
+
_context25.next = 11;
|
|
1919
2249
|
return this.computeBookingQueryResult(subscriber.context);
|
|
1920
2250
|
case 11:
|
|
1921
|
-
result =
|
|
2251
|
+
result = _context25.sent;
|
|
1922
2252
|
subscriber.callback(result);
|
|
1923
2253
|
this.logInfo('recomputeAndNotifyBookingQuery: 已推送', {
|
|
1924
2254
|
subscriberId: subscriberId
|
|
1925
2255
|
});
|
|
1926
|
-
|
|
2256
|
+
_context25.next = 20;
|
|
1927
2257
|
break;
|
|
1928
2258
|
case 16:
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
errorMessage =
|
|
2259
|
+
_context25.prev = 16;
|
|
2260
|
+
_context25.t0 = _context25["catch"](8);
|
|
2261
|
+
errorMessage = _context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0);
|
|
1932
2262
|
this.logError('recomputeAndNotifyBookingQuery: 推送失败', {
|
|
1933
2263
|
subscriberId: subscriberId,
|
|
1934
2264
|
error: errorMessage
|
|
1935
2265
|
});
|
|
1936
2266
|
case 20:
|
|
1937
|
-
|
|
2267
|
+
_context25.next = 6;
|
|
1938
2268
|
break;
|
|
1939
2269
|
case 22:
|
|
1940
|
-
|
|
2270
|
+
_context25.next = 27;
|
|
1941
2271
|
break;
|
|
1942
2272
|
case 24:
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
2273
|
+
_context25.prev = 24;
|
|
2274
|
+
_context25.t1 = _context25["catch"](4);
|
|
2275
|
+
_iterator8.e(_context25.t1);
|
|
1946
2276
|
case 27:
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
return
|
|
2277
|
+
_context25.prev = 27;
|
|
2278
|
+
_iterator8.f();
|
|
2279
|
+
return _context25.finish(27);
|
|
1950
2280
|
case 30:
|
|
1951
2281
|
case "end":
|
|
1952
|
-
return
|
|
2282
|
+
return _context25.stop();
|
|
1953
2283
|
}
|
|
1954
|
-
},
|
|
2284
|
+
}, _callee25, this, [[4, 24, 27, 30], [8, 16]]);
|
|
1955
2285
|
}));
|
|
1956
2286
|
function recomputeAndNotifyBookingQuery() {
|
|
1957
2287
|
return _recomputeAndNotifyBookingQuery.apply(this, arguments);
|
|
@@ -1983,11 +2313,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1983
2313
|
var allowedProductIds = new Set();
|
|
1984
2314
|
var allowedCollectionIds = new Set();
|
|
1985
2315
|
var hasProductAll = false;
|
|
1986
|
-
var
|
|
1987
|
-
|
|
2316
|
+
var _iterator9 = _createForOfIteratorHelper(activeMenuList),
|
|
2317
|
+
_step9;
|
|
1988
2318
|
try {
|
|
1989
|
-
for (
|
|
1990
|
-
var menu =
|
|
2319
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
2320
|
+
var menu = _step9.value;
|
|
1991
2321
|
var config = menu.partyroom_package;
|
|
1992
2322
|
if (!config) {
|
|
1993
2323
|
console.warn('[Server] 餐牌缺少 partyroom_package 配置:', menu);
|
|
@@ -2047,9 +2377,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
2047
2377
|
|
|
2048
2378
|
// 如果有餐牌允许所有商品,返回所有商品
|
|
2049
2379
|
} catch (err) {
|
|
2050
|
-
|
|
2380
|
+
_iterator9.e(err);
|
|
2051
2381
|
} finally {
|
|
2052
|
-
|
|
2382
|
+
_iterator9.f();
|
|
2053
2383
|
}
|
|
2054
2384
|
if (hasProductAll) {
|
|
2055
2385
|
this.logInfo('filterProductsByMenuConfig: 返回所有商品(product_all)', {
|
|
@@ -2119,7 +2449,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2119
2449
|
metadata: metadata || {}
|
|
2120
2450
|
});
|
|
2121
2451
|
}
|
|
2122
|
-
} catch (
|
|
2452
|
+
} catch (_unused2) {
|
|
2123
2453
|
// 日志记录失败不影响主流程
|
|
2124
2454
|
}
|
|
2125
2455
|
}
|
|
@@ -2140,7 +2470,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2140
2470
|
metadata: metadata || {}
|
|
2141
2471
|
});
|
|
2142
2472
|
}
|
|
2143
|
-
} catch (
|
|
2473
|
+
} catch (_unused3) {
|
|
2144
2474
|
// 日志记录失败不影响主流程
|
|
2145
2475
|
}
|
|
2146
2476
|
}
|
|
@@ -2161,7 +2491,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2161
2491
|
metadata: metadata || {}
|
|
2162
2492
|
});
|
|
2163
2493
|
}
|
|
2164
|
-
} catch (
|
|
2494
|
+
} catch (_unused4) {
|
|
2165
2495
|
// 日志记录失败不影响主流程
|
|
2166
2496
|
}
|
|
2167
2497
|
}
|