@pisell/pisellos 2.2.93 → 2.2.94

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.
Files changed (69) hide show
  1. package/dist/core/index.d.ts +0 -1
  2. package/dist/core/index.js +0 -7
  3. package/dist/modules/Customer/index.d.ts +0 -1
  4. package/dist/modules/Customer/index.js +12 -28
  5. package/dist/plugins/app-types/app/app.d.ts +1 -0
  6. package/dist/server/index.d.ts +55 -5
  7. package/dist/server/index.js +832 -236
  8. package/dist/server/modules/index.d.ts +6 -0
  9. package/dist/server/modules/index.js +7 -0
  10. package/dist/server/modules/order/index.d.ts +87 -0
  11. package/dist/server/modules/order/index.js +916 -0
  12. package/dist/server/modules/order/types.d.ts +530 -0
  13. package/dist/server/modules/order/types.js +141 -0
  14. package/dist/server/modules/order/utils/filterBookings.d.ts +6 -0
  15. package/dist/server/modules/order/utils/filterBookings.js +350 -0
  16. package/dist/server/modules/order/utils/filterOrders.d.ts +15 -0
  17. package/dist/server/modules/order/utils/filterOrders.js +226 -0
  18. package/dist/server/modules/products/index.d.ts +24 -19
  19. package/dist/server/modules/products/index.js +600 -429
  20. package/dist/server/modules/products/types.d.ts +0 -1
  21. package/dist/server/modules/resource/index.d.ts +88 -0
  22. package/dist/server/modules/resource/index.js +1202 -0
  23. package/dist/server/modules/resource/types.d.ts +121 -0
  24. package/dist/server/modules/resource/types.js +47 -0
  25. package/dist/server/utils/product.d.ts +0 -4
  26. package/dist/server/utils/product.js +0 -34
  27. package/dist/solution/BookingTicket/index.d.ts +1 -1
  28. package/dist/solution/Sales/index.d.ts +96 -0
  29. package/dist/solution/Sales/index.js +510 -0
  30. package/dist/solution/Sales/types.d.ts +65 -0
  31. package/dist/solution/Sales/types.js +26 -0
  32. package/dist/solution/index.d.ts +1 -0
  33. package/dist/solution/index.js +2 -1
  34. package/dist/types/index.d.ts +0 -2
  35. package/lib/core/index.d.ts +0 -1
  36. package/lib/core/index.js +0 -4
  37. package/lib/modules/Customer/index.d.ts +0 -1
  38. package/lib/modules/Customer/index.js +6 -21
  39. package/lib/plugins/app-types/app/app.d.ts +1 -0
  40. package/lib/server/index.d.ts +55 -5
  41. package/lib/server/index.js +350 -28
  42. package/lib/server/modules/index.d.ts +6 -0
  43. package/lib/server/modules/index.js +16 -2
  44. package/lib/server/modules/order/index.d.ts +87 -0
  45. package/lib/server/modules/order/index.js +543 -0
  46. package/lib/server/modules/order/types.d.ts +530 -0
  47. package/lib/server/modules/order/types.js +34 -0
  48. package/lib/server/modules/order/utils/filterBookings.d.ts +6 -0
  49. package/lib/server/modules/order/utils/filterBookings.js +320 -0
  50. package/lib/server/modules/order/utils/filterOrders.d.ts +15 -0
  51. package/lib/server/modules/order/utils/filterOrders.js +197 -0
  52. package/lib/server/modules/products/index.d.ts +24 -19
  53. package/lib/server/modules/products/index.js +150 -151
  54. package/lib/server/modules/products/types.d.ts +0 -1
  55. package/lib/server/modules/resource/index.d.ts +88 -0
  56. package/lib/server/modules/resource/index.js +571 -0
  57. package/lib/server/modules/resource/types.d.ts +121 -0
  58. package/lib/server/modules/resource/types.js +35 -0
  59. package/lib/server/utils/product.d.ts +0 -4
  60. package/lib/server/utils/product.js +0 -27
  61. package/lib/solution/BookingTicket/index.d.ts +1 -1
  62. package/lib/solution/Sales/index.d.ts +96 -0
  63. package/lib/solution/Sales/index.js +358 -0
  64. package/lib/solution/Sales/types.d.ts +65 -0
  65. package/lib/solution/Sales/types.js +35 -0
  66. package/lib/solution/index.d.ts +1 -0
  67. package/lib/solution/index.js +3 -1
  68. package/lib/types/index.d.ts +0 -2
  69. package/package.json +1 -1
@@ -17,17 +17,27 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
17
17
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
18
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
19
19
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
+ import dayjs from 'dayjs';
20
21
  import { ProductsModule } from "./modules/products";
21
22
  import { MenuModule } from "./modules/menu";
22
23
  import { QuotationModule } from "./modules/quotation";
23
24
  import { ScheduleModuleEx } from "./modules/schedule";
25
+ import { ResourceModule } from "./modules/resource";
24
26
  import { extractScheduleIdsFromMenus, extractTimePointsFromSchedules } from "./utils/schedule";
25
27
  import { ProductsHooks } from "./modules/products/types";
26
28
  import { perfMark } from "./utils/product";
29
+ import { OrderModule } from "./modules/order";
30
+ import { OrderHooks } from "./modules/order/types";
31
+ import { filterOrders } from "./modules/order/utils/filterOrders";
32
+ import { filterBookingsFromOrders, sortBookings, flattenOrdersToBookings } from "./modules/order/utils/filterBookings";
27
33
 
28
34
  // 重新导出类型供外部使用
29
35
 
30
36
  /** 商品查询订阅者 */
37
+
38
+ /** 订单列表查询订阅者 */
39
+
40
+ /** 预约列表查询订阅者 */
31
41
  /**
32
42
  * Server 类
33
43
  * 用于注册和管理服务端模块
@@ -47,6 +57,8 @@ var Server = /*#__PURE__*/function () {
47
57
  _defineProperty(this, "menu", void 0);
48
58
  _defineProperty(this, "quotation", void 0);
49
59
  _defineProperty(this, "schedule", void 0);
60
+ _defineProperty(this, "resource", void 0);
61
+ _defineProperty(this, "order", void 0);
50
62
  // 路由注册表
51
63
  _defineProperty(this, "router", {
52
64
  get: {},
@@ -56,6 +68,9 @@ var Server = /*#__PURE__*/function () {
56
68
  });
57
69
  // ---- 商品查询订阅者 ----
58
70
  _defineProperty(this, "productQuerySubscribers", new Map());
71
+ // ---- 订单 / 预约列表查询订阅者 ----
72
+ _defineProperty(this, "orderQuerySubscribers", new Map());
73
+ _defineProperty(this, "bookingQuerySubscribers", new Map());
59
74
  // 模块注册表 - 定义所有可用的模块配置
60
75
  _defineProperty(this, "moduleRegistry", {
61
76
  products: {
@@ -96,6 +111,26 @@ var Server = /*#__PURE__*/function () {
96
111
  availabilityDateList: [],
97
112
  otherProductsIds: []
98
113
  }
114
+ },
115
+ order: {
116
+ name: 'order',
117
+ moduleClass: OrderModule,
118
+ moduleName: 'server_order',
119
+ version: '1.0.0',
120
+ defaultStore: {
121
+ list: []
122
+ }
123
+ },
124
+ resource: {
125
+ name: 'resource',
126
+ moduleClass: ResourceModule,
127
+ moduleName: 'server_resource',
128
+ version: '1.0.0',
129
+ defaultStore: {
130
+ list: [],
131
+ map: new Map(),
132
+ bookings: []
133
+ }
99
134
  }
100
135
  });
101
136
  /**
@@ -175,18 +210,211 @@ var Server = /*#__PURE__*/function () {
175
210
  return _ref5.apply(this, arguments);
176
211
  };
177
212
  }());
