@pisell/pisellos 2.2.117 → 2.2.119

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.
@@ -1,9 +0,0 @@
1
- // 导出评估器
2
- export { PromotionEvaluator } from "./evaluator";
3
-
4
- // 导出适配器
5
- export { PromotionAdapter } from "./adapter";
6
- export { default } from "./adapter";
7
-
8
- // 导出策略配置示例常量
9
- export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
@@ -106,8 +106,7 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
106
106
  this.logger = app.logger;
107
107
  }
108
108
  this.initResourceDataSource();
109
- this.setupResourceSync();
110
- case 8:
109
+ case 7:
111
110
  case "end":
112
111
  return _context.stop();
113
112
  }
@@ -150,38 +149,41 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
150
149
  while (1) switch (_context2.prev = _context2.next) {
151
150
  case 0:
152
151
  _context2.next = 2;
153
- return this.loadResourcesFromSQLite();
152
+ return this.setupResourceSync();
154
153
  case 2:
154
+ _context2.next = 4;
155
+ return this.loadResourcesFromSQLite();
156
+ case 4:
155
157
  cachedResources = _context2.sent;
156
158
  if (!(cachedResources.length > 0)) {
157
- _context2.next = 10;
159
+ _context2.next = 12;
158
160
  break;
159
161
  }
160
162
  this.store.list = cloneDeep(cachedResources).map(function (item) {
161
163
  return _this3.normalizeResource(item);
162
164
  });
163
165
  this.syncResourcesMap();
164
- _context2.next = 8;
166
+ _context2.next = 10;
165
167
  return this.safeEmit(ResourceHooks.onResourcesChanged, this.store.list);
166
- case 8:
167
- _context2.next = 18;
168
- break;
169
168
  case 10:
170
- _context2.next = 12;
171
- return this.loadResourcesByServer();
169
+ _context2.next = 20;
170
+ break;
172
171
  case 12:
172
+ _context2.next = 14;
173
+ return this.loadResourcesByServer();
174
+ case 14:
173
175
  resources = _context2.sent;
174
176
  if (!(resources.length > 0)) {
175
- _context2.next = 18;
177
+ _context2.next = 20;
176
178
  break;
177
179
  }
178
180
  this.store.list = cloneDeep(resources).map(function (item) {
179
181
  return _this3.normalizeResource(item);
180
182
  });
181
183
  this.syncResourcesMap();
182
- _context2.next = 18;
184
+ _context2.next = 20;
183
185
  return this.safeEmit(ResourceHooks.onResourcesChanged, this.store.list);
184
- case 18:
186
+ case 20:
185
187
  case "end":
186
188
  return _context2.stop();
187
189
  }
@@ -471,9 +471,8 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
471
471
  lateTime = Math.max(current.diff(startAt, 'minute'), 0);
472
472
  }
473
473
  }
474
-
475
474
  // 未来查询投影:查询时间晚于设备时间时,预留+迟到且 end_time 仍在查询时间之后的预约强制视为占用
476
- if (current.isAfter(deviceCurrent) && bookingStatus === 'reserved' && reservedStatus === 'late' && endAt.isValid() && endAt.isAfter(current)) {
475
+ if (current.isAfter(deviceCurrent) && bookingStatus === 'reserved' && reservedStatus === 'late' && endAt.isValid() && endAt.isSameOrAfter(current)) {
477
476
  bookingStatus = 'occupied';
478
477
  reservedStatus = undefined;
479
478
  lateTime = undefined;
@@ -599,9 +598,9 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
599
598
  title: 'getResourceBookingList',
600
599
  metadata: {
601
600
  currentTime: currentTime,
602
- bookingList: bookingList,
601
+ bookingList: bookingList === null || bookingList === void 0 ? void 0 : bookingList.length,
603
602
  deviceTime: deviceTime,
604
- list: list
603
+ list: list === null || list === void 0 ? void 0 : list.length
605
604
  }
606
605
  });
607
606
  return _context3.abrupt("return", list);
@@ -68,7 +68,6 @@ var ResourceModule = class extends import_BaseModule.BaseModule {
68
68
  this.logger = app.logger;
69
69
  }
70
70
  this.initResourceDataSource();
71
- this.setupResourceSync();
72
71
  }
73
72
  logInfo(title, metadata) {
74
73
  if (this.logger) {
@@ -89,6 +88,7 @@ var ResourceModule = class extends import_BaseModule.BaseModule {
89
88
  }
90
89
  }
91
90
  async preload() {
91
+ await this.setupResourceSync();
92
92
  const cachedResources = await this.loadResourcesFromSQLite();
93
93
  if (cachedResources.length > 0) {
94
94
  this.store.list = (0, import_lodash_es.cloneDeep)(cachedResources).map((item) => this.normalizeResource(item));
@@ -360,7 +360,7 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
360
360
  lateTime = Math.max(current.diff(startAt, "minute"), 0);
361
361
  }
362
362
  }
363
- if (current.isAfter(deviceCurrent) && bookingStatus === "reserved" && reservedStatus === "late" && endAt.isValid() && endAt.isAfter(current)) {
363
+ if (current.isAfter(deviceCurrent) && bookingStatus === "reserved" && reservedStatus === "late" && endAt.isValid() && endAt.isSameOrAfter(current)) {
364
364
  bookingStatus = "occupied";
365
365
  reservedStatus = void 0;
366
366
  lateTime = void 0;
@@ -444,9 +444,9 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
444
444
  title: "getResourceBookingList",
445
445
  metadata: {
446
446
  currentTime,
447
- bookingList,
447
+ bookingList: bookingList == null ? void 0 : bookingList.length,
448
448
  deviceTime,
449
- list
449
+ list: list == null ? void 0 : list.length
450
450
  }
451
451
  });
452
452
  return list;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.117",
4
+ "version": "2.2.119",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",