@pisell/pisellos 2.2.236 → 2.2.238
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/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/server/modules/resource/index.d.ts +2 -0
- package/dist/server/modules/resource/index.js +29 -3
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/server/modules/resource/index.d.ts +2 -0
- package/lib/server/modules/resource/index.js +27 -3
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
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";
|
|
@@ -61,6 +61,8 @@ export declare class ResourceModule extends BaseModule implements Module {
|
|
|
61
61
|
*/
|
|
62
62
|
clear(): Promise<void>;
|
|
63
63
|
private attachBookingsToResource;
|
|
64
|
+
private normalizeIntegerIdValue;
|
|
65
|
+
private normalizeResourceIdFields;
|
|
64
66
|
private normalizeResource;
|
|
65
67
|
private safeEmit;
|
|
66
68
|
private syncResourcesMap;
|
|
@@ -428,15 +428,41 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
428
428
|
bookings: this.getBookingsByResourceId(resource.id)
|
|
429
429
|
});
|
|
430
430
|
}
|
|
431
|
+
}, {
|
|
432
|
+
key: "normalizeIntegerIdValue",
|
|
433
|
+
value: function normalizeIntegerIdValue(value) {
|
|
434
|
+
if (typeof value !== 'string') return value;
|
|
435
|
+
var matched = value.match(/^(-?\d+)\.0+$/);
|
|
436
|
+
if (!matched) return value;
|
|
437
|
+
return matched[1];
|
|
438
|
+
}
|
|
439
|
+
}, {
|
|
440
|
+
key: "normalizeResourceIdFields",
|
|
441
|
+
value: function normalizeResourceIdFields(resource) {
|
|
442
|
+
resource.id = this.normalizeIntegerIdValue(resource.id);
|
|
443
|
+
if (resource.form_record_id !== undefined) {
|
|
444
|
+
resource.form_record_id = this.normalizeIntegerIdValue(resource.form_record_id);
|
|
445
|
+
}
|
|
446
|
+
if (resource.form_id !== undefined) {
|
|
447
|
+
resource.form_id = this.normalizeIntegerIdValue(resource.form_id);
|
|
448
|
+
}
|
|
449
|
+
if (resource.resource_form_id !== undefined) {
|
|
450
|
+
resource.resource_form_id = this.normalizeIntegerIdValue(resource.resource_form_id);
|
|
451
|
+
}
|
|
452
|
+
if (resource.resource_id !== undefined) {
|
|
453
|
+
resource.resource_id = this.normalizeIntegerIdValue(resource.resource_id);
|
|
454
|
+
}
|
|
455
|
+
return resource;
|
|
456
|
+
}
|
|
431
457
|
}, {
|
|
432
458
|
key: "normalizeResource",
|
|
433
459
|
value: function normalizeResource(resource) {
|
|
434
460
|
var _ref2,
|
|
435
461
|
_resource$id,
|
|
436
462
|
_this7 = this;
|
|
437
|
-
var normalized = _objectSpread(_objectSpread({}, resource), {}, {
|
|
438
|
-
id: (_ref2 = (_resource$id = resource === null || resource === void 0 ? void 0 : resource.id) !== null && _resource$id !== void 0 ? _resource$id : resource === null || resource === void 0 ? void 0 : resource.form_record_id) !== null && _ref2 !== void 0 ? _ref2 : ''
|
|
439
|
-
});
|
|
463
|
+
var normalized = this.normalizeResourceIdFields(_objectSpread(_objectSpread({}, resource), {}, {
|
|
464
|
+
id: this.normalizeIntegerIdValue((_ref2 = (_resource$id = resource === null || resource === void 0 ? void 0 : resource.id) !== null && _resource$id !== void 0 ? _resource$id : resource === null || resource === void 0 ? void 0 : resource.form_record_id) !== null && _ref2 !== void 0 ? _ref2 : '')
|
|
465
|
+
}));
|
|
440
466
|
if (normalized.form_record_id === undefined && normalized.id !== '') {
|
|
441
467
|
normalized.form_record_id = normalized.id;
|
|
442
468
|
}
|
|
@@ -322,7 +322,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
322
322
|
* 获取当前的客户搜索条件
|
|
323
323
|
* @returns 当前搜索条件
|
|
324
324
|
*/
|
|
325
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
325
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
326
326
|
/**
|
|
327
327
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
328
328
|
* @returns 客户状态
|
|
@@ -283,7 +283,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
283
283
|
break;
|
|
284
284
|
}
|
|
285
285
|
console.warn('[BookingTicket] businessCode 缺失,跳过 OpenData 配置加载,当前 module name: ', this.name);
|
|
286
|
-
return _context2.abrupt("return",
|
|
286
|
+
return _context2.abrupt("return", new Error('businessCode 缺失'));
|
|
287
287
|
case 6:
|
|
288
288
|
lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
289
289
|
cachedData = this.store.openData.getOpenData();
|
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -61,6 +61,8 @@ export declare class ResourceModule extends BaseModule implements Module {
|
|
|
61
61
|
*/
|
|
62
62
|
clear(): Promise<void>;
|
|
63
63
|
private attachBookingsToResource;
|
|
64
|
+
private normalizeIntegerIdValue;
|
|
65
|
+
private normalizeResourceIdFields;
|
|
64
66
|
private normalizeResource;
|
|
65
67
|
private safeEmit;
|
|
66
68
|
private syncResourcesMap;
|
|
@@ -268,11 +268,35 @@ var ResourceModule = class extends import_BaseModule.BaseModule {
|
|
|
268
268
|
bookings: this.getBookingsByResourceId(resource.id)
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
|
+
normalizeIntegerIdValue(value) {
|
|
272
|
+
if (typeof value !== "string")
|
|
273
|
+
return value;
|
|
274
|
+
const matched = value.match(/^(-?\d+)\.0+$/);
|
|
275
|
+
if (!matched)
|
|
276
|
+
return value;
|
|
277
|
+
return matched[1];
|
|
278
|
+
}
|
|
279
|
+
normalizeResourceIdFields(resource) {
|
|
280
|
+
resource.id = this.normalizeIntegerIdValue(resource.id);
|
|
281
|
+
if (resource.form_record_id !== void 0) {
|
|
282
|
+
resource.form_record_id = this.normalizeIntegerIdValue(resource.form_record_id);
|
|
283
|
+
}
|
|
284
|
+
if (resource.form_id !== void 0) {
|
|
285
|
+
resource.form_id = this.normalizeIntegerIdValue(resource.form_id);
|
|
286
|
+
}
|
|
287
|
+
if (resource.resource_form_id !== void 0) {
|
|
288
|
+
resource.resource_form_id = this.normalizeIntegerIdValue(resource.resource_form_id);
|
|
289
|
+
}
|
|
290
|
+
if (resource.resource_id !== void 0) {
|
|
291
|
+
resource.resource_id = this.normalizeIntegerIdValue(resource.resource_id);
|
|
292
|
+
}
|
|
293
|
+
return resource;
|
|
294
|
+
}
|
|
271
295
|
normalizeResource(resource) {
|
|
272
|
-
const normalized = {
|
|
296
|
+
const normalized = this.normalizeResourceIdFields({
|
|
273
297
|
...resource,
|
|
274
|
-
id: (resource == null ? void 0 : resource.id) ?? (resource == null ? void 0 : resource.form_record_id) ?? ""
|
|
275
|
-
};
|
|
298
|
+
id: this.normalizeIntegerIdValue((resource == null ? void 0 : resource.id) ?? (resource == null ? void 0 : resource.form_record_id) ?? "")
|
|
299
|
+
});
|
|
276
300
|
if (normalized.form_record_id === void 0 && normalized.id !== "") {
|
|
277
301
|
normalized.form_record_id = normalized.id;
|
|
278
302
|
}
|
|
@@ -322,7 +322,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
322
322
|
* 获取当前的客户搜索条件
|
|
323
323
|
* @returns 当前搜索条件
|
|
324
324
|
*/
|
|
325
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
325
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
326
326
|
/**
|
|
327
327
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
328
328
|
* @returns 客户状态
|
|
@@ -192,7 +192,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
192
192
|
const businessCode = this.getBookingTicketBusinessCode();
|
|
193
193
|
if (!businessCode) {
|
|
194
194
|
console.warn("[BookingTicket] businessCode 缺失,跳过 OpenData 配置加载,当前 module name: ", this.name);
|
|
195
|
-
return
|
|
195
|
+
return new Error("businessCode 缺失");
|
|
196
196
|
}
|
|
197
197
|
const lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
198
198
|
const cachedData = this.store.openData.getOpenData();
|