@pisell/pisellos 2.2.198 → 2.2.199
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/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +7 -3
- package/dist/modules/Cart/utils/cartProduct.js +11 -1
- package/dist/modules/Cart/utils/changePrice.js +11 -11
- package/dist/modules/Order/index.js +155 -104
- package/dist/modules/Order/types.d.ts +1 -0
- package/dist/modules/Order/utils.d.ts +33 -2
- package/dist/modules/Order/utils.js +112 -55
- package/dist/modules/SalesSummary/utils.js +97 -63
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +294 -190
- package/dist/server/modules/order/index.d.ts +8 -0
- package/dist/server/modules/order/index.js +536 -317
- package/dist/server/modules/order/types.d.ts +2 -0
- package/dist/solution/BaseSales/index.js +2 -1
- package/dist/solution/BaseSales/types.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +19 -4
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/ScanOrder/types.d.ts +1 -0
- package/dist/solution/ScanOrder/utils.js +26 -9
- package/dist/solution/VenueBooking/index.js +2 -1
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +4 -1
- package/lib/modules/Cart/utils/cartProduct.js +11 -1
- package/lib/modules/Cart/utils/changePrice.js +12 -20
- package/lib/modules/Order/index.js +58 -6
- package/lib/modules/Order/types.d.ts +1 -0
- package/lib/modules/Order/utils.d.ts +33 -2
- package/lib/modules/Order/utils.js +44 -9
- package/lib/modules/SalesSummary/utils.js +41 -44
- package/lib/server/index.d.ts +3 -0
- package/lib/server/index.js +82 -3
- package/lib/server/modules/order/index.d.ts +8 -0
- package/lib/server/modules/order/index.js +106 -4
- package/lib/server/modules/order/types.d.ts +2 -0
- package/lib/solution/BaseSales/index.js +2 -1
- package/lib/solution/BaseSales/types.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +15 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/ScanOrder/types.d.ts +1 -0
- package/lib/solution/ScanOrder/utils.js +28 -10
- package/lib/solution/VenueBooking/index.js +2 -1
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -2761,7 +2761,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2761
2761
|
value: function () {
|
|
2762
2762
|
var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
2763
2763
|
var _this$app5;
|
|
2764
|
-
var backendPath, data, title, response, fresh, errorMessage, backendError;
|
|
2764
|
+
var backendPath, data, title, response, fresh, syncedOrder, errorMessage, backendError;
|
|
2765
2765
|
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2766
2766
|
while (1) switch (_context27.prev = _context27.next) {
|
|
2767
2767
|
case 0:
|
|
@@ -2777,12 +2777,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
2777
2777
|
break;
|
|
2778
2778
|
}
|
|
2779
2779
|
this.logError("".concat(title, ": app.request \u4E0D\u53EF\u7528"));
|
|
2780
|
-
return _context27.abrupt("return", {
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
});
|
|
2780
|
+
return _context27.abrupt("return", this.handlePendingSyncCheckoutOrder({
|
|
2781
|
+
backendPath: backendPath,
|
|
2782
|
+
data: data,
|
|
2783
|
+
title: title,
|
|
2784
|
+
reason: 'app.request 不可用'
|
|
2785
|
+
}));
|
|
2786
2786
|
case 5:
|
|
2787
2787
|
_context27.prev = 5;
|
|
2788
2788
|
_context27.next = 8;
|
|
@@ -2794,28 +2794,31 @@ var Server = /*#__PURE__*/function () {
|
|
|
2794
2794
|
response = _context27.sent;
|
|
2795
2795
|
fresh = this.extractOrderDataFromCheckoutResponse(response);
|
|
2796
2796
|
if (!(fresh && this.order)) {
|
|
2797
|
-
_context27.next =
|
|
2797
|
+
_context27.next = 17;
|
|
2798
2798
|
break;
|
|
2799
2799
|
}
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2800
|
+
syncedOrder = _objectSpread(_objectSpread({}, fresh), {}, {
|
|
2801
|
+
need_sync: 0
|
|
2802
|
+
});
|
|
2803
|
+
_context27.next = 14;
|
|
2804
|
+
return this.order.upsertOrdersFromRemote([syncedOrder]);
|
|
2805
|
+
case 14:
|
|
2803
2806
|
this.logInfo("".concat(title, ": \u8BA2\u5355\u5DF2\u540C\u6B65\u5230\u672C\u5730"), {
|
|
2804
2807
|
order_id: fresh.order_id,
|
|
2805
2808
|
external_sale_number: fresh.external_sale_number,
|
|
2806
2809
|
order_number: fresh.order_number
|
|
2807
2810
|
});
|
|
2808
|
-
_context27.next =
|
|
2811
|
+
_context27.next = 18;
|
|
2809
2812
|
break;
|
|
2810
|
-
case
|
|
2813
|
+
case 17:
|
|
2811
2814
|
this.logWarning("".concat(title, ": checkout \u8FD4\u56DE\u672A\u5305\u542B\u53EF\u540C\u6B65\u8BA2\u5355"), {
|
|
2812
2815
|
hasOrderModule: !!this.order,
|
|
2813
2816
|
backendPath: backendPath
|
|
2814
2817
|
});
|
|
2815
|
-
case
|
|
2818
|
+
case 18:
|
|
2816
2819
|
return _context27.abrupt("return", this.normalizeCheckoutResponse(response));
|
|
2817
|
-
case
|
|
2818
|
-
_context27.prev =
|
|
2820
|
+
case 21:
|
|
2821
|
+
_context27.prev = 21;
|
|
2819
2822
|
_context27.t0 = _context27["catch"](5);
|
|
2820
2823
|
errorMessage = _context27.t0 instanceof Error ? _context27.t0.message : String(_context27.t0);
|
|
2821
2824
|
this.logError("".concat(title, ": \u8BF7\u6C42\u5931\u8D25"), {
|
|
@@ -2824,28 +2827,121 @@ var Server = /*#__PURE__*/function () {
|
|
|
2824
2827
|
});
|
|
2825
2828
|
backendError = this.extractBackendErrorResponse(_context27.t0);
|
|
2826
2829
|
if (!backendError) {
|
|
2827
|
-
_context27.next =
|
|
2830
|
+
_context27.next = 28;
|
|
2828
2831
|
break;
|
|
2829
2832
|
}
|
|
2830
2833
|
return _context27.abrupt("return", backendError);
|
|
2831
|
-
case 27:
|
|
2832
|
-
return _context27.abrupt("return", {
|
|
2833
|
-
code: 500,
|
|
2834
|
-
status: false,
|
|
2835
|
-
message: errorMessage,
|
|
2836
|
-
data: null
|
|
2837
|
-
});
|
|
2838
2834
|
case 28:
|
|
2835
|
+
return _context27.abrupt("return", this.handlePendingSyncCheckoutOrder({
|
|
2836
|
+
backendPath: backendPath,
|
|
2837
|
+
data: data,
|
|
2838
|
+
title: title,
|
|
2839
|
+
reason: errorMessage
|
|
2840
|
+
}));
|
|
2841
|
+
case 29:
|
|
2839
2842
|
case "end":
|
|
2840
2843
|
return _context27.stop();
|
|
2841
2844
|
}
|
|
2842
|
-
}, _callee27, this, [[5,
|
|
2845
|
+
}, _callee27, this, [[5, 21]]);
|
|
2843
2846
|
}));
|
|
2844
2847
|
function handleOrderCheckoutSubmit(_x28) {
|
|
2845
2848
|
return _handleOrderCheckoutSubmit.apply(this, arguments);
|
|
2846
2849
|
}
|
|
2847
2850
|
return handleOrderCheckoutSubmit;
|
|
2848
2851
|
}()
|
|
2852
|
+
}, {
|
|
2853
|
+
key: "handlePendingSyncCheckoutOrder",
|
|
2854
|
+
value: function () {
|
|
2855
|
+
var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2856
|
+
var backendPath, data, title, reason, pendingOrder, errorMessage;
|
|
2857
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2858
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2859
|
+
case 0:
|
|
2860
|
+
backendPath = params.backendPath, data = params.data, title = params.title, reason = params.reason;
|
|
2861
|
+
pendingOrder = this.buildPendingSyncCheckoutOrder(data);
|
|
2862
|
+
if (pendingOrder) {
|
|
2863
|
+
_context28.next = 5;
|
|
2864
|
+
break;
|
|
2865
|
+
}
|
|
2866
|
+
this.logError("".concat(title, ": checkout \u5931\u8D25\u4E14\u8BA2\u5355\u7F3A\u5C11\u672C\u5730\u5B58\u50A8\u6807\u8BC6"), {
|
|
2867
|
+
backendPath: backendPath,
|
|
2868
|
+
reason: reason
|
|
2869
|
+
});
|
|
2870
|
+
return _context28.abrupt("return", {
|
|
2871
|
+
code: 500,
|
|
2872
|
+
status: false,
|
|
2873
|
+
message: '订单缺少本地存储标识,无法写入待同步队列',
|
|
2874
|
+
data: null
|
|
2875
|
+
});
|
|
2876
|
+
case 5:
|
|
2877
|
+
if (!(!this.order || typeof this.order.upsertPendingSyncOrders !== 'function')) {
|
|
2878
|
+
_context28.next = 8;
|
|
2879
|
+
break;
|
|
2880
|
+
}
|
|
2881
|
+
this.logError("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u5F85\u540C\u6B65\u5199\u5165"), {
|
|
2882
|
+
backendPath: backendPath,
|
|
2883
|
+
reason: reason
|
|
2884
|
+
});
|
|
2885
|
+
return _context28.abrupt("return", {
|
|
2886
|
+
code: 500,
|
|
2887
|
+
status: false,
|
|
2888
|
+
message: 'Order 模块不支持本地待同步写入',
|
|
2889
|
+
data: null
|
|
2890
|
+
});
|
|
2891
|
+
case 8:
|
|
2892
|
+
_context28.prev = 8;
|
|
2893
|
+
_context28.next = 11;
|
|
2894
|
+
return this.order.upsertPendingSyncOrders([pendingOrder]);
|
|
2895
|
+
case 11:
|
|
2896
|
+
this.logWarning("".concat(title, ": \u540E\u7AEF\u672A\u660E\u786E\u62A5\u9519\uFF0C\u8BA2\u5355\u5DF2\u5199\u5165\u672C\u5730\u5F85\u540C\u6B65"), {
|
|
2897
|
+
backendPath: backendPath,
|
|
2898
|
+
reason: reason,
|
|
2899
|
+
order_id: pendingOrder.order_id,
|
|
2900
|
+
external_sale_number: pendingOrder.external_sale_number,
|
|
2901
|
+
order_number: pendingOrder.order_number
|
|
2902
|
+
});
|
|
2903
|
+
return _context28.abrupt("return", {
|
|
2904
|
+
code: 200,
|
|
2905
|
+
status: true,
|
|
2906
|
+
message: '',
|
|
2907
|
+
data: pendingOrder
|
|
2908
|
+
});
|
|
2909
|
+
case 15:
|
|
2910
|
+
_context28.prev = 15;
|
|
2911
|
+
_context28.t0 = _context28["catch"](8);
|
|
2912
|
+
errorMessage = _context28.t0 instanceof Error ? _context28.t0.message : String(_context28.t0);
|
|
2913
|
+
this.logError("".concat(title, ": \u5199\u5165\u672C\u5730\u5F85\u540C\u6B65\u8BA2\u5355\u5931\u8D25"), {
|
|
2914
|
+
backendPath: backendPath,
|
|
2915
|
+
reason: reason,
|
|
2916
|
+
error: errorMessage
|
|
2917
|
+
});
|
|
2918
|
+
return _context28.abrupt("return", {
|
|
2919
|
+
code: 500,
|
|
2920
|
+
status: false,
|
|
2921
|
+
message: errorMessage,
|
|
2922
|
+
data: null
|
|
2923
|
+
});
|
|
2924
|
+
case 20:
|
|
2925
|
+
case "end":
|
|
2926
|
+
return _context28.stop();
|
|
2927
|
+
}
|
|
2928
|
+
}, _callee28, this, [[8, 15]]);
|
|
2929
|
+
}));
|
|
2930
|
+
function handlePendingSyncCheckoutOrder(_x29) {
|
|
2931
|
+
return _handlePendingSyncCheckoutOrder.apply(this, arguments);
|
|
2932
|
+
}
|
|
2933
|
+
return handlePendingSyncCheckoutOrder;
|
|
2934
|
+
}()
|
|
2935
|
+
}, {
|
|
2936
|
+
key: "buildPendingSyncCheckoutOrder",
|
|
2937
|
+
value: function buildPendingSyncCheckoutOrder(data) {
|
|
2938
|
+
if (!data || _typeof(data) !== 'object') return null;
|
|
2939
|
+
var hasStorageKey = data.external_sale_number !== undefined && data.external_sale_number !== null && data.external_sale_number !== '' ? true : data.order_id !== undefined && data.order_id !== null && data.order_id !== '';
|
|
2940
|
+
if (!hasStorageKey) return null;
|
|
2941
|
+
return _objectSpread(_objectSpread({}, data), {}, {
|
|
2942
|
+
need_sync: 1
|
|
2943
|
+
});
|
|
2944
|
+
}
|
|
2849
2945
|
}, {
|
|
2850
2946
|
key: "parseOrderIdsParam",
|
|
2851
2947
|
value:
|
|
@@ -2903,22 +2999,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
2903
2999
|
}, {
|
|
2904
3000
|
key: "handleUpdateLocalOrdersBatch",
|
|
2905
3001
|
value: (function () {
|
|
2906
|
-
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3002
|
+
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(orderIds) {
|
|
2907
3003
|
var _this$app6;
|
|
2908
3004
|
var existedBefore, _iterator11, _step11, id, fetched, message, fetchedMap, _iterator12, _step12, order, oid, freshOrders, succeedIds, failed, _iterator13, _step13, _id, fresh, _message, overwritten, inserted;
|
|
2909
|
-
return _regeneratorRuntime().wrap(function
|
|
2910
|
-
while (1) switch (
|
|
3005
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3006
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2911
3007
|
case 0:
|
|
2912
3008
|
this.logInfo('handleUpdateLocalOrdersBatch: 开始处理', {
|
|
2913
3009
|
count: orderIds.length,
|
|
2914
3010
|
orderIds: orderIds
|
|
2915
3011
|
});
|
|
2916
3012
|
if (this.order) {
|
|
2917
|
-
|
|
3013
|
+
_context29.next = 4;
|
|
2918
3014
|
break;
|
|
2919
3015
|
}
|
|
2920
3016
|
this.logError('handleUpdateLocalOrdersBatch: Order 模块未注册');
|
|
2921
|
-
return
|
|
3017
|
+
return _context29.abrupt("return", {
|
|
2922
3018
|
code: 500,
|
|
2923
3019
|
status: false,
|
|
2924
3020
|
message: 'Order 模块未注册',
|
|
@@ -2926,11 +3022,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2926
3022
|
});
|
|
2927
3023
|
case 4:
|
|
2928
3024
|
if ((_this$app6 = this.app) !== null && _this$app6 !== void 0 && _this$app6.request) {
|
|
2929
|
-
|
|
3025
|
+
_context29.next = 7;
|
|
2930
3026
|
break;
|
|
2931
3027
|
}
|
|
2932
3028
|
this.logError('handleUpdateLocalOrdersBatch: app.request 不可用');
|
|
2933
|
-
return
|
|
3029
|
+
return _context29.abrupt("return", {
|
|
2934
3030
|
code: 500,
|
|
2935
3031
|
status: false,
|
|
2936
3032
|
message: 'app.request 不可用',
|
|
@@ -2953,21 +3049,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
2953
3049
|
_iterator11.f();
|
|
2954
3050
|
}
|
|
2955
3051
|
fetched = [];
|
|
2956
|
-
|
|
2957
|
-
|
|
3052
|
+
_context29.prev = 11;
|
|
3053
|
+
_context29.next = 14;
|
|
2958
3054
|
return this.order.fetchOrdersByHttp(orderIds);
|
|
2959
3055
|
case 14:
|
|
2960
|
-
fetched =
|
|
2961
|
-
|
|
3056
|
+
fetched = _context29.sent;
|
|
3057
|
+
_context29.next = 22;
|
|
2962
3058
|
break;
|
|
2963
3059
|
case 17:
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
message =
|
|
3060
|
+
_context29.prev = 17;
|
|
3061
|
+
_context29.t0 = _context29["catch"](11);
|
|
3062
|
+
message = _context29.t0 instanceof Error ? _context29.t0.message : String(_context29.t0);
|
|
2967
3063
|
this.logError('handleUpdateLocalOrdersBatch: 批量拉取失败', {
|
|
2968
3064
|
message: message
|
|
2969
3065
|
});
|
|
2970
|
-
return
|
|
3066
|
+
return _context29.abrupt("return", {
|
|
2971
3067
|
code: 500,
|
|
2972
3068
|
status: false,
|
|
2973
3069
|
message: message,
|
|
@@ -2977,36 +3073,36 @@ var Server = /*#__PURE__*/function () {
|
|
|
2977
3073
|
// 按返回结果中的 order_id 建索引,未命中即视为单笔失败
|
|
2978
3074
|
fetchedMap = new Map();
|
|
2979
3075
|
_iterator12 = _createForOfIteratorHelper(fetched);
|
|
2980
|
-
|
|
3076
|
+
_context29.prev = 24;
|
|
2981
3077
|
_iterator12.s();
|
|
2982
3078
|
case 26:
|
|
2983
3079
|
if ((_step12 = _iterator12.n()).done) {
|
|
2984
|
-
|
|
3080
|
+
_context29.next = 34;
|
|
2985
3081
|
break;
|
|
2986
3082
|
}
|
|
2987
3083
|
order = _step12.value;
|
|
2988
3084
|
oid = order === null || order === void 0 ? void 0 : order.order_id;
|
|
2989
3085
|
if (!(oid === undefined || oid === null)) {
|
|
2990
|
-
|
|
3086
|
+
_context29.next = 31;
|
|
2991
3087
|
break;
|
|
2992
3088
|
}
|
|
2993
|
-
return
|
|
3089
|
+
return _context29.abrupt("continue", 32);
|
|
2994
3090
|
case 31:
|
|
2995
3091
|
fetchedMap.set(String(oid), order);
|
|
2996
3092
|
case 32:
|
|
2997
|
-
|
|
3093
|
+
_context29.next = 26;
|
|
2998
3094
|
break;
|
|
2999
3095
|
case 34:
|
|
3000
|
-
|
|
3096
|
+
_context29.next = 39;
|
|
3001
3097
|
break;
|
|
3002
3098
|
case 36:
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
_iterator12.e(
|
|
3099
|
+
_context29.prev = 36;
|
|
3100
|
+
_context29.t1 = _context29["catch"](24);
|
|
3101
|
+
_iterator12.e(_context29.t1);
|
|
3006
3102
|
case 39:
|
|
3007
|
-
|
|
3103
|
+
_context29.prev = 39;
|
|
3008
3104
|
_iterator12.f();
|
|
3009
|
-
return
|
|
3105
|
+
return _context29.finish(39);
|
|
3010
3106
|
case 42:
|
|
3011
3107
|
freshOrders = [];
|
|
3012
3108
|
succeedIds = [];
|
|
@@ -3032,23 +3128,23 @@ var Server = /*#__PURE__*/function () {
|
|
|
3032
3128
|
_iterator13.f();
|
|
3033
3129
|
}
|
|
3034
3130
|
if (!(freshOrders.length > 0)) {
|
|
3035
|
-
|
|
3131
|
+
_context29.next = 58;
|
|
3036
3132
|
break;
|
|
3037
3133
|
}
|
|
3038
|
-
|
|
3039
|
-
|
|
3134
|
+
_context29.prev = 48;
|
|
3135
|
+
_context29.next = 51;
|
|
3040
3136
|
return this.order.upsertOrdersFromRemote(freshOrders);
|
|
3041
3137
|
case 51:
|
|
3042
|
-
|
|
3138
|
+
_context29.next = 58;
|
|
3043
3139
|
break;
|
|
3044
3140
|
case 53:
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
_message =
|
|
3141
|
+
_context29.prev = 53;
|
|
3142
|
+
_context29.t2 = _context29["catch"](48);
|
|
3143
|
+
_message = _context29.t2 instanceof Error ? _context29.t2.message : String(_context29.t2);
|
|
3048
3144
|
this.logError('handleUpdateLocalOrdersBatch: 合并写入失败', {
|
|
3049
3145
|
message: _message
|
|
3050
3146
|
});
|
|
3051
|
-
return
|
|
3147
|
+
return _context29.abrupt("return", {
|
|
3052
3148
|
code: 500,
|
|
3053
3149
|
status: false,
|
|
3054
3150
|
message: _message,
|
|
@@ -3067,7 +3163,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3067
3163
|
insertedCount: inserted.length,
|
|
3068
3164
|
failedCount: failed.length
|
|
3069
3165
|
});
|
|
3070
|
-
return
|
|
3166
|
+
return _context29.abrupt("return", {
|
|
3071
3167
|
code: 200,
|
|
3072
3168
|
status: true,
|
|
3073
3169
|
message: '',
|
|
@@ -3079,11 +3175,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3079
3175
|
});
|
|
3080
3176
|
case 62:
|
|
3081
3177
|
case "end":
|
|
3082
|
-
return
|
|
3178
|
+
return _context29.stop();
|
|
3083
3179
|
}
|
|
3084
|
-
},
|
|
3180
|
+
}, _callee29, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
|
|
3085
3181
|
}));
|
|
3086
|
-
function handleUpdateLocalOrdersBatch(
|
|
3182
|
+
function handleUpdateLocalOrdersBatch(_x30) {
|
|
3087
3183
|
return _handleUpdateLocalOrdersBatch.apply(this, arguments);
|
|
3088
3184
|
}
|
|
3089
3185
|
return handleUpdateLocalOrdersBatch;
|
|
@@ -3187,12 +3283,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
3187
3283
|
}, {
|
|
3188
3284
|
key: "extractBackendErrorResponse",
|
|
3189
3285
|
value: function extractBackendErrorResponse(error) {
|
|
3190
|
-
var _error$response,
|
|
3286
|
+
var _error$response,
|
|
3287
|
+
_error$response2,
|
|
3288
|
+
_this6 = this;
|
|
3191
3289
|
var candidates = [error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data, error === null || error === void 0 ? void 0 : error.data, error === null || error === void 0 || (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.body, error === null || error === void 0 ? void 0 : error.body];
|
|
3192
3290
|
return candidates.find(function (candidate) {
|
|
3193
|
-
return
|
|
3291
|
+
return _this6.isExplicitBackendErrorResponse(candidate);
|
|
3194
3292
|
}) || null;
|
|
3195
3293
|
}
|
|
3294
|
+
}, {
|
|
3295
|
+
key: "isExplicitBackendErrorResponse",
|
|
3296
|
+
value: function isExplicitBackendErrorResponse(candidate) {
|
|
3297
|
+
if (!candidate || _typeof(candidate) !== 'object') return false;
|
|
3298
|
+
return candidate.code !== undefined || candidate.status !== undefined || typeof candidate.message === 'string';
|
|
3299
|
+
}
|
|
3196
3300
|
|
|
3197
3301
|
/**
|
|
3198
3302
|
* 从 url 或路由 path 解析 pathname(不含 query,去掉末尾 /)
|
|
@@ -3303,16 +3407,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
3303
3407
|
}, {
|
|
3304
3408
|
key: "recomputeAndNotifyFloorPlanQuery",
|
|
3305
3409
|
value: (function () {
|
|
3306
|
-
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3410
|
+
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
3307
3411
|
var _iterator15, _step15, _step15$value, subscriberId, sub, result, errorMessage;
|
|
3308
|
-
return _regeneratorRuntime().wrap(function
|
|
3309
|
-
while (1) switch (
|
|
3412
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3413
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3310
3414
|
case 0:
|
|
3311
3415
|
if (!(this.floorPlanQuerySubscribers.size === 0)) {
|
|
3312
|
-
|
|
3416
|
+
_context30.next = 2;
|
|
3313
3417
|
break;
|
|
3314
3418
|
}
|
|
3315
|
-
return
|
|
3419
|
+
return _context30.abrupt("return");
|
|
3316
3420
|
case 2:
|
|
3317
3421
|
this.logInfo('recomputeAndNotifyFloorPlanQuery: 开始推送', {
|
|
3318
3422
|
subscriberCount: this.floorPlanQuerySubscribers.size
|
|
@@ -3342,9 +3446,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3342
3446
|
}
|
|
3343
3447
|
case 5:
|
|
3344
3448
|
case "end":
|
|
3345
|
-
return
|
|
3449
|
+
return _context30.stop();
|
|
3346
3450
|
}
|
|
3347
|
-
},
|
|
3451
|
+
}, _callee30, this);
|
|
3348
3452
|
}));
|
|
3349
3453
|
function recomputeAndNotifyFloorPlanQuery() {
|
|
3350
3454
|
return _recomputeAndNotifyFloorPlanQuery.apply(this, arguments);
|
|
@@ -3374,21 +3478,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
3374
3478
|
* filter 逻辑暂为 mock,仅记录参数
|
|
3375
3479
|
*/
|
|
3376
3480
|
function () {
|
|
3377
|
-
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3481
|
+
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(data) {
|
|
3378
3482
|
var rawList, result;
|
|
3379
|
-
return _regeneratorRuntime().wrap(function
|
|
3380
|
-
while (1) switch (
|
|
3483
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3484
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3381
3485
|
case 0:
|
|
3382
3486
|
this.logInfo('computeOrderQueryResult: 开始过滤', {
|
|
3383
3487
|
data: data
|
|
3384
3488
|
});
|
|
3385
3489
|
console.log('[Server] computeOrderQueryResult', data);
|
|
3386
3490
|
if (this.order) {
|
|
3387
|
-
|
|
3491
|
+
_context31.next = 5;
|
|
3388
3492
|
break;
|
|
3389
3493
|
}
|
|
3390
3494
|
this.logError('computeOrderQueryResult: Order 模块未注册');
|
|
3391
|
-
return
|
|
3495
|
+
return _context31.abrupt("return", {
|
|
3392
3496
|
code: 500,
|
|
3393
3497
|
message: 'Order 模块未注册',
|
|
3394
3498
|
data: {
|
|
@@ -3412,7 +3516,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3412
3516
|
skip: result.skip,
|
|
3413
3517
|
rejected: result.rejected
|
|
3414
3518
|
});
|
|
3415
|
-
return
|
|
3519
|
+
return _context31.abrupt("return", {
|
|
3416
3520
|
code: 200,
|
|
3417
3521
|
data: result,
|
|
3418
3522
|
message: '',
|
|
@@ -3420,11 +3524,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3420
3524
|
});
|
|
3421
3525
|
case 10:
|
|
3422
3526
|
case "end":
|
|
3423
|
-
return
|
|
3527
|
+
return _context31.stop();
|
|
3424
3528
|
}
|
|
3425
|
-
},
|
|
3529
|
+
}, _callee31, this);
|
|
3426
3530
|
}));
|
|
3427
|
-
function computeOrderQueryResult(
|
|
3531
|
+
function computeOrderQueryResult(_x31) {
|
|
3428
3532
|
return _computeOrderQueryResult.apply(this, arguments);
|
|
3429
3533
|
}
|
|
3430
3534
|
return computeOrderQueryResult;
|
|
@@ -3437,17 +3541,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
3437
3541
|
}, {
|
|
3438
3542
|
key: "computeBookingQueryResult",
|
|
3439
3543
|
value: (function () {
|
|
3440
|
-
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3544
|
+
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(data) {
|
|
3441
3545
|
var rawOrders, result;
|
|
3442
|
-
return _regeneratorRuntime().wrap(function
|
|
3443
|
-
while (1) switch (
|
|
3546
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3547
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3444
3548
|
case 0:
|
|
3445
3549
|
if (this.order) {
|
|
3446
|
-
|
|
3550
|
+
_context32.next = 3;
|
|
3447
3551
|
break;
|
|
3448
3552
|
}
|
|
3449
3553
|
this.logError('computeBookingQueryResult: Order 模块未注册');
|
|
3450
|
-
return
|
|
3554
|
+
return _context32.abrupt("return", {
|
|
3451
3555
|
code: 500,
|
|
3452
3556
|
message: 'Order 模块未注册',
|
|
3453
3557
|
data: {
|
|
@@ -3466,7 +3570,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3466
3570
|
size: result.size,
|
|
3467
3571
|
skip: result.skip
|
|
3468
3572
|
});
|
|
3469
|
-
return
|
|
3573
|
+
return _context32.abrupt("return", {
|
|
3470
3574
|
code: 200,
|
|
3471
3575
|
data: result,
|
|
3472
3576
|
message: '',
|
|
@@ -3474,11 +3578,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3474
3578
|
});
|
|
3475
3579
|
case 8:
|
|
3476
3580
|
case "end":
|
|
3477
|
-
return
|
|
3581
|
+
return _context32.stop();
|
|
3478
3582
|
}
|
|
3479
|
-
},
|
|
3583
|
+
}, _callee32, this);
|
|
3480
3584
|
}));
|
|
3481
|
-
function computeBookingQueryResult(
|
|
3585
|
+
function computeBookingQueryResult(_x32) {
|
|
3482
3586
|
return _computeBookingQueryResult.apply(this, arguments);
|
|
3483
3587
|
}
|
|
3484
3588
|
return computeBookingQueryResult;
|
|
@@ -3494,12 +3598,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
3494
3598
|
}, {
|
|
3495
3599
|
key: "computeProductQueryResult",
|
|
3496
3600
|
value: (function () {
|
|
3497
|
-
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3601
|
+
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(context, options) {
|
|
3498
3602
|
var _menu_list_ids$length3,
|
|
3499
|
-
|
|
3603
|
+
_this7 = this;
|
|
3500
3604
|
var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, product_id, queryIds, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, activeMenuList, tMenu, menuList, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tSort;
|
|
3501
|
-
return _regeneratorRuntime().wrap(function
|
|
3502
|
-
while (1) switch (
|
|
3605
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3606
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3503
3607
|
case 0:
|
|
3504
3608
|
tTotal = performance.now();
|
|
3505
3609
|
menu_list_ids = context.menu_list_ids, ids = context.ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime, customer_id = context.customer_id, product_id = context.product_id;
|
|
@@ -3518,11 +3622,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3518
3622
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3519
3623
|
});
|
|
3520
3624
|
if (this.products) {
|
|
3521
|
-
|
|
3625
|
+
_context33.next = 7;
|
|
3522
3626
|
break;
|
|
3523
3627
|
}
|
|
3524
3628
|
this.logError('computeProductQueryResult: Products 模块未注册');
|
|
3525
|
-
return
|
|
3629
|
+
return _context33.abrupt("return", {
|
|
3526
3630
|
message: 'Products 模块未注册',
|
|
3527
3631
|
data: {
|
|
3528
3632
|
list: [],
|
|
@@ -3531,12 +3635,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
3531
3635
|
});
|
|
3532
3636
|
case 7:
|
|
3533
3637
|
if (!(queryIds.length > 0)) {
|
|
3534
|
-
|
|
3638
|
+
_context33.next = 18;
|
|
3535
3639
|
break;
|
|
3536
3640
|
}
|
|
3537
3641
|
uniqueIds = Array.from(new Set(queryIds));
|
|
3538
3642
|
_tPrice = performance.now();
|
|
3539
|
-
|
|
3643
|
+
_context33.next = 12;
|
|
3540
3644
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
3541
3645
|
scheduleModule: this.getSchedule(),
|
|
3542
3646
|
schedule_datetime: schedule_datetime,
|
|
@@ -3546,7 +3650,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3546
3650
|
productIds: uniqueIds
|
|
3547
3651
|
});
|
|
3548
3652
|
case 12:
|
|
3549
|
-
productsWithPrice =
|
|
3653
|
+
productsWithPrice = _context33.sent;
|
|
3550
3654
|
perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
|
|
3551
3655
|
count: productsWithPrice.length,
|
|
3552
3656
|
ids: uniqueIds
|
|
@@ -3565,7 +3669,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3565
3669
|
ids: uniqueIds,
|
|
3566
3670
|
count: _filteredProducts.length
|
|
3567
3671
|
});
|
|
3568
|
-
return
|
|
3672
|
+
return _context33.abrupt("return", {
|
|
3569
3673
|
code: 200,
|
|
3570
3674
|
data: {
|
|
3571
3675
|
list: _filteredProducts,
|
|
@@ -3576,19 +3680,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
3576
3680
|
});
|
|
3577
3681
|
case 18:
|
|
3578
3682
|
if (!(product_id != null && Number.isFinite(Number(product_id)))) {
|
|
3579
|
-
|
|
3683
|
+
_context33.next = 30;
|
|
3580
3684
|
break;
|
|
3581
3685
|
}
|
|
3582
3686
|
pid = Number(product_id);
|
|
3583
3687
|
_tPrice2 = performance.now();
|
|
3584
|
-
|
|
3688
|
+
_context33.next = 23;
|
|
3585
3689
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
3586
3690
|
scheduleModule: this.getSchedule()
|
|
3587
3691
|
}, {
|
|
3588
3692
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3589
3693
|
});
|
|
3590
3694
|
case 23:
|
|
3591
|
-
allProductsWithPrice =
|
|
3695
|
+
allProductsWithPrice = _context33.sent;
|
|
3592
3696
|
perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
|
|
3593
3697
|
count: allProductsWithPrice.length,
|
|
3594
3698
|
productId: pid
|
|
@@ -3608,7 +3712,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3608
3712
|
productId: pid,
|
|
3609
3713
|
found: !!item
|
|
3610
3714
|
});
|
|
3611
|
-
return
|
|
3715
|
+
return _context33.abrupt("return", {
|
|
3612
3716
|
code: 200,
|
|
3613
3717
|
data: item,
|
|
3614
3718
|
message: item ? '' : '商品不存在或未发布',
|
|
@@ -3616,11 +3720,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3616
3720
|
});
|
|
3617
3721
|
case 30:
|
|
3618
3722
|
if (this.menu) {
|
|
3619
|
-
|
|
3723
|
+
_context33.next = 33;
|
|
3620
3724
|
break;
|
|
3621
3725
|
}
|
|
3622
3726
|
this.logError('computeProductQueryResult: Menu 模块未注册');
|
|
3623
|
-
return
|
|
3727
|
+
return _context33.abrupt("return", {
|
|
3624
3728
|
message: 'Menu 模块未注册',
|
|
3625
3729
|
data: {
|
|
3626
3730
|
list: [],
|
|
@@ -3629,11 +3733,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3629
3733
|
});
|
|
3630
3734
|
case 33:
|
|
3631
3735
|
if (this.schedule) {
|
|
3632
|
-
|
|
3736
|
+
_context33.next = 36;
|
|
3633
3737
|
break;
|
|
3634
3738
|
}
|
|
3635
3739
|
this.logError('computeProductQueryResult: Schedule 模块未注册');
|
|
3636
|
-
return
|
|
3740
|
+
return _context33.abrupt("return", {
|
|
3637
3741
|
message: 'Schedule 模块未注册',
|
|
3638
3742
|
data: {
|
|
3639
3743
|
list: [],
|
|
@@ -3646,8 +3750,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
3646
3750
|
tMenu = performance.now();
|
|
3647
3751
|
menuList = this.menu.getMenuByIds(menu_list_ids);
|
|
3648
3752
|
activeMenuList = menuList.filter(function (menu) {
|
|
3649
|
-
var
|
|
3650
|
-
return ((
|
|
3753
|
+
var _this7$schedule;
|
|
3754
|
+
return ((_this7$schedule = _this7.schedule) === null || _this7$schedule === void 0 ? void 0 : _this7$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
|
|
3651
3755
|
});
|
|
3652
3756
|
perfMark('computeQuery.filterActiveMenu', performance.now() - tMenu, {
|
|
3653
3757
|
totalMenu: menuList.length,
|
|
@@ -3664,10 +3768,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3664
3768
|
});
|
|
3665
3769
|
tPrice = performance.now();
|
|
3666
3770
|
if (!(scopedProductIds.length > 0)) {
|
|
3667
|
-
|
|
3771
|
+
_context33.next = 49;
|
|
3668
3772
|
break;
|
|
3669
3773
|
}
|
|
3670
|
-
|
|
3774
|
+
_context33.next = 46;
|
|
3671
3775
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
3672
3776
|
scheduleModule: this.getSchedule(),
|
|
3673
3777
|
schedule_datetime: schedule_datetime,
|
|
@@ -3677,13 +3781,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
3677
3781
|
productIds: productScope.isAllProducts ? undefined : scopedProductIds
|
|
3678
3782
|
});
|
|
3679
3783
|
case 46:
|
|
3680
|
-
|
|
3681
|
-
|
|
3784
|
+
_context33.t0 = _context33.sent;
|
|
3785
|
+
_context33.next = 50;
|
|
3682
3786
|
break;
|
|
3683
3787
|
case 49:
|
|
3684
|
-
|
|
3788
|
+
_context33.t0 = [];
|
|
3685
3789
|
case 50:
|
|
3686
|
-
filteredProducts =
|
|
3790
|
+
filteredProducts = _context33.t0;
|
|
3687
3791
|
perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
|
|
3688
3792
|
count: filteredProducts.length,
|
|
3689
3793
|
scopedProductCount: scopedProductIds.length
|
|
@@ -3716,7 +3820,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3716
3820
|
filteredCount: filteredProducts.length,
|
|
3717
3821
|
activeMenuCount: activeMenuList.length
|
|
3718
3822
|
});
|
|
3719
|
-
return
|
|
3823
|
+
return _context33.abrupt("return", {
|
|
3720
3824
|
code: 200,
|
|
3721
3825
|
data: {
|
|
3722
3826
|
list: filteredProducts,
|
|
@@ -3727,11 +3831,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3727
3831
|
});
|
|
3728
3832
|
case 62:
|
|
3729
3833
|
case "end":
|
|
3730
|
-
return
|
|
3834
|
+
return _context33.stop();
|
|
3731
3835
|
}
|
|
3732
|
-
},
|
|
3836
|
+
}, _callee33, this);
|
|
3733
3837
|
}));
|
|
3734
|
-
function computeProductQueryResult(
|
|
3838
|
+
function computeProductQueryResult(_x33, _x34) {
|
|
3735
3839
|
return _computeProductQueryResult.apply(this, arguments);
|
|
3736
3840
|
}
|
|
3737
3841
|
return computeProductQueryResult;
|
|
@@ -3746,72 +3850,72 @@ var Server = /*#__PURE__*/function () {
|
|
|
3746
3850
|
}, {
|
|
3747
3851
|
key: "recomputeAndNotifyProductQuery",
|
|
3748
3852
|
value: (function () {
|
|
3749
|
-
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3853
|
+
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(options) {
|
|
3750
3854
|
var _iterator16, _step16, _step16$value, subscriberId, subscriber, result, errorMessage;
|
|
3751
|
-
return _regeneratorRuntime().wrap(function
|
|
3752
|
-
while (1) switch (
|
|
3855
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3856
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3753
3857
|
case 0:
|
|
3754
3858
|
if (!(this.productQuerySubscribers.size === 0)) {
|
|
3755
|
-
|
|
3859
|
+
_context34.next = 2;
|
|
3756
3860
|
break;
|
|
3757
3861
|
}
|
|
3758
|
-
return
|
|
3862
|
+
return _context34.abrupt("return");
|
|
3759
3863
|
case 2:
|
|
3760
3864
|
this.logInfo('recomputeAndNotifyProductQuery: 开始推送', {
|
|
3761
3865
|
subscriberCount: this.productQuerySubscribers.size,
|
|
3762
3866
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3763
3867
|
});
|
|
3764
3868
|
_iterator16 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
|
|
3765
|
-
|
|
3869
|
+
_context34.prev = 4;
|
|
3766
3870
|
_iterator16.s();
|
|
3767
3871
|
case 6:
|
|
3768
3872
|
if ((_step16 = _iterator16.n()).done) {
|
|
3769
|
-
|
|
3873
|
+
_context34.next = 22;
|
|
3770
3874
|
break;
|
|
3771
3875
|
}
|
|
3772
3876
|
_step16$value = _slicedToArray(_step16.value, 2), subscriberId = _step16$value[0], subscriber = _step16$value[1];
|
|
3773
|
-
|
|
3774
|
-
|
|
3877
|
+
_context34.prev = 8;
|
|
3878
|
+
_context34.next = 11;
|
|
3775
3879
|
return this.computeProductQueryResult(subscriber.context, {
|
|
3776
3880
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3777
3881
|
});
|
|
3778
3882
|
case 11:
|
|
3779
|
-
result =
|
|
3883
|
+
result = _context34.sent;
|
|
3780
3884
|
subscriber.callback(result);
|
|
3781
3885
|
this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
|
|
3782
3886
|
subscriberId: subscriberId
|
|
3783
3887
|
});
|
|
3784
|
-
|
|
3888
|
+
_context34.next = 20;
|
|
3785
3889
|
break;
|
|
3786
3890
|
case 16:
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
errorMessage =
|
|
3891
|
+
_context34.prev = 16;
|
|
3892
|
+
_context34.t0 = _context34["catch"](8);
|
|
3893
|
+
errorMessage = _context34.t0 instanceof Error ? _context34.t0.message : String(_context34.t0);
|
|
3790
3894
|
this.logError('recomputeAndNotifyProductQuery: 推送失败', {
|
|
3791
3895
|
subscriberId: subscriberId,
|
|
3792
3896
|
error: errorMessage
|
|
3793
3897
|
});
|
|
3794
3898
|
case 20:
|
|
3795
|
-
|
|
3899
|
+
_context34.next = 6;
|
|
3796
3900
|
break;
|
|
3797
3901
|
case 22:
|
|
3798
|
-
|
|
3902
|
+
_context34.next = 27;
|
|
3799
3903
|
break;
|
|
3800
3904
|
case 24:
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
_iterator16.e(
|
|
3905
|
+
_context34.prev = 24;
|
|
3906
|
+
_context34.t1 = _context34["catch"](4);
|
|
3907
|
+
_iterator16.e(_context34.t1);
|
|
3804
3908
|
case 27:
|
|
3805
|
-
|
|
3909
|
+
_context34.prev = 27;
|
|
3806
3910
|
_iterator16.f();
|
|
3807
|
-
return
|
|
3911
|
+
return _context34.finish(27);
|
|
3808
3912
|
case 30:
|
|
3809
3913
|
case "end":
|
|
3810
|
-
return
|
|
3914
|
+
return _context34.stop();
|
|
3811
3915
|
}
|
|
3812
|
-
},
|
|
3916
|
+
}, _callee34, this, [[4, 24, 27, 30], [8, 16]]);
|
|
3813
3917
|
}));
|
|
3814
|
-
function recomputeAndNotifyProductQuery(
|
|
3918
|
+
function recomputeAndNotifyProductQuery(_x35) {
|
|
3815
3919
|
return _recomputeAndNotifyProductQuery.apply(this, arguments);
|
|
3816
3920
|
}
|
|
3817
3921
|
return recomputeAndNotifyProductQuery;
|
|
@@ -3823,16 +3927,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
3823
3927
|
}, {
|
|
3824
3928
|
key: "recomputeAndNotifyOrderQuery",
|
|
3825
3929
|
value: (function () {
|
|
3826
|
-
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3930
|
+
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
3827
3931
|
var notifyStartAt, _iterator17, _step17, _step17$value, subscriberId, subscriber, computeStartAt, result, computeEndAt, callbackStartAt, callbackEndAt, errorMessage, notifyEndAt;
|
|
3828
|
-
return _regeneratorRuntime().wrap(function
|
|
3829
|
-
while (1) switch (
|
|
3932
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3933
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3830
3934
|
case 0:
|
|
3831
3935
|
if (!(this.orderQuerySubscribers.size === 0)) {
|
|
3832
|
-
|
|
3936
|
+
_context35.next = 2;
|
|
3833
3937
|
break;
|
|
3834
3938
|
}
|
|
3835
|
-
return
|
|
3939
|
+
return _context35.abrupt("return");
|
|
3836
3940
|
case 2:
|
|
3837
3941
|
notifyStartAt = Date.now();
|
|
3838
3942
|
this.logInfo('recomputeAndNotifyOrderQuery: 开始推送', {
|
|
@@ -3840,20 +3944,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
3840
3944
|
notifyStartAt: new Date(notifyStartAt).toISOString()
|
|
3841
3945
|
});
|
|
3842
3946
|
_iterator17 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
|
|
3843
|
-
|
|
3947
|
+
_context35.prev = 5;
|
|
3844
3948
|
_iterator17.s();
|
|
3845
3949
|
case 7:
|
|
3846
3950
|
if ((_step17 = _iterator17.n()).done) {
|
|
3847
|
-
|
|
3951
|
+
_context35.next = 27;
|
|
3848
3952
|
break;
|
|
3849
3953
|
}
|
|
3850
3954
|
_step17$value = _slicedToArray(_step17.value, 2), subscriberId = _step17$value[0], subscriber = _step17$value[1];
|
|
3851
|
-
|
|
3955
|
+
_context35.prev = 9;
|
|
3852
3956
|
computeStartAt = Date.now();
|
|
3853
|
-
|
|
3957
|
+
_context35.next = 13;
|
|
3854
3958
|
return this.computeOrderQueryResult(subscriber.context);
|
|
3855
3959
|
case 13:
|
|
3856
|
-
result =
|
|
3960
|
+
result = _context35.sent;
|
|
3857
3961
|
computeEndAt = Date.now();
|
|
3858
3962
|
callbackStartAt = Date.now();
|
|
3859
3963
|
subscriber.callback(result);
|
|
@@ -3864,30 +3968,30 @@ var Server = /*#__PURE__*/function () {
|
|
|
3864
3968
|
callbackDurationMs: callbackEndAt - callbackStartAt,
|
|
3865
3969
|
totalDurationMs: callbackEndAt - computeStartAt
|
|
3866
3970
|
});
|
|
3867
|
-
|
|
3971
|
+
_context35.next = 25;
|
|
3868
3972
|
break;
|
|
3869
3973
|
case 21:
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
errorMessage =
|
|
3974
|
+
_context35.prev = 21;
|
|
3975
|
+
_context35.t0 = _context35["catch"](9);
|
|
3976
|
+
errorMessage = _context35.t0 instanceof Error ? _context35.t0.message : String(_context35.t0);
|
|
3873
3977
|
this.logError('recomputeAndNotifyOrderQuery: 推送失败', {
|
|
3874
3978
|
subscriberId: subscriberId,
|
|
3875
3979
|
error: errorMessage
|
|
3876
3980
|
});
|
|
3877
3981
|
case 25:
|
|
3878
|
-
|
|
3982
|
+
_context35.next = 7;
|
|
3879
3983
|
break;
|
|
3880
3984
|
case 27:
|
|
3881
|
-
|
|
3985
|
+
_context35.next = 32;
|
|
3882
3986
|
break;
|
|
3883
3987
|
case 29:
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
_iterator17.e(
|
|
3988
|
+
_context35.prev = 29;
|
|
3989
|
+
_context35.t1 = _context35["catch"](5);
|
|
3990
|
+
_iterator17.e(_context35.t1);
|
|
3887
3991
|
case 32:
|
|
3888
|
-
|
|
3992
|
+
_context35.prev = 32;
|
|
3889
3993
|
_iterator17.f();
|
|
3890
|
-
return
|
|
3994
|
+
return _context35.finish(32);
|
|
3891
3995
|
case 35:
|
|
3892
3996
|
notifyEndAt = Date.now();
|
|
3893
3997
|
this.logInfo('recomputeAndNotifyOrderQuery: 推送完成', {
|
|
@@ -3896,9 +4000,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3896
4000
|
});
|
|
3897
4001
|
case 37:
|
|
3898
4002
|
case "end":
|
|
3899
|
-
return
|
|
4003
|
+
return _context35.stop();
|
|
3900
4004
|
}
|
|
3901
|
-
},
|
|
4005
|
+
}, _callee35, this, [[5, 29, 32, 35], [9, 21]]);
|
|
3902
4006
|
}));
|
|
3903
4007
|
function recomputeAndNotifyOrderQuery() {
|
|
3904
4008
|
return _recomputeAndNotifyOrderQuery.apply(this, arguments);
|
|
@@ -3912,67 +4016,67 @@ var Server = /*#__PURE__*/function () {
|
|
|
3912
4016
|
}, {
|
|
3913
4017
|
key: "recomputeAndNotifyBookingQuery",
|
|
3914
4018
|
value: (function () {
|
|
3915
|
-
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4019
|
+
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
3916
4020
|
var _iterator18, _step18, _step18$value, subscriberId, subscriber, result, errorMessage;
|
|
3917
|
-
return _regeneratorRuntime().wrap(function
|
|
3918
|
-
while (1) switch (
|
|
4021
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
4022
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3919
4023
|
case 0:
|
|
3920
4024
|
if (!(this.bookingQuerySubscribers.size === 0)) {
|
|
3921
|
-
|
|
4025
|
+
_context36.next = 2;
|
|
3922
4026
|
break;
|
|
3923
4027
|
}
|
|
3924
|
-
return
|
|
4028
|
+
return _context36.abrupt("return");
|
|
3925
4029
|
case 2:
|
|
3926
4030
|
this.logInfo('recomputeAndNotifyBookingQuery: 开始推送', {
|
|
3927
4031
|
subscriberCount: this.bookingQuerySubscribers.size
|
|
3928
4032
|
});
|
|
3929
4033
|
_iterator18 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
|
|
3930
|
-
|
|
4034
|
+
_context36.prev = 4;
|
|
3931
4035
|
_iterator18.s();
|
|
3932
4036
|
case 6:
|
|
3933
4037
|
if ((_step18 = _iterator18.n()).done) {
|
|
3934
|
-
|
|
4038
|
+
_context36.next = 22;
|
|
3935
4039
|
break;
|
|
3936
4040
|
}
|
|
3937
4041
|
_step18$value = _slicedToArray(_step18.value, 2), subscriberId = _step18$value[0], subscriber = _step18$value[1];
|
|
3938
|
-
|
|
3939
|
-
|
|
4042
|
+
_context36.prev = 8;
|
|
4043
|
+
_context36.next = 11;
|
|
3940
4044
|
return this.computeBookingQueryResult(subscriber.context);
|
|
3941
4045
|
case 11:
|
|
3942
|
-
result =
|
|
4046
|
+
result = _context36.sent;
|
|
3943
4047
|
subscriber.callback(result);
|
|
3944
4048
|
this.logInfo('recomputeAndNotifyBookingQuery: 已推送', {
|
|
3945
4049
|
subscriberId: subscriberId
|
|
3946
4050
|
});
|
|
3947
|
-
|
|
4051
|
+
_context36.next = 20;
|
|
3948
4052
|
break;
|
|
3949
4053
|
case 16:
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
errorMessage =
|
|
4054
|
+
_context36.prev = 16;
|
|
4055
|
+
_context36.t0 = _context36["catch"](8);
|
|
4056
|
+
errorMessage = _context36.t0 instanceof Error ? _context36.t0.message : String(_context36.t0);
|
|
3953
4057
|
this.logError('recomputeAndNotifyBookingQuery: 推送失败', {
|
|
3954
4058
|
subscriberId: subscriberId,
|
|
3955
4059
|
error: errorMessage
|
|
3956
4060
|
});
|
|
3957
4061
|
case 20:
|
|
3958
|
-
|
|
4062
|
+
_context36.next = 6;
|
|
3959
4063
|
break;
|
|
3960
4064
|
case 22:
|
|
3961
|
-
|
|
4065
|
+
_context36.next = 27;
|
|
3962
4066
|
break;
|
|
3963
4067
|
case 24:
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
_iterator18.e(
|
|
4068
|
+
_context36.prev = 24;
|
|
4069
|
+
_context36.t1 = _context36["catch"](4);
|
|
4070
|
+
_iterator18.e(_context36.t1);
|
|
3967
4071
|
case 27:
|
|
3968
|
-
|
|
4072
|
+
_context36.prev = 27;
|
|
3969
4073
|
_iterator18.f();
|
|
3970
|
-
return
|
|
4074
|
+
return _context36.finish(27);
|
|
3971
4075
|
case 30:
|
|
3972
4076
|
case "end":
|
|
3973
|
-
return
|
|
4077
|
+
return _context36.stop();
|
|
3974
4078
|
}
|
|
3975
|
-
},
|
|
4079
|
+
}, _callee36, this, [[4, 24, 27, 30], [8, 16]]);
|
|
3976
4080
|
}));
|
|
3977
4081
|
function recomputeAndNotifyBookingQuery() {
|
|
3978
4082
|
return _recomputeAndNotifyBookingQuery.apply(this, arguments);
|