@pisell/pisellos 2.2.111 → 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
|
-
|
|
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
|
|
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) {
|
|
@@ -576,7 +582,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
576
582
|
});
|
|
577
583
|
|
|
578
584
|
// 输出:每个资源都返回;bookings 可能是 0 / 1 / 多条(并发场景)
|
|
579
|
-
|
|
585
|
+
list = resourceList.map(function (resource) {
|
|
580
586
|
var resourceId = _this3.getResourceId(resource);
|
|
581
587
|
var matchedBookings = bookingMap.get(String(resourceId)) || [];
|
|
582
588
|
var bookings = _this3.pickBookingsForCurrentPoint(current, matchedBookings);
|
|
@@ -584,8 +590,15 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
584
590
|
resource_id: resourceId,
|
|
585
591
|
bookings: bookings
|
|
586
592
|
});
|
|
587
|
-
})
|
|
588
|
-
|
|
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:
|
|
589
602
|
case "end":
|
|
590
603
|
return _context3.stop();
|
|
591
604
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
+
var promotion_exports = {};
|
|
31
|
+
__export(promotion_exports, {
|
|
32
|
+
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
+
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
+
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
+
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
+
default: () => import_adapter2.default
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
+
var import_evaluator = require("./evaluator");
|
|
40
|
+
var import_adapter = require("./adapter");
|
|
41
|
+
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
+
var import_examples = require("./examples");
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
+
PromotionAdapter,
|
|
47
|
+
PromotionEvaluator,
|
|
48
|
+
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
+
});
|
|
@@ -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
|
// -------------------------------------------------------------------------
|
|
@@ -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
|
|
425
|
-
|
|
426
|
-
bookingMap.set(key,
|
|
426
|
+
const list2 = bookingMap.get(key) || [];
|
|
427
|
+
list2.push(booking);
|
|
428
|
+
bookingMap.set(key, list2);
|
|
427
429
|
});
|
|
428
430
|
});
|
|
429
|
-
|
|
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;
|