@pisell/pisellos 2.2.110 → 2.2.112

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.
@@ -24,6 +24,7 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
24
24
  protected options: ModuleOptions;
25
25
  protected otherParams: Record<string, any>;
26
26
  protected request: RequestPlugin;
27
+ private logger;
27
28
  constructor(name?: string, version?: string);
28
29
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
29
30
  /** 获取当前 store 快照 */
@@ -43,6 +43,8 @@ export * from "./types";
43
43
  export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
44
44
  _inherits(SalesImpl, _BaseModule);
45
45
  var _super = _createSuper(SalesImpl);
46
+ // LoggerManager 实例
47
+
46
48
  function SalesImpl(name, version) {
47
49
  var _this;
48
50
  _classCallCheck(this, SalesImpl);
@@ -55,6 +57,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
55
57
  _defineProperty(_assertThisInitialized(_this), "options", {});
56
58
  _defineProperty(_assertThisInitialized(_this), "otherParams", {});
57
59
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
60
+ _defineProperty(_assertThisInitialized(_this), "logger", void 0);
58
61
  return _this;
59
62
  }
60
63
  _createClass(SalesImpl, [{
@@ -87,9 +90,11 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
87
90
 
88
91
  // TODO(Rolo): 等领导提供 reservationList 的目标结构后,
89
92
  // 在这里补充从 Server/Order 读取 currentDay 原始数据并转换为预约列表。
90
- _context.next = 11;
93
+
94
+ this.logger = appPlugin === null || appPlugin === void 0 ? void 0 : appPlugin.getApp().logger;
95
+ _context.next = 12;
91
96
  return this.core.effects.emit("".concat(this.name, ":onInited"), {});
92
- case 11:
97
+ case 12:
93
98
  case "end":
94
99
  return _context.stop();
95
100
  }
@@ -510,6 +515,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
510
515
  resourceList,
511
516
  normalizedBookings,
512
517
  bookingMap,
518
+ list,
513
519
  _args3 = arguments;
514
520
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
515
521
  while (1) switch (_context3.prev = _context3.next) {
@@ -555,6 +561,8 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
555
561
  return _this3.normalizeMatchedBooking(current, deviceCurrent, booking);
556
562
  }).filter(function (booking) {
557
563
  return Boolean(booking);
564
+ }).filter(function (booking) {
565
+ return !booking.status;
558
566
  }).sort(function (left, right) {
559
567
  var leftStartAt = _this3.toBookingDateTime(left.start_date, left.start_time).valueOf();
560
568
  var rightStartAt = _this3.toBookingDateTime(right.start_date, right.start_time).valueOf();
@@ -574,7 +582,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
574
582
  });
575
583
 
576
584
  // 输出:每个资源都返回;bookings 可能是 0 / 1 / 多条(并发场景)
577
- return _context3.abrupt("return", resourceList.map(function (resource) {
585
+ list = resourceList.map(function (resource) {
578
586
  var resourceId = _this3.getResourceId(resource);
579
587
  var matchedBookings = bookingMap.get(String(resourceId)) || [];
580
588
  var bookings = _this3.pickBookingsForCurrentPoint(current, matchedBookings);
@@ -582,8 +590,15 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
582
590
  resource_id: resourceId,
583
591
  bookings: bookings
584
592
  });
585
- }));
586
- case 18:
593
+ });
594
+ this.logger.info('getResourceBookingList', {
595
+ currentTime: currentTime,
596
+ bookingList: bookingList,
597
+ deviceTime: deviceTime,
598
+ list: list
599
+ });
600
+ return _context3.abrupt("return", list);
601
+ case 20:
587
602
  case "end":
588
603
  return _context3.stop();
589
604
  }
@@ -24,6 +24,7 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
24
24
  protected options: ModuleOptions;
25
25
  protected otherParams: Record<string, any>;
26
26
  protected request: RequestPlugin;
27
+ private logger;
27
28
  constructor(name?: string, version?: string);
28
29
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
29
30
  /** 获取当前 store 快照 */
@@ -40,6 +40,7 @@ var import_BaseModule = require("../../modules/BaseModule");
40
40
  var import_types = require("./types");
41
41
  __reExport(Sales_exports, require("./types"), module.exports);
42
42
  var SalesImpl = class extends import_BaseModule.BaseModule {
43
+ // LoggerManager 实例
43
44
  constructor(name, version) {
44
45
  super(name, version);
45
46
  this.defaultName = "sales";
@@ -62,6 +63,7 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
62
63
  currentDay: (0, import_dayjs.default)().startOf("day"),
63
64
  reservationList: []
64
65
  };
66
+ this.logger = appPlugin == null ? void 0 : appPlugin.getApp().logger;
65
67
  await this.core.effects.emit(`${this.name}:onInited`, {});
66
68
  }
67
69
  // -------------------------------------------------------------------------
@@ -407,7 +409,7 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
407
409
  const resourceList = ((_a = resourceResponse == null ? void 0 : resourceResponse.data) == null ? void 0 : _a.list) ?? [];
408
410
  if (!Array.isArray(resourceList) || resourceList.length === 0)
409
411
  return [];
410
- const normalizedBookings = bookingList.map((booking) => this.normalizeMatchedBooking(current, deviceCurrent, booking)).filter((booking) => Boolean(booking)).sort((left, right) => {
412
+ const normalizedBookings = bookingList.map((booking) => this.normalizeMatchedBooking(current, deviceCurrent, booking)).filter((booking) => Boolean(booking)).filter((booking) => !booking.status).sort((left, right) => {
411
413
  const leftStartAt = this.toBookingDateTime(left.start_date, left.start_time).valueOf();
412
414
  const rightStartAt = this.toBookingDateTime(right.start_date, right.start_time).valueOf();
413
415
  return leftStartAt - rightStartAt;
@@ -421,12 +423,12 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
421
423
  if (relationId === void 0 || relationId === null)
422
424
  return;
423
425
  const key = String(relationId);
424
- const list = bookingMap.get(key) || [];
425
- list.push(booking);
426
- bookingMap.set(key, list);
426
+ const list2 = bookingMap.get(key) || [];
427
+ list2.push(booking);
428
+ bookingMap.set(key, list2);
427
429
  });
428
430
  });
429
- return resourceList.map((resource) => {
431
+ const list = resourceList.map((resource) => {
430
432
  const resourceId = this.getResourceId(resource);
431
433
  const matchedBookings = bookingMap.get(String(resourceId)) || [];
432
434
  const bookings = this.pickBookingsForCurrentPoint(current, matchedBookings);
@@ -436,6 +438,13 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
436
438
  bookings
437
439
  };
438
440
  });
441
+ this.logger.info("getResourceBookingList", {
442
+ currentTime,
443
+ bookingList,
444
+ deviceTime,
445
+ list
446
+ });
447
+ return list;
439
448
  }
440
449
  };
441
450
  var Sales_default = SalesImpl;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.110",
4
+ "version": "2.2.112",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",