213
+ /**
214
+ * 处理订单列表查询
215
+ * 存储订阅者信息,本地计算结果;数据变更时通过 callback 推送
216
+ */
217
+ _defineProperty(this, "handleOrderList", /*#__PURE__*/function () {
218
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref7) {
219
+ var url, method, data, config, queryPayload, _ref9, callback, subscriberId;
220
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
221
+ while (1) switch (_context3.prev = _context3.next) {
222
+ case 0:
223
+ url = _ref7.url, method = _ref7.method, data = _ref7.data, config = _ref7.config;
224
+ console.log('[Server] handleOrderList:', url, method, data, config);
225
+ queryPayload = data && _typeof(data) === 'object' ? _objectSpread({}, data) : {};
226
+ _ref9 = config || {}, callback = _ref9.callback, subscriberId = _ref9.subscriberId;
227
+ _this.logInfo('handleOrderList: 开始处理订单列表请求', {
228
+ data: queryPayload
229
+ });
230
+ if (subscriberId && typeof callback === 'function') {
231
+ _this.orderQuerySubscribers.set(subscriberId, {
232
+ callback: callback,
233
+ context: queryPayload
234
+ });
235
+ _this.logInfo('handleOrderList: 已注册订阅者', {
236
+ subscriberId: subscriberId,
237
+ totalSubscribers: _this.orderQuerySubscribers.size
238
+ });
239
+ }
240
+ return _context3.abrupt("return", _this.computeOrderQueryResult(queryPayload));
241
+ case 7:
242
+ case "end":
243
+ return _context3.stop();
244
+ }
245
+ }, _callee3);
246
+ }));
247
+ return function (_x3) {
248
+ return _ref8.apply(this, arguments);
249
+ };
250
+ }());
251
+ /**
252
+ * 取消订单列表查询订阅(HTTP 路由入口)
253
+ */
254
+ _defineProperty(this, "handleUnsubscribeOrderQuery", /*#__PURE__*/function () {
255
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref10) {
256
+ var data, _ref12, subscriberId;
257
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
258
+ while (1) switch (_context4.prev = _context4.next) {
259
+ case 0:
260
+ data = _ref10.data;
261
+ _ref12 = data || {}, subscriberId = _ref12.subscriberId;
262
+ if (subscriberId) {
263
+ _this.orderQuerySubscribers.delete(subscriberId);
264
+ _this.logInfo('handleUnsubscribeOrderQuery: 已移除订阅者', {
265
+ subscriberId: subscriberId,
266
+ remaining: _this.orderQuerySubscribers.size
267
+ });
268
+ }
269
+ return _context4.abrupt("return", {
270
+ code: 200,
271
+ message: 'ok',
272
+ status: true
273
+ });
274
+ case 4:
275
+ case "end":
276
+ return _context4.stop();
277
+ }
278
+ }, _callee4);
279
+ }));
280
+ return function (_x4) {
281
+ return _ref11.apply(this, arguments);
282
+ };
283
+ }());
284
+ /**
285
+ * 处理预约列表查询
286
+ * 今天:注册订阅者 + 本地数据筛选;非今天:清理订阅者 + 走真实 API
287
+ */
288
+ _defineProperty(this, "handleBookingList", /*#__PURE__*/function () {
289
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref13) {
290
+ var url, method, data, config, queryPayload, _ref15, callback, subscriberId, isToday;
291
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
292
+ while (1) switch (_context5.prev = _context5.next) {
293
+ case 0:
294
+ url = _ref13.url, method = _ref13.method, data = _ref13.data, config = _ref13.config;
295
+ console.log('[Server] handleBookingList:', url, method, data, config);
296
+ queryPayload = data && _typeof(data) === 'object' ? _objectSpread({}, data) : {};
297
+ _ref15 = config || {}, callback = _ref15.callback, subscriberId = _ref15.subscriberId;
298
+ isToday = _this.isBookingQueryForToday(queryPayload);
299
+ _this.logInfo('handleBookingList: 开始处理预约列表请求', {
300
+ data: queryPayload,
301
+ isToday: isToday
302
+ });
303
+ if (!isToday) {
304
+ _context5.next = 11;
305
+ break;
306
+ }
307
+ if (subscriberId && typeof callback === 'function') {
308
+ _this.bookingQuerySubscribers.set(subscriberId, {
309
+ callback: callback,
310
+ context: queryPayload
311
+ });
312
+ _this.logInfo('handleBookingList: 已注册订阅者(今天)', {
313
+ subscriberId: subscriberId,
314
+ totalSubscribers: _this.bookingQuerySubscribers.size
315
+ });
316
+ }
317
+ return _context5.abrupt("return", _this.computeBookingQueryResult(queryPayload));
318
+ case 11:
319
+ if (subscriberId) {
320
+ _this.bookingQuerySubscribers.delete(subscriberId);
321
+ _this.logInfo('handleBookingList: 已清理订阅者(非今天)', {
322
+ subscriberId: subscriberId,
323
+ remaining: _this.bookingQuerySubscribers.size
324
+ });
325
+ }
326
+ return _context5.abrupt("return", _this.fetchBookingListFromAPI(queryPayload));
327
+ case 13:
328
+ case "end":
329
+ return _context5.stop();
330
+ }
331
+ }, _callee5);
332
+ }));
333
+ return function (_x5) {
334
+ return _ref14.apply(this, arguments);
335
+ };
336
+ }());
337
+ /**
338
+ * 处理资源列表查询
339
+ * 转发到资源模块去
340
+ */
341
+ _defineProperty(this, "handleResourceList", /*#__PURE__*/function () {
342
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref16) {
343
+ var _this$resource;
344
+ var url, method, data, config, list;
345
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
346
+ while (1) switch (_context6.prev = _context6.next) {
347
+ case 0:
348
+ url = _ref16.url, method = _ref16.method, data = _ref16.data, config = _ref16.config;
349
+ console.log('[Server] handleResourceList:', url, method, data, config);
350
+ list = (_this$resource = _this.resource) === null || _this$resource === void 0 ? void 0 : _this$resource.getResources({
351
+ skip: (data === null || data === void 0 ? void 0 : data.skip) || 1,
352
+ num: (data === null || data === void 0 ? void 0 : data.num) || 10
353
+ });
354
+ return _context6.abrupt("return", {
355
+ code: 200,
356
+ data: {
357
+ list: list,
358
+ count: (list === null || list === void 0 ? void 0 : list.length) || 0
359
+ },
360
+ message: '',
361
+ status: true
362
+ });
363
+ case 4:
364
+ case "end":
365
+ return _context6.stop();
366
+ }
367
+ }, _callee6);
368
+ }));
369
+ return function (_x6) {
370
+ return _ref17.apply(this, arguments);
371
+ };
372
+ }());
373
+ /**
374
+ * 取消预约列表查询订阅(HTTP 路由入口)
375
+ */
376
+ _defineProperty(this, "handleUnsubscribeBookingQuery", /*#__PURE__*/function () {
377
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref18) {
378
+ var data, _ref20, subscriberId;
379
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
380
+ while (1) switch (_context7.prev = _context7.next) {
381
+ case 0:
382
+ data = _ref18.data;
383
+ _ref20 = data || {}, subscriberId = _ref20.subscriberId;
384
+ if (subscriberId) {
385
+ _this.bookingQuerySubscribers.delete(subscriberId);
386
+ _this.logInfo('handleUnsubscribeBookingQuery: 已移除订阅者', {
387
+ subscriberId: subscriberId,
388
+ remaining: _this.bookingQuerySubscribers.size
389
+ });
390
+ }
391
+ return _context7.abrupt("return", {
392
+ code: 200,
393
+ message: 'ok',
394
+ status: true
395
+ });
396
+ case 4:
397
+ case "end":
398
+ return _context7.stop();
399
+ }
400
+ }, _callee7);
401
+ }));
402
+ return function (_x7) {
403
+ return _ref19.apply(this, arguments);
404
+ };
405
+ }());
178
406
  /**
179
407
  * 处理获取日程时间段点的请求
180
408
  * 通过餐牌ID列表获取所有相关日程的时间段点
181
409
  */
