@pisell/pisellos 2.3.67 → 2.3.68
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/model/strategy/adapter/walletPass/evaluator.js +0 -1
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -2
- package/dist/modules/BaseModule.d.ts +1 -0
- package/dist/modules/BaseModule.js +24 -28
- package/dist/modules/Customer/index.d.ts +4 -0
- package/dist/modules/Customer/index.js +91 -59
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Order/index.d.ts +22 -2
- package/dist/modules/Order/index.js +313 -142
- package/dist/modules/Order/types.d.ts +13 -1
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +75 -0
- package/dist/modules/Order/utils.js +0 -1
- package/dist/modules/Payment/index.d.ts +4 -0
- package/dist/modules/Payment/index.js +14 -4
- package/dist/modules/Payment/walletpass.js +52 -18
- package/dist/modules/Quotation/index.d.ts +0 -6
- package/dist/modules/Quotation/index.js +19 -75
- package/dist/modules/Rules/index.js +46 -31
- package/dist/plugins/request.d.ts +0 -1
- package/dist/server/index.d.ts +2 -8
- package/dist/server/index.js +143 -212
- 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 +8 -17
- package/dist/server/modules/order/index.js +453 -506
- 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/server/utils/small-ticket.js +2 -1
- package/dist/solution/BaseSales/index.d.ts +3 -1
- package/dist/solution/BaseSales/index.js +99 -82
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingTicket/index.d.ts +6 -2
- package/dist/solution/BookingTicket/index.js +123 -75
- package/dist/solution/ScanOrder/utils.js +31 -20
- package/dist/solution/UnifiedBookingSales/index.d.ts +25 -0
- package/dist/solution/UnifiedBookingSales/index.js +640 -321
- package/dist/solution/UnifiedBookingSales/types.d.ts +7 -0
- package/lib/core/index.d.ts +0 -7
- package/lib/core/index.js +2 -20
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -1
- package/lib/model/strategy/adapter/walletPass/utils.js +0 -1
- package/lib/modules/BaseModule.d.ts +1 -0
- package/lib/modules/BaseModule.js +24 -37
- package/lib/modules/Customer/index.d.ts +4 -0
- package/lib/modules/Customer/index.js +11 -0
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Order/index.d.ts +22 -2
- package/lib/modules/Order/index.js +212 -54
- package/lib/modules/Order/types.d.ts +13 -1
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +70 -0
- package/lib/modules/Order/utils.js +0 -1
- package/lib/modules/Payment/index.d.ts +4 -0
- package/lib/modules/Payment/index.js +7 -0
- package/lib/modules/Payment/walletpass.js +27 -2
- package/lib/modules/Quotation/index.d.ts +0 -6
- package/lib/modules/Quotation/index.js +5 -49
- package/lib/modules/Rules/index.js +17 -1
- package/lib/plugins/request.d.ts +0 -1
- package/lib/server/index.d.ts +2 -8
- package/lib/server/index.js +20 -58
- 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 +8 -17
- package/lib/server/modules/order/index.js +106 -199
- 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/server/utils/small-ticket.js +1 -1
- package/lib/solution/BaseSales/index.d.ts +3 -1
- package/lib/solution/BaseSales/index.js +29 -16
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingTicket/index.d.ts +6 -2
- package/lib/solution/BookingTicket/index.js +53 -14
- package/lib/solution/ScanOrder/utils.js +29 -18
- package/lib/solution/UnifiedBookingSales/index.d.ts +25 -0
- package/lib/solution/UnifiedBookingSales/index.js +188 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +7 -0
- 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
|
}));
|
|
@@ -6005,9 +5953,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6005
5953
|
checkoutData: checkoutData,
|
|
6006
5954
|
order: pendingOrder,
|
|
6007
5955
|
response: pendingResult,
|
|
6008
|
-
requireFullyPaid: true
|
|
6009
|
-
// 自动小票固定使用 print_all 的收据类型 0,不随订单 type 改成券/手环类型 99。
|
|
6010
|
-
isManualPrint: true
|
|
5956
|
+
requireFullyPaid: true
|
|
6011
5957
|
});
|
|
6012
5958
|
case 18:
|
|
6013
5959
|
_context60.next = 20;
|
|
@@ -6093,9 +6039,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
6093
6039
|
checkoutData: syncResult.checkoutData,
|
|
6094
6040
|
order: syncedOrder,
|
|
6095
6041
|
response: syncResult.normalizedResponse,
|
|
6096
|
-
requireFullyPaid: true
|
|
6042
|
+
requireFullyPaid: true
|
|
6097
6043
|
// print_all 的 type=0 是收据打印;不要沿用同步成功后的券/手环打印 type=99。
|
|
6098
|
-
isManualPrint: true
|
|
6099
6044
|
});
|
|
6100
6045
|
case 16:
|
|
6101
6046
|
return _context61.abrupt("return", response);
|
|
@@ -6222,7 +6167,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6222
6167
|
key: "handlePendingSyncCheckoutOrder",
|
|
6223
6168
|
value: function () {
|
|
6224
6169
|
var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
|
|
6225
|
-
var
|
|
6170
|
+
var _this13 = this;
|
|
6226
6171
|
var backendPath, data, title, reason, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
|
|
6227
6172
|
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
6228
6173
|
while (1) switch (_context63.prev = _context63.next) {
|
|
@@ -6275,7 +6220,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6275
6220
|
});
|
|
6276
6221
|
changeGivenAmount = pendingOrder === null || pendingOrder === void 0 || (_pendingOrder$payment = pendingOrder.payments) === null || _pendingOrder$payment === void 0 ? void 0 : _pendingOrder$payment.reduce(function (sum, payment) {
|
|
6277
6222
|
var _payment$metadata;
|
|
6278
|
-
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);
|
|
6279
6224
|
}, 0);
|
|
6280
6225
|
return _context63.abrupt("return", {
|
|
6281
6226
|
code: 200,
|
|
@@ -6370,7 +6315,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6370
6315
|
value: function shouldAutoPrintCheckoutReceipt() {
|
|
6371
6316
|
var _this$core$context2, _this$core$context2$g, _this$app17, _this$app17$getStorag;
|
|
6372
6317
|
if (((_this$core$context2 = this.core.context) === null || _this$core$context2 === void 0 || (_this$core$context2$g = _this$core$context2.getPlatform) === null || _this$core$context2$g === void 0 ? void 0 : _this$core$context2$g.call(_this$core$context2)) !== 'android') return true;
|
|
6373
|
-
return ((_this$app17 = this.app) === null || _this$app17 === void 0 || (_this$app17 = _this$app17.storage) === null || _this$app17 === void 0 || (_this$app17$getStorag = _this$app17.getStorage) === null || _this$app17$getStorag === void 0 ? void 0 : _this$app17$getStorag.call(_this$app17, AUTO_PRINT_STORAGE_KEY))
|
|
6318
|
+
return ((_this$app17 = this.app) === null || _this$app17 === void 0 || (_this$app17 = _this$app17.storage) === null || _this$app17 === void 0 || (_this$app17$getStorag = _this$app17.getStorage) === null || _this$app17$getStorag === void 0 ? void 0 : _this$app17$getStorag.call(_this$app17, AUTO_PRINT_STORAGE_KEY)) !== 'false';
|
|
6374
6319
|
}
|
|
6375
6320
|
}, {
|
|
6376
6321
|
key: "shouldBuildSmallTicketData",
|
|
@@ -6415,13 +6360,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6415
6360
|
}, {
|
|
6416
6361
|
key: "sumPaidOrderPayments",
|
|
6417
6362
|
value: function sumPaidOrderPayments(payments) {
|
|
6418
|
-
var
|
|
6363
|
+
var _this14 = this;
|
|
6419
6364
|
if (!Array.isArray(payments)) return 0;
|
|
6420
6365
|
return payments.reduce(function (sum, payment) {
|
|
6421
6366
|
var _payment$amount;
|
|
6422
6367
|
var status = String((payment === null || payment === void 0 ? void 0 : payment.status) || '').toLowerCase();
|
|
6423
6368
|
if (status !== 'paid') return sum;
|
|
6424
|
-
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);
|
|
6425
6370
|
}, 0);
|
|
6426
6371
|
}
|
|
6427
6372
|
}, {
|
|
@@ -6437,7 +6382,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6437
6382
|
value: function () {
|
|
6438
6383
|
var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(order) {
|
|
6439
6384
|
var _this$products3,
|
|
6440
|
-
|
|
6385
|
+
_this15 = this;
|
|
6441
6386
|
var products, productIdSet, productIds, entries;
|
|
6442
6387
|
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
|
6443
6388
|
while (1) switch (_context66.prev = _context66.next) {
|
|
@@ -6470,20 +6415,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
6470
6415
|
_context66.next = 8;
|
|
6471
6416
|
return Promise.all(productIds.map( /*#__PURE__*/function () {
|
|
6472
6417
|
var _ref68 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(id) {
|
|
6473
|
-
var
|
|
6418
|
+
var _this15$products, _this15$products$getP, product;
|
|
6474
6419
|
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
|
6475
6420
|
while (1) switch (_context65.prev = _context65.next) {
|
|
6476
6421
|
case 0:
|
|
6477
6422
|
_context65.prev = 0;
|
|
6478
6423
|
_context65.next = 3;
|
|
6479
|
-
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));
|
|
6480
6425
|
case 3:
|
|
6481
6426
|
product = _context65.sent;
|
|
6482
6427
|
return _context65.abrupt("return", product ? [String(id), product] : null);
|
|
6483
6428
|
case 7:
|
|
6484
6429
|
_context65.prev = 7;
|
|
6485
6430
|
_context65.t0 = _context65["catch"](0);
|
|
6486
|
-
|
|
6431
|
+
_this15.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
|
|
6487
6432
|
product_id: id,
|
|
6488
6433
|
error: _context65.t0 instanceof Error ? _context65.t0.message : String(_context65.t0)
|
|
6489
6434
|
});
|
|
@@ -6634,7 +6579,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6634
6579
|
key: "withSalesDetailProductSnapshots",
|
|
6635
6580
|
value: function () {
|
|
6636
6581
|
var _withSalesDetailProductSnapshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(order) {
|
|
6637
|
-
var
|
|
6582
|
+
var _this16 = this;
|
|
6638
6583
|
var products, snapshotMap, hasChanged, enrichedProducts, enrichedOrder;
|
|
6639
6584
|
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
|
6640
6585
|
while (1) switch (_context68.prev = _context68.next) {
|
|
@@ -6658,8 +6603,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
6658
6603
|
case 8:
|
|
6659
6604
|
hasChanged = false;
|
|
6660
6605
|
enrichedProducts = products.map(function (product) {
|
|
6661
|
-
var productWithBundleSnapshots =
|
|
6662
|
-
var nextProduct =
|
|
6606
|
+
var productWithBundleSnapshots = _this16.withBundleCatalogSnapshots(product, snapshotMap);
|
|
6607
|
+
var nextProduct = _this16.withProductCatalogSnapshots(productWithBundleSnapshots, snapshotMap);
|
|
6663
6608
|
if (nextProduct !== product) hasChanged = true;
|
|
6664
6609
|
return nextProduct;
|
|
6665
6610
|
});
|
|
@@ -6687,13 +6632,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6687
6632
|
}, {
|
|
6688
6633
|
key: "withPendingSyncProductTitles",
|
|
6689
6634
|
value: function withPendingSyncProductTitles(order, productMap) {
|
|
6690
|
-
var
|
|
6635
|
+
var _this17 = this;
|
|
6691
6636
|
var products = Array.isArray(order.products) ? order.products : null;
|
|
6692
6637
|
if (!(products !== null && products !== void 0 && products.length)) return order;
|
|
6693
6638
|
return _objectSpread(_objectSpread({}, order), {}, {
|
|
6694
6639
|
products: products.map(function (product) {
|
|
6695
6640
|
return _objectSpread(_objectSpread({}, product), {}, {
|
|
6696
|
-
product_title:
|
|
6641
|
+
product_title: _this17.buildProductTitleSnapshot(product, productMap)
|
|
6697
6642
|
});
|
|
6698
6643
|
})
|
|
6699
6644
|
});
|
|
@@ -6704,7 +6649,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6704
6649
|
var _product$product_id4,
|
|
6705
6650
|
_product$product,
|
|
6706
6651
|
_fallbackProduct$prod,
|
|
6707
|
-
|
|
6652
|
+
_this18 = this;
|
|
6708
6653
|
var productId = (_product$product_id4 = product.product_id) !== null && _product$product_id4 !== void 0 ? _product$product_id4 : product.id;
|
|
6709
6654
|
var fallbackProduct = productId !== undefined && productId !== null ? productMap[productId] || productMap[String(productId)] : null;
|
|
6710
6655
|
var ownTitle = product.product_title || product.title || product.name || ((_product$product = product.product) === null || _product$product === void 0 ? void 0 : _product$product.title);
|
|
@@ -6712,7 +6657,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6712
6657
|
var currentLocale = this.getProductTitleSnapshotCurrentLocale();
|
|
6713
6658
|
var autoTitle = this.resolveFirstProductTitleValue(ownTitle) || this.resolveFirstProductTitleValue(fallbackTitle);
|
|
6714
6659
|
return PRODUCT_TITLE_SNAPSHOT_KEYS.reduce(function (snapshot, key) {
|
|
6715
|
-
snapshot[key] =
|
|
6660
|
+
snapshot[key] = _this18.resolveProductTitleValue(ownTitle, key, currentLocale) || _this18.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === 'auto' || key === 'original' ? autoTitle : null);
|
|
6716
6661
|
return snapshot;
|
|
6717
6662
|
}, {});
|
|
6718
6663
|
}
|
|
@@ -6811,14 +6756,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
6811
6756
|
key: "enrichPaymentNamesByCode",
|
|
6812
6757
|
value: function () {
|
|
6813
6758
|
var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(order) {
|
|
6814
|
-
var
|
|
6759
|
+
var _this19 = this;
|
|
6815
6760
|
var payments, hasMissingName, paymentModule, payMethods, nameByCode, _iterator12, _step12, method, codeKey, name, hasResolvedName, enrichedPayments;
|
|
6816
6761
|
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
|
6817
6762
|
while (1) switch (_context69.prev = _context69.next) {
|
|
6818
6763
|
case 0:
|
|
6819
6764
|
payments = Array.isArray(order === null || order === void 0 ? void 0 : order.payments) ? order.payments : [];
|
|
6820
6765
|
hasMissingName = payments.some(function (payment) {
|
|
6821
|
-
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);
|
|
6822
6767
|
});
|
|
6823
6768
|
if (hasMissingName) {
|
|
6824
6769
|
_context69.next = 4;
|
|
@@ -6851,9 +6796,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
6851
6796
|
}
|
|
6852
6797
|
hasResolvedName = false;
|
|
6853
6798
|
enrichedPayments = payments.map(function (payment) {
|
|
6854
|
-
if (!
|
|
6855
|
-
if (!
|
|
6856
|
-
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));
|
|
6857
6802
|
if (!name) return payment;
|
|
6858
6803
|
hasResolvedName = true;
|
|
6859
6804
|
return _objectSpread(_objectSpread({}, payment), {}, {
|
|
@@ -7435,10 +7380,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
7435
7380
|
value: function extractBackendErrorResponse(error) {
|
|
7436
7381
|
var _error$response3,
|
|
7437
7382
|
_error$response4,
|
|
7438
|
-
|
|
7383
|
+
_this20 = this;
|
|
7439
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];
|
|
7440
7385
|
return candidates.find(function (candidate) {
|
|
7441
|
-
return
|
|
7386
|
+
return _this20.isExplicitBackendErrorResponse(candidate);
|
|
7442
7387
|
}) || null;
|
|
7443
7388
|
}
|
|
7444
7389
|
}, {
|
|
@@ -7799,8 +7744,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
7799
7744
|
value: (function () {
|
|
7800
7745
|
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(context, options) {
|
|
7801
7746
|
var _menu_list_ids$length3,
|
|
7802
|
-
|
|
7803
|
-
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;
|
|
7804
7749
|
return _regeneratorRuntime().wrap(function _callee75$(_context75) {
|
|
7805
7750
|
while (1) switch (_context75.prev = _context75.next) {
|
|
7806
7751
|
case 0:
|
|
@@ -7811,6 +7756,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
7811
7756
|
}).filter(function (id) {
|
|
7812
7757
|
return Number.isFinite(id);
|
|
7813
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
|
+
});
|
|
7814
7765
|
this.logInfo('computeProductQueryResult 开始', {
|
|
7815
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,
|
|
7816
7767
|
ids: queryIds,
|
|
@@ -7822,28 +7773,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
7822
7773
|
strategyContextKeys: strategy_context ? Object.keys(strategy_context) : [],
|
|
7823
7774
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
7824
7775
|
});
|
|
7825
|
-
|
|
7826
|
-
// 预渲染可能在 PisellOS 顺序 preload 尚未完成时发起商品查询。此时 Menu/Schedule
|
|
7827
|
-
// 暂时为空不代表缓存失效;等待当前 preload 后再按原逻辑查询,避免并发远端刷新先 clear
|
|
7828
|
-
// SQLite/IndexDB,造成 preload 读到空数据并重复请求。正常运行期该字段为 null,不增加等待。
|
|
7829
|
-
startupPreloadTask = this.startupModulePreloadInFlight;
|
|
7830
|
-
if (!startupPreloadTask) {
|
|
7831
|
-
_context75.next = 8;
|
|
7832
|
-
break;
|
|
7833
|
-
}
|
|
7834
|
-
_context75.next = 8;
|
|
7835
|
-
return startupPreloadTask;
|
|
7836
|
-
case 8:
|
|
7837
|
-
// Menu/Schedule preload 会替换 store 中的数组;必须在等待完成后再读取,
|
|
7838
|
-
// 避免 formatterContext 持有预加载前的空数组快照。
|
|
7839
|
-
formatterContext = this.buildProductFormatterContext({
|
|
7840
|
-
schedule_date: schedule_date,
|
|
7841
|
-
schedule_datetime: schedule_datetime,
|
|
7842
|
-
customer_id: customer_id,
|
|
7843
|
-
strategy_context: strategy_context
|
|
7844
|
-
});
|
|
7845
7776
|
if (this.products) {
|
|
7846
|
-
_context75.next =
|
|
7777
|
+
_context75.next = 8;
|
|
7847
7778
|
break;
|
|
7848
7779
|
}
|
|
7849
7780
|
this.logError('computeProductQueryResult: Products 模块未注册');
|
|
@@ -7851,19 +7782,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
7851
7782
|
message: 'Products 模块未注册',
|
|
7852
7783
|
data: this.buildProductQueryResultPayload([], 0)
|
|
7853
7784
|
});
|
|
7854
|
-
case
|
|
7785
|
+
case 8:
|
|
7855
7786
|
if (!(queryIds.length > 0)) {
|
|
7856
|
-
_context75.next =
|
|
7787
|
+
_context75.next = 20;
|
|
7857
7788
|
break;
|
|
7858
7789
|
}
|
|
7859
7790
|
uniqueIds = Array.from(new Set(queryIds));
|
|
7860
7791
|
_tPrice = performance.now();
|
|
7861
|
-
_context75.next =
|
|
7792
|
+
_context75.next = 13;
|
|
7862
7793
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
7863
7794
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
|
|
7864
7795
|
productIds: uniqueIds
|
|
7865
7796
|
});
|
|
7866
|
-
case
|
|
7797
|
+
case 13:
|
|
7867
7798
|
productsWithPrice = _context75.sent;
|
|
7868
7799
|
perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
|
|
7869
7800
|
count: productsWithPrice.length,
|
|
@@ -7890,18 +7821,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
7890
7821
|
message: '',
|
|
7891
7822
|
status: true
|
|
7892
7823
|
});
|
|
7893
|
-
case
|
|
7824
|
+
case 20:
|
|
7894
7825
|
if (!(product_id != null && Number.isFinite(Number(product_id)))) {
|
|
7895
|
-
_context75.next =
|
|
7826
|
+
_context75.next = 32;
|
|
7896
7827
|
break;
|
|
7897
7828
|
}
|
|
7898
7829
|
pid = Number(product_id);
|
|
7899
7830
|
_tPrice2 = performance.now();
|
|
7900
|
-
_context75.next =
|
|
7831
|
+
_context75.next = 25;
|
|
7901
7832
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
7902
7833
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
7903
7834
|
});
|
|
7904
|
-
case
|
|
7835
|
+
case 25:
|
|
7905
7836
|
allProductsWithPrice = _context75.sent;
|
|
7906
7837
|
perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
|
|
7907
7838
|
count: allProductsWithPrice.length,
|
|
@@ -7928,17 +7859,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
7928
7859
|
message: item ? '' : '商品不存在或未发布',
|
|
7929
7860
|
status: true
|
|
7930
7861
|
});
|
|
7931
|
-
case
|
|
7862
|
+
case 32:
|
|
7932
7863
|
if (!this.shouldQueryProductsByExtensionTypes(extension_type)) {
|
|
7933
|
-
_context75.next =
|
|
7864
|
+
_context75.next = 52;
|
|
7934
7865
|
break;
|
|
7935
7866
|
}
|
|
7936
7867
|
_tPrice3 = performance.now();
|
|
7937
|
-
_context75.next =
|
|
7868
|
+
_context75.next = 36;
|
|
7938
7869
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
7939
7870
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
7940
7871
|
});
|
|
7941
|
-
case
|
|
7872
|
+
case 36:
|
|
7942
7873
|
_filteredProducts2 = _context75.sent;
|
|
7943
7874
|
perfMark('computeQuery.getProductsWithPrice(extensionType)', performance.now() - _tPrice3, {
|
|
7944
7875
|
count: _filteredProducts2.length,
|
|
@@ -7984,9 +7915,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
7984
7915
|
message: '',
|
|
7985
7916
|
status: true
|
|
7986
7917
|
});
|
|
7987
|
-
case
|
|
7918
|
+
case 52:
|
|
7988
7919
|
if (this.menu) {
|
|
7989
|
-
_context75.next =
|
|
7920
|
+
_context75.next = 55;
|
|
7990
7921
|
break;
|
|
7991
7922
|
}
|
|
7992
7923
|
this.logError('computeProductQueryResult: Menu 模块未注册');
|
|
@@ -7994,9 +7925,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
7994
7925
|
message: 'Menu 模块未注册',
|
|
7995
7926
|
data: this.buildProductQueryResultPayload([], 0)
|
|
7996
7927
|
});
|
|
7997
|
-
case
|
|
7928
|
+
case 55:
|
|
7998
7929
|
if (this.schedule) {
|
|
7999
|
-
_context75.next =
|
|
7930
|
+
_context75.next = 58;
|
|
8000
7931
|
break;
|
|
8001
7932
|
}
|
|
8002
7933
|
this.logError('computeProductQueryResult: Schedule 模块未注册');
|
|
@@ -8004,41 +7935,41 @@ var Server = /*#__PURE__*/function () {
|
|
|
8004
7935
|
message: 'Schedule 模块未注册',
|
|
8005
7936
|
data: this.buildProductQueryResultPayload([], 0)
|
|
8006
7937
|
});
|
|
8007
|
-
case
|
|
7938
|
+
case 58:
|
|
8008
7939
|
activeMenuList = [];
|
|
8009
7940
|
if (!(menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0)) {
|
|
8010
|
-
_context75.next =
|
|
7941
|
+
_context75.next = 71;
|
|
8011
7942
|
break;
|
|
8012
7943
|
}
|
|
8013
7944
|
tMenu = performance.now();
|
|
8014
7945
|
getActiveMenus = function getActiveMenus() {
|
|
8015
|
-
return
|
|
8016
|
-
var
|
|
8017
|
-
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;
|
|
8018
7949
|
});
|
|
8019
7950
|
};
|
|
8020
7951
|
activeMenuList = getActiveMenus();
|
|
8021
7952
|
_context75.t0 = !activeMenuList.length;
|
|
8022
7953
|
if (!_context75.t0) {
|
|
8023
|
-
_context75.next =
|
|
7954
|
+
_context75.next = 68;
|
|
8024
7955
|
break;
|
|
8025
7956
|
}
|
|
8026
|
-
_context75.next =
|
|
7957
|
+
_context75.next = 67;
|
|
8027
7958
|
return this.refreshMenuScheduleCacheAfterEmptyResult();
|
|
8028
|
-
case
|
|
7959
|
+
case 67:
|
|
8029
7960
|
_context75.t0 = _context75.sent;
|
|
8030
|
-
case
|
|
7961
|
+
case 68:
|
|
8031
7962
|
if (!_context75.t0) {
|
|
8032
|
-
_context75.next =
|
|
7963
|
+
_context75.next = 70;
|
|
8033
7964
|
break;
|
|
8034
7965
|
}
|
|
8035
7966
|
activeMenuList = getActiveMenus();
|
|
8036
|
-
case
|
|
7967
|
+
case 70:
|
|
8037
7968
|
perfMark('computeQuery.filterActiveMenu', performance.now() - tMenu, {
|
|
8038
7969
|
totalMenu: menu_list_ids.length,
|
|
8039
7970
|
activeMenu: activeMenuList.length
|
|
8040
7971
|
});
|
|
8041
|
-
case
|
|
7972
|
+
case 71:
|
|
8042
7973
|
tFilter = performance.now();
|
|
8043
7974
|
productScope = this.getProductScopeByMenuConfig(activeMenuList);
|
|
8044
7975
|
scopedProductIds = this.products.getProductIdsByScope(productScope);
|
|
@@ -8049,21 +7980,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
8049
7980
|
});
|
|
8050
7981
|
tPrice = performance.now();
|
|
8051
7982
|
if (!(scopedProductIds.length > 0)) {
|
|
8052
|
-
_context75.next =
|
|
7983
|
+
_context75.next = 82;
|
|
8053
7984
|
break;
|
|
8054
7985
|
}
|
|
8055
|
-
_context75.next =
|
|
7986
|
+
_context75.next = 79;
|
|
8056
7987
|
return this.products.getProductsWithPrice(schedule_date, formatterContext, {
|
|
8057
7988
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
|
|
8058
7989
|
productIds: productScope.isAllProducts ? undefined : scopedProductIds
|
|
8059
7990
|
});
|
|
8060
|
-
case
|
|
7991
|
+
case 79:
|
|
8061
7992
|
_context75.t1 = _context75.sent;
|
|
8062
|
-
_context75.next =
|
|
7993
|
+
_context75.next = 83;
|
|
8063
7994
|
break;
|
|
8064
|
-
case
|
|
7995
|
+
case 82:
|
|
8065
7996
|
_context75.t1 = [];
|
|
8066
|
-
case
|
|
7997
|
+
case 83:
|
|
8067
7998
|
filteredProducts = _context75.t1;
|
|
8068
7999
|
perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
|
|
8069
8000
|
count: filteredProducts.length,
|
|
@@ -8111,7 +8042,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
8111
8042
|
message: '',
|
|
8112
8043
|
status: true
|
|
8113
8044
|
});
|
|
8114
|
-
case
|
|
8045
|
+
case 99:
|
|
8115
8046
|
case "end":
|
|
8116
8047
|
return _context75.stop();
|
|
8117
8048
|
}
|
|
@@ -8323,7 +8254,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
8323
8254
|
}, {
|
|
8324
8255
|
key: "notifySalesSearchSubscribers",
|
|
8325
8256
|
value: function notifySalesSearchSubscribers(payload) {
|
|
8326
|
-
var
|
|
8257
|
+
var _this22 = this;
|
|
8327
8258
|
if (this.salesSearchSubscribers.size === 0) return;
|
|
8328
8259
|
var changedOrders = this.extractChangedOrdersFromPayload(payload);
|
|
8329
8260
|
if (changedOrders.length === 0) {
|
|
@@ -8341,21 +8272,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
8341
8272
|
subscriber = _step20$value[1];
|
|
8342
8273
|
try {
|
|
8343
8274
|
var changedVisibleOrders = changedOrders.filter(function (order) {
|
|
8344
|
-
var orderId =
|
|
8275
|
+
var orderId = _this22.getSalesSearchOrderId(order);
|
|
8345
8276
|
return !!orderId && subscriber.visibleOrderIds.has(orderId);
|
|
8346
8277
|
});
|
|
8347
8278
|
if (changedVisibleOrders.length === 0) {
|
|
8348
8279
|
return 1; // continue
|
|
8349
8280
|
}
|
|
8350
|
-
subscriber.callback(
|
|
8351
|
-
|
|
8281
|
+
subscriber.callback(_this22.buildSalesSearchDeltaResponse(subscriber, changedVisibleOrders));
|
|
8282
|
+
_this22.logInfo('notifySalesSearchSubscribers: 已推送 delta', {
|
|
8352
8283
|
subscriberId: subscriberId,
|
|
8353
8284
|
kind: subscriber.kind,
|
|
8354
8285
|
count: changedVisibleOrders.length
|
|
8355
8286
|
});
|
|
8356
8287
|
} catch (error) {
|
|
8357
8288
|
var errorMessage = error instanceof Error ? error.message : String(error);
|
|
8358
|
-
|
|
8289
|
+
_this22.logError('notifySalesSearchSubscribers: 推送失败', {
|
|
8359
8290
|
subscriberId: subscriberId,
|
|
8360
8291
|
error: errorMessage
|
|
8361
8292
|
});
|