@pisell/pisellos 2.2.31 → 2.2.32
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/modules/Product/index.d.ts +1 -1
- package/dist/modules/Summary/utils.d.ts +1 -1
- package/dist/server/index.d.ts +20 -0
- package/dist/server/index.js +508 -125
- package/dist/server/modules/menu/index.d.ts +19 -0
- package/dist/server/modules/menu/index.js +220 -70
- package/dist/server/modules/products/index.d.ts +19 -0
- package/dist/server/modules/products/index.js +347 -116
- package/dist/server/modules/schedule/index.d.ts +19 -0
- package/dist/server/modules/schedule/index.js +227 -66
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Summary/utils.d.ts +1 -1
- package/lib/server/index.d.ts +20 -0
- package/lib/server/index.js +288 -5
- package/lib/server/modules/menu/index.d.ts +19 -0
- package/lib/server/modules/menu/index.js +120 -1
- package/lib/server/modules/products/index.d.ts +19 -0
- package/lib/server/modules/products/index.js +203 -17
- package/lib/server/modules/schedule/index.d.ts +19 -0
- package/lib/server/modules/schedule/index.js +140 -11
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -11,7 +11,26 @@ export declare class ScheduleModuleEx extends BaseModule implements Module, Sche
|
|
|
11
11
|
private request;
|
|
12
12
|
private store;
|
|
13
13
|
private dbManager;
|
|
14
|
+
private logger;
|
|
14
15
|
constructor(name?: string, version?: string);
|
|
16
|
+
/**
|
|
17
|
+
* 记录信息日志
|
|
18
|
+
* @param title 日志标题
|
|
19
|
+
* @param metadata 日志元数据
|
|
20
|
+
*/
|
|
21
|
+
private logInfo;
|
|
22
|
+
/**
|
|
23
|
+
* 记录警告日志
|
|
24
|
+
* @param title 日志标题
|
|
25
|
+
* @param metadata 日志元数据
|
|
26
|
+
*/
|
|
27
|
+
private logWarning;
|
|
28
|
+
/**
|
|
29
|
+
* 记录错误日志
|
|
30
|
+
* @param title 日志标题
|
|
31
|
+
* @param metadata 日志元数据
|
|
32
|
+
*/
|
|
33
|
+
private logError;
|
|
15
34
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
16
35
|
/**
|
|
17
36
|
* 加载当前店铺下所有 schedule(从服务器)
|
|
@@ -43,7 +43,7 @@ var INDEXDB_STORE_NAME = 'schedule';
|
|
|
43
43
|
export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
44
44
|
_inherits(ScheduleModuleEx, _BaseModule);
|
|
45
45
|
var _super = _createSuper(ScheduleModuleEx);
|
|
46
|
-
//
|
|
46
|
+
// LoggerManager 实例
|
|
47
47
|
|
|
48
48
|
function ScheduleModuleEx(name, version) {
|
|
49
49
|
var _this;
|
|
@@ -54,9 +54,74 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
54
54
|
_defineProperty(_assertThisInitialized(_this), "request", void 0);
|
|
55
55
|
_defineProperty(_assertThisInitialized(_this), "store", {});
|
|
56
56
|
_defineProperty(_assertThisInitialized(_this), "dbManager", void 0);
|
|
57
|
+
// IndexDBManager 实例
|
|
58
|
+
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
57
59
|
return _this;
|
|
58
60
|
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 记录信息日志
|
|
64
|
+
* @param title 日志标题
|
|
65
|
+
* @param metadata 日志元数据
|
|
66
|
+
*/
|
|
59
67
|
_createClass(ScheduleModuleEx, [{
|
|
68
|
+
key: "logInfo",
|
|
69
|
+
value: function logInfo(title, metadata) {
|
|
70
|
+
try {
|
|
71
|
+
if (this.logger) {
|
|
72
|
+
this.logger.addLog({
|
|
73
|
+
type: 'info',
|
|
74
|
+
title: "[ScheduleModule] ".concat(title),
|
|
75
|
+
metadata: metadata || {}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
} catch (_unused) {
|
|
79
|
+
// 日志记录失败不影响主流程
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 记录警告日志
|
|
85
|
+
* @param title 日志标题
|
|
86
|
+
* @param metadata 日志元数据
|
|
87
|
+
*/
|
|
88
|
+
}, {
|
|
89
|
+
key: "logWarning",
|
|
90
|
+
value: function logWarning(title, metadata) {
|
|
91
|
+
try {
|
|
92
|
+
if (this.logger) {
|
|
93
|
+
this.logger.addLog({
|
|
94
|
+
type: 'warning',
|
|
95
|
+
title: "[ScheduleModule] ".concat(title),
|
|
96
|
+
metadata: metadata || {}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
} catch (_unused2) {
|
|
100
|
+
// 日志记录失败不影响主流程
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* 记录错误日志
|
|
106
|
+
* @param title 日志标题
|
|
107
|
+
* @param metadata 日志元数据
|
|
108
|
+
*/
|
|
109
|
+
}, {
|
|
110
|
+
key: "logError",
|
|
111
|
+
value: function logError(title, metadata) {
|
|
112
|
+
try {
|
|
113
|
+
if (this.logger) {
|
|
114
|
+
this.logger.addLog({
|
|
115
|
+
type: 'error',
|
|
116
|
+
title: "[ScheduleModule] ".concat(title),
|
|
117
|
+
metadata: metadata || {}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
} catch (_unused3) {
|
|
121
|
+
// 日志记录失败不影响主流程
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}, {
|
|
60
125
|
key: "initialize",
|
|
61
126
|
value: function () {
|
|
62
127
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
@@ -84,18 +149,24 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
84
149
|
this.store.map = new Map();
|
|
85
150
|
}
|
|
86
151
|
|
|
87
|
-
// 获取并存储 dbManager
|
|
152
|
+
// 获取并存储 dbManager 和 logger
|
|
88
153
|
appPlugin = core.getPlugin('app');
|
|
89
154
|
if (appPlugin) {
|
|
90
155
|
app = appPlugin.getApp();
|
|
91
156
|
this.dbManager = app.dbManager;
|
|
157
|
+
this.logger = app.logger;
|
|
92
158
|
if (this.dbManager) {
|
|
93
159
|
console.log('[Schedule] IndexDB Manager 已初始化');
|
|
94
160
|
} else {
|
|
95
161
|
console.warn('[Schedule] IndexDB Manager 未找到');
|
|
96
162
|
}
|
|
97
163
|
}
|
|
98
|
-
|
|
164
|
+
this.logInfo('模块初始化完成', {
|
|
165
|
+
hasDbManager: !!this.dbManager,
|
|
166
|
+
hasLogger: !!this.logger,
|
|
167
|
+
initialScheduleCount: this.store.scheduleList.length
|
|
168
|
+
});
|
|
169
|
+
case 9:
|
|
99
170
|
case "end":
|
|
100
171
|
return _context.stop();
|
|
101
172
|
}
|
|
@@ -113,30 +184,49 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
113
184
|
key: "loadAllSchedule",
|
|
114
185
|
value: (function () {
|
|
115
186
|
var _loadAllSchedule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
116
|
-
var _scheduleList$data;
|
|
117
|
-
var scheduleList, list;
|
|
187
|
+
var startTime, _scheduleList$data, scheduleList, list, duration, _duration, errorMessage;
|
|
118
188
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
119
189
|
while (1) switch (_context2.prev = _context2.next) {
|
|
120
190
|
case 0:
|
|
121
|
-
|
|
191
|
+
this.logInfo('开始从服务器加载日程列表');
|
|
192
|
+
startTime = Date.now();
|
|
193
|
+
_context2.prev = 2;
|
|
194
|
+
_context2.next = 5;
|
|
122
195
|
return this.request.get("/schedule", {
|
|
123
196
|
num: 999
|
|
124
197
|
}, {
|
|
125
198
|
cache: undefined
|
|
126
199
|
});
|
|
127
|
-
case
|
|
200
|
+
case 5:
|
|
128
201
|
scheduleList = _context2.sent;
|
|
129
|
-
list = ((_scheduleList$data = scheduleList.data) === null || _scheduleList$data === void 0 ? void 0 : _scheduleList$data.list) || [];
|
|
130
|
-
|
|
202
|
+
list = ((_scheduleList$data = scheduleList.data) === null || _scheduleList$data === void 0 ? void 0 : _scheduleList$data.list) || [];
|
|
203
|
+
duration = Date.now() - startTime;
|
|
204
|
+
this.logInfo('从服务器加载日程列表成功', {
|
|
205
|
+
scheduleCount: list.length,
|
|
206
|
+
duration: "".concat(duration, "ms")
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// 保存到 IndexDB
|
|
210
|
+
_context2.next = 11;
|
|
131
211
|
return this.saveScheduleToIndexDB(list);
|
|
132
|
-
case
|
|
212
|
+
case 11:
|
|
133
213
|
this.setScheduleList(list);
|
|
134
214
|
return _context2.abrupt("return", list);
|
|
135
|
-
case
|
|
215
|
+
case 15:
|
|
216
|
+
_context2.prev = 15;
|
|
217
|
+
_context2.t0 = _context2["catch"](2);
|
|
218
|
+
_duration = Date.now() - startTime;
|
|
219
|
+
errorMessage = _context2.t0 instanceof Error ? _context2.t0.message : String(_context2.t0);
|
|
220
|
+
this.logError('从服务器加载日程列表失败', {
|
|
221
|
+
duration: "".concat(_duration, "ms"),
|
|
222
|
+
error: errorMessage
|
|
223
|
+
});
|
|
224
|
+
throw _context2.t0;
|
|
225
|
+
case 21:
|
|
136
226
|
case "end":
|
|
137
227
|
return _context2.stop();
|
|
138
228
|
}
|
|
139
|
-
}, _callee2, this);
|
|
229
|
+
}, _callee2, this, [[2, 15]]);
|
|
140
230
|
}));
|
|
141
231
|
function loadAllSchedule() {
|
|
142
232
|
return _loadAllSchedule.apply(this, arguments);
|
|
@@ -168,6 +258,9 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
168
258
|
key: "getScheduleByIds",
|
|
169
259
|
value: function getScheduleByIds(ids) {
|
|
170
260
|
if (!ids || ids.length === 0) {
|
|
261
|
+
this.logWarning('getScheduleByIds: 未提供有效的 ids', {
|
|
262
|
+
idsCount: 0
|
|
263
|
+
});
|
|
171
264
|
return [];
|
|
172
265
|
}
|
|
173
266
|
var result = [];
|
|
@@ -186,6 +279,11 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
186
279
|
} finally {
|
|
187
280
|
_iterator.f();
|
|
188
281
|
}
|
|
282
|
+
this.logInfo('getScheduleByIds: 查询完成', {
|
|
283
|
+
requestedCount: ids.length,
|
|
284
|
+
foundCount: result.length,
|
|
285
|
+
notFoundCount: ids.length - result.length
|
|
286
|
+
});
|
|
189
287
|
return result;
|
|
190
288
|
}
|
|
191
289
|
|
|
@@ -220,32 +318,43 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
220
318
|
key: "clear",
|
|
221
319
|
value: (function () {
|
|
222
320
|
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
321
|
+
var errorMessage;
|
|
223
322
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
224
323
|
while (1) switch (_context3.prev = _context3.next) {
|
|
225
324
|
case 0:
|
|
325
|
+
this.logInfo('开始清空缓存', {
|
|
326
|
+
currentScheduleCount: this.store.scheduleList.length
|
|
327
|
+
});
|
|
226
328
|
this.store.scheduleList = [];
|
|
227
329
|
this.store.map.clear();
|
|
228
330
|
// 同时清空 IndexDB 中的数据
|
|
229
331
|
if (!this.dbManager) {
|
|
230
|
-
_context3.next =
|
|
332
|
+
_context3.next = 16;
|
|
231
333
|
break;
|
|
232
334
|
}
|
|
233
|
-
_context3.prev =
|
|
234
|
-
_context3.next =
|
|
335
|
+
_context3.prev = 4;
|
|
336
|
+
_context3.next = 7;
|
|
235
337
|
return this.dbManager.clear(INDEXDB_STORE_NAME);
|
|
236
|
-
case
|
|
338
|
+
case 7:
|
|
237
339
|
console.log('[Schedule] IndexDB 缓存已清空');
|
|
238
|
-
|
|
340
|
+
this.logInfo('IndexDB 缓存已清空');
|
|
341
|
+
_context3.next = 16;
|
|
239
342
|
break;
|
|
240
|
-
case
|
|
241
|
-
_context3.prev =
|
|
242
|
-
_context3.t0 = _context3["catch"](
|
|
343
|
+
case 11:
|
|
344
|
+
_context3.prev = 11;
|
|
345
|
+
_context3.t0 = _context3["catch"](4);
|
|
346
|
+
errorMessage = _context3.t0 instanceof Error ? _context3.t0.message : String(_context3.t0);
|
|
243
347
|
console.error('[Schedule] 清空 IndexDB 缓存失败:', _context3.t0);
|
|
244
|
-
|
|
348
|
+
this.logError('清空 IndexDB 缓存失败', {
|
|
349
|
+
error: errorMessage
|
|
350
|
+
});
|
|
351
|
+
case 16:
|
|
352
|
+
this.logInfo('缓存清空完成');
|
|
353
|
+
case 17:
|
|
245
354
|
case "end":
|
|
246
355
|
return _context3.stop();
|
|
247
356
|
}
|
|
248
|
-
}, _callee3, this, [[
|
|
357
|
+
}, _callee3, this, [[4, 11]]);
|
|
249
358
|
}));
|
|
250
359
|
function clear() {
|
|
251
360
|
return _clear.apply(this, arguments);
|
|
@@ -271,7 +380,13 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
271
380
|
scheduleListData.push(item);
|
|
272
381
|
}
|
|
273
382
|
});
|
|
274
|
-
|
|
383
|
+
var result = _getDateIsInSchedule(date, scheduleListData);
|
|
384
|
+
this.logInfo('getDateIsInSchedule: 判断日期是否在日程范围内', {
|
|
385
|
+
date: date,
|
|
386
|
+
scheduleCount: scheduleListData.length,
|
|
387
|
+
isInSchedule: result
|
|
388
|
+
});
|
|
389
|
+
return result;
|
|
275
390
|
}
|
|
276
391
|
|
|
277
392
|
/**
|
|
@@ -282,32 +397,40 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
282
397
|
key: "loadScheduleFromIndexDB",
|
|
283
398
|
value: (function () {
|
|
284
399
|
var _loadScheduleFromIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
285
|
-
var scheduleList;
|
|
400
|
+
var _scheduleList$length, scheduleList, errorMessage;
|
|
286
401
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
287
402
|
while (1) switch (_context4.prev = _context4.next) {
|
|
288
403
|
case 0:
|
|
289
404
|
if (this.dbManager) {
|
|
290
|
-
_context4.next =
|
|
405
|
+
_context4.next = 3;
|
|
291
406
|
break;
|
|
292
407
|
}
|
|
408
|
+
this.logWarning('loadScheduleFromIndexDB: dbManager 不可用');
|
|
293
409
|
return _context4.abrupt("return", []);
|
|
294
|
-
case
|
|
295
|
-
_context4.prev =
|
|
296
|
-
_context4.next =
|
|
410
|
+
case 3:
|
|
411
|
+
_context4.prev = 3;
|
|
412
|
+
_context4.next = 6;
|
|
297
413
|
return this.dbManager.getAll(INDEXDB_STORE_NAME);
|
|
298
|
-
case
|
|
414
|
+
case 6:
|
|
299
415
|
scheduleList = _context4.sent;
|
|
416
|
+
this.logInfo('从 IndexDB 加载日程数据', {
|
|
417
|
+
scheduleCount: (_scheduleList$length = scheduleList === null || scheduleList === void 0 ? void 0 : scheduleList.length) !== null && _scheduleList$length !== void 0 ? _scheduleList$length : 0
|
|
418
|
+
});
|
|
300
419
|
return _context4.abrupt("return", scheduleList || []);
|
|
301
|
-
case
|
|
302
|
-
_context4.prev =
|
|
303
|
-
_context4.t0 = _context4["catch"](
|
|
420
|
+
case 11:
|
|
421
|
+
_context4.prev = 11;
|
|
422
|
+
_context4.t0 = _context4["catch"](3);
|
|
423
|
+
errorMessage = _context4.t0 instanceof Error ? _context4.t0.message : String(_context4.t0);
|
|
304
424
|
console.error('[Schedule] 从 IndexDB 读取数据失败:', _context4.t0);
|
|
425
|
+
this.logError('从 IndexDB 读取数据失败', {
|
|
426
|
+
error: errorMessage
|
|
427
|
+
});
|
|
305
428
|
return _context4.abrupt("return", []);
|
|
306
|
-
case
|
|
429
|
+
case 17:
|
|
307
430
|
case "end":
|
|
308
431
|
return _context4.stop();
|
|
309
432
|
}
|
|
310
|
-
}, _callee4, this, [[
|
|
433
|
+
}, _callee4, this, [[3, 11]]);
|
|
311
434
|
}));
|
|
312
435
|
function loadScheduleFromIndexDB() {
|
|
313
436
|
return _loadScheduleFromIndexDB.apply(this, arguments);
|
|
@@ -324,39 +447,51 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
324
447
|
value: (function () {
|
|
325
448
|
var _saveScheduleToIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(scheduleList) {
|
|
326
449
|
var _this3 = this;
|
|
327
|
-
var savePromises;
|
|
450
|
+
var savePromises, errorMessage;
|
|
328
451
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
329
452
|
while (1) switch (_context5.prev = _context5.next) {
|
|
330
453
|
case 0:
|
|
331
454
|
if (this.dbManager) {
|
|
332
|
-
_context5.next =
|
|
455
|
+
_context5.next = 3;
|
|
333
456
|
break;
|
|
334
457
|
}
|
|
458
|
+
this.logWarning('saveScheduleToIndexDB: dbManager 不可用');
|
|
335
459
|
return _context5.abrupt("return");
|
|
336
|
-
case
|
|
337
|
-
|
|
338
|
-
|
|
460
|
+
case 3:
|
|
461
|
+
this.logInfo('开始保存日程数据到 IndexDB', {
|
|
462
|
+
scheduleCount: scheduleList.length
|
|
463
|
+
});
|
|
464
|
+
_context5.prev = 4;
|
|
465
|
+
_context5.next = 7;
|
|
339
466
|
return this.dbManager.clear(INDEXDB_STORE_NAME);
|
|
340
|
-
case
|
|
467
|
+
case 7:
|
|
341
468
|
// 逐个保存日程(每个日程是独立的记录)
|
|
342
469
|
savePromises = scheduleList.map(function (schedule) {
|
|
343
470
|
return _this3.dbManager.add(INDEXDB_STORE_NAME, schedule);
|
|
344
471
|
});
|
|
345
|
-
_context5.next =
|
|
472
|
+
_context5.next = 10;
|
|
346
473
|
return Promise.all(savePromises);
|
|
347
|
-
case
|
|
474
|
+
case 10:
|
|
348
475
|
console.log("[Schedule] \u5DF2\u5C06 ".concat(scheduleList.length, " \u6761\u65E5\u7A0B\u6570\u636E\u4FDD\u5B58\u5230 IndexDB"));
|
|
349
|
-
|
|
476
|
+
this.logInfo('日程数据已保存到 IndexDB', {
|
|
477
|
+
scheduleCount: scheduleList.length
|
|
478
|
+
});
|
|
479
|
+
_context5.next = 19;
|
|
350
480
|
break;
|
|
351
|
-
case 11:
|
|
352
|
-
_context5.prev = 11;
|
|
353
|
-
_context5.t0 = _context5["catch"](2);
|
|
354
|
-
console.error('[Schedule] 保存数据到 IndexDB 失败:', _context5.t0);
|
|
355
481
|
case 14:
|
|
482
|
+
_context5.prev = 14;
|
|
483
|
+
_context5.t0 = _context5["catch"](4);
|
|
484
|
+
errorMessage = _context5.t0 instanceof Error ? _context5.t0.message : String(_context5.t0);
|
|
485
|
+
console.error('[Schedule] 保存数据到 IndexDB 失败:', _context5.t0);
|
|
486
|
+
this.logError('保存数据到 IndexDB 失败', {
|
|
487
|
+
scheduleCount: scheduleList.length,
|
|
488
|
+
error: errorMessage
|
|
489
|
+
});
|
|
490
|
+
case 19:
|
|
356
491
|
case "end":
|
|
357
492
|
return _context5.stop();
|
|
358
493
|
}
|
|
359
|
-
}, _callee5, this, [[
|
|
494
|
+
}, _callee5, this, [[4, 14]]);
|
|
360
495
|
}));
|
|
361
496
|
function saveScheduleToIndexDB(_x3) {
|
|
362
497
|
return _saveScheduleToIndexDB.apply(this, arguments);
|
|
@@ -372,18 +507,20 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
372
507
|
key: "preload",
|
|
373
508
|
value: (function () {
|
|
374
509
|
var _preload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
375
|
-
var cachedData, scheduleList;
|
|
510
|
+
var startTime, cachedData, duration, errorMessage, scheduleList, _duration2, _duration3;
|
|
376
511
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
377
512
|
while (1) switch (_context6.prev = _context6.next) {
|
|
378
513
|
case 0:
|
|
379
514
|
console.log('[Schedule] 开始预加载数据...');
|
|
380
|
-
|
|
381
|
-
|
|
515
|
+
startTime = Date.now();
|
|
516
|
+
this.logInfo('开始预加载数据');
|
|
517
|
+
_context6.prev = 3;
|
|
518
|
+
_context6.next = 6;
|
|
382
519
|
return this.loadScheduleFromIndexDB();
|
|
383
|
-
case
|
|
520
|
+
case 6:
|
|
384
521
|
cachedData = _context6.sent;
|
|
385
522
|
if (!(cachedData && cachedData.length > 0)) {
|
|
386
|
-
_context6.next =
|
|
523
|
+
_context6.next = 14;
|
|
387
524
|
break;
|
|
388
525
|
}
|
|
389
526
|
console.log("[Schedule] \u4ECE IndexDB \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u6761\u65E5\u7A0B\u6570\u636E"));
|
|
@@ -391,35 +528,59 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
391
528
|
this.store.scheduleList = cloneDeep(cachedData);
|
|
392
529
|
// 同步更新 Map 缓存
|
|
393
530
|
this.syncScheduleMap();
|
|
531
|
+
duration = Date.now() - startTime;
|
|
532
|
+
this.logInfo('预加载完成(从 IndexDB)', {
|
|
533
|
+
scheduleCount: cachedData.length,
|
|
534
|
+
duration: "".concat(duration, "ms"),
|
|
535
|
+
source: 'IndexDB'
|
|
536
|
+
});
|
|
394
537
|
return _context6.abrupt("return");
|
|
395
|
-
case
|
|
538
|
+
case 14:
|
|
396
539
|
console.log('[Schedule] IndexDB 中没有缓存数据,从服务器加载...');
|
|
397
|
-
|
|
540
|
+
this.logInfo('IndexDB 中没有缓存数据,准备从服务器加载');
|
|
541
|
+
_context6.next = 23;
|
|
398
542
|
break;
|
|
399
|
-
case
|
|
400
|
-
_context6.prev =
|
|
401
|
-
_context6.t0 = _context6["catch"](
|
|
543
|
+
case 18:
|
|
544
|
+
_context6.prev = 18;
|
|
545
|
+
_context6.t0 = _context6["catch"](3);
|
|
546
|
+
errorMessage = _context6.t0 instanceof Error ? _context6.t0.message : String(_context6.t0);
|
|
402
547
|
console.warn('[Schedule] 从 IndexDB 加载数据失败:', _context6.t0);
|
|
403
|
-
|
|
404
|
-
|
|
548
|
+
this.logWarning('从 IndexDB 加载数据失败,准备从服务器加载', {
|
|
549
|
+
error: errorMessage
|
|
550
|
+
});
|
|
551
|
+
case 23:
|
|
552
|
+
_context6.next = 25;
|
|
405
553
|
return this.loadAllSchedule();
|
|
406
|
-
case
|
|
554
|
+
case 25:
|
|
407
555
|
scheduleList = _context6.sent;
|
|
408
556
|
if (!(scheduleList && scheduleList.length > 0)) {
|
|
409
|
-
_context6.next =
|
|
557
|
+
_context6.next = 35;
|
|
410
558
|
break;
|
|
411
559
|
}
|
|
412
|
-
_context6.next =
|
|
560
|
+
_context6.next = 29;
|
|
413
561
|
return this.saveScheduleToIndexDB(scheduleList);
|
|
414
|
-
case
|
|
562
|
+
case 29:
|
|
415
563
|
this.store.scheduleList = cloneDeep(scheduleList);
|
|
416
564
|
// 同步更新 Map 缓存
|
|
417
565
|
this.syncScheduleMap();
|
|
418
|
-
|
|
566
|
+
_duration2 = Date.now() - startTime;
|
|
567
|
+
this.logInfo('预加载完成(从服务器)', {
|
|
568
|
+
scheduleCount: scheduleList.length,
|
|
569
|
+
duration: "".concat(_duration2, "ms"),
|
|
570
|
+
source: 'Server'
|
|
571
|
+
});
|
|
572
|
+
_context6.next = 37;
|
|
573
|
+
break;
|
|
574
|
+
case 35:
|
|
575
|
+
_duration3 = Date.now() - startTime;
|
|
576
|
+
this.logWarning('预加载完成但未获取到数据', {
|
|
577
|
+
duration: "".concat(_duration3, "ms")
|
|
578
|
+
});
|
|
579
|
+
case 37:
|
|
419
580
|
case "end":
|
|
420
581
|
return _context6.stop();
|
|
421
582
|
}
|
|
422
|
-
}, _callee6, this, [[
|
|
583
|
+
}, _callee6, this, [[3, 18]]);
|
|
423
584
|
}));
|
|
424
585
|
function preload() {
|
|
425
586
|
return _preload.apply(this, arguments);
|
|
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
123
123
|
* 获取当前的客户搜索条件
|
|
124
124
|
* @returns 当前搜索条件
|
|
125
125
|
*/
|
|
126
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
126
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
127
127
|
/**
|
|
128
128
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
129
129
|
* @returns 客户状态
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -21,7 +21,7 @@ export declare const calculateSubtotal: (items: CartItem[]) => string;
|
|
|
21
21
|
* @return {*}
|
|
22
22
|
* @Author: xiangfeng.xue
|
|
23
23
|
*/
|
|
24
|
-
export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => "0.00"
|
|
24
|
+
export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => Decimal | "0.00";
|
|
25
25
|
/**
|
|
26
26
|
* @title: 计算定金
|
|
27
27
|
* @param items - 购物车商品数组
|
package/lib/server/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export type { RouteHandler, HttpMethod, RouteDefinition, Router, ModuleRegistryC
|
|
|
11
11
|
*/
|
|
12
12
|
declare class Server {
|
|
13
13
|
private core;
|
|
14
|
+
private app;
|
|
15
|
+
private logger;
|
|
14
16
|
products?: ProductsModule;
|
|
15
17
|
menu?: MenuModule;
|
|
16
18
|
quotation?: QuotationModule;
|
|
@@ -142,6 +144,24 @@ declare class Server {
|
|
|
142
144
|
* @private
|
|
143
145
|
*/
|
|
144
146
|
private filterProductsByMenuConfig;
|
|
147
|
+
/**
|
|
148
|
+
* 记录信息日志
|
|
149
|
+
* @param title 日志标题
|
|
150
|
+
* @param metadata 日志元数据
|
|
151
|
+
*/
|
|
152
|
+
private logInfo;
|
|
153
|
+
/**
|
|
154
|
+
* 记录警告日志
|
|
155
|
+
* @param title 日志标题
|
|
156
|
+
* @param metadata 日志元数据
|
|
157
|
+
*/
|
|
158
|
+
private logWarning;
|
|
159
|
+
/**
|
|
160
|
+
* 记录错误日志
|
|
161
|
+
* @param title 日志标题
|
|
162
|
+
* @param metadata 日志元数据
|
|
163
|
+
*/
|
|
164
|
+
private logError;
|
|
145
165
|
/**
|
|
146
166
|
* 处理获取日程时间段点的请求
|
|
147
167
|
* 通过餐牌ID列表获取所有相关日程的时间段点
|