182
410
  _defineProperty(this, "handleGetScheduleTimePoints", /*#__PURE__*/function () {
183
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref7) {
411
+ var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref21) {
184
412
  var _menu_list_ids$length;
185
413
  var url, method, data, config, menu_list_ids, _menu_list_ids$length2, menuList, scheduleIds, scheduleList, timePoints, errorMessage;
186
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
187
- while (1) switch (_context3.prev = _context3.next) {
414
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
415
+ while (1) switch (_context8.prev = _context8.next) {
188
416
  case 0:
189
- url = _ref7.url, method = _ref7.method, data = _ref7.data, config = _ref7.config;
417
+ url = _ref21.url, method = _ref21.method, data = _ref21.data, config = _ref21.config;
190
418
  console.log('[Server] handleGetScheduleTimePoints:', url, method, data, config);
191
419
  menu_list_ids = data.menu_list_ids;
192
420
  _this.logInfo('handleGetScheduleTimePoints 开始处理', {
@@ -196,12 +424,12 @@ var Server = /*#__PURE__*/function () {
196
424
 
197
425
  // 检查必要的模块是否已注册
198
426
  if (_this.menu) {
199
- _context3.next = 8;
427
+ _context8.next = 8;
200
428
  break;
201
429
  }
202
430
  console.error('[Server] Menu 模块未注册');
203
431
  _this.logError('handleGetScheduleTimePoints: Menu 模块未注册');
204
- return _context3.abrupt("return", {
432
+ return _context8.abrupt("return", {
205
433
  code: 500,
206
434
  message: 'Menu 模块未注册',
207
435
  data: [],
@@ -209,12 +437,12 @@ var Server = /*#__PURE__*/function () {
209
437
  });
210
438
  case 8:
211
439
  if (_this.schedule) {
212
- _context3.next = 12;
440
+ _context8.next = 12;
213
441
  break;
214
442
  }
215
443
  console.error('[Server] Schedule 模块未注册');
216
444
  _this.logError('handleGetScheduleTimePoints: Schedule 模块未注册');
217
- return _context3.abrupt("return", {
445
+ return _context8.abrupt("return", {
218
446
  code: 500,
219
447
  message: 'Schedule 模块未注册',
220
448
  data: [],
@@ -222,7 +450,7 @@ var Server = /*#__PURE__*/function () {
222
450
  });
223
451
  case 12:
224
452
  if (!(!menu_list_ids || !Array.isArray(menu_list_ids) || menu_list_ids.length === 0)) {
225
- _context3.next = 16;
453
+ _context8.next = 16;
226
454
  break;
227
455
  }
228
456
  console.error('[Server] menu_list_ids 参数无效');
@@ -230,14 +458,14 @@ var Server = /*#__PURE__*/function () {
230
458
  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,
231
459
  menu_list_ids: menu_list_ids
232
460
  });
233
- return _context3.abrupt("return", {
461
+ return _context8.abrupt("return", {
234
462
  code: 400,
235
463
  message: 'menu_list_ids 参数无效',
236
464
  data: [],
237
465
  status: false
238
466
  });
239
467
  case 16:
240
- _context3.prev = 16;
468
+ _context8.prev = 16;
241
469
  // 1. 获取餐牌列表
242
470
  menuList = _this.menu.getMenuByIds(menu_list_ids);
243
471
  console.log("[Server] \u627E\u5230 ".concat(menuList.length, " \u4E2A\u9910\u724C"));
@@ -255,13 +483,13 @@ var Server = /*#__PURE__*/function () {
255
483
  scheduleCount: scheduleIds.length
256
484
  });
257
485
  if (!(scheduleIds.length === 0)) {
258
- _context3.next = 26;
486
+ _context8.next = 26;
259
487
  break;
260
488
  }
261
489
  _this.logInfo('handleGetScheduleTimePoints: 没有找到相关日程', {
262
490
  menuListIdsCount: menu_list_ids.length
263
491
  });
264
- return _context3.abrupt("return", {
492
+ return _context8.abrupt("return", {
265
493
  code: 200,
266
494
  message: '没有找到相关日程',
267
495
  data: [],
@@ -285,22 +513,22 @@ var Server = /*#__PURE__*/function () {
285
513
  scheduleCount: scheduleList.length,
286
514
  timePointCount: timePoints.length
287
515
  });
288
- return _context3.abrupt("return", {
516
+ return _context8.abrupt("return", {
289
517
  code: 200,
290
518
  message: '获取成功',
291
519
  data: timePoints,
292
520
  status: true
293
521
  });
294
522
  case 35:
295
- _context3.prev = 35;
296
- _context3.t0 = _context3["catch"](16);
297
- errorMessage = _context3.t0 instanceof Error ? _context3.t0.message : '未知错误';
298
- console.error('[Server] 获取日程时间点失败:', _context3.t0);
523
+ _context8.prev = 35;
524
+ _context8.t0 = _context8["catch"](16);
525
+ errorMessage = _context8.t0 instanceof Error ? _context8.t0.message : '未知错误';
526
+ console.error('[Server] 获取日程时间点失败:', _context8.t0);
299
527
  _this.logError('handleGetScheduleTimePoints: 获取日程时间点失败', {
300
528
  menuListIdsCount: menu_list_ids.length,
301
529
  error: errorMessage
302
530
  });
303
- return _context3.abrupt("return", {
531
+ return _context8.abrupt("return", {
304
532
  code: 500,
305
533
  message: "\u83B7\u53D6\u5931\u8D25: ".concat(errorMessage),
306
534
  data: [],
@@ -308,12 +536,12 @@ var Server = /*#__PURE__*/function () {
308
536
  });
309
537
  case 41:
310
538
  case "end":
311
- return _context3.stop();
539
+ return _context8.stop();
312
540
  }
313
- }, _callee3, null, [[16, 35]]);
541
+ }, _callee8, null, [[16, 35]]);
314
542
  }));
315
- return function (_x3) {
316
- return _ref8.apply(this, arguments);
543
+ return function (_x8) {
544
+ return _ref22.apply(this, arguments);
317
545
  };
318
546
  }());
319
547
  this.core = core;
@@ -374,10 +602,10 @@ var Server = /*#__PURE__*/function () {
374
602
  }, {
375
603
  key: "registerModuleWithRoutes",
376
604
  value: (function () {
377
- var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(module, options, moduleName) {
605
+ var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(module, options, moduleName) {
378
606
  var routes;
379
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
380
- while (1) switch (_context4.prev = _context4.next) {
607
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
608
+ while (1) switch (_context9.prev = _context9.next) {
381
609
  case 0:
382
610
  this.logInfo("\u5F00\u59CB\u6CE8\u518C\u6A21\u5757: ".concat(moduleName), {
383
611
  moduleName: moduleName,
@@ -385,7 +613,7 @@ var Server = /*#__PURE__*/function () {
385
613
  });
386
614
 
387
615
  // 注册模块到 Core
388
- _context4.next = 3;
616
+ _context9.next = 3;
389
617
  return this.core.registerModule(module, options);
390
618
  case 3:
391
619
  console.log("[Server] \u2705 ".concat(moduleName, " \u6A21\u5757\u5DF2\u6CE8\u518C"));
@@ -406,11 +634,11 @@ var Server = /*#__PURE__*/function () {
406
634
  }
407
635
  case 6:
408
636
  case "end":
409
- return _context4.stop();
637
+ return _context9.stop();
410
638
  }
411
- }, _callee4, this);
639
+ }, _callee9, this);
412
640
  }));
413
- function registerModuleWithRoutes(_x4, _x5, _x6) {
641
+ function registerModuleWithRoutes(_x9, _x10, _x11) {
414
642
  return _registerModuleWithRoutes.apply(this, arguments);
415
643
  }
416
644
  return registerModuleWithRoutes;
@@ -423,10 +651,10 @@ var Server = /*#__PURE__*/function () {
423
651
  }, {
424
652
  key: "registerModuleByName",
425
653
  value: (function () {
426
- var _registerModuleByName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(moduleConfig) {
654
+ var _registerModuleByName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(moduleConfig) {
427
655
  var moduleName, shouldPreload, customConfig, registryConfig, ModuleClass, moduleInstance, moduleOptions;
428
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
429
- while (1) switch (_context5.prev = _context5.next) {
656
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
657
+ while (1) switch (_context10.prev = _context10.next) {
430
658
  case 0:
431
659
  // 解析配置
432
660
  moduleName = typeof moduleConfig === 'string' ? moduleConfig : moduleConfig.name;
@@ -441,7 +669,7 @@ var Server = /*#__PURE__*/function () {
441
669
  // 查找模块配置
442
670
  registryConfig = this.moduleRegistry[moduleName];
443
671
  if (registryConfig) {
444
- _context5.next = 8;
672
+ _context10.next = 8;
445
673
  break;
446
674
  }
447
675
  this.logError("\u672A\u627E\u5230\u6A21\u5757\u914D\u7F6E: ".concat(moduleName), {
@@ -455,7 +683,7 @@ var Server = /*#__PURE__*/function () {
455
683
  moduleOptions = _objectSpread({
456
684
  store: _objectSpread({}, registryConfig.defaultStore)
457
685
  }, customConfig); // 注册模块和路由
458
- _context5.next = 13;
686
+ _context10.next = 13;
459
687
  return this.registerModuleWithRoutes(moduleInstance, moduleOptions, moduleName.charAt(0).toUpperCase() + moduleName.slice(1));
460
688
  case 13:
461
689
  // 保存模块实例
@@ -465,18 +693,18 @@ var Server = /*#__PURE__*/function () {
465
693
  shouldPreload: shouldPreload,
466
694
  version: registryConfig.version
467
695
  });
468
- return _context5.abrupt("return", {
696
+ return _context10.abrupt("return", {
469
697
  module: moduleInstance,
470
698
  config: registryConfig,
471
699
  shouldPreload: shouldPreload
472
700
  });
473
701
  case 16:
474
702
  case "end":
475
- return _context5.stop();
703
+ return _context10.stop();
476
704
  }
477
- }, _callee5, this);
705
+ }, _callee10, this);
478
706
  }));
479
- function registerModuleByName(_x7) {
707
+ function registerModuleByName(_x12) {
480
708
  return _registerModuleByName.apply(this, arguments);
481
709
  }
482
710
  return registerModuleByName;
@@ -489,10 +717,10 @@ var Server = /*#__PURE__*/function () {
489
717
  }, {
490
718
  key: "registerModules",
491
719
  value: (function () {
492
- var _registerModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(moduleConfigs) {
720
+ var _registerModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(moduleConfigs) {
493
721
  var configs, registeredModules, _iterator, _step, config, configName, result, errorMessage;
494
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
495
- while (1) switch (_context6.prev = _context6.next) {
722
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
723
+ while (1) switch (_context11.prev = _context11.next) {
496
724
  case 0:
497
725
  console.log('[Server] 开始注册模块...');
498
726
 
@@ -504,47 +732,47 @@ var Server = /*#__PURE__*/function () {
504
732
  });
505
733
  registeredModules = [];
506
734
  _iterator = _createForOfIteratorHelper(configs);
507
- _context6.prev = 5;
735
+ _context11.prev = 5;
508
736
  _iterator.s();
509
737
  case 7:
510
738
  if ((_step = _iterator.n()).done) {
511
- _context6.next = 25;
739
+ _context11.next = 25;
512
740
  break;
513
741
  }
514
742
  config = _step.value;
515
743
  configName = typeof config === 'string' ? config : config.name;
516
- _context6.prev = 10;
517
- _context6.next = 13;
744
+ _context11.prev = 10;
745
+ _context11.next = 13;
518
746
  return this.registerModuleByName(config);
519
747
  case 13:
520
- result = _context6.sent;
748
+ result = _context11.sent;
521
749
  registeredModules.push(result);
522
- _context6.next = 23;
750
+ _context11.next = 23;
523
751
  break;
524
752
  case 17:
525
- _context6.prev = 17;
526
- _context6.t0 = _context6["catch"](10);
527
- errorMessage = _context6.t0 instanceof Error ? _context6.t0.message : String(_context6.t0);
753
+ _context11.prev = 17;
754
+ _context11.t0 = _context11["catch"](10);
755
+ errorMessage = _context11.t0 instanceof Error ? _context11.t0.message : String(_context11.t0);
528
756
  this.logError("\u6A21\u5757\u6CE8\u518C\u5931\u8D25: ".concat(configName), {
529
757
  moduleName: configName,
530
758
  error: errorMessage
531
759
  });
532
- console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:", _context6.t0);
533
- throw _context6.t0;
760
+ console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:", _context11.t0);
761
+ throw _context11.t0;
534
762
  case 23:
535
- _context6.next = 7;
763
+ _context11.next = 7;
536
764
  break;
537
765
  case 25:
538
- _context6.next = 30;
766
+ _context11.next = 30;
539
767
  break;
540
768
  case 27:
541
- _context6.prev = 27;
542
- _context6.t1 = _context6["catch"](5);
543
- _iterator.e(_context6.t1);
769
+ _context11.prev = 27;
770
+ _context11.t1 = _context11["catch"](5);
771
+ _iterator.e(_context11.t1);
544
772
  case 30:
545
- _context6.prev = 30;
773
+ _context11.prev = 30;
546
774
  _iterator.f();
547
- return _context6.finish(30);
775
+ return _context11.finish(30);
548
776
  case 33:
549
777
  console.log('[Server] ✅ 所有模块注册完成');
550
778
  this.logInfo('所有模块注册完成', {
@@ -554,14 +782,14 @@ var Server = /*#__PURE__*/function () {
554
782
  return m === null || m === void 0 || (_m$config = m.config) === null || _m$config === void 0 ? void 0 : _m$config.name;
555
783
  })
556
784
  });
557
- return _context6.abrupt("return", registeredModules);
785
+ return _context11.abrupt("return", registeredModules);
558
786
  case 36:
559
787
  case "end":
560
- return _context6.stop();
788
+ return _context11.stop();
561
789
  }
562
- }, _callee6, this, [[5, 27, 30, 33], [10, 17]]);
790
+ }, _callee11, this, [[5, 27, 30, 33], [10, 17]]);
563
791
  }));
564
- function registerModules(_x8) {
792
+ function registerModules(_x13) {
565
793
  return _registerModules.apply(this, arguments);
566
794
  }
567
795
  return registerModules;
@@ -574,10 +802,10 @@ var Server = /*#__PURE__*/function () {
574
802
  }, {
575
803
  key: "preloadModulesData",
576
804
  value: (function () {
577
- var _preloadModulesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(registeredModules, options) {
805
+ var _preloadModulesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(registeredModules, options) {
578
806
  var modulesToPreload, preloadResults, _iterator2, _step2, _step2$value, module, config, shouldPreload, startTime, _options$onModuleLoad, _options$onModuleLoad2, duration, _duration, errorMessage, successCount, failCount;
579
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
580
- while (1) switch (_context7.prev = _context7.next) {
807
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
808
+ while (1) switch (_context12.prev = _context12.next) {
581
809
  case 0:
582
810
  console.log('[Server] 开始预加载模块数据...');
583
811
  modulesToPreload = registeredModules.filter(function (m) {
@@ -590,16 +818,16 @@ var Server = /*#__PURE__*/function () {
590
818
  });
591
819
  preloadResults = [];
592
820
  _iterator2 = _createForOfIteratorHelper(registeredModules);
593
- _context7.prev = 5;
821
+ _context12.prev = 5;
594
822
  _iterator2.s();
595
823
  case 7:
596
824
  if ((_step2 = _iterator2.n()).done) {
597
- _context7.next = 40;
825
+ _context12.next = 40;
598
826
  break;
599
827
  }
600
828
  _step2$value = _step2.value, module = _step2$value.module, config = _step2$value.config, shouldPreload = _step2$value.shouldPreload;
601
829
  if (shouldPreload) {
602
- _context7.next = 13;
830
+ _context12.next = 13;
603
831
  break;
604
832
  }
605
833
  console.log("[Server] \u23ED\uFE0F \u8DF3\u8FC7 ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D"));
@@ -607,19 +835,19 @@ var Server = /*#__PURE__*/function () {
607
835
  moduleName: config.name,
608
836
  reason: 'shouldPreload=false'
609
837
  });
610
- return _context7.abrupt("continue", 38);
838
+ return _context12.abrupt("continue", 38);
611
839
  case 13:
612
840
  if (!(typeof module.preload === 'function')) {
613
- _context7.next = 36;
841
+ _context12.next = 36;
614
842
  break;
615
843
  }
616
844
  startTime = Date.now();
617
- _context7.prev = 15;
845
+ _context12.prev = 15;
618
846
  this.logInfo("\u5F00\u59CB\u9884\u52A0\u8F7D\u6A21\u5757: ".concat(config.name), {
619
847
  moduleName: config.name
620
848
  });
621
849
  options === null || options === void 0 || (_options$onModuleLoad = options.onModuleLoad) === null || _options$onModuleLoad === void 0 || _options$onModuleLoad.call(options, config.name);
622
- _context7.next = 20;
850
+ _context12.next = 20;
623
851
  return module.preload();
624
852
  case 20:
625
853
  options === null || options === void 0 || (_options$onModuleLoad2 = options.onModuleLoadComplete) === null || _options$onModuleLoad2 === void 0 || _options$onModuleLoad2.call(options, config.name);
@@ -633,14 +861,14 @@ var Server = /*#__PURE__*/function () {
633
861
  name: config.name,
634
862
  success: true
635
863
  });
636
- _context7.next = 34;
864
+ _context12.next = 34;
637
865
  break;
638
866
  case 27:
639
- _context7.prev = 27;
640
- _context7.t0 = _context7["catch"](15);
867
+ _context12.prev = 27;
868
+ _context12.t0 = _context12["catch"](15);
641
869
  _duration = Date.now() - startTime;
642
- errorMessage = _context7.t0 instanceof Error ? _context7.t0.message : String(_context7.t0);
643
- console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"), _context7.t0);
870
+ errorMessage = _context12.t0 instanceof Error ? _context12.t0.message : String(_context12.t0);
871
+ console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"), _context12.t0);
644
872
  this.logError("\u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25: ".concat(config.name), {
645
873
  moduleName: config.name,
646
874
  duration: "".concat(_duration, "ms"),
@@ -652,7 +880,7 @@ var Server = /*#__PURE__*/function () {
652
880
  error: errorMessage
653
881
  });
654
882
  case 34:
655
- _context7.next = 38;
883
+ _context12.next = 38;
656
884
  break;
657
885
  case 36:
658
886
  console.log("[Server] \u26A0\uFE0F ".concat(config.name, " \u6A21\u5757\u672A\u5B9E\u73B0 preload() \u65B9\u6CD5"));
@@ -660,19 +888,19 @@ var Server = /*#__PURE__*/function () {
660
888
  moduleName: config.name
661
889
  });
662
890
  case 38:
663
- _context7.next = 7;
891
+ _context12.next = 7;
664
892
  break;
665
893
  case 40:
666
- _context7.next = 45;
894
+ _context12.next = 45;
667
895
  break;
668
896
  case 42:
669
- _context7.prev = 42;
670
- _context7.t1 = _context7["catch"](5);
671
- _iterator2.e(_context7.t1);
897
+ _context12.prev = 42;
898
+ _context12.t1 = _context12["catch"](5);
899
+ _iterator2.e(_context12.t1);
672
900
  case 45:
673
- _context7.prev = 45;
901
+ _context12.prev = 45;
674
902
  _iterator2.f();
675
- return _context7.finish(45);
903
+ return _context12.finish(45);
676
904
  case 48:
677
905
  successCount = preloadResults.filter(function (r) {
678
906
  return r.success;
@@ -687,11 +915,11 @@ var Server = /*#__PURE__*/function () {
687
915
  });
688
916
  case 52:
689
917
  case "end":
690
- return _context7.stop();
918
+ return _context12.stop();
691
919
  }
692
- }, _callee7, this, [[5, 42, 45, 48], [15, 27]]);
920
+ }, _callee12, this, [[5, 42, 45, 48], [15, 27]]);
693
921
  }));
694
- function preloadModulesData(_x9, _x10) {
922
+ function preloadModulesData(_x14, _x15) {
695
923
  return _preloadModulesData.apply(this, arguments);
696
924
  }
697
925
  return preloadModulesData;
@@ -705,7 +933,7 @@ var Server = /*#__PURE__*/function () {
705
933
  }, {
706
934
  key: "initialize",
707
935
  value: (function () {
708
- var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(moduleConfigs) {
936
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(moduleConfigs) {
709
937
  var _moduleConfigs$length,
710
938
  _this3 = this;
711
939
  var autoPreload,
@@ -713,12 +941,12 @@ var Server = /*#__PURE__*/function () {
713
941
  startTime,
714
942
  registeredModules,
715
943
  duration,
716
- _args8 = arguments;
717
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
718
- while (1) switch (_context8.prev = _context8.next) {
944
+ _args13 = arguments;
945
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
946
+ while (1) switch (_context13.prev = _context13.next) {
719
947
  case 0:
720
- autoPreload = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : true;
721
- options = _args8.length > 2 ? _args8[2] : undefined;
948
+ autoPreload = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : true;
949
+ options = _args13.length > 2 ? _args13[2] : undefined;
722
950
  startTime = Date.now();
723
951
  this.logInfo('Server 初始化开始', {
724
952
  moduleConfigCount: (_moduleConfigs$length = moduleConfigs === null || moduleConfigs === void 0 ? void 0 : moduleConfigs.length) !== null && _moduleConfigs$length !== void 0 ? _moduleConfigs$length : 'all',
@@ -730,18 +958,18 @@ var Server = /*#__PURE__*/function () {
730
958
  this.registerServerRoutes();
731
959
 
732
960
  // 注册模块
733
- _context8.next = 7;
961
+ _context13.next = 7;
734
962
  return this.registerModules(moduleConfigs);
735
963
  case 7:
736
- registeredModules = _context8.sent;
964
+ registeredModules = _context13.sent;
737
965
  if (!autoPreload) {
738
- _context8.next = 13;
966
+ _context13.next = 13;
739
967
  break;
740
968
  }
741
- _context8.next = 11;
969
+ _context13.next = 11;
742
970
  return this.preloadModulesData(registeredModules, options);
743
971
  case 11:
744
- _context8.next = 14;
972
+ _context13.next = 14;
745
973
  break;
746
974
  case 13:
747
975
  this.logInfo('跳过自动预加载', {
@@ -749,24 +977,28 @@ var Server = /*#__PURE__*/function () {
749
977
  });
750
978
  case 14:
751
979
  // 监听 ProductsModule 同步完成事件,重新计算并推送查询结果
752
- this.core.effects.on(ProductsHooks.onProductsSyncCompleted, function (payload) {
753
- _this3.recomputeAndNotifyProductQuery({
754
- changedIds: payload === null || payload === void 0 ? void 0 : payload.changedIds
755
- });
980
+ this.core.effects.on(ProductsHooks.onProductsSyncCompleted, function () {
981
+ _this3.recomputeAndNotifyProductQuery();
982
+ });
983
+
984
+ // 订单 / 预约本地数据变更时,向订阅者推送最新列表
985
+ this.core.effects.on(OrderHooks.onOrdersChanged, function () {
986
+ _this3.recomputeAndNotifyOrderQuery();
987
+ _this3.recomputeAndNotifyBookingQuery();
756
988
  });
757
989
  duration = Date.now() - startTime;
758
990
  this.logInfo('Server 初始化完成', {
759
991
  duration: "".concat(duration, "ms"),
760
992
  registeredModuleCount: registeredModules.length
761
993
  });
762
- return _context8.abrupt("return", registeredModules);
763
- case 18:
994
+ return _context13.abrupt("return", registeredModules);
995
+ case 19:
764
996
  case "end":
765
- return _context8.stop();
997
+ return _context13.stop();
766
998
  }
767
- }, _callee8, this);
999
+ }, _callee13, this);
768
1000
  }));
769
- function initialize(_x11) {
1001
+ function initialize(_x16) {
770
1002
  return _initialize.apply(this, arguments);
771
1003
  }
772
1004
  return initialize;
@@ -819,6 +1051,8 @@ var Server = /*#__PURE__*/function () {
819
1051
  if (this.menu) modules.push('menu');
820
1052
  if (this.quotation) modules.push('quotation');
821
1053
  if (this.schedule) modules.push('schedule');
1054
+ if (this.resource) modules.push('resource');
1055
+ if (this.order) modules.push('order');
822
1056
  return modules;
823
1057
  }
824
1058
 
@@ -830,45 +1064,45 @@ var Server = /*#__PURE__*/function () {
830
1064
  }, {
831
1065
  key: "refreshProductsInBackground",
832
1066
  value: (function () {
833
- var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
1067
+ var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
834
1068
  var startTime, duration, _duration2, errorMessage;
835
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
836
- while (1) switch (_context9.prev = _context9.next) {
1069
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1070
+ while (1) switch (_context14.prev = _context14.next) {
837
1071
  case 0:
838
1072
  if (this.products) {
839
- _context9.next = 3;
1073
+ _context14.next = 3;
840
1074
  break;
841
1075
  }
842
1076
  this.logWarning('refreshProductsInBackground: Products 模块未注册');
843
- return _context9.abrupt("return");
1077
+ return _context14.abrupt("return");
844
1078
  case 3:
845
1079
  this.logInfo('refreshProductsInBackground 开始');
846
1080
  startTime = Date.now();
847
- _context9.prev = 5;
848
- _context9.next = 8;
1081
+ _context14.prev = 5;
1082
+ _context14.next = 8;
849
1083
  return this.products.silentRefresh();
850
1084
  case 8:
851
1085
  duration = Date.now() - startTime;
852
1086
  this.logInfo('refreshProductsInBackground 完成', {
853
1087
  duration: "".concat(duration, "ms")
854
1088
  });
855
- _context9.next = 18;
1089
+ _context14.next = 18;
856
1090
  break;
857
1091
  case 12:
858
- _context9.prev = 12;
859
- _context9.t0 = _context9["catch"](5);
1092
+ _context14.prev = 12;
1093
+ _context14.t0 = _context14["catch"](5);
860
1094
  _duration2 = Date.now() - startTime;
861
- errorMessage = _context9.t0 instanceof Error ? _context9.t0.message : String(_context9.t0);
862
- console.error('[Server] refreshProductsInBackground 失败:', _context9.t0);
1095
+ errorMessage = _context14.t0 instanceof Error ? _context14.t0.message : String(_context14.t0);
1096
+ console.error('[Server] refreshProductsInBackground 失败:', _context14.t0);
863
1097
  this.logError('refreshProductsInBackground 失败', {
864
1098
  duration: "".concat(_duration2, "ms"),
865
1099
  error: errorMessage
866
1100
  });
867
1101
  case 18:
868
1102
  case "end":
869
- return _context9.stop();
1103
+ return _context14.stop();
870
1104
  }
871
- }, _callee9, this, [[5, 12]]);
1105
+ }, _callee14, this, [[5, 12]]);
872
1106
  }));
873
1107
  function refreshProductsInBackground() {
874
1108
  return _refreshProductsInBackground.apply(this, arguments);
@@ -883,10 +1117,10 @@ var Server = /*#__PURE__*/function () {
883
1117
  }, {
884
1118
  key: "clearAllIndexDB",
885
1119
  value: (function () {
886
- var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
1120
+ var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
887
1121
  var clearTasks, moduleNames, errorMessage;
888
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
889
- while (1) switch (_context10.prev = _context10.next) {
1122
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1123
+ while (1) switch (_context15.prev = _context15.next) {
890
1124
  case 0:
891
1125
  console.log('[Server] 开始清空所有模块的IndexedDB缓存...');
892
1126
  this.logInfo('开始清空所有模块的 IndexedDB 缓存');
@@ -908,42 +1142,50 @@ var Server = /*#__PURE__*/function () {
908
1142
  clearTasks.push(this.schedule.clear());
909
1143
  moduleNames.push('Schedule');
910
1144
  }
1145
+ if (this.resource) {
1146
+ clearTasks.push(this.resource.clear());
1147
+ moduleNames.push('Resource');
1148
+ }
1149
+ if (this.order) {
1150
+ clearTasks.push(this.order.clear());
1151
+ moduleNames.push('Order');
1152
+ }
911
1153
  if (!(clearTasks.length === 0)) {
912
- _context10.next = 12;
1154
+ _context15.next = 14;
913
1155
  break;
914
1156
  }
915
1157
  console.warn('[Server] 没有找到已注册的模块,无需清空');
916
1158
  this.logWarning('没有找到已注册的模块,无需清空 IndexedDB');
917
- return _context10.abrupt("return");
918
- case 12:
1159
+ return _context15.abrupt("return");
1160
+ case 14:
919
1161
  this.logInfo('准备清空模块缓存', {
920
1162
  moduleNames: moduleNames
921
1163
  });
922
- _context10.prev = 13;
923
- _context10.next = 16;
1164
+ _context15.prev = 15;
1165
+ _context15.next = 18;
924
1166
  return Promise.all(clearTasks);
925
- case 16:
1167
+ case 18:
926
1168
  console.log("[Server] \u2705 \u5DF2\u6210\u529F\u6E05\u7A7A\u6240\u6709\u6A21\u5757\u7684IndexedDB\u7F13\u5B58: ".concat(moduleNames.join(', ')));
927
1169
  this.logInfo('成功清空所有模块的 IndexedDB 缓存', {
928
1170
  moduleNames: moduleNames
929
1171
  });
930
- _context10.next = 26;
1172
+ _context15.next = 28;
931
1173
  break;
932
- case 20:
933
- _context10.prev = 20;
934
- _context10.t0 = _context10["catch"](13);
935
- errorMessage = _context10.t0 instanceof Error ? _context10.t0.message : String(_context10.t0);
936
- console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context10.t0);
1174
+ case 22:
1175
+ _context15.prev = 22;
1176
+ _context15.t0 = _context15["catch"](15);
1177
+ errorMessage = _context15.t0 instanceof Error ? _context15.t0.message : String(_context15.t0);
1178
+ console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context15.t0);
937
1179
  this.logError('清空 IndexedDB 缓存时发生错误', {
938
1180
  moduleNames: moduleNames,
939
1181
  error: errorMessage
940
1182
  });
941
- throw _context10.t0;
942
- case 26:
1183
+ throw _context15.t0;
1184
+ case 28:
943
1185
  case "end":
944
- return _context10.stop();
1186
+ return _context15.stop();
945
1187
  }
946
- }, _callee10, this, [[13, 20]]);
1188
+ }, _callee15, this, [[15, 22]]);
947
1189
  }));
948
1190
  function clearAllIndexDB() {
949
1191
  return _clearAllIndexDB.apply(this, arguments);
@@ -994,13 +1236,12 @@ var Server = /*#__PURE__*/function () {
994
1236
  }, {
995
1237
  key: "handleRoute",
996
1238
  value: (function () {
997
- var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(method, path, params) {
1239
+ var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(method, path, params) {
998
1240
  var startTime, handler, result, duration, _duration3, errorMessage;
999
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1000
- while (1) switch (_context11.prev = _context11.next) {
1241
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1242
+ while (1) switch (_context16.prev = _context16.next) {
1001
1243
  case 0:
1002
1244
  startTime = Date.now();
1003
- console.log(method, path, params, 'method, path, params');
1004
1245
  this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5F00\u59CB: ".concat(method.toUpperCase(), " ").concat(path), {
1005
1246
  method: method.toUpperCase(),
1006
1247
  path: path,
@@ -1009,7 +1250,7 @@ var Server = /*#__PURE__*/function () {
1009
1250
  });
1010
1251
  handler = this.getRouteHandler(method, path);
1011
1252
  if (handler) {
1012
- _context11.next = 7;
1253
+ _context16.next = 6;
1013
1254
  break;
1014
1255
  }
1015
1256
  this.logError("\u8DEF\u7531\u672A\u627E\u5230: ".concat(method.toUpperCase(), " ").concat(path), {
@@ -1017,12 +1258,12 @@ var Server = /*#__PURE__*/function () {
1017
1258
  path: path
1018
1259
  });
1019
1260
  throw new Error("Route not found: ".concat(method.toUpperCase(), " ").concat(path));
1020
- case 7:
1021
- _context11.prev = 7;
1022
- _context11.next = 10;
1261
+ case 6:
1262
+ _context16.prev = 6;
1263
+ _context16.next = 9;
1023
1264
  return handler(params);
1024
- case 10:
1025
- result = _context11.sent;
1265
+ case 9:
1266
+ result = _context16.sent;
1026
1267
  duration = Date.now() - startTime;
1027
1268
  this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5B8C\u6210: ".concat(method.toUpperCase(), " ").concat(path), {
1028
1269
  method: method.toUpperCase(),
@@ -1031,12 +1272,12 @@ var Server = /*#__PURE__*/function () {
1031
1272
  resultCode: result === null || result === void 0 ? void 0 : result.code,
1032
1273
  resultStatus: result === null || result === void 0 ? void 0 : result.status
1033
1274
  });
1034
- return _context11.abrupt("return", result);
1035
- case 16:
1036
- _context11.prev = 16;
1037
- _context11.t0 = _context11["catch"](7);
1275
+ return _context16.abrupt("return", result);
1276
+ case 15:
1277
+ _context16.prev = 15;
1278
+ _context16.t0 = _context16["catch"](6);
1038
1279
  _duration3 = Date.now() - startTime;
1039
- errorMessage = _context11.t0 instanceof Error ? _context11.t0.message : String(_context11.t0);
1280
+ errorMessage = _context16.t0 instanceof Error ? _context16.t0.message : String(_context16.t0);
1040
1281
  this.logError("\u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), {
1041
1282
  method: method.toUpperCase(),
1042
1283
  path: path,
@@ -1044,15 +1285,15 @@ var Server = /*#__PURE__*/function () {
1044
1285
  error: errorMessage,
1045
1286
  data: params.data
1046
1287
  });
1047
- console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), _context11.t0);
1048
- throw _context11.t0;
1049
- case 23:
1288
+ console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), _context16.t0);
1289
+ throw _context16.t0;
1290
+ case 22:
1050
1291
  case "end":
1051
- return _context11.stop();
1292
+ return _context16.stop();
1052
1293
  }
1053
- }, _callee11, this, [[7, 16]]);
1294
+ }, _callee16, this, [[6, 15]]);
1054
1295
  }));
1055
- function handleRoute(_x12, _x13, _x14) {
1296
+ function handleRoute(_x17, _x18, _x19) {
1056
1297
  return _handleRoute.apply(this, arguments);
1057
1298
  }
1058
1299
  return handleRoute;
@@ -1098,6 +1339,26 @@ var Server = /*#__PURE__*/function () {
1098
1339
  method: 'post',
1099
1340
  path: '/shop/menu/schedule-time-points',
1100
1341
  handler: this.handleGetScheduleTimePoints.bind(this)
1342
+ }, {
1343
+ method: 'post',
1344
+ path: '/shop/order/v2/list',
1345
+ handler: this.handleOrderList.bind(this)
1346
+ }, {
1347
+ method: 'post',
1348
+ path: '/shop/order/v2/list/unsubscribe',
1349
+ handler: this.handleUnsubscribeOrderQuery.bind(this)
1350
+ }, {
1351
+ method: 'get',
1352
+ path: '/shop/schedule/booking',
1353
+ handler: this.handleBookingList.bind(this)
1354
+ }, {
1355
+ method: 'get',
1356
+ path: '/shop/schedule/booking/unsubscribe',
1357
+ handler: this.handleUnsubscribeBookingQuery.bind(this)
1358
+ }, {
1359
+ method: 'get',
1360
+ path: '/shop/form/resource/page',
1361
+ handler: this.handleResourceList.bind(this)
1101
1362
  }]);
1102
1363
  }
1103
1364
 
@@ -1116,37 +1377,240 @@ var Server = /*#__PURE__*/function () {
1116
1377
  }
1117
1378
  }
1118
1379
  }, {
1119
- key: "computeProductQueryResult",
1380
+ key: "isBookingQueryForToday",
1381
+ value:
1382
+ /**
1383
+ * 判断预约查询的 es_start_datetime_between 起始日期是否为今天
1384
+ */
1385
+ function isBookingQueryForToday(data) {
1386
+ var range = data === null || data === void 0 ? void 0 : data.es_start_datetime_between;
1387
+ if (!Array.isArray(range) || range.length < 1) return true;
1388
+ var startDateStr = String(range[0]).split('T')[0].split(' ')[0];
1389
+ var todayStr = dayjs().format('YYYY-MM-DD');
1390
+ return startDateStr === todayStr;
1391
+ }
1392
+
1393
+ /**
1394
+ * 非今天的预约查询:通过真实 API 获取数据,再做 flattenOrdersToBookings 拆分
1395
+ */
1396
+ }, {
1397
+ key: "fetchBookingListFromAPI",
1398
+ value: (function () {
1399
+ var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(data) {
1400
+ var _this$app2;
1401
+ var _ref23, _response$data$list, _response$data, response, rawList, list, errorMessage;
1402
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1403
+ while (1) switch (_context17.prev = _context17.next) {
1404
+ case 0:
1405
+ if ((_this$app2 = this.app) !== null && _this$app2 !== void 0 && _this$app2.request) {
1406
+ _context17.next = 3;
1407
+ break;
1408
+ }
1409
+ this.logError('fetchBookingListFromAPI: app.request 不可用');
1410
+ return _context17.abrupt("return", {
1411
+ code: 500,
1412
+ message: 'app.request 不可用',
1413
+ data: {
1414
+ list: [],
1415
+ count: 0
1416
+ },
1417
+ status: false
1418
+ });
1419
+ case 3:
1420
+ _context17.prev = 3;
1421
+ _context17.next = 6;
1422
+ return this.app.request.get('/shop/order/sales', _objectSpread(_objectSpread({}, data), {}, {
1423
+ with: ["all"]
1424
+ }), {
1425
+ isShopApi: true
1426
+ });
1427
+ case 6:
1428
+ response = _context17.sent;
1429
+ rawList = (_ref23 = (_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 && _ref23 !== void 0 ? _ref23 : [];
1430
+ list = flattenOrdersToBookings(rawList);
1431
+ this.logInfo('fetchBookingListFromAPI: API 返回并拆分完成', {
1432
+ rawCount: rawList.length,
1433
+ flattenedCount: list.length
1434
+ });
1435
+ return _context17.abrupt("return", {
1436
+ code: 200,
1437
+ data: _objectSpread(_objectSpread({}, response.data), {}, {
1438
+ list: list
1439
+ }),
1440
+ message: '',
1441
+ status: true
1442
+ });
1443
+ case 13:
1444
+ _context17.prev = 13;
1445
+ _context17.t0 = _context17["catch"](3);
1446
+ errorMessage = _context17.t0 instanceof Error ? _context17.t0.message : String(_context17.t0);
1447
+ this.logError('fetchBookingListFromAPI: 请求失败', {
1448
+ error: errorMessage
1449
+ });
1450
+ return _context17.abrupt("return", {
1451
+ code: 500,
1452
+ message: errorMessage,
1453
+ data: {
1454
+ list: [],
1455
+ count: 0
1456
+ },
1457
+ status: false
1458
+ });
1459
+ case 18:
1460
+ case "end":
1461
+ return _context17.stop();
1462
+ }
1463
+ }, _callee17, this, [[3, 13]]);
1464
+ }));
1465
+ function fetchBookingListFromAPI(_x20) {
1466
+ return _fetchBookingListFromAPI.apply(this, arguments);
1467
+ }
1468
+ return fetchBookingListFromAPI;
1469
+ }())
1470
+ }, {
1471
+ key: "computeOrderQueryResult",
1120
1472
  value: (
1473
+ /**
1474
+ * 订单列表本地计算(编排 Order 模块)
1475
+ * filter 逻辑暂为 mock,仅记录参数
1476
+ */
1477
+ function () {
1478
+ var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(data) {
1479
+ var rawList, result;
1480
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1481
+ while (1) switch (_context18.prev = _context18.next) {
1482
+ case 0:
1483
+ this.logInfo('computeOrderQueryResult: 开始过滤', {
1484
+ data: data
1485
+ });
1486
+ console.log('[Server] computeOrderQueryResult', data);
1487
+ if (this.order) {
1488
+ _context18.next = 5;
1489
+ break;
1490
+ }
1491
+ this.logError('computeOrderQueryResult: Order 模块未注册');
1492
+ return _context18.abrupt("return", {
1493
+ code: 500,
1494
+ message: 'Order 模块未注册',
1495
+ data: {
1496
+ list: [],
1497
+ count: 0
1498
+ },
1499
+ status: false
1500
+ });
1501
+ case 5:
1502
+ rawList = this.order.getOrders();
1503
+ this.logInfo('computeOrderQueryResult: 本地订单数量', {
1504
+ rawCount: rawList.length
1505
+ });
1506
+
1507
+ // 使用 filterOrders 进行过滤、排序、分页
1508
+ result = filterOrders(rawList, data);
1509
+ this.logInfo('computeOrderQueryResult: 过滤结果', {
1510
+ rawCount: rawList.length,
1511
+ filteredCount: result.count,
1512
+ size: result.size,
1513
+ skip: result.skip
1514
+ });
1515
+ return _context18.abrupt("return", {
1516
+ code: 200,
1517
+ data: result,
1518
+ message: '',
1519
+ status: true
1520
+ });
1521
+ case 10:
1522
+ case "end":
1523
+ return _context18.stop();
1524
+ }
1525
+ }, _callee18, this);
1526
+ }));
1527
+ function computeOrderQueryResult(_x21) {
1528
+ return _computeOrderQueryResult.apply(this, arguments);
1529
+ }
1530
+ return computeOrderQueryResult;
1531
+ }()
1532
+ /**
1533
+ * 预约列表本地计算(编排 Order 模块)
1534
+ * 从订单中展开 bookings,再按条件筛选 + 分页
1535
+ */
1536
+ )
1537
+ }, {
1538
+ key: "computeBookingQueryResult",
1539
+ value: (function () {
1540
+ var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(data) {
1541
+ var rawOrders, result;
1542
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1543
+ while (1) switch (_context19.prev = _context19.next) {
1544
+ case 0:
1545
+ if (this.order) {
1546
+ _context19.next = 3;
1547
+ break;
1548
+ }
1549
+ this.logError('computeBookingQueryResult: Order 模块未注册');
1550
+ return _context19.abrupt("return", {
1551
+ code: 500,
1552
+ message: 'Order 模块未注册',
1553
+ data: {
1554
+ list: [],
1555
+ count: 0
1556
+ },
1557
+ status: false
1558
+ });
1559
+ case 3:
1560
+ rawOrders = this.order.getOrders();
1561
+ result = filterBookingsFromOrders(rawOrders, data);
1562
+ result = sortBookings(result, data);
1563
+ this.logInfo('computeBookingQueryResult: 过滤结果', {
1564
+ orderCount: rawOrders.length,
1565
+ filteredCount: result.count,
1566
+ size: result.size,
1567
+ skip: result.skip
1568
+ });
1569
+ return _context19.abrupt("return", {
1570
+ code: 200,
1571
+ data: result,
1572
+ message: '',
1573
+ status: true
1574
+ });
1575
+ case 8:
1576
+ case "end":
1577
+ return _context19.stop();
1578
+ }
1579
+ }, _callee19, this);
1580
+ }));
1581
+ function computeBookingQueryResult(_x22) {
1582
+ return _computeBookingQueryResult.apply(this, arguments);
1583
+ }
1584
+ return computeBookingQueryResult;
1585
+ }()
1121
1586
  /**
1122
1587
  * 商品查询的核心计算逻辑(编排 Products、Menu、Schedule 模块)
1123
1588
  * 供 handleProductQuery 首次返回及 pubsub 变更推送复用
1124
- * @param context 查询上下文
1125
- * @param options 可选参数
1126
- * @param options.changedIds 变更的商品 IDs,用于增量更新价格缓存
1127
1589
  */
