@pisell/pisellos 2.3.23 → 2.3.24
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/dataVariant/adapter.d.ts +50 -0
- package/dist/model/strategy/adapter/dataVariant/adapter.js +167 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +89 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +780 -0
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/dist/model/strategy/adapter/dataVariant/examples.js +277 -0
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/dist/model/strategy/adapter/dataVariant/index.js +4 -0
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +148 -0
- package/dist/model/strategy/adapter/dataVariant/type.js +54 -0
- package/dist/model/strategy/adapter/index.d.ts +4 -0
- package/dist/model/strategy/adapter/index.js +5 -1
- package/dist/modules/Discount/index.d.ts +5 -2
- package/dist/modules/Discount/index.js +30 -7
- package/dist/modules/Discount/types.d.ts +4 -0
- package/dist/modules/Order/index.d.ts +2 -1
- package/dist/modules/Order/index.js +25 -11
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +22 -0
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +4 -2
- package/dist/modules/ProductList/types.d.ts +2 -0
- package/dist/server/index.d.ts +50 -0
- package/dist/server/index.js +995 -749
- package/dist/server/modules/products/index.d.ts +26 -7
- package/dist/server/modules/products/index.js +167 -76
- package/dist/server/modules/products/types.d.ts +14 -0
- package/dist/solution/BaseSales/index.d.ts +2 -0
- package/dist/solution/BaseSales/index.js +23 -13
- package/dist/solution/BookingTicket/types.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +15 -14
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.js +149 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +89 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +583 -0
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/lib/model/strategy/adapter/dataVariant/examples.js +293 -0
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/lib/model/strategy/adapter/dataVariant/index.js +38 -0
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +148 -0
- package/lib/model/strategy/adapter/dataVariant/type.js +31 -0
- package/lib/model/strategy/adapter/index.d.ts +4 -0
- package/lib/model/strategy/adapter/index.js +13 -2
- package/lib/modules/Discount/index.d.ts +5 -2
- package/lib/modules/Discount/index.js +23 -3
- package/lib/modules/Discount/types.d.ts +4 -0
- package/lib/modules/Order/index.d.ts +2 -1
- package/lib/modules/Order/index.js +13 -1
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +22 -0
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +4 -2
- package/lib/modules/ProductList/types.d.ts +2 -0
- package/lib/server/index.d.ts +50 -0
- package/lib/server/index.js +206 -29
- package/lib/server/modules/products/index.d.ts +26 -7
- package/lib/server/modules/products/index.js +114 -35
- package/lib/server/modules/products/types.d.ts +14 -0
- package/lib/solution/BaseSales/index.d.ts +2 -0
- package/lib/solution/BaseSales/index.js +12 -3
- package/lib/solution/BookingTicket/types.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +2 -1
- package/package.json +1 -1
|
@@ -68,6 +68,10 @@ export interface DiscountWithReason {
|
|
|
68
68
|
discountList: Discount[];
|
|
69
69
|
unavailableReasonKey: DiscountFilterRejectKey | null;
|
|
70
70
|
}
|
|
71
|
+
export interface DiscountPrepareConfigResult {
|
|
72
|
+
discountList: Discount[];
|
|
73
|
+
availableWalletIds: number[];
|
|
74
|
+
}
|
|
71
75
|
interface ExtensionData {
|
|
72
76
|
id: number;
|
|
73
77
|
shop_id: number;
|
|
@@ -75,6 +75,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
75
75
|
apply?: boolean;
|
|
76
76
|
}): Promise<Discount[]>;
|
|
77
77
|
getDiscountList(): Discount[];
|
|
78
|
+
getAvailableWalletIds(): number[];
|
|
78
79
|
private ensureEditDiscountConfigForProductChange;
|
|
79
80
|
scanCode(code: string, customerId?: number): Promise<{
|
|
80
81
|
isAvailable: boolean;
|
|
@@ -464,7 +465,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
464
465
|
generateIdempotencyToken(): string;
|
|
465
466
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
466
467
|
createOrder(params: CommitOrderParams['query']): {
|
|
467
|
-
type: "
|
|
468
|
+
type: "appointment_booking" | "virtual";
|
|
468
469
|
platform: string;
|
|
469
470
|
sales_channel: string;
|
|
470
471
|
order_sales_channel: string;
|
|
@@ -295,14 +295,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
295
295
|
if (!this.store.summary) {
|
|
296
296
|
this.store.summary = createEmptySummary();
|
|
297
297
|
}
|
|
298
|
+
if (!Array.isArray(this.store.availableWalletIds)) {
|
|
299
|
+
this.store.availableWalletIds = [];
|
|
300
|
+
}
|
|
298
301
|
this.request = this.core.getPlugin('request');
|
|
299
302
|
appPlugin = this.core.getPlugin('app');
|
|
300
303
|
if (appPlugin) {
|
|
301
|
-
_context.next =
|
|
304
|
+
_context.next = 9;
|
|
302
305
|
break;
|
|
303
306
|
}
|
|
304
307
|
throw new Error('Order 模块需要 app 插件支持');
|
|
305
|
-
case
|
|
308
|
+
case 9:
|
|
306
309
|
app = appPlugin.getApp();
|
|
307
310
|
this.logger = app.logger;
|
|
308
311
|
this.window = this.core.getPlugin('window');
|
|
@@ -315,7 +318,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
315
318
|
this.otherParams = otherParams;
|
|
316
319
|
this.registerDiscountModules(options);
|
|
317
320
|
this.logInfo('OrderModule initialized successfully');
|
|
318
|
-
case
|
|
321
|
+
case 21:
|
|
319
322
|
case "end":
|
|
320
323
|
return _context.stop();
|
|
321
324
|
}
|
|
@@ -492,7 +495,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
492
495
|
value: function () {
|
|
493
496
|
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
494
497
|
var _this$store$tempOrder, _this$store$discount, _this$store$tempOrder2;
|
|
495
|
-
var orderId, discountList, _this$store$discount2, _this$store$discount3, _this$store$discount4, currentDiscountList, currentEditDiscounts, currentScanDiscounts, currentScanDiscountIds, runtimeDiscountIds, runtimeDiscounts, mergedDiscountList;
|
|
498
|
+
var orderId, prepareConfigResult, discountList, _this$store$discount2, _this$store$discount3, _this$store$discount4, currentDiscountList, currentEditDiscounts, currentScanDiscounts, currentScanDiscountIds, runtimeDiscountIds, runtimeDiscounts, mergedDiscountList;
|
|
496
499
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
497
500
|
while (1) switch (_context3.prev = _context3.next) {
|
|
498
501
|
case 0:
|
|
@@ -504,14 +507,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
504
507
|
with_good_pass: 1,
|
|
505
508
|
with_discount_card: 1,
|
|
506
509
|
with_wallet_pass_holder: 1,
|
|
510
|
+
with_available_wallet_flag: 1,
|
|
511
|
+
with_available_wallet_pass_flag: 1,
|
|
507
512
|
request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
508
513
|
}, orderId ? {
|
|
509
514
|
order_id: orderId
|
|
510
515
|
} : {}));
|
|
511
516
|
case 3:
|
|
512
|
-
|
|
517
|
+
prepareConfigResult = _context3.sent;
|
|
518
|
+
discountList = prepareConfigResult === null || prepareConfigResult === void 0 ? void 0 : prepareConfigResult.discountList;
|
|
519
|
+
this.store.availableWalletIds = (prepareConfigResult === null || prepareConfigResult === void 0 ? void 0 : prepareConfigResult.availableWalletIds) || [];
|
|
513
520
|
if (!discountList) {
|
|
514
|
-
_context3.next =
|
|
521
|
+
_context3.next = 18;
|
|
515
522
|
break;
|
|
516
523
|
}
|
|
517
524
|
currentDiscountList = ((_this$store$discount2 = this.store.discount) === null || _this$store$discount2 === void 0 ? void 0 : _this$store$discount2.getDiscountList()) || [];
|
|
@@ -532,17 +539,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
532
539
|
return true;
|
|
533
540
|
});
|
|
534
541
|
mergedDiscountList = [].concat(_toConsumableArray(currentEditDiscounts), _toConsumableArray(currentScanDiscounts), _toConsumableArray(runtimeDiscounts));
|
|
535
|
-
_context3.next = 14;
|
|
536
|
-
return (_this$store$discount3 = this.store.discount) === null || _this$store$discount3 === void 0 ? void 0 : _this$store$discount3.setOriginalDiscountList(mergedDiscountList);
|
|
537
|
-
case 14:
|
|
538
542
|
_context3.next = 16;
|
|
539
|
-
return (_this$store$
|
|
543
|
+
return (_this$store$discount3 = this.store.discount) === null || _this$store$discount3 === void 0 ? void 0 : _this$store$discount3.setOriginalDiscountList(mergedDiscountList);
|
|
540
544
|
case 16:
|
|
545
|
+
_context3.next = 18;
|
|
546
|
+
return (_this$store$discount4 = this.store.discount) === null || _this$store$discount4 === void 0 ? void 0 : _this$store$discount4.setDiscountList(mergedDiscountList);
|
|
547
|
+
case 18:
|
|
541
548
|
if (params.apply !== false && (_this$store$tempOrder2 = this.store.tempOrder) !== null && _this$store$tempOrder2 !== void 0 && (_this$store$tempOrder2 = _this$store$tempOrder2.products) !== null && _this$store$tempOrder2 !== void 0 && _this$store$tempOrder2.length) {
|
|
542
549
|
this.applyDiscount();
|
|
543
550
|
}
|
|
544
551
|
return _context3.abrupt("return", this.getDiscountList());
|
|
545
|
-
case
|
|
552
|
+
case 20:
|
|
546
553
|
case "end":
|
|
547
554
|
return _context3.stop();
|
|
548
555
|
}
|
|
@@ -559,6 +566,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
559
566
|
var _this$store$discount5;
|
|
560
567
|
return ((_this$store$discount5 = this.store.discount) === null || _this$store$discount5 === void 0 ? void 0 : _this$store$discount5.getDiscountList()) || [];
|
|
561
568
|
}
|
|
569
|
+
}, {
|
|
570
|
+
key: "getAvailableWalletIds",
|
|
571
|
+
value: function getAvailableWalletIds() {
|
|
572
|
+
return Array.isArray(this.store.availableWalletIds) ? _toConsumableArray(this.store.availableWalletIds) : [];
|
|
573
|
+
}
|
|
562
574
|
}, {
|
|
563
575
|
key: "ensureEditDiscountConfigForProductChange",
|
|
564
576
|
value: function () {
|
|
@@ -3118,6 +3130,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3118
3130
|
}
|
|
3119
3131
|
var nextCustomerId = (_tempOrder$customer_i5 = tempOrder.customer_id) !== null && _tempOrder$customer_i5 !== void 0 ? _tempOrder$customer_i5 : null;
|
|
3120
3132
|
if (String(previousCustomerId !== null && previousCustomerId !== void 0 ? previousCustomerId : '') !== String(nextCustomerId !== null && nextCustomerId !== void 0 ? nextCustomerId : '')) {
|
|
3133
|
+
this.store.availableWalletIds = [];
|
|
3121
3134
|
clearTempOrderHolderAssignments(tempOrder);
|
|
3122
3135
|
this.clearCustomerBoundDiscounts(tempOrder);
|
|
3123
3136
|
this.applyDiscount();
|
|
@@ -3162,6 +3175,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3162
3175
|
tempOrder.email = '';
|
|
3163
3176
|
tempOrder.customer = null;
|
|
3164
3177
|
if (tempOrder._extend) delete tempOrder._extend.customerSnapshot;
|
|
3178
|
+
this.store.availableWalletIds = [];
|
|
3165
3179
|
this.clearCustomerBoundDiscounts(tempOrder);
|
|
3166
3180
|
this.persistTempOrder();
|
|
3167
3181
|
this.saveDraftInBackground();
|
|
@@ -309,6 +309,7 @@ export interface OrderState {
|
|
|
309
309
|
lastOrderInfo?: Record<string, any>;
|
|
310
310
|
syncState?: OrderSyncState;
|
|
311
311
|
discountList: any[];
|
|
312
|
+
availableWalletIds?: number[];
|
|
312
313
|
discount: DiscountModule | null;
|
|
313
314
|
rules: RulesModule | null;
|
|
314
315
|
}
|
|
@@ -775,6 +776,7 @@ export interface OrderModuleAPI {
|
|
|
775
776
|
apply?: boolean;
|
|
776
777
|
}) => Promise<Discount[]>;
|
|
777
778
|
getDiscountList: () => Discount[];
|
|
779
|
+
getAvailableWalletIds: () => number[];
|
|
778
780
|
applyDiscount: () => void;
|
|
779
781
|
/**
|
|
780
782
|
* 注入促销评估器。
|
|
@@ -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
|
}
|
|
@@ -9,6 +9,26 @@ export interface ProductCollection {
|
|
|
9
9
|
/** 商品集合封面 */
|
|
10
10
|
cover: string;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* 商品 Data Variant 记录,结构与后端 data_variant 表对齐。
|
|
14
|
+
*/
|
|
15
|
+
export interface ProductDataVariant {
|
|
16
|
+
/** 变体记录 id */
|
|
17
|
+
id: number;
|
|
18
|
+
/** 店铺 id */
|
|
19
|
+
shop_id: number;
|
|
20
|
+
/** 所属模块,商品场景固定为 product */
|
|
21
|
+
module: string;
|
|
22
|
+
/** 模块数据 id,商品场景对应 product.id */
|
|
23
|
+
module_data_id: number;
|
|
24
|
+
/** 关联 data_variant_rule.id */
|
|
25
|
+
data_variant_rule_id: number;
|
|
26
|
+
/** 命中策略后覆盖到商品上的字段 */
|
|
27
|
+
data: Record<string, any>;
|
|
28
|
+
created_at: string | null;
|
|
29
|
+
updated_at: string | null;
|
|
30
|
+
deleted_at: string | null;
|
|
31
|
+
}
|
|
12
32
|
/**
|
|
13
33
|
* 商品基本信息接口
|
|
14
34
|
*/
|
|
@@ -214,6 +234,8 @@ export interface ProductData {
|
|
|
214
234
|
bundle_group_count: number;
|
|
215
235
|
/** 选项组数量 */
|
|
216
236
|
option_group_count: number;
|
|
237
|
+
/** 智能定价变体列表,/product/query with dataVariants 返回 */
|
|
238
|
+
data_variants?: ProductDataVariant[];
|
|
217
239
|
/** 服务时长 */
|
|
218
240
|
service_times?: any;
|
|
219
241
|
}
|
|
@@ -26,7 +26,7 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
26
26
|
* const products = await productList.getAddTimeProducts({ schedule_date: '2026-06-16' });
|
|
27
27
|
*/
|
|
28
28
|
getAddTimeProducts(params?: ProductListLoadProductsParams): Promise<any>;
|
|
29
|
-
loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, extension_type, status, }?: ProductListLoadProductsParams, options?: {
|
|
29
|
+
loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, extension_type, status, strategy_context, }?: ProductListLoadProductsParams, options?: {
|
|
30
30
|
callback?: (result: any) => void;
|
|
31
31
|
subscriberId?: string;
|
|
32
32
|
}): Promise<any>;
|
|
@@ -152,6 +152,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
152
152
|
extension_type,
|
|
153
153
|
_ref$status,
|
|
154
154
|
status,
|
|
155
|
+
strategy_context,
|
|
155
156
|
options,
|
|
156
157
|
userPlugin,
|
|
157
158
|
customer_id,
|
|
@@ -162,7 +163,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
162
163
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
163
164
|
while (1) switch (_context4.prev = _context4.next) {
|
|
164
165
|
case 0:
|
|
165
|
-
_ref = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, _ref$menu_list_ids = _ref.menu_list_ids, menu_list_ids = _ref$menu_list_ids === void 0 ? [] : _ref$menu_list_ids, paramsCustomerId = _ref.customer_id, _ref$with_count = _ref.with_count, with_count = _ref$with_count === void 0 ? [] : _ref$with_count, schedule_datetime = _ref.schedule_datetime, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId, with_schedule = _ref.with_schedule, extension_type = _ref.extension_type, _ref$status = _ref.status, status = _ref$status === void 0 ? 'published' : _ref$status;
|
|
166
|
+
_ref = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, _ref$menu_list_ids = _ref.menu_list_ids, menu_list_ids = _ref$menu_list_ids === void 0 ? [] : _ref$menu_list_ids, paramsCustomerId = _ref.customer_id, _ref$with_count = _ref.with_count, with_count = _ref$with_count === void 0 ? [] : _ref$with_count, schedule_datetime = _ref.schedule_datetime, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId, with_schedule = _ref.with_schedule, extension_type = _ref.extension_type, _ref$status = _ref.status, status = _ref$status === void 0 ? 'published' : _ref$status, strategy_context = _ref.strategy_context;
|
|
166
167
|
options = _args4.length > 1 ? _args4[1] : undefined;
|
|
167
168
|
// // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
|
|
168
169
|
// if (!schedule_ids?.length) {
|
|
@@ -206,7 +207,8 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
206
207
|
is_eject: 1,
|
|
207
208
|
with_schedule: with_schedule,
|
|
208
209
|
schedule_datetime: schedule_datetime,
|
|
209
|
-
extension_type: extension_type
|
|
210
|
+
extension_type: extension_type,
|
|
211
|
+
strategy_context: strategy_context
|
|
210
212
|
}, {
|
|
211
213
|
osServer: true,
|
|
212
214
|
callback: options === null || options === void 0 ? void 0 : options.callback,
|
|
@@ -12,6 +12,8 @@ export interface ProductListLoadProductsParams {
|
|
|
12
12
|
with_schedule?: number;
|
|
13
13
|
extension_type?: string[];
|
|
14
14
|
status?: string;
|
|
15
|
+
/** 智能定价条件上下文,仅影响策略命中,不参与商品集合筛选 */
|
|
16
|
+
strategy_context?: Record<string, any>;
|
|
15
17
|
}
|
|
16
18
|
export interface ProductListData {
|
|
17
19
|
list: ProductData[];
|
package/dist/server/index.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ declare class Server {
|
|
|
47
47
|
private prefixRouterGet;
|
|
48
48
|
router: Router;
|
|
49
49
|
private productQuerySubscribers;
|
|
50
|
+
/** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
|
|
51
|
+
private productQueryScheduleTimers;
|
|
50
52
|
private orderQuerySubscribers;
|
|
51
53
|
private bookingQuerySubscribers;
|
|
52
54
|
private bookingRemoteQuerySubscribers;
|
|
@@ -210,6 +212,48 @@ declare class Server {
|
|
|
210
212
|
* 根据 subscriberId 移除商品查询订阅者
|
|
211
213
|
*/
|
|
212
214
|
removeProductQuerySubscriber(subscriberId?: string): void;
|
|
215
|
+
/**
|
|
216
|
+
* 构建商品 query 响应 data 段,附带智能定价 schedule_time_points 元数据。
|
|
217
|
+
*/
|
|
218
|
+
private buildProductQueryResultPayload;
|
|
219
|
+
/**
|
|
220
|
+
* 是否启用商品 query 订阅的 schedule 时间点定时重算。
|
|
221
|
+
* strategy_context.enable_schedule_reload === false 时关闭。
|
|
222
|
+
*/
|
|
223
|
+
private shouldScheduleProductQueryReload;
|
|
224
|
+
/**
|
|
225
|
+
* 清除指定 subscriber 的全部 schedule 定时器,防止重复 query 或 unsubscribe 后泄漏。
|
|
226
|
+
*/
|
|
227
|
+
private clearSubscriberScheduleTimers;
|
|
228
|
+
/**
|
|
229
|
+
* 从 productQueryScheduleTimers 移除已触发的 timer 引用。
|
|
230
|
+
*/
|
|
231
|
+
private removeScheduleTimerRef;
|
|
232
|
+
/**
|
|
233
|
+
* 计算 schedule 变价时间点到当前时刻的延迟(ms)。已过期返回 -1。
|
|
234
|
+
*/
|
|
235
|
+
private computeScheduleTimePointDelayMs;
|
|
236
|
+
/**
|
|
237
|
+
* 定时重算前刷新 subscriber schedule 上下文:使用执行瞬间时间,禁止沿用首次 query 的 schedule_datetime。
|
|
238
|
+
*/
|
|
239
|
+
private refreshSubscriberScheduleAtExecution;
|
|
240
|
+
/**
|
|
241
|
+
* 为 subscriber 注册智能定价 scheduleTimePoints 定时重算。
|
|
242
|
+
* 必须先 clearSubscriberScheduleTimers,再调用本方法。
|
|
243
|
+
*/
|
|
244
|
+
private scheduleSubscriberTimePointReloads;
|
|
245
|
+
/**
|
|
246
|
+
* schedule 变价时间点定时器触发:刷新 schedule_datetime 后重算并 callback。
|
|
247
|
+
*/
|
|
248
|
+
private onScheduleTimePointTimerFire;
|
|
249
|
+
/**
|
|
250
|
+
* 对单个商品 query 订阅者重算并推送(定时路径;不新建 schedule timer)。
|
|
251
|
+
*/
|
|
252
|
+
private recomputeAndNotifySubscriber;
|
|
253
|
+
/**
|
|
254
|
+
* query 完成后为 subscriber 同步 schedule 定时器(先 clear 再 schedule)。
|
|
255
|
+
*/
|
|
256
|
+
private syncProductQueryScheduleTimers;
|
|
213
257
|
/**
|
|
214
258
|
* 处理商品查询请求
|
|
215
259
|
* 存储订阅者信息,便于数据变更时推送最新结果
|
|
@@ -570,6 +614,12 @@ declare class Server {
|
|
|
570
614
|
* @param options.changedIds 变更的商品 IDs,用于增量更新价格缓存
|
|
571
615
|
*/
|
|
572
616
|
private computeProductQueryResult;
|
|
617
|
+
/**
|
|
618
|
+
* 构建商品格式化上下文。
|
|
619
|
+
*
|
|
620
|
+
* 智能定价条件使用全量 menuList/scheduleList;Product Query 顶层参数只保留筛选商品集合所需字段。
|
|
621
|
+
*/
|
|
622
|
+
private buildProductFormatterContext;
|
|
573
623
|
/**
|
|
574
624
|
* 数据变更后,遍历所有订阅者重新计算查询结果并通过 callback 推送
|
|
575
625
|
* 由 ProductsModule 的 onProductsSyncCompleted 事件触发
|