@pisell/pisellos 2.3.69 → 2.3.71
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/core/index.d.ts +0 -7
- package/dist/core/index.js +65 -109
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Order/types.js +1 -0
- package/dist/modules/Quotation/index.d.ts +0 -6
- package/dist/modules/Quotation/index.js +19 -75
- package/dist/plugins/request.d.ts +0 -1
- package/dist/server/index.d.ts +2 -8
- package/dist/server/index.js +140 -206
- package/dist/server/modules/floor-plan/index.d.ts +0 -4
- package/dist/server/modules/floor-plan/index.js +98 -240
- package/dist/server/modules/menu/index.js +23 -48
- package/dist/server/modules/order/index.d.ts +7 -17
- package/dist/server/modules/order/index.js +207 -419
- package/dist/server/modules/products/index.d.ts +2 -8
- package/dist/server/modules/products/index.js +75 -167
- package/dist/server/modules/resource/index.js +13 -21
- package/dist/solution/BaseSales/index.js +15 -4
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +5 -15
- package/dist/solution/BookingTicket/index.js +21 -6
- package/lib/core/index.d.ts +0 -7
- package/lib/core/index.js +2 -20
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Quotation/index.d.ts +0 -6
- package/lib/modules/Quotation/index.js +5 -49
- package/lib/plugins/request.d.ts +0 -1
- package/lib/server/index.d.ts +2 -8
- package/lib/server/index.js +17 -52
- package/lib/server/modules/floor-plan/index.d.ts +0 -4
- package/lib/server/modules/floor-plan/index.js +6 -54
- package/lib/server/modules/menu/index.js +5 -31
- package/lib/server/modules/order/index.d.ts +7 -17
- package/lib/server/modules/order/index.js +40 -197
- package/lib/server/modules/products/index.d.ts +2 -8
- package/lib/server/modules/products/index.js +24 -97
- package/lib/server/modules/resource/index.js +2 -7
- package/lib/solution/BaseSales/index.js +4 -4
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +5 -15
- package/lib/solution/BookingTicket/index.js +15 -5
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -103,8 +103,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
103
103
|
_defineProperty(this, "productQueryScheduleTimers", new Map());
|
|
104
104
|
/** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
|
|
105
105
|
_defineProperty(this, "menuScheduleRefreshInFlight", null);
|
|
106
|
-
/** 启动阶段模块预加载任务;预渲染商品查询复用该任务,避免缓存尚未 ready 时误触发远端自愈。 */
|
|
107
|
-
_defineProperty(this, "startupModulePreloadInFlight", null);
|
|
108
106
|
_defineProperty(this, "lastMenuScheduleRefreshAt", 0);
|
|
109
107
|
_defineProperty(this, "MENU_SCHEDULE_REFRESH_COOLDOWN_MS", 30 * 1000);
|
|
110
108
|
// ---- 订单 / 预约列表查询订阅者 ----
|
|
@@ -2268,7 +2266,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
2268
2266
|
options,
|
|
2269
2267
|
startTime,
|
|
2270
2268
|
registeredModules,
|
|
2271
|
-
preloadTask,
|
|
2272
2269
|
duration,
|
|
2273
2270
|
_args29 = arguments;
|
|
2274
2271
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
@@ -2293,31 +2290,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
2293
2290
|
case 8:
|
|
2294
2291
|
registeredModules = _context29.sent;
|
|
2295
2292
|
if (!autoPreload) {
|
|
2296
|
-
_context29.next =
|
|
2293
|
+
_context29.next = 14;
|
|
2297
2294
|
break;
|
|
2298
2295
|
}
|
|
2299
|
-
|
|
2300
|
-
this.
|
|
2301
|
-
|
|
2296
|
+
_context29.next = 12;
|
|
2297
|
+
return this.preloadModulesData(registeredModules, options);
|
|
2298
|
+
case 12:
|
|
2302
2299
|
_context29.next = 15;
|
|
2303
|
-
return preloadTask;
|
|
2304
|
-
case 15:
|
|
2305
|
-
_context29.prev = 15;
|
|
2306
|
-
if (this.startupModulePreloadInFlight === preloadTask) {
|
|
2307
|
-
this.startupModulePreloadInFlight = null;
|
|
2308
|
-
}
|
|
2309
|
-
return _context29.finish(15);
|
|
2310
|
-
case 18:
|
|
2311
|
-
_context29.next = 21;
|
|
2312
2300
|
break;
|
|
2313
|
-
case
|
|
2301
|
+
case 14:
|
|
2314
2302
|
this.logInfo('跳过自动预加载', {
|
|
2315
2303
|
autoPreload: autoPreload
|
|
2316
2304
|
});
|
|
2317
|
-
case
|
|
2318
|
-
_context29.next =
|
|
2305
|
+
case 15:
|
|
2306
|
+
_context29.next = 17;
|
|
2319
2307
|
return this.setupProductsQuotationPriceBridge();
|
|
2320
|
-
case
|
|
2308
|
+
case 17:
|
|
2321
2309
|
// 监听 ProductsModule 同步完成事件,重新计算并推送查询结果
|
|
2322
2310
|
this.core.effects.on(ProductsHooks.onProductsSyncCompleted, function (payload) {
|
|
2323
2311
|
_this3.recomputeAndNotifyProductQuery({
|
|
@@ -2343,11 +2331,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2343
2331
|
registeredModuleCount: registeredModules.length
|
|
2344
2332
|
});
|
|
2345
2333
|
return _context29.abrupt("return", registeredModules);
|
|
2346
|
-
case
|
|
2334
|
+
case 23:
|
|
2347
2335
|
case "end":
|
|
2348
2336
|
return _context29.stop();
|
|
2349
2337
|
}
|
|
2350
|
-
}, _callee29, this
|
|
2338
|
+
}, _callee29, this);
|
|
2351
2339
|
}));
|
|
2352
2340
|
function initialize(_x32) {
|
|
2353
2341
|
return _initialize.apply(this, arguments);
|
|
@@ -2729,7 +2717,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
2729
2717
|
key: "setupProductsQuotationPriceBridge",
|
|
2730
2718
|
value: (function () {
|
|
2731
2719
|
var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2732
|
-
var _this5 = this;
|
|
2733
2720
|
var _this$core$context, errorMessage;
|
|
2734
2721
|
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2735
2722
|
while (1) switch (_context33.prev = _context33.next) {
|
|
@@ -2749,42 +2736,31 @@ var Server = /*#__PURE__*/function () {
|
|
|
2749
2736
|
return _context33.abrupt("return");
|
|
2750
2737
|
case 6:
|
|
2751
2738
|
_context33.prev = 6;
|
|
2739
|
+
_context33.next = 9;
|
|
2740
|
+
return this.schedule.loadAllSchedule();
|
|
2741
|
+
case 9:
|
|
2752
2742
|
this.products.clearPriceCache();
|
|
2753
|
-
_context33.next =
|
|
2743
|
+
_context33.next = 12;
|
|
2754
2744
|
return this.products.setupQuotationPriceBridge({
|
|
2755
2745
|
scheduleModule: this.schedule,
|
|
2756
|
-
channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel
|
|
2757
|
-
onQuotationUpdated: function onQuotationUpdated() {
|
|
2758
|
-
void _this5.recomputeAndNotifyProductQuery();
|
|
2759
|
-
}
|
|
2760
|
-
});
|
|
2761
|
-
case 10:
|
|
2762
|
-
// Schedule 已在模块 preload 阶段加载完成。价格桥接先使用本地数据,
|
|
2763
|
-
// 远端刷新转为后台校准,避免二次启动重复阻塞请求。
|
|
2764
|
-
void this.schedule.loadAllSchedule().then(function () {
|
|
2765
|
-
var _this5$products;
|
|
2766
|
-
(_this5$products = _this5.products) === null || _this5$products === void 0 || _this5$products.clearPriceCache();
|
|
2767
|
-
void _this5.recomputeAndNotifyProductQuery();
|
|
2768
|
-
}).catch(function (error) {
|
|
2769
|
-
_this5.logWarning('Products 报价单价格桥接后台刷新 Schedule 失败,继续使用本地数据', {
|
|
2770
|
-
error: error instanceof Error ? error.message : String(error)
|
|
2771
|
-
});
|
|
2746
|
+
channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel
|
|
2772
2747
|
});
|
|
2748
|
+
case 12:
|
|
2773
2749
|
this.logInfo('Products 报价单价格桥接初始化完成');
|
|
2774
|
-
_context33.next =
|
|
2750
|
+
_context33.next = 19;
|
|
2775
2751
|
break;
|
|
2776
|
-
case
|
|
2777
|
-
_context33.prev =
|
|
2752
|
+
case 15:
|
|
2753
|
+
_context33.prev = 15;
|
|
2778
2754
|
_context33.t0 = _context33["catch"](6);
|
|
2779
2755
|
errorMessage = _context33.t0 instanceof Error ? _context33.t0.message : String(_context33.t0);
|
|
2780
2756
|
this.logError('Products 报价单价格桥接初始化失败', {
|
|
2781
2757
|
error: errorMessage
|
|
2782
2758
|
});
|
|
2783
|
-
case
|
|
2759
|
+
case 19:
|
|
2784
2760
|
case "end":
|
|
2785
2761
|
return _context33.stop();
|
|
2786
2762
|
}
|
|
2787
|
-
}, _callee33, this, [[6,
|
|
2763
|
+
}, _callee33, this, [[6, 15]]);
|
|
2788
2764
|
}));
|
|
2789
2765
|
function setupProductsQuotationPriceBridge() {
|
|
2790
2766
|
return _setupProductsQuotationPriceBridge.apply(this, arguments);
|
|
@@ -2854,58 +2830,44 @@ var Server = /*#__PURE__*/function () {
|
|
|
2854
2830
|
key: "refreshProductsInBackground",
|
|
2855
2831
|
value: (function () {
|
|
2856
2832
|
var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2857
|
-
var
|
|
2858
|
-
trigger,
|
|
2859
|
-
startTime,
|
|
2860
|
-
duration,
|
|
2861
|
-
_duration2,
|
|
2862
|
-
errorMessage,
|
|
2863
|
-
_args34 = arguments;
|
|
2833
|
+
var startTime, duration, _duration2, errorMessage;
|
|
2864
2834
|
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2865
2835
|
while (1) switch (_context34.prev = _context34.next) {
|
|
2866
2836
|
case 0:
|
|
2867
|
-
options = _args34.length > 0 && _args34[0] !== undefined ? _args34[0] : {};
|
|
2868
2837
|
if (this.products) {
|
|
2869
|
-
_context34.next =
|
|
2838
|
+
_context34.next = 3;
|
|
2870
2839
|
break;
|
|
2871
2840
|
}
|
|
2872
2841
|
this.logWarning('refreshProductsInBackground: Products 模块未注册');
|
|
2873
2842
|
return _context34.abrupt("return");
|
|
2874
|
-
case
|
|
2875
|
-
|
|
2876
|
-
this.logInfo('refreshProductsInBackground 开始', {
|
|
2877
|
-
trigger: trigger
|
|
2878
|
-
});
|
|
2843
|
+
case 3:
|
|
2844
|
+
this.logInfo('refreshProductsInBackground 开始');
|
|
2879
2845
|
startTime = Date.now();
|
|
2880
|
-
_context34.prev =
|
|
2881
|
-
_context34.next =
|
|
2882
|
-
return this.products.silentRefresh(
|
|
2883
|
-
|
|
2884
|
-
});
|
|
2885
|
-
case 10:
|
|
2846
|
+
_context34.prev = 5;
|
|
2847
|
+
_context34.next = 8;
|
|
2848
|
+
return this.products.silentRefresh();
|
|
2849
|
+
case 8:
|
|
2886
2850
|
duration = Date.now() - startTime;
|
|
2887
2851
|
this.logInfo('refreshProductsInBackground 完成', {
|
|
2888
|
-
trigger: trigger,
|
|
2889
2852
|
duration: "".concat(duration, "ms")
|
|
2890
2853
|
});
|
|
2891
|
-
_context34.next =
|
|
2854
|
+
_context34.next = 18;
|
|
2892
2855
|
break;
|
|
2893
|
-
case
|
|
2894
|
-
_context34.prev =
|
|
2895
|
-
_context34.t0 = _context34["catch"](
|
|
2856
|
+
case 12:
|
|
2857
|
+
_context34.prev = 12;
|
|
2858
|
+
_context34.t0 = _context34["catch"](5);
|
|
2896
2859
|
_duration2 = Date.now() - startTime;
|
|
2897
2860
|
errorMessage = _context34.t0 instanceof Error ? _context34.t0.message : String(_context34.t0);
|
|
2898
2861
|
console.error('[Server] refreshProductsInBackground 失败:', _context34.t0);
|
|
2899
2862
|
this.logError('refreshProductsInBackground 失败', {
|
|
2900
|
-
trigger: trigger,
|
|
2901
2863
|
duration: "".concat(_duration2, "ms"),
|
|
2902
2864
|
error: errorMessage
|
|
2903
2865
|
});
|
|
2904
|
-
case
|
|
2866
|
+
case 18:
|
|
2905
2867
|
case "end":
|
|
2906
2868
|
return _context34.stop();
|
|
2907
2869
|
}
|
|
2908
|
-
}, _callee34, this, [[
|
|
2870
|
+
}, _callee34, this, [[5, 12]]);
|
|
2909
2871
|
}));
|
|
2910
2872
|
function refreshProductsInBackground() {
|
|
2911
2873
|
return _refreshProductsInBackground.apply(this, arguments);
|
|
@@ -2922,58 +2884,44 @@ var Server = /*#__PURE__*/function () {
|
|
|
2922
2884
|
key: "refreshOrdersInBackground",
|
|
2923
2885
|
value: (function () {
|
|
2924
2886
|
var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2925
|
-
var
|
|
2926
|
-
trigger,
|
|
2927
|
-
startTime,
|
|
2928
|
-
duration,
|
|
2929
|
-
_duration3,
|
|
2930
|
-
errorMessage,
|
|
2931
|
-
_args35 = arguments;
|
|
2887
|
+
var startTime, duration, _duration3, errorMessage;
|
|
2932
2888
|
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2933
2889
|
while (1) switch (_context35.prev = _context35.next) {
|
|
2934
2890
|
case 0:
|
|
2935
|
-
options = _args35.length > 0 && _args35[0] !== undefined ? _args35[0] : {};
|
|
2936
2891
|
if (this.order) {
|
|
2937
|
-
_context35.next =
|
|
2892
|
+
_context35.next = 3;
|
|
2938
2893
|
break;
|
|
2939
2894
|
}
|
|
2940
2895
|
this.logWarning('refreshOrdersInBackground: Order 模块未注册');
|
|
2941
2896
|
return _context35.abrupt("return");
|
|
2942
|
-
case
|
|
2943
|
-
|
|
2944
|
-
this.logInfo('refreshOrdersInBackground 开始', {
|
|
2945
|
-
trigger: trigger
|
|
2946
|
-
});
|
|
2897
|
+
case 3:
|
|
2898
|
+
this.logInfo('refreshOrdersInBackground 开始');
|
|
2947
2899
|
startTime = Date.now();
|
|
2948
|
-
_context35.prev =
|
|
2949
|
-
_context35.next =
|
|
2950
|
-
return this.order.silentRefresh(
|
|
2951
|
-
|
|
2952
|
-
});
|
|
2953
|
-
case 10:
|
|
2900
|
+
_context35.prev = 5;
|
|
2901
|
+
_context35.next = 8;
|
|
2902
|
+
return this.order.silentRefresh();
|
|
2903
|
+
case 8:
|
|
2954
2904
|
duration = Date.now() - startTime;
|
|
2955
2905
|
this.logInfo('refreshOrdersInBackground 完成', {
|
|
2956
|
-
trigger: trigger,
|
|
2957
2906
|
duration: "".concat(duration, "ms")
|
|
2958
2907
|
});
|
|
2959
|
-
_context35.next =
|
|
2908
|
+
_context35.next = 18;
|
|
2960
2909
|
break;
|
|
2961
|
-
case
|
|
2962
|
-
_context35.prev =
|
|
2963
|
-
_context35.t0 = _context35["catch"](
|
|
2910
|
+
case 12:
|
|
2911
|
+
_context35.prev = 12;
|
|
2912
|
+
_context35.t0 = _context35["catch"](5);
|
|
2964
2913
|
_duration3 = Date.now() - startTime;
|
|
2965
2914
|
errorMessage = _context35.t0 instanceof Error ? _context35.t0.message : String(_context35.t0);
|
|
2966
2915
|
console.error('[Server] refreshOrdersInBackground 失败:', _context35.t0);
|
|
2967
2916
|
this.logError('refreshOrdersInBackground 失败', {
|
|
2968
|
-
trigger: trigger,
|
|
2969
2917
|
duration: "".concat(_duration3, "ms"),
|
|
2970
2918
|
error: errorMessage
|
|
2971
2919
|
});
|
|
2972
|
-
case
|
|
2920
|
+
case 18:
|
|
2973
2921
|
case "end":
|
|
2974
2922
|
return _context35.stop();
|
|
2975
2923
|
}
|
|
2976
|
-
}, _callee35, this, [[
|
|
2924
|
+
}, _callee35, this, [[5, 12]]);
|
|
2977
2925
|
}));
|
|
2978
2926
|
function refreshOrdersInBackground() {
|
|
2979
2927
|
return _refreshOrdersInBackground.apply(this, arguments);
|
|
@@ -3287,10 +3235,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3287
3235
|
}, {
|
|
3288
3236
|
key: "getAllRoutes",
|
|
3289
3237
|
value: function getAllRoutes() {
|
|
3290
|
-
var
|
|
3238
|
+
var _this5 = this;
|
|
3291
3239
|
var routes = [];
|
|
3292
3240
|
['get', 'post', 'put', 'remove'].forEach(function (method) {
|
|
3293
|
-
Object.keys(
|
|
3241
|
+
Object.keys(_this5.router[method]).forEach(function (path) {
|
|
3294
3242
|
routes.push({
|
|
3295
3243
|
method: method,
|
|
3296
3244
|
path: path
|
|
@@ -3420,7 +3368,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3420
3368
|
key: "getPaymentRouteModule",
|
|
3421
3369
|
value: function () {
|
|
3422
3370
|
var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3423
|
-
var
|
|
3371
|
+
var _this6 = this;
|
|
3424
3372
|
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3425
3373
|
while (1) switch (_context40.prev = _context40.next) {
|
|
3426
3374
|
case 0:
|
|
@@ -3449,13 +3397,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
3449
3397
|
case 0:
|
|
3450
3398
|
module = new PaymentServerModule('server_payment_route', '1.0.0');
|
|
3451
3399
|
_context39.next = 3;
|
|
3452
|
-
return module.initialize(
|
|
3400
|
+
return module.initialize(_this6.core, {
|
|
3453
3401
|
store: {
|
|
3454
3402
|
payMethods: []
|
|
3455
3403
|
}
|
|
3456
3404
|
});
|
|
3457
3405
|
case 3:
|
|
3458
|
-
|
|
3406
|
+
_this6.paymentRouteModule = module;
|
|
3459
3407
|
return _context39.abrupt("return", module);
|
|
3460
3408
|
case 5:
|
|
3461
3409
|
case "end":
|
|
@@ -3463,7 +3411,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3463
3411
|
}
|
|
3464
3412
|
}, _callee39);
|
|
3465
3413
|
}))().finally(function () {
|
|
3466
|
-
|
|
3414
|
+
_this6.paymentRouteModuleInFlight = undefined;
|
|
3467
3415
|
});
|
|
3468
3416
|
return _context40.abrupt("return", this.paymentRouteModuleInFlight);
|
|
3469
3417
|
case 8:
|
|
@@ -3639,7 +3587,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3639
3587
|
}, {
|
|
3640
3588
|
key: "scheduleSubscriberTimePointReloads",
|
|
3641
3589
|
value: function scheduleSubscriberTimePointReloads(subscriberId, timePoints) {
|
|
3642
|
-
var
|
|
3590
|
+
var _this7 = this;
|
|
3643
3591
|
var subscriber = this.productQuerySubscribers.get(subscriberId);
|
|
3644
3592
|
if (!subscriber || !timePoints.length) return;
|
|
3645
3593
|
var scheduleDate = subscriber.context.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
@@ -3660,7 +3608,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3660
3608
|
setInterval(function () {
|
|
3661
3609
|
var currentTime = dayjs().format('hh:mm');
|
|
3662
3610
|
if (timePoints.includes(currentTime)) {
|
|
3663
|
-
|
|
3611
|
+
_this7.onScheduleTimePointTimerFire(subscriberId);
|
|
3664
3612
|
}
|
|
3665
3613
|
}, 60000);
|
|
3666
3614
|
if (timerIds.length > 0) {
|
|
@@ -3829,7 +3777,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3829
3777
|
key: "refreshMenuScheduleCacheAfterEmptyResult",
|
|
3830
3778
|
value: (function () {
|
|
3831
3779
|
var _refreshMenuScheduleCacheAfterEmptyResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
|
|
3832
|
-
var
|
|
3780
|
+
var _this8 = this;
|
|
3833
3781
|
var now;
|
|
3834
3782
|
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3835
3783
|
while (1) switch (_context44.prev = _context44.next) {
|
|
@@ -3852,11 +3800,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3852
3800
|
this.menuScheduleRefreshInFlight = Promise.all([this.menu.loadMenuList(), this.schedule.loadAllSchedule()]).then(function () {
|
|
3853
3801
|
return undefined;
|
|
3854
3802
|
}).catch(function (error) {
|
|
3855
|
-
|
|
3803
|
+
_this8.logWarning('刷新菜单/日程缓存失败,继续使用现有缓存', {
|
|
3856
3804
|
error: error instanceof Error ? error.message : String(error)
|
|
3857
3805
|
});
|
|
3858
3806
|
}).finally(function () {
|
|
3859
|
-
|
|
3807
|
+
_this8.menuScheduleRefreshInFlight = null;
|
|
3860
3808
|
});
|
|
3861
3809
|
}
|
|
3862
3810
|
_context44.next = 8;
|
|
@@ -4042,10 +3990,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
4042
3990
|
}, {
|
|
4043
3991
|
key: "stripSalesSearchPageParams",
|
|
4044
3992
|
value: function stripSalesSearchPageParams(value) {
|
|
4045
|
-
var
|
|
3993
|
+
var _this9 = this;
|
|
4046
3994
|
if (Array.isArray(value)) {
|
|
4047
3995
|
return value.map(function (item) {
|
|
4048
|
-
return
|
|
3996
|
+
return _this9.stripSalesSearchPageParams(item);
|
|
4049
3997
|
});
|
|
4050
3998
|
}
|
|
4051
3999
|
if (!value || _typeof(value) !== 'object') return value;
|
|
@@ -4083,12 +4031,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
4083
4031
|
key: "extractSalesSearchOrderIds",
|
|
4084
4032
|
value: function extractSalesSearchOrderIds(kind, result) {
|
|
4085
4033
|
var _this$findSalesSearch,
|
|
4086
|
-
|
|
4034
|
+
_this10 = this;
|
|
4087
4035
|
var data = this.extractSalesSearchResponseData(result);
|
|
4088
4036
|
var list = kind === 'aggregate' ? (_this$findSalesSearch = this.findSalesSearchAggregateGroup(data)) === null || _this$findSalesSearch === void 0 ? void 0 : _this$findSalesSearch.list : data === null || data === void 0 ? void 0 : data.list;
|
|
4089
4037
|
if (!Array.isArray(list)) return [];
|
|
4090
4038
|
return list.map(function (item) {
|
|
4091
|
-
return
|
|
4039
|
+
return _this10.getSalesSearchOrderId(item);
|
|
4092
4040
|
}).filter(function (id) {
|
|
4093
4041
|
return !!id;
|
|
4094
4042
|
});
|
|
@@ -4255,11 +4203,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4255
4203
|
}, {
|
|
4256
4204
|
key: "stableSerialize",
|
|
4257
4205
|
value: function stableSerialize(value) {
|
|
4258
|
-
var
|
|
4206
|
+
var _this11 = this;
|
|
4259
4207
|
if (value === null || value === undefined) return 'null';
|
|
4260
4208
|
if (Array.isArray(value)) {
|
|
4261
4209
|
return "[".concat(value.map(function (item) {
|
|
4262
|
-
return
|
|
4210
|
+
return _this11.stableSerialize(item);
|
|
4263
4211
|
}).join(','), "]");
|
|
4264
4212
|
}
|
|
4265
4213
|
if (_typeof(value) === 'object') {
|
|
@@ -4268,7 +4216,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4268
4216
|
return obj[k] !== undefined;
|
|
4269
4217
|
}).sort();
|
|
4270
4218
|
return "{".concat(keys.map(function (k) {
|
|
4271
|
-
return "".concat(JSON.stringify(k), ":").concat(
|
|
4219
|
+
return "".concat(JSON.stringify(k), ":").concat(_this11.stableSerialize(obj[k]));
|
|
4272
4220
|
}).join(','), "}");
|
|
4273
4221
|
}
|
|
4274
4222
|
return JSON.stringify(value);
|
|
@@ -4808,7 +4756,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4808
4756
|
key: "runLocalPaymentUpdateInQueue",
|
|
4809
4757
|
value: function () {
|
|
4810
4758
|
var _runLocalPaymentUpdateInQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(key, task, context) {
|
|
4811
|
-
var
|
|
4759
|
+
var _this12 = this;
|
|
4812
4760
|
var queuedAt, hasPreviousTask, previous, current, tail, _data, result, released;
|
|
4813
4761
|
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
4814
4762
|
while (1) switch (_context50.prev = _context50.next) {
|
|
@@ -4827,7 +4775,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4827
4775
|
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4828
4776
|
while (1) switch (_context49.prev = _context49.next) {
|
|
4829
4777
|
case 0:
|
|
4830
|
-
|
|
4778
|
+
_this12.logInfo('handleUpdateLocalPayment: 串行队列开始执行', _objectSpread(_objectSpread({}, context), {}, {
|
|
4831
4779
|
queue_key: key,
|
|
4832
4780
|
queue_wait_ms: Date.now() - queuedAt
|
|
4833
4781
|
}));
|
|
@@ -6219,7 +6167,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6219
6167
|
key: "handlePendingSyncCheckoutOrder",
|
|
6220
6168
|
value: function () {
|
|
6221
6169
|
var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
|
|
6222
|
-
var
|
|
6170
|
+
var _this13 = this;
|
|
6223
6171
|
var backendPath, data, title, reason, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
|
|
6224
6172
|
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
6225
6173
|
while (1) switch (_context63.prev = _context63.next) {
|
|
@@ -6272,7 +6220,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6272
6220
|
});
|
|
6273
6221
|
changeGivenAmount = pendingOrder === null || pendingOrder === void 0 || (_pendingOrder$payment = pendingOrder.payments) === null || _pendingOrder$payment === void 0 ? void 0 : _pendingOrder$payment.reduce(function (sum, payment) {
|
|
6274
6222
|
var _payment$metadata;
|
|
6275
|
-
return sum +
|
|
6223
|
+
return sum + _this13.toAmountNumber(payment === null || payment === void 0 || (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.change_given_amount);
|
|
6276
6224
|
}, 0);
|
|
6277
6225
|
return _context63.abrupt("return", {
|
|
6278
6226
|
code: 200,
|
|
@@ -6412,13 +6360,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6412
6360
|
}, {
|
|
6413
6361
|
key: "sumPaidOrderPayments",
|
|
6414
6362
|
value: function sumPaidOrderPayments(payments) {
|
|
6415
|
-
var
|
|
6363
|
+
var _this14 = this;
|
|
6416
6364
|
if (!Array.isArray(payments)) return 0;
|
|
6417
6365
|
return payments.reduce(function (sum, payment) {
|
|
6418
6366
|
var _payment$amount;
|
|
6419
6367
|
var status = String((payment === null || payment === void 0 ? void 0 : payment.status) || '').toLowerCase();
|
|
6420
6368
|
if (status !== 'paid') return sum;
|
|
6421
|
-
return sum +
|
|
6369
|
+
return sum + _this14.toAmountNumber((_payment$amount = payment === null || payment === void 0 ? void 0 : payment.amount) !== null && _payment$amount !== void 0 ? _payment$amount : payment === null || payment === void 0 ? void 0 : payment.origin_amount);
|
|
6422
6370
|
}, 0);
|
|
6423
6371
|
}
|
|
6424
6372
|
}, {
|
|
@@ -6434,7 +6382,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6434
6382
|
value: function () {
|
|
6435
6383
|
var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(order) {
|
|
6436
6384
|
var _this$products3,
|
|
6437
|
-
|
|
6385
|
+
_this15 = this;
|
|
6438
6386
|
var products, productIdSet, productIds, entries;
|
|
6439
6387
|
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
|
6440
6388
|
while (1) switch (_context66.prev = _context66.next) {
|
|
@@ -6467,20 +6415,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
6467
6415
|
_context66.next = 8;
|
|
6468
6416
|
return Promise.all(productIds.map( /*#__PURE__*/function () {
|
|
6469
6417
|
var _ref68 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(id) {
|
|
6470
|
-
var
|
|
6418
|
+
var _this15$products, _this15$products$getP, product;
|
|
6471
6419
|
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
|
6472
6420
|
while (1) switch (_context65.prev = _context65.next) {
|
|
6473
6421
|
case 0:
|
|
6474
6422
|
_context65.prev = 0;
|
|
6475
6423
|
_context65.next = 3;
|
|
6476
|
-
return (
|
|
6424
|
+
return (_this15$products = _this15.products) === null || _this15$products === void 0 || (_this15$products$getP = _this15$products.getProductById) === null || _this15$products$getP === void 0 ? void 0 : _this15$products$getP.call(_this15$products, Number(id));
|
|
6477
6425
|
case 3:
|
|
6478
6426
|
product = _context65.sent;
|
|
6479
6427
|
return _context65.abrupt("return", product ? [String(id), product] : null);
|
|
6480
6428
|
case 7:
|
|
6481
6429
|
_context65.prev = 7;
|
|
6482
6430
|
_context65.t0 = _context65["catch"](0);
|
|
6483
|
-
|
|
6431
|
+
_this15.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
|
|
6484
6432
|
product_id: id,
|
|
6485
6433
|
error: _context65.t0 instanceof Error ? _context65.t0.message : String(_context65.t0)
|
|
6486
6434
|
});
|
|
@@ -6631,7 +6579,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6631
6579
|
key: "withSalesDetailProductSnapshots",
|
|
6632
6580
|
value: function () {
|
|
6633
6581
|
var _withSalesDetailProductSnapshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(order) {
|
|
6634
|
-
var
|
|
6582
|
+
var _this16 = this;
|
|
6635
6583
|
var products, snapshotMap, hasChanged, enrichedProducts, enrichedOrder;
|
|
6636
6584
|
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
|
6637
6585
|
while (1) switch (_context68.prev = _context68.next) {
|
|
@@ -6655,8 +6603,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
6655
6603
|
case 8:
|
|
6656
6604
|
hasChanged = false;
|
|
6657
6605
|
enrichedProducts = products.map(function (product) {
|
|
6658
|
-
var productWithBundleSnapshots =
|
|
6659
|
-
var nextProduct =
|
|
6606
|
+
var productWithBundleSnapshots = _this16.withBundleCatalogSnapshots(product, snapshotMap);
|
|
6607
|
+
var nextProduct = _this16.withProductCatalogSnapshots(productWithBundleSnapshots, snapshotMap);
|
|
6660
6608
|
if (nextProduct !== product) hasChanged = true;
|
|
6661
6609
|
return nextProduct;
|
|
6662
6610
|
});
|
|
@@ -6684,13 +6632,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6684
6632
|
}, {
|
|
6685
6633
|
key: "withPendingSyncProductTitles",
|
|
6686
6634
|
value: function withPendingSyncProductTitles(order, productMap) {
|
|
6687
|
-
var
|
|
6635
|
+
var _this17 = this;
|
|
6688
6636
|
var products = Array.isArray(order.products) ? order.products : null;
|
|
6689
6637
|
if (!(products !== null && products !== void 0 && products.length)) return order;
|
|
6690
6638
|
return _objectSpread(_objectSpread({}, order), {}, {
|
|
6691
6639
|
products: products.map(function (product) {
|
|
6692
6640
|
return _objectSpread(_objectSpread({}, product), {}, {
|
|
6693
|
-
product_title:
|
|
6641
|
+
product_title: _this17.buildProductTitleSnapshot(product, productMap)
|
|
6694
6642
|
});
|
|
6695
6643
|
})
|
|
6696
6644
|
});
|
|
@@ -6701,7 +6649,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6701
6649
|
var _product$product_id4,
|
|
6702
6650
|
_product$product,
|
|
6703
6651
|
_fallbackProduct$prod,
|
|
6704
|
-
|
|
6652
|
+
_this18 = this;
|
|
6705
6653
|
var productId = (_product$product_id4 = product.product_id) !== null && _product$product_id4 !== void 0 ? _product$product_id4 : product.id;
|
|
6706
6654
|
var fallbackProduct = productId !== undefined && productId !== null ? productMap[productId] || productMap[String(productId)] : null;
|
|
6707
6655
|
var ownTitle = product.product_title || product.title || product.name || ((_product$product = product.product) === null || _product$product === void 0 ? void 0 : _product$product.title);
|
|
@@ -6709,7 +6657,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6709
6657
|
var currentLocale = this.getProductTitleSnapshotCurrentLocale();
|
|
6710
6658
|
var autoTitle = this.resolveFirstProductTitleValue(ownTitle) || this.resolveFirstProductTitleValue(fallbackTitle);
|
|
6711
6659
|
return PRODUCT_TITLE_SNAPSHOT_KEYS.reduce(function (snapshot, key) {
|
|
6712
|
-
snapshot[key] =
|
|
6660
|
+
snapshot[key] = _this18.resolveProductTitleValue(ownTitle, key, currentLocale) || _this18.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === 'auto' || key === 'original' ? autoTitle : null);
|
|
6713
6661
|
return snapshot;
|
|
6714
6662
|
}, {});
|
|
6715
6663
|
}
|
|
@@ -6808,14 +6756,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
6808
6756
|
key: "enrichPaymentNamesByCode",
|
|
6809
6757
|
value: function () {
|
|
6810
6758
|
var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(order) {
|
|
6811
|
-
var
|
|
6759
|
+
var _this19 = this;
|
|
6812
6760
|
var payments, hasMissingName, paymentModule, payMethods, nameByCode, _iterator12, _step12, method, codeKey, name, hasResolvedName, enrichedPayments;
|
|
6813
6761
|
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
|
6814
6762
|
while (1) switch (_context69.prev = _context69.next) {
|
|
6815
6763
|
case 0:
|
|
6816
6764
|
payments = Array.isArray(order === null || order === void 0 ? void 0 : order.payments) ? order.payments : [];
|
|
6817
6765
|
hasMissingName = payments.some(function (payment) {
|
|
6818
|
-
return
|
|
6766
|
+
return _this19.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this19.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
|
|
6819
6767
|
});
|
|
6820
6768
|
if (hasMissingName) {
|
|
6821
6769
|
_context69.next = 4;
|
|
@@ -6848,9 +6796,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
6848
6796
|
}
|
|
6849
6797
|
hasResolvedName = false;
|
|
6850
6798
|
enrichedPayments = payments.map(function (payment) {
|
|
6851
|
-
if (!
|
|
6852
|
-
if (!
|
|
6853
|
-
var name = nameByCode.get(
|
|
6799
|
+
if (!_this19.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name)) return payment;
|
|
6800
|
+
if (!_this19.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code)) return payment;
|
|
6801
|
+
var name = nameByCode.get(_this19.getPaymentCodeKey(payment === null || payment === void 0 ? void 0 : payment.code));
|
|
6854
6802
|
if (!name) return payment;
|
|
6855
6803
|
hasResolvedName = true;
|
|
6856
6804
|
return _objectSpread(_objectSpread({}, payment), {}, {
|
|
@@ -7432,10 +7380,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
7432
7380
|
value: function extractBackendErrorResponse(error) {
|
|
7433
7381
|
var _error$response3,
|
|
7434
7382
|
_error$response4,
|
|
7435
|
-
|
|
7383
|
+
_this20 = this;
|
|
7436
7384
|
var candidates = [error === null || error === void 0 || (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data, error === null || error === void 0 ? void 0 : error.data, error === null || error === void 0 || (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.body, error === null || error === void 0 ? void 0 : error.body];
|
|
7437
7385
|
return candidates.find(function (candidate) {
|
|
7438
|
-
return
|
|
7386
|
+
return _this20.isExplicitBackendErrorResponse(candidate);
|
|
7439
7387
|
}) || null;
|
|
7440
7388
|
}
|
|
7441
7389
|
}, {
|
|
@@ -7796,8 +7744,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
7796
7744
|
value: (function () {
|
|
7797
7745
|
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(context, options) {
|
|
7798
7746
|
var _menu_list_ids$length3,
|
|
7799
|
-
|
|
7800
|
-
var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, extension_type, product_id, strategy_context, queryIds,
|
|
7747
|
+
_this21 = this;
|
|
7748
|
+
var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, extension_type, product_id, strategy_context, queryIds, formatterContext, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, extensionFilteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, _tPrice3, _filteredProducts2, _tStatus, _beforeStatusCount, _tExtensionType, _beforeExtensionTypeCount, _tSort, activeMenuList, tMenu, getActiveMenus, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tExtensionType, beforeExtensionTypeCount, tSort;
|
|
7801
7749
|
return _regeneratorRuntime().wrap(function _callee75$(_context75) {
|
|
7802
7750
|
while (1) switch (_context75.prev = _context75.next) {
|
|
7803
7751
|
case 0:
|
|
@@ -7808,6 +7756,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
7808
7756
|
}).filter(function (id) {
|
|
7809
7757
|
return Number.isFinite(id);
|
|
7810
7758
|
}) : [];
|
|
7759
|
+
formatterContext = this.buildProductFormatterContext({
|
|
7760
|
+
schedule_date: schedule_date,
|
|
7761
|
+
schedule_datetime: schedule_datetime,
|
|
7762
|
+
customer_id: customer_id,
|
|
7763
|
+
strategy_context: strategy_context
|
|
7764
|
+
});
|
|
7811
7765
|
this.logInfo('computeProductQueryResult 开始', {
|
|
7812
7766
|
menuListIdsCount: (_menu_list_ids$length3 = menu_list_ids === null || menu_list_ids === void 0 ? void 0 : menu_list_ids.length) !== null && _menu_list_ids$length3 !== void 0 ? _menu_list_ids$length3 : 0,
|
|
7813
7767
|
ids: queryIds,
|
|
@@ -7819,28 +7773,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
7819
7773
|
strategyContextKeys: strategy_context ? Object.keys(strategy_context) : [],
|
|
7820
7774
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
7821
7775
|
});
|
|
7822
|
-
|
|
7823
|
-
// 预渲染可能在 PisellOS 顺序 preload 尚未完成时发起商品查询。此时 Menu/Schedule
|
|
7824
|
-
// 暂时为空不代表缓存失效;等待当前 preload 后再按原逻辑查询,避免并发远端刷新先 clear
|
|
7825
|
-
// SQLite/IndexDB,造成 preload 读到空数据并重复请求。正常运行期该字段为 null,不增加等待。
|
|
7826
|
-
startupPreloadTask = this.startupModulePreloadInFlight;
|
|
7827
|
-
if (!startupPreloadTask) {
|
|
7828
|
-
_context75.next = 8;
|
|
7829
|
-
break;
|
|
7830
|
-
}
|
|
7831
|
-
_context75.next = 8;
|
|
7832
|
-
return startupPreloadTask;
|
|
7833
|
-
case 8:
|
|
7834
|
-
// Menu/Schedule preload 会替换 store 中的数组;必须在等待完成后再读取,
|
|
7835
|
-
// 避免 formatterContext 持有预加载前的空数组快照。
|
|
7836
|
-
formatterContext = this.buildProductFormatterContext({
|
|
7837
|
-
schedule_date: schedule_date,
|
|
7838
|
-
schedule_datetime: schedule_datetime,
|
|
7839
|
-
customer_id: customer_id,
|
|
7840
|
-
strategy_context: strategy_context
|
|
7841
|
-
});
|
|
7842
7776
|
if (this.products) {
|
|
7843
|
-
_context75.next =
|
|
7777
|
+
_context75.next = 8;
|
|
7844
7778
|
break;
|
|
7845
7779
|
}
|
|
7846
7780
|
this.logError('computeProductQueryResult: Products 模块未注册');
|
|
@@ -7848,19 +7782,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
7848
7782
|
message: 'Products 模块未注册',
|
|
7849
7783
|
data: this.buildProductQueryResultPayload([], 0)
|
|
7850
7784
|
});
|
|
7851
|
-
case
|
|
7785
|
+
case 8:
|
|
7852
7786
|
if (!(queryIds.length > 0)) {
|
|
7853
|
-
_context75.next =
|
|
7787
|
+
_context75.next = 20;
|
|
7854
7788
|
break;
|
|
7855
7789
|
}
|
|
7856
7790
|
uniqueIds = Array.from(new Set(queryIds));
|
|
7857
7791
|
_tPrice = performance.now();
|
|
7858
|
-
_context75.next =
|
|
7792
|
+
_context75.next = 13;
|
|
7859
7793
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
7860
7794
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
|
|
7861
7795
|
productIds: uniqueIds
|
|
7862
7796
|
});
|
|
7863
|
-
case
|
|
7797
|
+
case 13:
|
|
7864
7798
|
productsWithPrice = _context75.sent;
|
|
7865
7799
|
perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
|
|
7866
7800
|
count: productsWithPrice.length,
|
|
@@ -7887,18 +7821,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
7887
7821
|
message: '',
|
|
7888
7822
|
status: true
|
|
7889
7823
|
});
|
|
7890
|
-
case
|
|
7824
|
+
case 20:
|
|
7891
7825
|
if (!(product_id != null && Number.isFinite(Number(product_id)))) {
|
|
7892
|
-
_context75.next =
|
|
7826
|
+
_context75.next = 32;
|
|
7893
7827
|
break;
|
|
7894
7828
|
}
|
|
7895
7829
|
pid = Number(product_id);
|
|
7896
7830
|
_tPrice2 = performance.now();
|
|
7897
|
-
_context75.next =
|
|
7831
|
+
_context75.next = 25;
|
|
7898
7832
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
7899
7833
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
7900
7834
|
});
|
|
7901
|
-
case
|
|
7835
|
+
case 25:
|
|
7902
7836
|
allProductsWithPrice = _context75.sent;
|
|
7903
7837
|
perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
|
|
7904
7838
|
count: allProductsWithPrice.length,
|
|
@@ -7925,17 +7859,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
7925
7859
|
message: item ? '' : '商品不存在或未发布',
|
|
7926
7860
|
status: true
|
|
7927
7861
|
});
|
|
7928
|
-
case
|
|
7862
|
+
case 32:
|
|
7929
7863
|
if (!this.shouldQueryProductsByExtensionTypes(extension_type)) {
|
|
7930
|
-
_context75.next =
|
|
7864
|
+
_context75.next = 52;
|
|
7931
7865
|
break;
|
|
7932
7866
|
}
|
|
7933
7867
|
_tPrice3 = performance.now();
|
|
7934
|
-
_context75.next =
|
|
7868
|
+
_context75.next = 36;
|
|
7935
7869
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
7936
7870
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
7937
7871
|
});
|
|
7938
|
-
case
|
|
7872
|
+
case 36:
|
|
7939
7873
|
_filteredProducts2 = _context75.sent;
|
|
7940
7874
|
perfMark('computeQuery.getProductsWithPrice(extensionType)', performance.now() - _tPrice3, {
|
|
7941
7875
|
count: _filteredProducts2.length,
|
|
@@ -7981,9 +7915,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
7981
7915
|
message: '',
|
|
7982
7916
|
status: true
|
|
7983
7917
|
});
|
|
7984
|
-
case
|
|
7918
|
+
case 52:
|
|
7985
7919
|
if (this.menu) {
|
|
7986
|
-
_context75.next =
|
|
7920
|
+
_context75.next = 55;
|
|
7987
7921
|
break;
|
|
7988
7922
|
}
|
|
7989
7923
|
this.logError('computeProductQueryResult: Menu 模块未注册');
|
|
@@ -7991,9 +7925,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
7991
7925
|
message: 'Menu 模块未注册',
|
|
7992
7926
|
data: this.buildProductQueryResultPayload([], 0)
|
|
7993
7927
|
});
|
|
7994
|
-
case
|
|
7928
|
+
case 55:
|
|
7995
7929
|
if (this.schedule) {
|
|
7996
|
-
_context75.next =
|
|
7930
|
+
_context75.next = 58;
|
|
7997
7931
|
break;
|
|
7998
7932
|
}
|
|
7999
7933
|
this.logError('computeProductQueryResult: Schedule 模块未注册');
|
|
@@ -8001,41 +7935,41 @@ var Server = /*#__PURE__*/function () {
|
|
|
8001
7935
|
message: 'Schedule 模块未注册',
|
|
8002
7936
|
data: this.buildProductQueryResultPayload([], 0)
|
|
8003
7937
|
});
|
|
8004
|
-
case
|
|
7938
|
+
case 58:
|
|
8005
7939
|
activeMenuList = [];
|
|
8006
7940
|
if (!(menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0)) {
|
|
8007
|
-
_context75.next =
|
|
7941
|
+
_context75.next = 71;
|
|
8008
7942
|
break;
|
|
8009
7943
|
}
|
|
8010
7944
|
tMenu = performance.now();
|
|
8011
7945
|
getActiveMenus = function getActiveMenus() {
|
|
8012
|
-
return
|
|
8013
|
-
var
|
|
8014
|
-
return ((
|
|
7946
|
+
return _this21.menu.getMenuByIds(menu_list_ids).filter(function (menu) {
|
|
7947
|
+
var _this21$schedule;
|
|
7948
|
+
return ((_this21$schedule = _this21.schedule) === null || _this21$schedule === void 0 ? void 0 : _this21$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
|
|
8015
7949
|
});
|
|
8016
7950
|
};
|
|
8017
7951
|
activeMenuList = getActiveMenus();
|
|
8018
7952
|
_context75.t0 = !activeMenuList.length;
|
|
8019
7953
|
if (!_context75.t0) {
|
|
8020
|
-
_context75.next =
|
|
7954
|
+
_context75.next = 68;
|
|
8021
7955
|
break;
|
|
8022
7956
|
}
|
|
8023
|
-
_context75.next =
|
|
7957
|
+
_context75.next = 67;
|
|
8024
7958
|
return this.refreshMenuScheduleCacheAfterEmptyResult();
|
|
8025
|
-
case
|
|
7959
|
+
case 67:
|
|
8026
7960
|
_context75.t0 = _context75.sent;
|
|
8027
|
-
case
|
|
7961
|
+
case 68:
|
|
8028
7962
|
if (!_context75.t0) {
|
|
8029
|
-
_context75.next =
|
|
7963
|
+
_context75.next = 70;
|
|
8030
7964
|
break;
|
|
8031
7965
|
}
|
|
8032
7966
|
activeMenuList = getActiveMenus();
|
|
8033
|
-
case
|
|
7967
|
+
case 70:
|
|
8034
7968
|
perfMark('computeQuery.filterActiveMenu', performance.now() - tMenu, {
|
|
8035
7969
|
totalMenu: menu_list_ids.length,
|
|
8036
7970
|
activeMenu: activeMenuList.length
|
|
8037
7971
|
});
|
|
8038
|
-
case
|
|
7972
|
+
case 71:
|
|
8039
7973
|
tFilter = performance.now();
|
|
8040
7974
|
productScope = this.getProductScopeByMenuConfig(activeMenuList);
|
|
8041
7975
|
scopedProductIds = this.products.getProductIdsByScope(productScope);
|
|
@@ -8046,21 +7980,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
8046
7980
|
});
|
|
8047
7981
|
tPrice = performance.now();
|
|
8048
7982
|
if (!(scopedProductIds.length > 0)) {
|
|
8049
|
-
_context75.next =
|
|
7983
|
+
_context75.next = 82;
|
|
8050
7984
|
break;
|
|
8051
7985
|
}
|
|
8052
|
-
_context75.next =
|
|
7986
|
+
_context75.next = 79;
|
|
8053
7987
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
8054
7988
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
|
|
8055
7989
|
productIds: productScope.isAllProducts ? undefined : scopedProductIds
|
|
8056
7990
|
});
|
|
8057
|
-
case
|
|
7991
|
+
case 79:
|
|
8058
7992
|
_context75.t1 = _context75.sent;
|
|
8059
|
-
_context75.next =
|
|
7993
|
+
_context75.next = 83;
|
|
8060
7994
|
break;
|
|
8061
|
-
case
|
|
7995
|
+
case 82:
|
|
8062
7996
|
_context75.t1 = [];
|
|
8063
|
-
case
|
|
7997
|
+
case 83:
|
|
8064
7998
|
filteredProducts = _context75.t1;
|
|
8065
7999
|
perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
|
|
8066
8000
|
count: filteredProducts.length,
|
|
@@ -8108,7 +8042,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
8108
8042
|
message: '',
|
|
8109
8043
|
status: true
|
|
8110
8044
|
});
|
|
8111
|
-
case
|
|
8045
|
+
case 99:
|
|
8112
8046
|
case "end":
|
|
8113
8047
|
return _context75.stop();
|
|
8114
8048
|
}
|
|
@@ -8320,7 +8254,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
8320
8254
|
}, {
|
|
8321
8255
|
key: "notifySalesSearchSubscribers",
|
|
8322
8256
|
value: function notifySalesSearchSubscribers(payload) {
|
|
8323
|
-
var
|
|
8257
|
+
var _this22 = this;
|
|
8324
8258
|
if (this.salesSearchSubscribers.size === 0) return;
|
|
8325
8259
|
var changedOrders = this.extractChangedOrdersFromPayload(payload);
|
|
8326
8260
|
if (changedOrders.length === 0) {
|
|
@@ -8338,21 +8272,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
8338
8272
|
subscriber = _step20$value[1];
|
|
8339
8273
|
try {
|
|
8340
8274
|
var changedVisibleOrders = changedOrders.filter(function (order) {
|
|
8341
|
-
var orderId =
|
|
8275
|
+
var orderId = _this22.getSalesSearchOrderId(order);
|
|
8342
8276
|
return !!orderId && subscriber.visibleOrderIds.has(orderId);
|
|
8343
8277
|
});
|
|
8344
8278
|
if (changedVisibleOrders.length === 0) {
|
|
8345
8279
|
return 1; // continue
|
|
8346
8280
|
}
|
|
8347
|
-
subscriber.callback(
|
|
8348
|
-
|
|
8281
|
+
subscriber.callback(_this22.buildSalesSearchDeltaResponse(subscriber, changedVisibleOrders));
|
|
8282
|
+
_this22.logInfo('notifySalesSearchSubscribers: 已推送 delta', {
|
|
8349
8283
|
subscriberId: subscriberId,
|
|
8350
8284
|
kind: subscriber.kind,
|
|
8351
8285
|
count: changedVisibleOrders.length
|
|
8352
8286
|
});
|
|
8353
8287
|
} catch (error) {
|
|
8354
8288
|
var errorMessage = error instanceof Error ? error.message : String(error);
|
|
8355
|
-
|
|
8289
|
+
_this22.logError('notifySalesSearchSubscribers: 推送失败', {
|
|
8356
8290
|
subscriberId: subscriberId,
|
|
8357
8291
|
error: errorMessage
|
|
8358
8292
|
});
|