1128
- function () {
1129
- var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(context, options) {
1590
+ )
1591
+ }, {
1592
+ key: "computeProductQueryResult",
1593
+ value: (function () {
1594
+ var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(context) {
1130
1595
  var _menu_list_ids$length3,
1131
1596
  _this5 = this;
1132
- var tTotal, menu_list_ids, schedule_date, schedule_datetime, activeMenuList, tMenu, menuList, tPrice, allProductsWithPrice, tFilter, filteredProducts, tStatus, beforeStatusCount, tSort;
1133
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1134
- while (1) switch (_context12.prev = _context12.next) {
1597
+ var tTotal, menu_list_ids, schedule_date, schedule_datetime, activeMenuList, tMenu, menuList, tPrice, allProductsWithPrice, tFilter, filteredProducts, tSort;
1598
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1599
+ while (1) switch (_context20.prev = _context20.next) {
1135
1600
  case 0:
1136
1601
  tTotal = performance.now();
1137
1602
  menu_list_ids = context.menu_list_ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime;
1138
1603
  this.logInfo('computeProductQueryResult 开始', {
1139
1604
  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,
1140
1605
  schedule_datetime: schedule_datetime,
1141
- schedule_date: schedule_date,
1142
- changedIds: options === null || options === void 0 ? void 0 : options.changedIds
1606
+ schedule_date: schedule_date
1143
1607
  });
1144
1608
  if (this.products) {
1145
- _context12.next = 6;
1609
+ _context20.next = 6;
1146
1610
  break;
1147
1611
  }
1148
1612
  this.logError('computeProductQueryResult: Products 模块未注册');
1149
- return _context12.abrupt("return", {
1613
+ return _context20.abrupt("return", {
1150
1614
  message: 'Products 模块未注册',
1151
1615
  data: {
1152
1616
  list: [],
@@ -1155,11 +1619,11 @@ var Server = /*#__PURE__*/function () {
1155
1619
  });
1156
1620
  case 6:
1157
1621
  if (this.menu) {
1158
- _context12.next = 9;
1622
+ _context20.next = 9;
1159
1623
  break;
1160
1624
  }
1161
1625
  this.logError('computeProductQueryResult: Menu 模块未注册');
1162
- return _context12.abrupt("return", {
1626
+ return _context20.abrupt("return", {
1163
1627
  message: 'Menu 模块未注册',
1164
1628
  data: {
1165
1629
  list: [],
@@ -1168,11 +1632,11 @@ var Server = /*#__PURE__*/function () {
1168
1632
  });
1169
1633
  case 9:
1170
1634
  if (this.schedule) {
1171
- _context12.next = 12;
1635
+ _context20.next = 12;
1172
1636
  break;
1173
1637
  }
1174
1638
  this.logError('computeProductQueryResult: Schedule 模块未注册');
1175
- return _context12.abrupt("return", {
1639
+ return _context20.abrupt("return", {
1176
1640
  message: 'Schedule 模块未注册',
1177
1641
  data: {
1178
1642
  list: [],
@@ -1194,14 +1658,12 @@ var Server = /*#__PURE__*/function () {
1194
1658
  });
1195
1659
  }
1196
1660
  tPrice = performance.now();
1197
- _context12.next = 17;
1661
+ _context20.next = 17;
1198
1662
  return this.products.getProductsWithPrice(schedule_date, {
1199
1663
  scheduleModule: this.getSchedule()
1200
- }, {
1201
- changedIds: options === null || options === void 0 ? void 0 : options.changedIds
1202
1664
  });
1203
1665
  case 17:
1204
- allProductsWithPrice = _context12.sent;
1666
+ allProductsWithPrice = _context20.sent;
1205
1667
  perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
1206
1668
  count: allProductsWithPrice.length
1207
1669
  });
@@ -1211,15 +1673,6 @@ var Server = /*#__PURE__*/function () {
1211
1673
  before: allProductsWithPrice.length,
1212
1674
  after: filteredProducts.length
1213
1675
  });
1214
- tStatus = performance.now();
1215
- beforeStatusCount = filteredProducts.length;
1216
- filteredProducts = filteredProducts.filter(function (p) {
1217
- return ((p === null || p === void 0 ? void 0 : p.status) || "published") === 'published';
1218
- });
1219
- perfMark('computeQuery.filterByStatus', performance.now() - tStatus, {
1220
- before: beforeStatusCount,
1221
- after: filteredProducts.length
1222
- });
1223
1676
  tSort = performance.now();
1224
1677
  filteredProducts = filteredProducts.sort(function (a, b) {
1225
1678
  var sortDiff = Number(b.sort) - Number(a.sort);
@@ -1239,7 +1692,7 @@ var Server = /*#__PURE__*/function () {
1239
1692
  filteredCount: filteredProducts.length,
1240
1693
  activeMenuCount: activeMenuList.length
1241
1694
  });
1242
- return _context12.abrupt("return", {
1695
+ return _context20.abrupt("return", {
1243
1696
  code: 200,
1244
1697
  data: {
1245
1698
  list: filteredProducts,
@@ -1248,13 +1701,13 @@ var Server = /*#__PURE__*/function () {
1248
1701
  message: '',
1249
1702
  status: true
1250
1703
  });
1251
- case 32:
1704
+ case 28:
1252
1705
  case "end":
1253
- return _context12.stop();
1706
+ return _context20.stop();
1254
1707
  }
1255
- }, _callee12, this);
1708
+ }, _callee20, this);
1256
1709
  }));
1257
- function computeProductQueryResult(_x15, _x16) {
1710
+ function computeProductQueryResult(_x23) {
1258
1711
  return _computeProductQueryResult.apply(this, arguments);
1259
1712
  }
1260
1713
  return computeProductQueryResult;
@@ -1262,83 +1715,226 @@ var Server = /*#__PURE__*/function () {
1262
1715
  /**
1263
1716
  * 数据变更后,遍历所有订阅者重新计算查询结果并通过 callback 推送
1264
1717
  * 由 ProductsModule 的 onProductsSyncCompleted 事件触发
1265
- * @param options 可选参数
1266
- * @param options.changedIds 变更的商品 IDs,用于增量更新价格缓存
1267
1718
  */
1268
1719
  )
1269
1720
  }, {
1270
1721
  key: "recomputeAndNotifyProductQuery",
1271
1722
  value: (function () {
1272
- var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(options) {
1723
+ var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1273
1724
  var _iterator3, _step3, _step3$value, subscriberId, subscriber, result, errorMessage;
1274
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1275
- while (1) switch (_context13.prev = _context13.next) {
1725
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1726
+ while (1) switch (_context21.prev = _context21.next) {
1276
1727
  case 0:
1277
1728
  if (!(this.productQuerySubscribers.size === 0)) {
1278
- _context13.next = 2;
1729
+ _context21.next = 2;
1279
1730
  break;
1280
1731
  }
1281
- return _context13.abrupt("return");
1732
+ return _context21.abrupt("return");
1282
1733
  case 2:
1283
1734
  this.logInfo('recomputeAndNotifyProductQuery: 开始推送', {
1284
- subscriberCount: this.productQuerySubscribers.size,
1285
- changedIds: options === null || options === void 0 ? void 0 : options.changedIds
1735
+ subscriberCount: this.productQuerySubscribers.size
1286
1736
  });
1287
1737
  _iterator3 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
1288
- _context13.prev = 4;
1738
+ _context21.prev = 4;
1289
1739
  _iterator3.s();
1290
1740
  case 6:
1291
1741
  if ((_step3 = _iterator3.n()).done) {
1292
- _context13.next = 22;
1742
+ _context21.next = 22;
1293
1743
  break;
1294
1744
  }
1295
1745
  _step3$value = _slicedToArray(_step3.value, 2), subscriberId = _step3$value[0], subscriber = _step3$value[1];
1296
- _context13.prev = 8;
1297
- _context13.next = 11;
1298
- return this.computeProductQueryResult(subscriber.context, {
1299
- changedIds: options === null || options === void 0 ? void 0 : options.changedIds
1300
- });
1746
+ _context21.prev = 8;
1747
+ _context21.next = 11;
1748
+ return this.computeProductQueryResult(subscriber.context);
1301
1749
  case 11:
1302
- result = _context13.sent;
1750
+ result = _context21.sent;
1303
1751
  subscriber.callback(result);
1304
1752
  this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
1305
1753
  subscriberId: subscriberId
1306
1754
  });
1307
- _context13.next = 20;
1755
+ _context21.next = 20;
1308
1756
  break;
1309
1757
  case 16:
1310
- _context13.prev = 16;
1311
- _context13.t0 = _context13["catch"](8);
1312
- errorMessage = _context13.t0 instanceof Error ? _context13.t0.message : String(_context13.t0);
1758
+ _context21.prev = 16;
1759
+ _context21.t0 = _context21["catch"](8);
1760
+ errorMessage = _context21.t0 instanceof Error ? _context21.t0.message : String(_context21.t0);
1313
1761
  this.logError('recomputeAndNotifyProductQuery: 推送失败', {
1314
1762
  subscriberId: subscriberId,
1315
1763
  error: errorMessage
1316
1764
  });
1317
1765
  case 20:
1318
- _context13.next = 6;
1766
+ _context21.next = 6;
1319
1767
  break;
1320
1768
  case 22:
1321
- _context13.next = 27;
1769
+ _context21.next = 27;
1322
1770
  break;
1323
1771
  case 24:
1324
- _context13.prev = 24;
1325
- _context13.t1 = _context13["catch"](4);
1326
- _iterator3.e(_context13.t1);
1772
+ _context21.prev = 24;
1773
+ _context21.t1 = _context21["catch"](4);
1774
+ _iterator3.e(_context21.t1);
1327
1775
  case 27:
1328
- _context13.prev = 27;
1776
+ _context21.prev = 27;
1329
1777
  _iterator3.f();
1330
- return _context13.finish(27);
1778
+ return _context21.finish(27);
1331
1779
  case 30:
1332
1780
  case "end":
1333
- return _context13.stop();
1781
+ return _context21.stop();
1334
1782
  }
1335
- }, _callee13, this, [[4, 24, 27, 30], [8, 16]]);
1783
+ }, _callee21, this, [[4, 24, 27, 30], [8, 16]]);
1336
1784
  }));
1337
- function recomputeAndNotifyProductQuery(_x17) {
1785
+ function recomputeAndNotifyProductQuery() {
1338
1786
  return _recomputeAndNotifyProductQuery.apply(this, arguments);
1339
1787
  }
1340
1788
  return recomputeAndNotifyProductQuery;
1341
1789
  }()
1790
+ /**
1791
+ * 订单数据变更后,遍历订阅者重新计算并通过 callback 推送
1792
+ */
1793
+ )
1794
+ }, {
1795
+ key: "recomputeAndNotifyOrderQuery",
1796
+ value: (function () {
1797
+ var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1798
+ var _iterator4, _step4, _step4$value, subscriberId, subscriber, result, errorMessage;
1799
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1800
+ while (1) switch (_context22.prev = _context22.next) {
1801
+ case 0:
1802
+ if (!(this.orderQuerySubscribers.size === 0)) {
1803
+ _context22.next = 2;
1804
+ break;
1805
+ }
1806
+ return _context22.abrupt("return");
1807
+ case 2:
1808
+ this.logInfo('recomputeAndNotifyOrderQuery: 开始推送', {
1809
+ subscriberCount: this.orderQuerySubscribers.size
1810
+ });
1811
+ _iterator4 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
1812
+ _context22.prev = 4;
1813
+ _iterator4.s();
1814
+ case 6:
1815
+ if ((_step4 = _iterator4.n()).done) {
1816
+ _context22.next = 22;
1817
+ break;
1818
+ }
1819
+ _step4$value = _slicedToArray(_step4.value, 2), subscriberId = _step4$value[0], subscriber = _step4$value[1];
1820
+ _context22.prev = 8;
1821
+ _context22.next = 11;
1822
+ return this.computeOrderQueryResult(subscriber.context);
1823
+ case 11:
1824
+ result = _context22.sent;
1825
+ subscriber.callback(result);
1826
+ this.logInfo('recomputeAndNotifyOrderQuery: 已推送', {
1827
+ subscriberId: subscriberId
1828
+ });
1829
+ _context22.next = 20;
1830
+ break;
1831
+ case 16:
1832
+ _context22.prev = 16;
1833
+ _context22.t0 = _context22["catch"](8);
1834
+ errorMessage = _context22.t0 instanceof Error ? _context22.t0.message : String(_context22.t0);
1835
+ this.logError('recomputeAndNotifyOrderQuery: 推送失败', {
1836
+ subscriberId: subscriberId,
1837
+ error: errorMessage
1838
+ });
1839
+ case 20:
1840
+ _context22.next = 6;
1841
+ break;
1842
+ case 22:
1843
+ _context22.next = 27;
1844
+ break;
1845
+ case 24:
1846
+ _context22.prev = 24;
1847
+ _context22.t1 = _context22["catch"](4);
1848
+ _iterator4.e(_context22.t1);
1849
+ case 27:
1850
+ _context22.prev = 27;
1851
+ _iterator4.f();
1852
+ return _context22.finish(27);
1853
+ case 30:
1854
+ case "end":
1855
+ return _context22.stop();
1856
+ }
1857
+ }, _callee22, this, [[4, 24, 27, 30], [8, 16]]);
1858
+ }));
1859
+ function recomputeAndNotifyOrderQuery() {
1860
+ return _recomputeAndNotifyOrderQuery.apply(this, arguments);
1861
+ }
1862
+ return recomputeAndNotifyOrderQuery;
1863
+ }()
1864
+ /**
1865
+ * 预约数据变更后,遍历订阅者重新计算并通过 callback 推送
1866
+ */
1867
+ )
1868
+ }, {
1869
+ key: "recomputeAndNotifyBookingQuery",
1870
+ value: (function () {
1871
+ var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1872
+ var _iterator5, _step5, _step5$value, subscriberId, subscriber, result, errorMessage;
1873
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1874
+ while (1) switch (_context23.prev = _context23.next) {
1875
+ case 0:
1876
+ if (!(this.bookingQuerySubscribers.size === 0)) {
1877
+ _context23.next = 2;
1878
+ break;
1879
+ }
1880
+ return _context23.abrupt("return");
1881
+ case 2:
1882
+ this.logInfo('recomputeAndNotifyBookingQuery: 开始推送', {
1883
+ subscriberCount: this.bookingQuerySubscribers.size
1884
+ });
1885
+ _iterator5 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
1886
+ _context23.prev = 4;
1887
+ _iterator5.s();
1888
+ case 6:
1889
+ if ((_step5 = _iterator5.n()).done) {
1890
+ _context23.next = 22;
1891
+ break;
1892
+ }
1893
+ _step5$value = _slicedToArray(_step5.value, 2), subscriberId = _step5$value[0], subscriber = _step5$value[1];
1894
+ _context23.prev = 8;
1895
+ _context23.next = 11;
1896
+ return this.computeBookingQueryResult(subscriber.context);
1897
+ case 11:
1898
+ result = _context23.sent;
1899
+ subscriber.callback(result);
1900
+ this.logInfo('recomputeAndNotifyBookingQuery: 已推送', {
1901
+ subscriberId: subscriberId
1902
+ });
1903
+ _context23.next = 20;
1904
+ break;
1905
+ case 16:
1906
+ _context23.prev = 16;
1907
+ _context23.t0 = _context23["catch"](8);
1908
+ errorMessage = _context23.t0 instanceof Error ? _context23.t0.message : String(_context23.t0);
1909
+ this.logError('recomputeAndNotifyBookingQuery: 推送失败', {
1910
+ subscriberId: subscriberId,
1911
+ error: errorMessage
1912
+ });
1913
+ case 20:
1914
+ _context23.next = 6;
1915
+ break;
1916
+ case 22:
1917
+ _context23.next = 27;
1918
+ break;
1919
+ case 24:
1920
+ _context23.prev = 24;
1921
+ _context23.t1 = _context23["catch"](4);
1922
+ _iterator5.e(_context23.t1);
1923
+ case 27:
1924
+ _context23.prev = 27;
1925
+ _iterator5.f();
1926
+ return _context23.finish(27);
1927
+ case 30:
1928
+ case "end":
1929
+ return _context23.stop();
1930
+ }
1931
+ }, _callee23, this, [[4, 24, 27, 30], [8, 16]]);
1932
+ }));
1933
+ function recomputeAndNotifyBookingQuery() {
1934
+ return _recomputeAndNotifyBookingQuery.apply(this, arguments);
1935
+ }
1936
+ return recomputeAndNotifyBookingQuery;
1937
+ }()
1342
1938
  /**
1343
1939
  * 根据餐牌配置过滤商品
1344
1940
  * @param products 所有商品列表
@@ -1364,11 +1960,11 @@ var Server = /*#__PURE__*/function () {
1364
1960
  var allowedProductIds = new Set();
1365
1961
  var allowedCollectionIds = new Set();
1366
1962
  var hasProductAll = false;
1367
- var _iterator4 = _createForOfIteratorHelper(activeMenuList),
1368
- _step4;
1963
+ var _iterator6 = _createForOfIteratorHelper(activeMenuList),
1964
+ _step6;
1369
1965
  try {
1370
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1371
- var menu = _step4.value;
1966
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1967
+ var menu = _step6.value;
1372
1968
  var config = menu.partyroom_package;
1373
1969
  if (!config) {
1374
1970
  console.warn('[Server] 餐牌缺少 partyroom_package 配置:', menu);
@@ -1428,9 +2024,9 @@ var Server = /*#__PURE__*/function () {
1428
2024
 
1429
2025
  // 如果有餐牌允许所有商品,返回所有商品
1430
2026
  } catch (err) {
1431
- _iterator4.e(err);
2027
+ _iterator6.e(err);
1432
2028
  } finally {
1433
- _iterator4.f();
2029
+ _iterator6.f();
1434
2030
  }
1435
2031
  if (hasProductAll) {
1436
2032
  this.logInfo('filterProductsByMenuConfig: 返回所有商品(product_all)', {