@pisell/pisellos 2.2.232 → 2.2.234
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Order/index.d.ts +36 -1
- package/dist/modules/Order/index.js +496 -308
- package/dist/modules/Order/types.d.ts +11 -0
- package/dist/modules/Order/utils.d.ts +1 -0
- package/dist/modules/Order/utils.js +1 -1
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js +855 -633
- package/dist/server/modules/order/index.d.ts +2 -0
- package/dist/server/modules/order/index.js +86 -32
- package/dist/solution/BaseSales/index.d.ts +6 -0
- package/dist/solution/BaseSales/index.js +240 -197
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +38 -2
- package/dist/solution/BookingTicket/index.js +653 -323
- package/dist/solution/BookingTicket/types.d.ts +62 -0
- package/dist/solution/BookingTicket/types.js +30 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +9 -1
- package/dist/solution/BookingTicket/utils/cartView.js +76 -5
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +9 -13
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +42 -33
- package/lib/modules/Order/index.d.ts +36 -1
- package/lib/modules/Order/index.js +98 -10
- package/lib/modules/Order/types.d.ts +11 -0
- package/lib/modules/Order/utils.d.ts +1 -0
- package/lib/modules/Order/utils.js +1 -1
- package/lib/server/index.d.ts +5 -0
- package/lib/server/index.js +224 -63
- package/lib/server/modules/order/index.d.ts +2 -0
- package/lib/server/modules/order/index.js +43 -1
- package/lib/solution/BaseSales/index.d.ts +6 -0
- package/lib/solution/BaseSales/index.js +20 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +38 -2
- package/lib/solution/BookingTicket/index.js +196 -4
- package/lib/solution/BookingTicket/types.d.ts +62 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
- package/lib/solution/BookingTicket/utils/cartView.d.ts +9 -1
- package/lib/solution/BookingTicket/utils/cartView.js +48 -2
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +9 -13
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +41 -28
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -2003,7 +2003,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2003
2003
|
value: function () {
|
|
2004
2004
|
var _handleSyncSalesTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(ctx) {
|
|
2005
2005
|
var _ctx$task, _this$app4;
|
|
2006
|
-
var payload, backendPath, data, title,
|
|
2006
|
+
var payload, backendPath, data, title, _ctx$task2, _syncResult$syncedOrd, syncResult, backendError, message, errorMessage;
|
|
2007
2007
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2008
2008
|
while (1) switch (_context26.prev = _context26.next) {
|
|
2009
2009
|
case 0:
|
|
@@ -2026,58 +2026,218 @@ var Server = /*#__PURE__*/function () {
|
|
|
2026
2026
|
case 9:
|
|
2027
2027
|
_context26.prev = 9;
|
|
2028
2028
|
_context26.next = 12;
|
|
2029
|
-
return this.
|
|
2029
|
+
return this.runCheckoutSync({
|
|
2030
|
+
backendPath: backendPath,
|
|
2031
|
+
data: data,
|
|
2032
|
+
title: title,
|
|
2033
|
+
externalSaleNumber: payload.external_sale_number,
|
|
2034
|
+
deviceId: (_ctx$task2 = ctx.task) === null || _ctx$task2 === void 0 ? void 0 : _ctx$task2.device_id,
|
|
2035
|
+
persistCheckoutDataWithResponse: false
|
|
2036
|
+
});
|
|
2037
|
+
case 12:
|
|
2038
|
+
syncResult = _context26.sent;
|
|
2039
|
+
if (!syncResult.rejected) {
|
|
2040
|
+
_context26.next = 16;
|
|
2041
|
+
break;
|
|
2042
|
+
}
|
|
2043
|
+
this.logError("".concat(title, ": sync_sales \u540E\u7AEF\u660E\u786E\u5931\u8D25"), {
|
|
2044
|
+
backendPath: backendPath,
|
|
2045
|
+
response: syncResult.errorResponse
|
|
2046
|
+
});
|
|
2047
|
+
return _context26.abrupt("return", this.taskFail('BACKEND_REJECTED', syncResult.message || '后端明确拒绝 checkout', syncResult.errorResponse));
|
|
2048
|
+
case 16:
|
|
2049
|
+
return _context26.abrupt("return", this.taskOk({
|
|
2050
|
+
order: (_syncResult$syncedOrd = syncResult.syncedOrder) !== null && _syncResult$syncedOrd !== void 0 ? _syncResult$syncedOrd : null,
|
|
2051
|
+
response: syncResult.normalizedResponse
|
|
2052
|
+
}));
|
|
2053
|
+
case 19:
|
|
2054
|
+
_context26.prev = 19;
|
|
2055
|
+
_context26.t0 = _context26["catch"](9);
|
|
2056
|
+
backendError = this.extractBackendErrorResponse(_context26.t0);
|
|
2057
|
+
if (!backendError) {
|
|
2058
|
+
_context26.next = 26;
|
|
2059
|
+
break;
|
|
2060
|
+
}
|
|
2061
|
+
message = (backendError === null || backendError === void 0 ? void 0 : backendError.message) || '后端明确拒绝 checkout';
|
|
2062
|
+
this.logError("".concat(title, ": sync_sales \u540E\u7AEF\u660E\u786E\u5931\u8D25"), {
|
|
2063
|
+
backendPath: backendPath,
|
|
2064
|
+
backendError: backendError
|
|
2065
|
+
});
|
|
2066
|
+
return _context26.abrupt("return", this.taskFail('BACKEND_REJECTED', message, backendError));
|
|
2067
|
+
case 26:
|
|
2068
|
+
errorMessage = this.getUnknownErrorMessage(_context26.t0);
|
|
2069
|
+
this.logError("".concat(title, ": sync_sales \u8BF7\u6C42\u672A\u660E\u786E\u6210\u529F"), {
|
|
2070
|
+
backendPath: backendPath,
|
|
2071
|
+
error: errorMessage,
|
|
2072
|
+
error_detail: this.normalizeUnknownError(_context26.t0)
|
|
2073
|
+
});
|
|
2074
|
+
return _context26.abrupt("return", this.taskTimeout(errorMessage));
|
|
2075
|
+
case 29:
|
|
2076
|
+
case "end":
|
|
2077
|
+
return _context26.stop();
|
|
2078
|
+
}
|
|
2079
|
+
}, _callee26, this, [[9, 19]]);
|
|
2080
|
+
}));
|
|
2081
|
+
function handleSyncSalesTask(_x29) {
|
|
2082
|
+
return _handleSyncSalesTask.apply(this, arguments);
|
|
2083
|
+
}
|
|
2084
|
+
return handleSyncSalesTask;
|
|
2085
|
+
}()
|
|
2086
|
+
}, {
|
|
2087
|
+
key: "runCheckoutSync",
|
|
2088
|
+
value: function () {
|
|
2089
|
+
var _runCheckoutSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
2090
|
+
var _this$app5;
|
|
2091
|
+
var backendPath, title, normalizedData, checkoutData, remoteCheckoutData, response, fresh, externalSaleNumber, syncedOrder, printableSyncedOrder;
|
|
2092
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2093
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2094
|
+
case 0:
|
|
2095
|
+
backendPath = params.backendPath, title = params.title;
|
|
2096
|
+
_context27.next = 3;
|
|
2097
|
+
return this.normalizeCheckoutSubmitData(params.data, title);
|
|
2098
|
+
case 3:
|
|
2099
|
+
normalizedData = _context27.sent;
|
|
2100
|
+
_context27.next = 6;
|
|
2101
|
+
return this.ensureCheckoutOrderNumbers(normalizedData, title);
|
|
2102
|
+
case 6:
|
|
2103
|
+
checkoutData = _context27.sent;
|
|
2104
|
+
remoteCheckoutData = this.omitCheckoutSyncMode(checkoutData);
|
|
2105
|
+
if ((_this$app5 = this.app) !== null && _this$app5 !== void 0 && (_this$app5 = _this$app5.request) !== null && _this$app5 !== void 0 && _this$app5.post) {
|
|
2106
|
+
_context27.next = 10;
|
|
2107
|
+
break;
|
|
2108
|
+
}
|
|
2109
|
+
throw new Error('app.request 不可用');
|
|
2110
|
+
case 10:
|
|
2111
|
+
_context27.next = 12;
|
|
2112
|
+
return this.app.request.post(backendPath, remoteCheckoutData, {
|
|
2030
2113
|
isShopApi: true,
|
|
2031
2114
|
customToast: function customToast() {}
|
|
2032
2115
|
});
|
|
2033
2116
|
case 12:
|
|
2034
|
-
response =
|
|
2117
|
+
response = _context27.sent;
|
|
2035
2118
|
if (!this.isCheckoutResponseRejected(response)) {
|
|
2036
|
-
|
|
2119
|
+
_context27.next = 15;
|
|
2037
2120
|
break;
|
|
2038
2121
|
}
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2122
|
+
return _context27.abrupt("return", {
|
|
2123
|
+
rejected: true,
|
|
2124
|
+
message: (response === null || response === void 0 ? void 0 : response.message) || '后端明确拒绝 checkout',
|
|
2125
|
+
errorResponse: response,
|
|
2126
|
+
response: response,
|
|
2127
|
+
normalizedResponse: this.normalizeCheckoutResponse(response),
|
|
2128
|
+
checkoutData: remoteCheckoutData
|
|
2043
2129
|
});
|
|
2044
|
-
|
|
2045
|
-
case 17:
|
|
2130
|
+
case 15:
|
|
2046
2131
|
fresh = this.extractOrderDataFromCheckoutResponse(response);
|
|
2047
|
-
externalSaleNumber = this.getCheckoutExternalSaleNumber(
|
|
2132
|
+
externalSaleNumber = this.getCheckoutExternalSaleNumber(remoteCheckoutData, {
|
|
2133
|
+
external_sale_number: params.externalSaleNumber,
|
|
2134
|
+
data: remoteCheckoutData
|
|
2135
|
+
});
|
|
2136
|
+
_context27.next = 19;
|
|
2137
|
+
return this.persistSyncedCheckoutOrder({
|
|
2138
|
+
backendPath: backendPath,
|
|
2139
|
+
checkoutData: remoteCheckoutData,
|
|
2140
|
+
externalSaleNumber: externalSaleNumber,
|
|
2141
|
+
fresh: fresh,
|
|
2142
|
+
title: title,
|
|
2143
|
+
persistCheckoutDataWithResponse: params.persistCheckoutDataWithResponse === true
|
|
2144
|
+
});
|
|
2145
|
+
case 19:
|
|
2146
|
+
syncedOrder = _context27.sent;
|
|
2147
|
+
printableSyncedOrder = syncedOrder ? this.buildSyncedOrderForPrint({
|
|
2148
|
+
syncedOrder: syncedOrder,
|
|
2149
|
+
checkoutResponseOrder: fresh
|
|
2150
|
+
}) : undefined;
|
|
2151
|
+
if (!(printableSyncedOrder && this.shouldPrintSyncedOrder({
|
|
2152
|
+
checkoutData: remoteCheckoutData,
|
|
2153
|
+
syncedOrder: printableSyncedOrder
|
|
2154
|
+
}))) {
|
|
2155
|
+
_context27.next = 24;
|
|
2156
|
+
break;
|
|
2157
|
+
}
|
|
2158
|
+
_context27.next = 24;
|
|
2159
|
+
return this.dispatchPrintOtherReceiptTask({
|
|
2160
|
+
checkoutData: remoteCheckoutData,
|
|
2161
|
+
syncedOrder: printableSyncedOrder,
|
|
2162
|
+
response: response,
|
|
2163
|
+
deviceId: params.deviceId
|
|
2164
|
+
});
|
|
2165
|
+
case 24:
|
|
2166
|
+
return _context27.abrupt("return", {
|
|
2167
|
+
rejected: false,
|
|
2168
|
+
response: response,
|
|
2169
|
+
normalizedResponse: this.normalizeCheckoutResponse(response),
|
|
2170
|
+
checkoutData: remoteCheckoutData,
|
|
2171
|
+
syncedOrder: syncedOrder,
|
|
2172
|
+
fresh: fresh
|
|
2173
|
+
});
|
|
2174
|
+
case 25:
|
|
2175
|
+
case "end":
|
|
2176
|
+
return _context27.stop();
|
|
2177
|
+
}
|
|
2178
|
+
}, _callee27, this);
|
|
2179
|
+
}));
|
|
2180
|
+
function runCheckoutSync(_x30) {
|
|
2181
|
+
return _runCheckoutSync.apply(this, arguments);
|
|
2182
|
+
}
|
|
2183
|
+
return runCheckoutSync;
|
|
2184
|
+
}()
|
|
2185
|
+
}, {
|
|
2186
|
+
key: "omitCheckoutSyncMode",
|
|
2187
|
+
value: function omitCheckoutSyncMode(data) {
|
|
2188
|
+
if (!data || _typeof(data) !== 'object') return data;
|
|
2189
|
+
var next = _objectSpread({}, data);
|
|
2190
|
+
delete next.sync_mode;
|
|
2191
|
+
delete next.syncMode;
|
|
2192
|
+
return next;
|
|
2193
|
+
}
|
|
2194
|
+
}, {
|
|
2195
|
+
key: "persistSyncedCheckoutOrder",
|
|
2196
|
+
value: function () {
|
|
2197
|
+
var _persistSyncedCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2198
|
+
var backendPath, checkoutData, externalSaleNumber, fresh, title, persistCheckoutDataWithResponse, shouldMergeRemoteOrder, syncedOrder, _external_sale_number2, _external_sale_number3, _syncedOrder$order_id, _syncedOrder, patch, result;
|
|
2199
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2200
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2201
|
+
case 0:
|
|
2202
|
+
backendPath = params.backendPath, checkoutData = params.checkoutData, externalSaleNumber = params.externalSaleNumber, fresh = params.fresh, title = params.title, persistCheckoutDataWithResponse = params.persistCheckoutDataWithResponse;
|
|
2048
2203
|
shouldMergeRemoteOrder = fresh ? this.isMergeableCheckoutOrder(fresh, externalSaleNumber) : false;
|
|
2049
|
-
if (!(this.order && fresh && shouldMergeRemoteOrder)) {
|
|
2050
|
-
|
|
2204
|
+
if (!(this.order && fresh && (shouldMergeRemoteOrder || persistCheckoutDataWithResponse))) {
|
|
2205
|
+
_context28.next = 9;
|
|
2051
2206
|
break;
|
|
2052
2207
|
}
|
|
2053
|
-
syncedOrder = _objectSpread(_objectSpread({}, fresh), {}, {
|
|
2208
|
+
syncedOrder = persistCheckoutDataWithResponse ? _objectSpread(_objectSpread(_objectSpread({}, checkoutData), fresh), {}, {
|
|
2054
2209
|
external_sale_number: (_external_sale_number2 = fresh.external_sale_number) !== null && _external_sale_number2 !== void 0 ? _external_sale_number2 : externalSaleNumber,
|
|
2055
2210
|
need_sync: 0
|
|
2211
|
+
}) : _objectSpread(_objectSpread({}, fresh), {}, {
|
|
2212
|
+
external_sale_number: (_external_sale_number3 = fresh.external_sale_number) !== null && _external_sale_number3 !== void 0 ? _external_sale_number3 : externalSaleNumber,
|
|
2213
|
+
need_sync: 0
|
|
2056
2214
|
});
|
|
2057
|
-
|
|
2215
|
+
_context28.next = 6;
|
|
2058
2216
|
return this.order.upsertOrdersFromRemote([syncedOrder]);
|
|
2059
|
-
case
|
|
2217
|
+
case 6:
|
|
2060
2218
|
this.logInfo("".concat(title, ": sync_sales \u5B8C\u6574\u8BA2\u5355\u5DF2\u540C\u6B65\u5230\u672C\u5730"), {
|
|
2061
2219
|
order_id: fresh.order_id,
|
|
2062
2220
|
external_sale_number: syncedOrder.external_sale_number,
|
|
2063
|
-
order_number: fresh.order_number
|
|
2221
|
+
order_number: fresh.order_number,
|
|
2222
|
+
mergedRemoteOrder: shouldMergeRemoteOrder,
|
|
2223
|
+
persistedCheckoutDataWithResponse: persistCheckoutDataWithResponse
|
|
2064
2224
|
});
|
|
2065
|
-
|
|
2225
|
+
_context28.next = 19;
|
|
2066
2226
|
break;
|
|
2067
|
-
case
|
|
2227
|
+
case 9:
|
|
2068
2228
|
if (!(this.order && externalSaleNumber && typeof this.order.markOrderSyncedByExternalSaleNumber === 'function')) {
|
|
2069
|
-
|
|
2229
|
+
_context28.next = 18;
|
|
2070
2230
|
break;
|
|
2071
2231
|
}
|
|
2072
2232
|
patch = this.buildCheckoutSyncSuccessPatch(fresh);
|
|
2073
|
-
|
|
2233
|
+
_context28.next = 13;
|
|
2074
2234
|
return this.order.markOrderSyncedByExternalSaleNumber({
|
|
2075
2235
|
externalSaleNumber: externalSaleNumber,
|
|
2076
2236
|
patch: patch
|
|
2077
2237
|
});
|
|
2078
|
-
case
|
|
2079
|
-
result =
|
|
2080
|
-
syncedOrder = (result === null || result === void 0 ? void 0 : result.order) || _objectSpread(_objectSpread(_objectSpread({},
|
|
2238
|
+
case 13:
|
|
2239
|
+
result = _context28.sent;
|
|
2240
|
+
syncedOrder = (result === null || result === void 0 ? void 0 : result.order) || _objectSpread(_objectSpread(_objectSpread({}, checkoutData), patch), {}, {
|
|
2081
2241
|
external_sale_number: externalSaleNumber,
|
|
2082
2242
|
need_sync: 0
|
|
2083
2243
|
});
|
|
@@ -2087,70 +2247,26 @@ var Server = /*#__PURE__*/function () {
|
|
|
2087
2247
|
hasRemoteOrder: !!fresh,
|
|
2088
2248
|
mergedRemoteOrder: false
|
|
2089
2249
|
});
|
|
2090
|
-
|
|
2250
|
+
_context28.next = 19;
|
|
2091
2251
|
break;
|
|
2092
|
-
case
|
|
2252
|
+
case 18:
|
|
2093
2253
|
this.logWarning("".concat(title, ": sync_sales Order \u6A21\u5757\u672A\u6CE8\u518C"), {
|
|
2094
2254
|
backendPath: backendPath,
|
|
2095
2255
|
external_sale_number: externalSaleNumber,
|
|
2096
2256
|
order_id: fresh === null || fresh === void 0 ? void 0 : fresh.order_id
|
|
2097
2257
|
});
|
|
2098
|
-
case
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
checkoutResponseOrder: fresh
|
|
2102
|
-
}) : undefined;
|
|
2103
|
-
if (!(printableSyncedOrder && this.shouldPrintSyncedOrder({
|
|
2104
|
-
checkoutData: data,
|
|
2105
|
-
syncedOrder: printableSyncedOrder
|
|
2106
|
-
}))) {
|
|
2107
|
-
_context26.next = 41;
|
|
2108
|
-
break;
|
|
2109
|
-
}
|
|
2110
|
-
_context26.next = 41;
|
|
2111
|
-
return this.dispatchPrintOtherReceiptTask({
|
|
2112
|
-
checkoutData: data,
|
|
2113
|
-
syncedOrder: printableSyncedOrder,
|
|
2114
|
-
response: response,
|
|
2115
|
-
deviceId: (_ctx$task2 = ctx.task) === null || _ctx$task2 === void 0 ? void 0 : _ctx$task2.device_id
|
|
2116
|
-
});
|
|
2117
|
-
case 41:
|
|
2118
|
-
return _context26.abrupt("return", this.taskOk({
|
|
2119
|
-
order: (_syncedOrder2 = syncedOrder) !== null && _syncedOrder2 !== void 0 ? _syncedOrder2 : null,
|
|
2120
|
-
response: this.normalizeCheckoutResponse(response)
|
|
2121
|
-
}));
|
|
2122
|
-
case 44:
|
|
2123
|
-
_context26.prev = 44;
|
|
2124
|
-
_context26.t0 = _context26["catch"](9);
|
|
2125
|
-
backendError = this.extractBackendErrorResponse(_context26.t0);
|
|
2126
|
-
if (!backendError) {
|
|
2127
|
-
_context26.next = 51;
|
|
2128
|
-
break;
|
|
2129
|
-
}
|
|
2130
|
-
_message = (backendError === null || backendError === void 0 ? void 0 : backendError.message) || '后端明确拒绝 checkout';
|
|
2131
|
-
this.logError("".concat(title, ": sync_sales \u540E\u7AEF\u660E\u786E\u5931\u8D25"), {
|
|
2132
|
-
backendPath: backendPath,
|
|
2133
|
-
backendError: backendError
|
|
2134
|
-
});
|
|
2135
|
-
return _context26.abrupt("return", this.taskFail('BACKEND_REJECTED', _message, backendError));
|
|
2136
|
-
case 51:
|
|
2137
|
-
errorMessage = this.getUnknownErrorMessage(_context26.t0);
|
|
2138
|
-
this.logError("".concat(title, ": sync_sales \u8BF7\u6C42\u672A\u660E\u786E\u6210\u529F"), {
|
|
2139
|
-
backendPath: backendPath,
|
|
2140
|
-
error: errorMessage,
|
|
2141
|
-
error_detail: this.normalizeUnknownError(_context26.t0)
|
|
2142
|
-
});
|
|
2143
|
-
return _context26.abrupt("return", this.taskTimeout(errorMessage));
|
|
2144
|
-
case 54:
|
|
2258
|
+
case 19:
|
|
2259
|
+
return _context28.abrupt("return", syncedOrder);
|
|
2260
|
+
case 20:
|
|
2145
2261
|
case "end":
|
|
2146
|
-
return
|
|
2262
|
+
return _context28.stop();
|
|
2147
2263
|
}
|
|
2148
|
-
},
|
|
2264
|
+
}, _callee28, this);
|
|
2149
2265
|
}));
|
|
2150
|
-
function
|
|
2151
|
-
return
|
|
2266
|
+
function persistSyncedCheckoutOrder(_x31) {
|
|
2267
|
+
return _persistSyncedCheckoutOrder.apply(this, arguments);
|
|
2152
2268
|
}
|
|
2153
|
-
return
|
|
2269
|
+
return persistSyncedCheckoutOrder;
|
|
2154
2270
|
}()
|
|
2155
2271
|
/**
|
|
2156
2272
|
* 将普通层 QuotationModule 的报价单计算能力桥接到 Server Products 模块。
|
|
@@ -2158,51 +2274,51 @@ var Server = /*#__PURE__*/function () {
|
|
|
2158
2274
|
}, {
|
|
2159
2275
|
key: "setupProductsQuotationPriceBridge",
|
|
2160
2276
|
value: (function () {
|
|
2161
|
-
var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2277
|
+
var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2162
2278
|
var _this$core$context, errorMessage;
|
|
2163
|
-
return _regeneratorRuntime().wrap(function
|
|
2164
|
-
while (1) switch (
|
|
2279
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2280
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2165
2281
|
case 0:
|
|
2166
2282
|
if (this.products) {
|
|
2167
|
-
|
|
2283
|
+
_context29.next = 3;
|
|
2168
2284
|
break;
|
|
2169
2285
|
}
|
|
2170
2286
|
this.logInfo('setupProductsQuotationPriceBridge: Products 模块未注册');
|
|
2171
|
-
return
|
|
2287
|
+
return _context29.abrupt("return");
|
|
2172
2288
|
case 3:
|
|
2173
2289
|
if (this.schedule) {
|
|
2174
|
-
|
|
2290
|
+
_context29.next = 6;
|
|
2175
2291
|
break;
|
|
2176
2292
|
}
|
|
2177
2293
|
this.logInfo('setupProductsQuotationPriceBridge: Schedule 模块未注册');
|
|
2178
|
-
return
|
|
2294
|
+
return _context29.abrupt("return");
|
|
2179
2295
|
case 6:
|
|
2180
|
-
|
|
2181
|
-
|
|
2296
|
+
_context29.prev = 6;
|
|
2297
|
+
_context29.next = 9;
|
|
2182
2298
|
return this.schedule.loadAllSchedule();
|
|
2183
2299
|
case 9:
|
|
2184
2300
|
this.products.clearPriceCache();
|
|
2185
|
-
|
|
2301
|
+
_context29.next = 12;
|
|
2186
2302
|
return this.products.setupQuotationPriceBridge({
|
|
2187
2303
|
scheduleModule: this.schedule,
|
|
2188
2304
|
channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel
|
|
2189
2305
|
});
|
|
2190
2306
|
case 12:
|
|
2191
2307
|
this.logInfo('Products 报价单价格桥接初始化完成');
|
|
2192
|
-
|
|
2308
|
+
_context29.next = 19;
|
|
2193
2309
|
break;
|
|
2194
2310
|
case 15:
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
errorMessage =
|
|
2311
|
+
_context29.prev = 15;
|
|
2312
|
+
_context29.t0 = _context29["catch"](6);
|
|
2313
|
+
errorMessage = _context29.t0 instanceof Error ? _context29.t0.message : String(_context29.t0);
|
|
2198
2314
|
this.logError('Products 报价单价格桥接初始化失败', {
|
|
2199
2315
|
error: errorMessage
|
|
2200
2316
|
});
|
|
2201
2317
|
case 19:
|
|
2202
2318
|
case "end":
|
|
2203
|
-
return
|
|
2319
|
+
return _context29.stop();
|
|
2204
2320
|
}
|
|
2205
|
-
},
|
|
2321
|
+
}, _callee29, this, [[6, 15]]);
|
|
2206
2322
|
}));
|
|
2207
2323
|
function setupProductsQuotationPriceBridge() {
|
|
2208
2324
|
return _setupProductsQuotationPriceBridge.apply(this, arguments);
|
|
@@ -2271,45 +2387,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
2271
2387
|
}, {
|
|
2272
2388
|
key: "refreshProductsInBackground",
|
|
2273
2389
|
value: (function () {
|
|
2274
|
-
var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2390
|
+
var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2275
2391
|
var startTime, duration, _duration2, errorMessage;
|
|
2276
|
-
return _regeneratorRuntime().wrap(function
|
|
2277
|
-
while (1) switch (
|
|
2392
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2393
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2278
2394
|
case 0:
|
|
2279
2395
|
if (this.products) {
|
|
2280
|
-
|
|
2396
|
+
_context30.next = 3;
|
|
2281
2397
|
break;
|
|
2282
2398
|
}
|
|
2283
2399
|
this.logWarning('refreshProductsInBackground: Products 模块未注册');
|
|
2284
|
-
return
|
|
2400
|
+
return _context30.abrupt("return");
|
|
2285
2401
|
case 3:
|
|
2286
2402
|
this.logInfo('refreshProductsInBackground 开始');
|
|
2287
2403
|
startTime = Date.now();
|
|
2288
|
-
|
|
2289
|
-
|
|
2404
|
+
_context30.prev = 5;
|
|
2405
|
+
_context30.next = 8;
|
|
2290
2406
|
return this.products.silentRefresh();
|
|
2291
2407
|
case 8:
|
|
2292
2408
|
duration = Date.now() - startTime;
|
|
2293
2409
|
this.logInfo('refreshProductsInBackground 完成', {
|
|
2294
2410
|
duration: "".concat(duration, "ms")
|
|
2295
2411
|
});
|
|
2296
|
-
|
|
2412
|
+
_context30.next = 18;
|
|
2297
2413
|
break;
|
|
2298
2414
|
case 12:
|
|
2299
|
-
|
|
2300
|
-
|
|
2415
|
+
_context30.prev = 12;
|
|
2416
|
+
_context30.t0 = _context30["catch"](5);
|
|
2301
2417
|
_duration2 = Date.now() - startTime;
|
|
2302
|
-
errorMessage =
|
|
2303
|
-
console.error('[Server] refreshProductsInBackground 失败:',
|
|
2418
|
+
errorMessage = _context30.t0 instanceof Error ? _context30.t0.message : String(_context30.t0);
|
|
2419
|
+
console.error('[Server] refreshProductsInBackground 失败:', _context30.t0);
|
|
2304
2420
|
this.logError('refreshProductsInBackground 失败', {
|
|
2305
2421
|
duration: "".concat(_duration2, "ms"),
|
|
2306
2422
|
error: errorMessage
|
|
2307
2423
|
});
|
|
2308
2424
|
case 18:
|
|
2309
2425
|
case "end":
|
|
2310
|
-
return
|
|
2426
|
+
return _context30.stop();
|
|
2311
2427
|
}
|
|
2312
|
-
},
|
|
2428
|
+
}, _callee30, this, [[5, 12]]);
|
|
2313
2429
|
}));
|
|
2314
2430
|
function refreshProductsInBackground() {
|
|
2315
2431
|
return _refreshProductsInBackground.apply(this, arguments);
|
|
@@ -2325,45 +2441,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
2325
2441
|
}, {
|
|
2326
2442
|
key: "refreshOrdersInBackground",
|
|
2327
2443
|
value: (function () {
|
|
2328
|
-
var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2444
|
+
var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2329
2445
|
var startTime, duration, _duration3, errorMessage;
|
|
2330
|
-
return _regeneratorRuntime().wrap(function
|
|
2331
|
-
while (1) switch (
|
|
2446
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2447
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2332
2448
|
case 0:
|
|
2333
2449
|
if (this.order) {
|
|
2334
|
-
|
|
2450
|
+
_context31.next = 3;
|
|
2335
2451
|
break;
|
|
2336
2452
|
}
|
|
2337
2453
|
this.logWarning('refreshOrdersInBackground: Order 模块未注册');
|
|
2338
|
-
return
|
|
2454
|
+
return _context31.abrupt("return");
|
|
2339
2455
|
case 3:
|
|
2340
2456
|
this.logInfo('refreshOrdersInBackground 开始');
|
|
2341
2457
|
startTime = Date.now();
|
|
2342
|
-
|
|
2343
|
-
|
|
2458
|
+
_context31.prev = 5;
|
|
2459
|
+
_context31.next = 8;
|
|
2344
2460
|
return this.order.silentRefresh();
|
|
2345
2461
|
case 8:
|
|
2346
2462
|
duration = Date.now() - startTime;
|
|
2347
2463
|
this.logInfo('refreshOrdersInBackground 完成', {
|
|
2348
2464
|
duration: "".concat(duration, "ms")
|
|
2349
2465
|
});
|
|
2350
|
-
|
|
2466
|
+
_context31.next = 18;
|
|
2351
2467
|
break;
|
|
2352
2468
|
case 12:
|
|
2353
|
-
|
|
2354
|
-
|
|
2469
|
+
_context31.prev = 12;
|
|
2470
|
+
_context31.t0 = _context31["catch"](5);
|
|
2355
2471
|
_duration3 = Date.now() - startTime;
|
|
2356
|
-
errorMessage =
|
|
2357
|
-
console.error('[Server] refreshOrdersInBackground 失败:',
|
|
2472
|
+
errorMessage = _context31.t0 instanceof Error ? _context31.t0.message : String(_context31.t0);
|
|
2473
|
+
console.error('[Server] refreshOrdersInBackground 失败:', _context31.t0);
|
|
2358
2474
|
this.logError('refreshOrdersInBackground 失败', {
|
|
2359
2475
|
duration: "".concat(_duration3, "ms"),
|
|
2360
2476
|
error: errorMessage
|
|
2361
2477
|
});
|
|
2362
2478
|
case 18:
|
|
2363
2479
|
case "end":
|
|
2364
|
-
return
|
|
2480
|
+
return _context31.stop();
|
|
2365
2481
|
}
|
|
2366
|
-
},
|
|
2482
|
+
}, _callee31, this, [[5, 12]]);
|
|
2367
2483
|
}));
|
|
2368
2484
|
function refreshOrdersInBackground() {
|
|
2369
2485
|
return _refreshOrdersInBackground.apply(this, arguments);
|
|
@@ -2378,10 +2494,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
2378
2494
|
}, {
|
|
2379
2495
|
key: "clearAllIndexDB",
|
|
2380
2496
|
value: (function () {
|
|
2381
|
-
var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2497
|
+
var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
2382
2498
|
var clearTasks, moduleNames, errorMessage;
|
|
2383
|
-
return _regeneratorRuntime().wrap(function
|
|
2384
|
-
while (1) switch (
|
|
2499
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2500
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2385
2501
|
case 0:
|
|
2386
2502
|
console.log('[Server] 开始清空所有模块的IndexedDB缓存...');
|
|
2387
2503
|
this.logInfo('开始清空所有模块的 IndexedDB 缓存');
|
|
@@ -2416,41 +2532,41 @@ var Server = /*#__PURE__*/function () {
|
|
|
2416
2532
|
moduleNames.push('FloorPlan');
|
|
2417
2533
|
}
|
|
2418
2534
|
if (!(clearTasks.length === 0)) {
|
|
2419
|
-
|
|
2535
|
+
_context32.next = 15;
|
|
2420
2536
|
break;
|
|
2421
2537
|
}
|
|
2422
2538
|
console.warn('[Server] 没有找到已注册的模块,无需清空');
|
|
2423
2539
|
this.logWarning('没有找到已注册的模块,无需清空 IndexedDB');
|
|
2424
|
-
return
|
|
2540
|
+
return _context32.abrupt("return");
|
|
2425
2541
|
case 15:
|
|
2426
2542
|
this.logInfo('准备清空模块缓存', {
|
|
2427
2543
|
moduleNames: moduleNames
|
|
2428
2544
|
});
|
|
2429
|
-
|
|
2430
|
-
|
|
2545
|
+
_context32.prev = 16;
|
|
2546
|
+
_context32.next = 19;
|
|
2431
2547
|
return Promise.all(clearTasks);
|
|
2432
2548
|
case 19:
|
|
2433
2549
|
console.log("[Server] \u2705 \u5DF2\u6210\u529F\u6E05\u7A7A\u6240\u6709\u6A21\u5757\u7684IndexedDB\u7F13\u5B58: ".concat(moduleNames.join(', ')));
|
|
2434
2550
|
this.logInfo('成功清空所有模块的 IndexedDB 缓存', {
|
|
2435
2551
|
moduleNames: moduleNames
|
|
2436
2552
|
});
|
|
2437
|
-
|
|
2553
|
+
_context32.next = 29;
|
|
2438
2554
|
break;
|
|
2439
2555
|
case 23:
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
errorMessage =
|
|
2443
|
-
console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:',
|
|
2556
|
+
_context32.prev = 23;
|
|
2557
|
+
_context32.t0 = _context32["catch"](16);
|
|
2558
|
+
errorMessage = _context32.t0 instanceof Error ? _context32.t0.message : String(_context32.t0);
|
|
2559
|
+
console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context32.t0);
|
|
2444
2560
|
this.logError('清空 IndexedDB 缓存时发生错误', {
|
|
2445
2561
|
moduleNames: moduleNames,
|
|
2446
2562
|
error: errorMessage
|
|
2447
2563
|
});
|
|
2448
|
-
throw
|
|
2564
|
+
throw _context32.t0;
|
|
2449
2565
|
case 29:
|
|
2450
2566
|
case "end":
|
|
2451
|
-
return
|
|
2567
|
+
return _context32.stop();
|
|
2452
2568
|
}
|
|
2453
|
-
},
|
|
2569
|
+
}, _callee32, this, [[16, 23]]);
|
|
2454
2570
|
}));
|
|
2455
2571
|
function clearAllIndexDB() {
|
|
2456
2572
|
return _clearAllIndexDB.apply(this, arguments);
|
|
@@ -2525,10 +2641,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
2525
2641
|
}, {
|
|
2526
2642
|
key: "handleRoute",
|
|
2527
2643
|
value: (function () {
|
|
2528
|
-
var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2644
|
+
var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(method, path, params) {
|
|
2529
2645
|
var startTime, handler, result, duration, _duration4, errorMessage;
|
|
2530
|
-
return _regeneratorRuntime().wrap(function
|
|
2531
|
-
while (1) switch (
|
|
2646
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2647
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2532
2648
|
case 0:
|
|
2533
2649
|
startTime = Date.now();
|
|
2534
2650
|
this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5F00\u59CB: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
@@ -2539,7 +2655,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2539
2655
|
});
|
|
2540
2656
|
handler = this.getRouteHandler(method, path);
|
|
2541
2657
|
if (handler) {
|
|
2542
|
-
|
|
2658
|
+
_context33.next = 6;
|
|
2543
2659
|
break;
|
|
2544
2660
|
}
|
|
2545
2661
|
this.logError("\u8DEF\u7531\u672A\u627E\u5230: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
@@ -2548,13 +2664,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
2548
2664
|
});
|
|
2549
2665
|
throw new Error("Route not found: ".concat(method.toUpperCase(), " ").concat(path));
|
|
2550
2666
|
case 6:
|
|
2551
|
-
|
|
2552
|
-
|
|
2667
|
+
_context33.prev = 6;
|
|
2668
|
+
_context33.next = 9;
|
|
2553
2669
|
return handler(_objectSpread(_objectSpread({}, params), {}, {
|
|
2554
2670
|
path: path
|
|
2555
2671
|
}));
|
|
2556
2672
|
case 9:
|
|
2557
|
-
result =
|
|
2673
|
+
result = _context33.sent;
|
|
2558
2674
|
duration = Date.now() - startTime;
|
|
2559
2675
|
this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5B8C\u6210: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
2560
2676
|
method: method.toUpperCase(),
|
|
@@ -2563,12 +2679,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
2563
2679
|
resultCode: result === null || result === void 0 ? void 0 : result.code,
|
|
2564
2680
|
resultStatus: result === null || result === void 0 ? void 0 : result.status
|
|
2565
2681
|
});
|
|
2566
|
-
return
|
|
2682
|
+
return _context33.abrupt("return", result);
|
|
2567
2683
|
case 15:
|
|
2568
|
-
|
|
2569
|
-
|
|
2684
|
+
_context33.prev = 15;
|
|
2685
|
+
_context33.t0 = _context33["catch"](6);
|
|
2570
2686
|
_duration4 = Date.now() - startTime;
|
|
2571
|
-
errorMessage =
|
|
2687
|
+
errorMessage = _context33.t0 instanceof Error ? _context33.t0.message : String(_context33.t0);
|
|
2572
2688
|
this.logError("\u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
2573
2689
|
method: method.toUpperCase(),
|
|
2574
2690
|
path: path,
|
|
@@ -2576,15 +2692,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
2576
2692
|
error: errorMessage,
|
|
2577
2693
|
data: params.data
|
|
2578
2694
|
});
|
|
2579
|
-
console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path),
|
|
2580
|
-
throw
|
|
2695
|
+
console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), _context33.t0);
|
|
2696
|
+
throw _context33.t0;
|
|
2581
2697
|
case 22:
|
|
2582
2698
|
case "end":
|
|
2583
|
-
return
|
|
2699
|
+
return _context33.stop();
|
|
2584
2700
|
}
|
|
2585
|
-
},
|
|
2701
|
+
}, _callee33, this, [[6, 15]]);
|
|
2586
2702
|
}));
|
|
2587
|
-
function handleRoute(
|
|
2703
|
+
function handleRoute(_x32, _x33, _x34) {
|
|
2588
2704
|
return _handleRoute.apply(this, arguments);
|
|
2589
2705
|
}
|
|
2590
2706
|
return handleRoute;
|
|
@@ -2708,36 +2824,36 @@ var Server = /*#__PURE__*/function () {
|
|
|
2708
2824
|
}, {
|
|
2709
2825
|
key: "getPaymentRouteModule",
|
|
2710
2826
|
value: function () {
|
|
2711
|
-
var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2827
|
+
var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2712
2828
|
var _this6 = this;
|
|
2713
|
-
return _regeneratorRuntime().wrap(function
|
|
2714
|
-
while (1) switch (
|
|
2829
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2830
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2715
2831
|
case 0:
|
|
2716
2832
|
if (!this.payment) {
|
|
2717
|
-
|
|
2833
|
+
_context35.next = 2;
|
|
2718
2834
|
break;
|
|
2719
2835
|
}
|
|
2720
|
-
return
|
|
2836
|
+
return _context35.abrupt("return", this.payment);
|
|
2721
2837
|
case 2:
|
|
2722
2838
|
if (!this.paymentRouteModule) {
|
|
2723
|
-
|
|
2839
|
+
_context35.next = 4;
|
|
2724
2840
|
break;
|
|
2725
2841
|
}
|
|
2726
|
-
return
|
|
2842
|
+
return _context35.abrupt("return", this.paymentRouteModule);
|
|
2727
2843
|
case 4:
|
|
2728
2844
|
if (!this.paymentRouteModuleInFlight) {
|
|
2729
|
-
|
|
2845
|
+
_context35.next = 6;
|
|
2730
2846
|
break;
|
|
2731
2847
|
}
|
|
2732
|
-
return
|
|
2848
|
+
return _context35.abrupt("return", this.paymentRouteModuleInFlight);
|
|
2733
2849
|
case 6:
|
|
2734
|
-
this.paymentRouteModuleInFlight = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2850
|
+
this.paymentRouteModuleInFlight = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2735
2851
|
var module;
|
|
2736
|
-
return _regeneratorRuntime().wrap(function
|
|
2737
|
-
while (1) switch (
|
|
2852
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2853
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2738
2854
|
case 0:
|
|
2739
2855
|
module = new PaymentServerModule('server_payment_route', '1.0.0');
|
|
2740
|
-
|
|
2856
|
+
_context34.next = 3;
|
|
2741
2857
|
return module.initialize(_this6.core, {
|
|
2742
2858
|
store: {
|
|
2743
2859
|
payMethods: []
|
|
@@ -2745,21 +2861,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
2745
2861
|
});
|
|
2746
2862
|
case 3:
|
|
2747
2863
|
_this6.paymentRouteModule = module;
|
|
2748
|
-
return
|
|
2864
|
+
return _context34.abrupt("return", module);
|
|
2749
2865
|
case 5:
|
|
2750
2866
|
case "end":
|
|
2751
|
-
return
|
|
2867
|
+
return _context34.stop();
|
|
2752
2868
|
}
|
|
2753
|
-
},
|
|
2869
|
+
}, _callee34);
|
|
2754
2870
|
}))().finally(function () {
|
|
2755
2871
|
_this6.paymentRouteModuleInFlight = undefined;
|
|
2756
2872
|
});
|
|
2757
|
-
return
|
|
2873
|
+
return _context35.abrupt("return", this.paymentRouteModuleInFlight);
|
|
2758
2874
|
case 8:
|
|
2759
2875
|
case "end":
|
|
2760
|
-
return
|
|
2876
|
+
return _context35.stop();
|
|
2761
2877
|
}
|
|
2762
|
-
},
|
|
2878
|
+
}, _callee35, this);
|
|
2763
2879
|
}));
|
|
2764
2880
|
function getPaymentRouteModule() {
|
|
2765
2881
|
return _getPaymentRouteModule.apply(this, arguments);
|
|
@@ -2769,19 +2885,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
2769
2885
|
}, {
|
|
2770
2886
|
key: "fetchQuotationAvailableFromAPI",
|
|
2771
2887
|
value: function () {
|
|
2772
|
-
var _fetchQuotationAvailableFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2773
|
-
var _this$
|
|
2888
|
+
var _fetchQuotationAvailableFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(data) {
|
|
2889
|
+
var _this$app6;
|
|
2774
2890
|
var requester;
|
|
2775
|
-
return _regeneratorRuntime().wrap(function
|
|
2776
|
-
while (1) switch (
|
|
2891
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2892
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2777
2893
|
case 0:
|
|
2778
|
-
requester = ((_this$
|
|
2894
|
+
requester = ((_this$app6 = this.app) === null || _this$app6 === void 0 ? void 0 : _this$app6.request) || this.core.getPlugin('request');
|
|
2779
2895
|
if (requester !== null && requester !== void 0 && requester.get) {
|
|
2780
|
-
|
|
2896
|
+
_context36.next = 4;
|
|
2781
2897
|
break;
|
|
2782
2898
|
}
|
|
2783
2899
|
this.logError('fetchQuotationAvailableFromAPI: request 不可用');
|
|
2784
|
-
return
|
|
2900
|
+
return _context36.abrupt("return", {
|
|
2785
2901
|
code: 500,
|
|
2786
2902
|
message: 'request 不可用',
|
|
2787
2903
|
data: {
|
|
@@ -2790,14 +2906,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
2790
2906
|
status: false
|
|
2791
2907
|
});
|
|
2792
2908
|
case 4:
|
|
2793
|
-
return
|
|
2909
|
+
return _context36.abrupt("return", requester.get('/shop/quotation/available', data));
|
|
2794
2910
|
case 5:
|
|
2795
2911
|
case "end":
|
|
2796
|
-
return
|
|
2912
|
+
return _context36.stop();
|
|
2797
2913
|
}
|
|
2798
|
-
},
|
|
2914
|
+
}, _callee36, this);
|
|
2799
2915
|
}));
|
|
2800
|
-
function fetchQuotationAvailableFromAPI(
|
|
2916
|
+
function fetchQuotationAvailableFromAPI(_x35) {
|
|
2801
2917
|
return _fetchQuotationAvailableFromAPI.apply(this, arguments);
|
|
2802
2918
|
}
|
|
2803
2919
|
return fetchQuotationAvailableFromAPI;
|
|
@@ -2837,16 +2953,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
2837
2953
|
* const result = await this.handleSalesSearchRequest('single', '/shop/es/search/sales', { keyword: '1001' }, {})
|
|
2838
2954
|
*/
|
|
2839
2955
|
function () {
|
|
2840
|
-
var _handleSalesSearchRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2956
|
+
var _handleSalesSearchRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(kind, backendPath, data, config) {
|
|
2841
2957
|
var queryPayload, result, _ref53, callback, subscriberId, resetVisibleOrderIds, contextSignature, existing, shouldReset, visibleOrderIds, _iterator5, _step5, orderId;
|
|
2842
|
-
return _regeneratorRuntime().wrap(function
|
|
2843
|
-
while (1) switch (
|
|
2958
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
2959
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2844
2960
|
case 0:
|
|
2845
2961
|
queryPayload = data && _typeof(data) === 'object' ? _objectSpread({}, data) : {};
|
|
2846
|
-
|
|
2962
|
+
_context37.next = 3;
|
|
2847
2963
|
return this.fetchSalesSearchFromAPI(backendPath, queryPayload);
|
|
2848
2964
|
case 3:
|
|
2849
|
-
result =
|
|
2965
|
+
result = _context37.sent;
|
|
2850
2966
|
_ref53 = config || {}, callback = _ref53.callback, subscriberId = _ref53.subscriberId, resetVisibleOrderIds = _ref53.resetVisibleOrderIds;
|
|
2851
2967
|
if (subscriberId && typeof callback === 'function') {
|
|
2852
2968
|
contextSignature = this.buildSalesSearchSignature(kind, queryPayload);
|
|
@@ -2878,14 +2994,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
2878
2994
|
visibleCount: visibleOrderIds.size
|
|
2879
2995
|
});
|
|
2880
2996
|
}
|
|
2881
|
-
return
|
|
2997
|
+
return _context37.abrupt("return", result);
|
|
2882
2998
|
case 7:
|
|
2883
2999
|
case "end":
|
|
2884
|
-
return
|
|
3000
|
+
return _context37.stop();
|
|
2885
3001
|
}
|
|
2886
|
-
},
|
|
3002
|
+
}, _callee37, this);
|
|
2887
3003
|
}));
|
|
2888
|
-
function handleSalesSearchRequest(
|
|
3004
|
+
function handleSalesSearchRequest(_x36, _x37, _x38, _x39) {
|
|
2889
3005
|
return _handleSalesSearchRequest.apply(this, arguments);
|
|
2890
3006
|
}
|
|
2891
3007
|
return handleSalesSearchRequest;
|
|
@@ -2900,20 +3016,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
2900
3016
|
}, {
|
|
2901
3017
|
key: "fetchSalesSearchFromAPI",
|
|
2902
3018
|
value: (function () {
|
|
2903
|
-
var _fetchSalesSearchFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2904
|
-
var _this$
|
|
3019
|
+
var _fetchSalesSearchFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(backendPath, data) {
|
|
3020
|
+
var _this$app7;
|
|
2905
3021
|
var _response$data3, _response$code, _response$status, _response$message, response, _payload, errorMessage;
|
|
2906
|
-
return _regeneratorRuntime().wrap(function
|
|
2907
|
-
while (1) switch (
|
|
3022
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3023
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
2908
3024
|
case 0:
|
|
2909
|
-
if ((_this$
|
|
2910
|
-
|
|
3025
|
+
if ((_this$app7 = this.app) !== null && _this$app7 !== void 0 && _this$app7.request) {
|
|
3026
|
+
_context38.next = 3;
|
|
2911
3027
|
break;
|
|
2912
3028
|
}
|
|
2913
3029
|
this.logError('fetchSalesSearchFromAPI: app.request 不可用', {
|
|
2914
3030
|
backendPath: backendPath
|
|
2915
3031
|
});
|
|
2916
|
-
return
|
|
3032
|
+
return _context38.abrupt("return", {
|
|
2917
3033
|
code: 500,
|
|
2918
3034
|
message: 'app.request 不可用',
|
|
2919
3035
|
data: backendPath === '/shop/es/search' ? {
|
|
@@ -2925,29 +3041,29 @@ var Server = /*#__PURE__*/function () {
|
|
|
2925
3041
|
status: false
|
|
2926
3042
|
});
|
|
2927
3043
|
case 3:
|
|
2928
|
-
|
|
2929
|
-
|
|
3044
|
+
_context38.prev = 3;
|
|
3045
|
+
_context38.next = 6;
|
|
2930
3046
|
return this.app.request.post(backendPath, data, {
|
|
2931
3047
|
isShopApi: true
|
|
2932
3048
|
});
|
|
2933
3049
|
case 6:
|
|
2934
|
-
response =
|
|
3050
|
+
response = _context38.sent;
|
|
2935
3051
|
_payload = (_response$data3 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data3 !== void 0 ? _response$data3 : response;
|
|
2936
|
-
return
|
|
3052
|
+
return _context38.abrupt("return", {
|
|
2937
3053
|
code: (_response$code = response === null || response === void 0 ? void 0 : response.code) !== null && _response$code !== void 0 ? _response$code : 200,
|
|
2938
3054
|
status: (_response$status = response === null || response === void 0 ? void 0 : response.status) !== null && _response$status !== void 0 ? _response$status : true,
|
|
2939
3055
|
message: (_response$message = response === null || response === void 0 ? void 0 : response.message) !== null && _response$message !== void 0 ? _response$message : '',
|
|
2940
3056
|
data: _payload
|
|
2941
3057
|
});
|
|
2942
3058
|
case 11:
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
errorMessage =
|
|
3059
|
+
_context38.prev = 11;
|
|
3060
|
+
_context38.t0 = _context38["catch"](3);
|
|
3061
|
+
errorMessage = _context38.t0 instanceof Error ? _context38.t0.message : String(_context38.t0);
|
|
2946
3062
|
this.logError('fetchSalesSearchFromAPI: 请求失败', {
|
|
2947
3063
|
backendPath: backendPath,
|
|
2948
3064
|
error: errorMessage
|
|
2949
3065
|
});
|
|
2950
|
-
return
|
|
3066
|
+
return _context38.abrupt("return", {
|
|
2951
3067
|
code: 500,
|
|
2952
3068
|
message: errorMessage,
|
|
2953
3069
|
data: backendPath === '/shop/es/search' ? {
|
|
@@ -2960,11 +3076,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2960
3076
|
});
|
|
2961
3077
|
case 16:
|
|
2962
3078
|
case "end":
|
|
2963
|
-
return
|
|
3079
|
+
return _context38.stop();
|
|
2964
3080
|
}
|
|
2965
|
-
},
|
|
3081
|
+
}, _callee38, this, [[3, 11]]);
|
|
2966
3082
|
}));
|
|
2967
|
-
function fetchSalesSearchFromAPI(
|
|
3083
|
+
function fetchSalesSearchFromAPI(_x40, _x41) {
|
|
2968
3084
|
return _fetchSalesSearchFromAPI.apply(this, arguments);
|
|
2969
3085
|
}
|
|
2970
3086
|
return fetchSalesSearchFromAPI;
|
|
@@ -3469,18 +3585,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
3469
3585
|
}, {
|
|
3470
3586
|
key: "fetchOrderListFromAPI",
|
|
3471
3587
|
value: (function () {
|
|
3472
|
-
var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3473
|
-
var _this$
|
|
3588
|
+
var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(data) {
|
|
3589
|
+
var _this$app8;
|
|
3474
3590
|
var _response$data4, response, _payload2, list, count, errorMessage;
|
|
3475
|
-
return _regeneratorRuntime().wrap(function
|
|
3476
|
-
while (1) switch (
|
|
3591
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3592
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3477
3593
|
case 0:
|
|
3478
|
-
if ((_this$
|
|
3479
|
-
|
|
3594
|
+
if ((_this$app8 = this.app) !== null && _this$app8 !== void 0 && _this$app8.request) {
|
|
3595
|
+
_context39.next = 3;
|
|
3480
3596
|
break;
|
|
3481
3597
|
}
|
|
3482
3598
|
this.logError('fetchOrderListFromAPI: app.request 不可用');
|
|
3483
|
-
return
|
|
3599
|
+
return _context39.abrupt("return", {
|
|
3484
3600
|
code: 500,
|
|
3485
3601
|
message: 'app.request 不可用',
|
|
3486
3602
|
data: {
|
|
@@ -3490,17 +3606,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
3490
3606
|
status: false
|
|
3491
3607
|
});
|
|
3492
3608
|
case 3:
|
|
3493
|
-
|
|
3494
|
-
|
|
3609
|
+
_context39.prev = 3;
|
|
3610
|
+
_context39.next = 6;
|
|
3495
3611
|
return this.app.request.post('/shop/order/v2/list', data, {
|
|
3496
3612
|
isShopApi: true
|
|
3497
3613
|
});
|
|
3498
3614
|
case 6:
|
|
3499
|
-
response =
|
|
3615
|
+
response = _context39.sent;
|
|
3500
3616
|
_payload2 = (_response$data4 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data4 !== void 0 ? _response$data4 : response;
|
|
3501
3617
|
list = Array.isArray(_payload2 === null || _payload2 === void 0 ? void 0 : _payload2.list) ? _payload2.list : [];
|
|
3502
3618
|
count = typeof (_payload2 === null || _payload2 === void 0 ? void 0 : _payload2.count) === 'number' ? _payload2.count : list.length;
|
|
3503
|
-
return
|
|
3619
|
+
return _context39.abrupt("return", {
|
|
3504
3620
|
code: 200,
|
|
3505
3621
|
data: _objectSpread(_objectSpread({}, _payload2), {}, {
|
|
3506
3622
|
list: list,
|
|
@@ -3510,13 +3626,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
3510
3626
|
status: true
|
|
3511
3627
|
});
|
|
3512
3628
|
case 13:
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
errorMessage =
|
|
3629
|
+
_context39.prev = 13;
|
|
3630
|
+
_context39.t0 = _context39["catch"](3);
|
|
3631
|
+
errorMessage = _context39.t0 instanceof Error ? _context39.t0.message : String(_context39.t0);
|
|
3516
3632
|
this.logError('fetchOrderListFromAPI: 请求失败', {
|
|
3517
3633
|
error: errorMessage
|
|
3518
3634
|
});
|
|
3519
|
-
return
|
|
3635
|
+
return _context39.abrupt("return", {
|
|
3520
3636
|
code: 500,
|
|
3521
3637
|
message: errorMessage,
|
|
3522
3638
|
data: {
|
|
@@ -3527,11 +3643,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3527
3643
|
});
|
|
3528
3644
|
case 18:
|
|
3529
3645
|
case "end":
|
|
3530
|
-
return
|
|
3646
|
+
return _context39.stop();
|
|
3531
3647
|
}
|
|
3532
|
-
},
|
|
3648
|
+
}, _callee39, this, [[3, 13]]);
|
|
3533
3649
|
}));
|
|
3534
|
-
function fetchOrderListFromAPI(
|
|
3650
|
+
function fetchOrderListFromAPI(_x42) {
|
|
3535
3651
|
return _fetchOrderListFromAPI.apply(this, arguments);
|
|
3536
3652
|
}
|
|
3537
3653
|
return fetchOrderListFromAPI;
|
|
@@ -3543,17 +3659,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
3543
3659
|
}, {
|
|
3544
3660
|
key: "fetchBookingListFromAPI",
|
|
3545
3661
|
value: (function () {
|
|
3546
|
-
var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3662
|
+
var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(data) {
|
|
3547
3663
|
var memoryCacheEnabled, withFields, requestPayload, cacheKey, cached, rawList, bookingResult, _bookingResult$list, errorMessage;
|
|
3548
|
-
return _regeneratorRuntime().wrap(function
|
|
3549
|
-
while (1) switch (
|
|
3664
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3665
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3550
3666
|
case 0:
|
|
3551
3667
|
if (this.order) {
|
|
3552
|
-
|
|
3668
|
+
_context40.next = 3;
|
|
3553
3669
|
break;
|
|
3554
3670
|
}
|
|
3555
3671
|
this.logError('fetchBookingListFromAPI: Order 模块不可用');
|
|
3556
|
-
return
|
|
3672
|
+
return _context40.abrupt("return", {
|
|
3557
3673
|
code: 500,
|
|
3558
3674
|
message: 'Order 模块不可用',
|
|
3559
3675
|
data: {
|
|
@@ -3563,18 +3679,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
3563
3679
|
status: false
|
|
3564
3680
|
});
|
|
3565
3681
|
case 3:
|
|
3566
|
-
|
|
3682
|
+
_context40.prev = 3;
|
|
3567
3683
|
memoryCacheEnabled = this.isBookingRemoteMemoryCacheEnabled(data);
|
|
3568
3684
|
withFields = this.resolveBookingSalesWith(data);
|
|
3569
3685
|
requestPayload = this.normalizeBookingRemoteQueryPayload(data, withFields);
|
|
3570
3686
|
cacheKey = this.buildBookingRemoteCacheKey(requestPayload);
|
|
3571
3687
|
if (!memoryCacheEnabled) {
|
|
3572
|
-
|
|
3688
|
+
_context40.next = 13;
|
|
3573
3689
|
break;
|
|
3574
3690
|
}
|
|
3575
3691
|
cached = this.readBookingRemoteCache(cacheKey);
|
|
3576
3692
|
if (!cached) {
|
|
3577
|
-
|
|
3693
|
+
_context40.next = 13;
|
|
3578
3694
|
break;
|
|
3579
3695
|
}
|
|
3580
3696
|
this.logInfo('fetchBookingListFromAPI: 命中内存缓存', {
|
|
@@ -3582,14 +3698,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
3582
3698
|
listCount: cached.bookingResult.count,
|
|
3583
3699
|
withFields: cached.withFields
|
|
3584
3700
|
});
|
|
3585
|
-
return
|
|
3701
|
+
return _context40.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
|
|
3586
3702
|
cache_hit: true
|
|
3587
3703
|
}));
|
|
3588
3704
|
case 13:
|
|
3589
|
-
|
|
3705
|
+
_context40.next = 15;
|
|
3590
3706
|
return this.order.fetchOrdersBySSE(requestPayload);
|
|
3591
3707
|
case 15:
|
|
3592
|
-
rawList =
|
|
3708
|
+
rawList = _context40.sent;
|
|
3593
3709
|
bookingResult = sortBookings(filterBookingsFromOrders(rawList, data), data); // DEBUG: 挂到 window 上方便排查 SSE → 日历数据丢失问题
|
|
3594
3710
|
if (typeof globalThis !== 'undefined') {
|
|
3595
3711
|
globalThis.__SSE_BOOKING_DEBUG__ = {
|
|
@@ -3636,15 +3752,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
3636
3752
|
cacheKey: cacheKey,
|
|
3637
3753
|
withFields: withFields
|
|
3638
3754
|
});
|
|
3639
|
-
return
|
|
3755
|
+
return _context40.abrupt("return", this.buildBookingResponse(bookingResult));
|
|
3640
3756
|
case 23:
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
errorMessage =
|
|
3757
|
+
_context40.prev = 23;
|
|
3758
|
+
_context40.t0 = _context40["catch"](3);
|
|
3759
|
+
errorMessage = _context40.t0 instanceof Error ? _context40.t0.message : String(_context40.t0);
|
|
3644
3760
|
this.logError('fetchBookingListFromAPI: SSE 请求失败', {
|
|
3645
3761
|
error: errorMessage
|
|
3646
3762
|
});
|
|
3647
|
-
return
|
|
3763
|
+
return _context40.abrupt("return", {
|
|
3648
3764
|
code: 500,
|
|
3649
3765
|
message: errorMessage,
|
|
3650
3766
|
data: {
|
|
@@ -3655,11 +3771,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3655
3771
|
});
|
|
3656
3772
|
case 28:
|
|
3657
3773
|
case "end":
|
|
3658
|
-
return
|
|
3774
|
+
return _context40.stop();
|
|
3659
3775
|
}
|
|
3660
|
-
},
|
|
3776
|
+
}, _callee40, this, [[3, 23]]);
|
|
3661
3777
|
}));
|
|
3662
|
-
function fetchBookingListFromAPI(
|
|
3778
|
+
function fetchBookingListFromAPI(_x43) {
|
|
3663
3779
|
return _fetchBookingListFromAPI.apply(this, arguments);
|
|
3664
3780
|
}
|
|
3665
3781
|
return fetchBookingListFromAPI;
|
|
@@ -3667,24 +3783,24 @@ var Server = /*#__PURE__*/function () {
|
|
|
3667
3783
|
}, {
|
|
3668
3784
|
key: "getDeviceTaskPlugin",
|
|
3669
3785
|
value: function getDeviceTaskPlugin() {
|
|
3670
|
-
var _this$
|
|
3671
|
-
return ((_this$
|
|
3786
|
+
var _this$app9, _this$app9$getPlugin;
|
|
3787
|
+
return ((_this$app9 = this.app) === null || _this$app9 === void 0 || (_this$app9$getPlugin = _this$app9.getPlugin) === null || _this$app9$getPlugin === void 0 ? void 0 : _this$app9$getPlugin.call(_this$app9, 'deviceTask')) || null;
|
|
3672
3788
|
}
|
|
3673
3789
|
}, {
|
|
3674
3790
|
key: "getIdGeneratorPlugin",
|
|
3675
3791
|
value: function getIdGeneratorPlugin() {
|
|
3676
|
-
var _this$
|
|
3677
|
-
return ((_this$
|
|
3792
|
+
var _this$app10, _this$app10$getPlugin;
|
|
3793
|
+
return ((_this$app10 = this.app) === null || _this$app10 === void 0 || (_this$app10$getPlugin = _this$app10.getPlugin) === null || _this$app10$getPlugin === void 0 ? void 0 : _this$app10$getPlugin.call(_this$app10, 'idGenerator')) || null;
|
|
3678
3794
|
}
|
|
3679
3795
|
}, {
|
|
3680
3796
|
key: "getAppData",
|
|
3681
3797
|
value: function getAppData(key) {
|
|
3682
|
-
var _this$core$getPlugin, _this$core$getPlugin$, _this$
|
|
3798
|
+
var _this$core$getPlugin, _this$core$getPlugin$, _this$app11, _this$app11$getData, _this$app12, _this$app12$getStore, _this$app12$getStore$, _this$app12$getStore$2, _this$app13, _this$app13$getStore, _this$app13$getStore$, _this$app13$getStore$2, _this$app14, _this$app14$getStore, _this$app14$getStore$, _this$app14$getStore$2;
|
|
3683
3799
|
var getData = (_this$core$getPlugin = this.core.getPlugin('app')) === null || _this$core$getPlugin === void 0 || (_this$core$getPlugin$ = _this$core$getPlugin.getData) === null || _this$core$getPlugin$ === void 0 ? void 0 : _this$core$getPlugin$.call(_this$core$getPlugin);
|
|
3684
3800
|
if (typeof getData === 'function') return getData(key);
|
|
3685
|
-
var directValue = (_this$
|
|
3801
|
+
var directValue = (_this$app11 = this.app) === null || _this$app11 === void 0 || (_this$app11$getData = _this$app11.getData) === null || _this$app11$getData === void 0 ? void 0 : _this$app11$getData.call(_this$app11, key);
|
|
3686
3802
|
if (directValue !== undefined) return directValue;
|
|
3687
|
-
var coreData = ((_this$
|
|
3803
|
+
var coreData = ((_this$app12 = this.app) === null || _this$app12 === void 0 || (_this$app12 = _this$app12.models) === null || _this$app12 === void 0 || (_this$app12$getStore = _this$app12.getStore) === null || _this$app12$getStore === void 0 || (_this$app12$getStore$ = (_this$app12$getStore$2 = _this$app12$getStore.call(_this$app12)).getDataByModel) === null || _this$app12$getStore$ === void 0 ? void 0 : _this$app12$getStore$.call(_this$app12$getStore$2, 'core', 'core')) || ((_this$app13 = this.app) === null || _this$app13 === void 0 || (_this$app13 = _this$app13.data) === null || _this$app13 === void 0 || (_this$app13 = _this$app13.store) === null || _this$app13 === void 0 || (_this$app13$getStore = _this$app13.getStore) === null || _this$app13$getStore === void 0 || (_this$app13$getStore$ = (_this$app13$getStore$2 = _this$app13$getStore.call(_this$app13)).getDataByModel) === null || _this$app13$getStore$ === void 0 ? void 0 : _this$app13$getStore$.call(_this$app13$getStore$2, 'core', 'core')) || ((_this$app14 = this.app) === null || _this$app14 === void 0 || (_this$app14 = _this$app14.data) === null || _this$app14 === void 0 || (_this$app14 = _this$app14.store) === null || _this$app14 === void 0 || (_this$app14$getStore = _this$app14.getStore) === null || _this$app14$getStore === void 0 || (_this$app14$getStore$ = (_this$app14$getStore$2 = _this$app14$getStore.call(_this$app14)).getDataByModel) === null || _this$app14$getStore$ === void 0 || (_this$app14$getStore$ = _this$app14$getStore$.call(_this$app14$getStore$2, 'core')) === null || _this$app14$getStore$ === void 0 ? void 0 : _this$app14$getStore$.core);
|
|
3688
3804
|
return coreData === null || coreData === void 0 ? void 0 : coreData[key];
|
|
3689
3805
|
}
|
|
3690
3806
|
}, {
|
|
@@ -3735,32 +3851,32 @@ var Server = /*#__PURE__*/function () {
|
|
|
3735
3851
|
}, {
|
|
3736
3852
|
key: "getShortNumberOrDeviceId",
|
|
3737
3853
|
value: function () {
|
|
3738
|
-
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3854
|
+
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
|
|
3739
3855
|
var getAsyncIotDeviceInfo, res;
|
|
3740
|
-
return _regeneratorRuntime().wrap(function
|
|
3741
|
-
while (1) switch (
|
|
3856
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3857
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3742
3858
|
case 0:
|
|
3743
3859
|
getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
|
|
3744
3860
|
if (!getAsyncIotDeviceInfo) {
|
|
3745
|
-
|
|
3861
|
+
_context41.next = 7;
|
|
3746
3862
|
break;
|
|
3747
3863
|
}
|
|
3748
|
-
|
|
3864
|
+
_context41.next = 4;
|
|
3749
3865
|
return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
|
|
3750
3866
|
case 4:
|
|
3751
|
-
res =
|
|
3867
|
+
res = _context41.sent;
|
|
3752
3868
|
if (!(res !== null && res !== void 0 && res.short_number)) {
|
|
3753
|
-
|
|
3869
|
+
_context41.next = 7;
|
|
3754
3870
|
break;
|
|
3755
3871
|
}
|
|
3756
|
-
return
|
|
3872
|
+
return _context41.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
|
|
3757
3873
|
case 7:
|
|
3758
|
-
return
|
|
3874
|
+
return _context41.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
|
|
3759
3875
|
case 8:
|
|
3760
3876
|
case "end":
|
|
3761
|
-
return
|
|
3877
|
+
return _context41.stop();
|
|
3762
3878
|
}
|
|
3763
|
-
},
|
|
3879
|
+
}, _callee41, this);
|
|
3764
3880
|
}));
|
|
3765
3881
|
function getShortNumberOrDeviceId() {
|
|
3766
3882
|
return _getShortNumberOrDeviceId.apply(this, arguments);
|
|
@@ -3787,16 +3903,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
3787
3903
|
}, {
|
|
3788
3904
|
key: "normalizeCheckoutSubmitData",
|
|
3789
3905
|
value: function () {
|
|
3790
|
-
var _normalizeCheckoutSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3906
|
+
var _normalizeCheckoutSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(data, title) {
|
|
3791
3907
|
var next, externalSaleNumber, shouldClearLocalOrderId, hasCheckoutOrderNumbers, localOrder;
|
|
3792
|
-
return _regeneratorRuntime().wrap(function
|
|
3793
|
-
while (1) switch (
|
|
3908
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3909
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3794
3910
|
case 0:
|
|
3795
3911
|
if (!(!data || _typeof(data) !== 'object')) {
|
|
3796
|
-
|
|
3912
|
+
_context42.next = 2;
|
|
3797
3913
|
break;
|
|
3798
3914
|
}
|
|
3799
|
-
return
|
|
3915
|
+
return _context42.abrupt("return", data);
|
|
3800
3916
|
case 2:
|
|
3801
3917
|
next = _objectSpread({}, data);
|
|
3802
3918
|
externalSaleNumber = next.external_sale_number;
|
|
@@ -3804,7 +3920,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3804
3920
|
if (shouldClearLocalOrderId) next.order_id = null;
|
|
3805
3921
|
hasCheckoutOrderNumbers = !this.isBlankCheckoutValue(next.shop_order_number) && !this.isBlankCheckoutValue(next.shop_full_order_number);
|
|
3806
3922
|
if (!hasCheckoutOrderNumbers) {
|
|
3807
|
-
|
|
3923
|
+
_context42.next = 10;
|
|
3808
3924
|
break;
|
|
3809
3925
|
}
|
|
3810
3926
|
this.logInfo("".concat(title, ": checkout \u5DF2\u643A\u5E26\u8BA2\u5355\u53F7\uFF0C\u8DF3\u8FC7\u67E5\u91CD"), {
|
|
@@ -3814,10 +3930,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3814
3930
|
shop_order_number: next.shop_order_number,
|
|
3815
3931
|
shop_full_order_number: next.shop_full_order_number
|
|
3816
3932
|
});
|
|
3817
|
-
return
|
|
3933
|
+
return _context42.abrupt("return", next);
|
|
3818
3934
|
case 10:
|
|
3819
3935
|
if (!this.isBlankCheckoutValue(externalSaleNumber)) {
|
|
3820
|
-
|
|
3936
|
+
_context42.next = 13;
|
|
3821
3937
|
break;
|
|
3822
3938
|
}
|
|
3823
3939
|
if (shouldClearLocalOrderId) {
|
|
@@ -3826,10 +3942,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3826
3942
|
order_id: next.order_id
|
|
3827
3943
|
});
|
|
3828
3944
|
}
|
|
3829
|
-
return
|
|
3945
|
+
return _context42.abrupt("return", next);
|
|
3830
3946
|
case 13:
|
|
3831
3947
|
if (!(!this.order || typeof this.order.getLocalOrderFromMemoryByLookup !== 'function')) {
|
|
3832
|
-
|
|
3948
|
+
_context42.next = 16;
|
|
3833
3949
|
break;
|
|
3834
3950
|
}
|
|
3835
3951
|
if (shouldClearLocalOrderId) {
|
|
@@ -3838,12 +3954,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
3838
3954
|
external_sale_number: externalSaleNumber
|
|
3839
3955
|
});
|
|
3840
3956
|
}
|
|
3841
|
-
return
|
|
3957
|
+
return _context42.abrupt("return", next);
|
|
3842
3958
|
case 16:
|
|
3843
|
-
|
|
3959
|
+
_context42.prev = 16;
|
|
3844
3960
|
localOrder = this.order.getLocalOrderFromMemoryByLookup(externalSaleNumber);
|
|
3845
3961
|
if (localOrder) {
|
|
3846
|
-
|
|
3962
|
+
_context42.next = 21;
|
|
3847
3963
|
break;
|
|
3848
3964
|
}
|
|
3849
3965
|
if (shouldClearLocalOrderId) {
|
|
@@ -3853,7 +3969,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3853
3969
|
localOrderFound: false
|
|
3854
3970
|
});
|
|
3855
3971
|
}
|
|
3856
|
-
return
|
|
3972
|
+
return _context42.abrupt("return", next);
|
|
3857
3973
|
case 21:
|
|
3858
3974
|
if (this.isBlankCheckoutValue(next.shop_order_number)) {
|
|
3859
3975
|
next.shop_order_number = localOrder.shop_order_number;
|
|
@@ -3869,23 +3985,23 @@ var Server = /*#__PURE__*/function () {
|
|
|
3869
3985
|
shop_order_number: next.shop_order_number,
|
|
3870
3986
|
shop_full_order_number: next.shop_full_order_number
|
|
3871
3987
|
});
|
|
3872
|
-
return
|
|
3988
|
+
return _context42.abrupt("return", next);
|
|
3873
3989
|
case 27:
|
|
3874
|
-
|
|
3875
|
-
|
|
3990
|
+
_context42.prev = 27;
|
|
3991
|
+
_context42.t0 = _context42["catch"](16);
|
|
3876
3992
|
this.logWarning("".concat(title, ": checkout \u67E5\u627E\u672C\u5730\u8BA2\u5355\u5931\u8D25"), {
|
|
3877
3993
|
external_sale_number: externalSaleNumber,
|
|
3878
|
-
error: this.getUnknownErrorMessage(
|
|
3879
|
-
error_detail: this.normalizeUnknownError(
|
|
3994
|
+
error: this.getUnknownErrorMessage(_context42.t0),
|
|
3995
|
+
error_detail: this.normalizeUnknownError(_context42.t0)
|
|
3880
3996
|
});
|
|
3881
|
-
return
|
|
3997
|
+
return _context42.abrupt("return", next);
|
|
3882
3998
|
case 31:
|
|
3883
3999
|
case "end":
|
|
3884
|
-
return
|
|
4000
|
+
return _context42.stop();
|
|
3885
4001
|
}
|
|
3886
|
-
},
|
|
4002
|
+
}, _callee42, this, [[16, 27]]);
|
|
3887
4003
|
}));
|
|
3888
|
-
function normalizeCheckoutSubmitData(
|
|
4004
|
+
function normalizeCheckoutSubmitData(_x44, _x45) {
|
|
3889
4005
|
return _normalizeCheckoutSubmitData.apply(this, arguments);
|
|
3890
4006
|
}
|
|
3891
4007
|
return normalizeCheckoutSubmitData;
|
|
@@ -3893,81 +4009,81 @@ var Server = /*#__PURE__*/function () {
|
|
|
3893
4009
|
}, {
|
|
3894
4010
|
key: "ensureCheckoutOrderNumbers",
|
|
3895
4011
|
value: function () {
|
|
3896
|
-
var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4012
|
+
var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(data, title) {
|
|
3897
4013
|
var next, needsShopOrderNumber, needsShopFullOrderNumber, idGenerator;
|
|
3898
|
-
return _regeneratorRuntime().wrap(function
|
|
3899
|
-
while (1) switch (
|
|
4014
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4015
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3900
4016
|
case 0:
|
|
3901
4017
|
if (!(!data || _typeof(data) !== 'object')) {
|
|
3902
|
-
|
|
4018
|
+
_context43.next = 2;
|
|
3903
4019
|
break;
|
|
3904
4020
|
}
|
|
3905
|
-
return
|
|
4021
|
+
return _context43.abrupt("return", data);
|
|
3906
4022
|
case 2:
|
|
3907
4023
|
next = _objectSpread({}, data);
|
|
3908
4024
|
needsShopOrderNumber = next.shop_order_number === undefined || next.shop_order_number === null || next.shop_order_number === '';
|
|
3909
4025
|
needsShopFullOrderNumber = next.shop_full_order_number === undefined || next.shop_full_order_number === null || next.shop_full_order_number === '';
|
|
3910
4026
|
if (!(!needsShopOrderNumber && !needsShopFullOrderNumber)) {
|
|
3911
|
-
|
|
4027
|
+
_context43.next = 7;
|
|
3912
4028
|
break;
|
|
3913
4029
|
}
|
|
3914
|
-
return
|
|
4030
|
+
return _context43.abrupt("return", next);
|
|
3915
4031
|
case 7:
|
|
3916
4032
|
idGenerator = this.getIdGeneratorPlugin();
|
|
3917
4033
|
if (idGenerator) {
|
|
3918
|
-
|
|
4034
|
+
_context43.next = 11;
|
|
3919
4035
|
break;
|
|
3920
4036
|
}
|
|
3921
4037
|
this.logWarning("".concat(title, ": idGenerator \u63D2\u4EF6\u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u751F\u6210\u8BA2\u5355\u53F7"), {
|
|
3922
4038
|
needsShopOrderNumber: needsShopOrderNumber,
|
|
3923
4039
|
needsShopFullOrderNumber: needsShopFullOrderNumber
|
|
3924
4040
|
});
|
|
3925
|
-
return
|
|
4041
|
+
return _context43.abrupt("return", next);
|
|
3926
4042
|
case 11:
|
|
3927
|
-
|
|
4043
|
+
_context43.prev = 11;
|
|
3928
4044
|
if (!(needsShopOrderNumber && idGenerator.generateShopOrderNumber)) {
|
|
3929
|
-
|
|
4045
|
+
_context43.next = 16;
|
|
3930
4046
|
break;
|
|
3931
4047
|
}
|
|
3932
|
-
|
|
4048
|
+
_context43.next = 15;
|
|
3933
4049
|
return idGenerator.generateShopOrderNumber({
|
|
3934
4050
|
biz: next.business_code || 'ticket'
|
|
3935
4051
|
});
|
|
3936
4052
|
case 15:
|
|
3937
|
-
next.shop_order_number =
|
|
4053
|
+
next.shop_order_number = _context43.sent;
|
|
3938
4054
|
case 16:
|
|
3939
4055
|
if (!(needsShopFullOrderNumber && idGenerator.generateReceiptId)) {
|
|
3940
|
-
|
|
4056
|
+
_context43.next = 20;
|
|
3941
4057
|
break;
|
|
3942
4058
|
}
|
|
3943
|
-
|
|
4059
|
+
_context43.next = 19;
|
|
3944
4060
|
return idGenerator.generateReceiptId({
|
|
3945
4061
|
biz: next.business_code || 'ticket'
|
|
3946
4062
|
});
|
|
3947
4063
|
case 19:
|
|
3948
|
-
next.shop_full_order_number =
|
|
4064
|
+
next.shop_full_order_number = _context43.sent;
|
|
3949
4065
|
case 20:
|
|
3950
4066
|
this.logInfo("".concat(title, ": checkout \u8BA2\u5355\u53F7\u5DF2\u51C6\u5907"), {
|
|
3951
4067
|
shop_order_number: next.shop_order_number,
|
|
3952
4068
|
shop_full_order_number: next.shop_full_order_number
|
|
3953
4069
|
});
|
|
3954
|
-
|
|
4070
|
+
_context43.next = 26;
|
|
3955
4071
|
break;
|
|
3956
4072
|
case 23:
|
|
3957
|
-
|
|
3958
|
-
|
|
4073
|
+
_context43.prev = 23;
|
|
4074
|
+
_context43.t0 = _context43["catch"](11);
|
|
3959
4075
|
this.logError("".concat(title, ": \u751F\u6210 checkout \u8BA2\u5355\u53F7\u5931\u8D25"), {
|
|
3960
|
-
error:
|
|
4076
|
+
error: _context43.t0 instanceof Error ? _context43.t0.message : String(_context43.t0)
|
|
3961
4077
|
});
|
|
3962
4078
|
case 26:
|
|
3963
|
-
return
|
|
4079
|
+
return _context43.abrupt("return", next);
|
|
3964
4080
|
case 27:
|
|
3965
4081
|
case "end":
|
|
3966
|
-
return
|
|
4082
|
+
return _context43.stop();
|
|
3967
4083
|
}
|
|
3968
|
-
},
|
|
4084
|
+
}, _callee43, this, [[11, 23]]);
|
|
3969
4085
|
}));
|
|
3970
|
-
function ensureCheckoutOrderNumbers(
|
|
4086
|
+
function ensureCheckoutOrderNumbers(_x46, _x47) {
|
|
3971
4087
|
return _ensureCheckoutOrderNumbers.apply(this, arguments);
|
|
3972
4088
|
}
|
|
3973
4089
|
return ensureCheckoutOrderNumbers;
|
|
@@ -3975,27 +4091,27 @@ var Server = /*#__PURE__*/function () {
|
|
|
3975
4091
|
}, {
|
|
3976
4092
|
key: "dispatchCheckoutSyncTask",
|
|
3977
4093
|
value: function () {
|
|
3978
|
-
var _dispatchCheckoutSyncTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4094
|
+
var _dispatchCheckoutSyncTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
3979
4095
|
var deviceTask, debugDeviceId, debugIdempotencyKey, _params$data, _params$data2, _params$data3, _params$data4, result;
|
|
3980
|
-
return _regeneratorRuntime().wrap(function
|
|
3981
|
-
while (1) switch (
|
|
4096
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4097
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3982
4098
|
case 0:
|
|
3983
4099
|
this.registerDeviceTaskActions();
|
|
3984
4100
|
deviceTask = this.getDeviceTaskPlugin();
|
|
3985
|
-
|
|
4101
|
+
_context44.next = 4;
|
|
3986
4102
|
return this.getShortNumberOrDeviceId();
|
|
3987
4103
|
case 4:
|
|
3988
|
-
debugDeviceId =
|
|
4104
|
+
debugDeviceId = _context44.sent;
|
|
3989
4105
|
debugIdempotencyKey = this.buildCheckoutTaskIdempotencyKey(params.data);
|
|
3990
4106
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
3991
|
-
|
|
4107
|
+
_context44.next = 9;
|
|
3992
4108
|
break;
|
|
3993
4109
|
}
|
|
3994
4110
|
this.logError("".concat(params.title, ": deviceTask.dispatch \u4E0D\u53EF\u7528"));
|
|
3995
|
-
return
|
|
4111
|
+
return _context44.abrupt("return");
|
|
3996
4112
|
case 9:
|
|
3997
|
-
|
|
3998
|
-
|
|
4113
|
+
_context44.prev = 9;
|
|
4114
|
+
_context44.next = 12;
|
|
3999
4115
|
return deviceTask.dispatch({
|
|
4000
4116
|
action: 'sync_sales',
|
|
4001
4117
|
device_id: debugDeviceId,
|
|
@@ -4013,27 +4129,27 @@ var Server = /*#__PURE__*/function () {
|
|
|
4013
4129
|
source_id: ((_params$data2 = params.data) === null || _params$data2 === void 0 ? void 0 : _params$data2.order_id) || ((_params$data3 = params.data) === null || _params$data3 === void 0 ? void 0 : _params$data3.external_sale_number) || ((_params$data4 = params.data) === null || _params$data4 === void 0 ? void 0 : _params$data4.shop_order_number)
|
|
4014
4130
|
});
|
|
4015
4131
|
case 12:
|
|
4016
|
-
result =
|
|
4132
|
+
result = _context44.sent;
|
|
4017
4133
|
this.logInfo("".concat(params.title, ": sync_sales \u4EFB\u52A1\u5DF2\u6D3E\u53D1"), {
|
|
4018
4134
|
uuid: result === null || result === void 0 ? void 0 : result.uuid,
|
|
4019
4135
|
status: result === null || result === void 0 ? void 0 : result.status,
|
|
4020
4136
|
reused: result === null || result === void 0 ? void 0 : result.reused
|
|
4021
4137
|
});
|
|
4022
|
-
|
|
4138
|
+
_context44.next = 19;
|
|
4023
4139
|
break;
|
|
4024
4140
|
case 16:
|
|
4025
|
-
|
|
4026
|
-
|
|
4141
|
+
_context44.prev = 16;
|
|
4142
|
+
_context44.t0 = _context44["catch"](9);
|
|
4027
4143
|
this.logError("".concat(params.title, ": \u6D3E\u53D1 sync_sales \u4EFB\u52A1\u5931\u8D25"), {
|
|
4028
|
-
error:
|
|
4144
|
+
error: _context44.t0 instanceof Error ? _context44.t0.message : String(_context44.t0)
|
|
4029
4145
|
});
|
|
4030
4146
|
case 19:
|
|
4031
4147
|
case "end":
|
|
4032
|
-
return
|
|
4148
|
+
return _context44.stop();
|
|
4033
4149
|
}
|
|
4034
|
-
},
|
|
4150
|
+
}, _callee44, this, [[9, 16]]);
|
|
4035
4151
|
}));
|
|
4036
|
-
function dispatchCheckoutSyncTask(
|
|
4152
|
+
function dispatchCheckoutSyncTask(_x48) {
|
|
4037
4153
|
return _dispatchCheckoutSyncTask.apply(this, arguments);
|
|
4038
4154
|
}
|
|
4039
4155
|
return dispatchCheckoutSyncTask;
|
|
@@ -4041,26 +4157,26 @@ var Server = /*#__PURE__*/function () {
|
|
|
4041
4157
|
}, {
|
|
4042
4158
|
key: "dispatchPrintOtherReceiptTask",
|
|
4043
4159
|
value: function () {
|
|
4044
|
-
var _dispatchPrintOtherReceiptTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4160
|
+
var _dispatchPrintOtherReceiptTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
|
|
4045
4161
|
var deviceTask, _params$deviceId, _params$syncedOrder, _params$syncedOrder2, _params$syncedOrder3, printIdentity, deviceId;
|
|
4046
|
-
return _regeneratorRuntime().wrap(function
|
|
4047
|
-
while (1) switch (
|
|
4162
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
4163
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4048
4164
|
case 0:
|
|
4049
4165
|
deviceTask = this.getDeviceTaskPlugin();
|
|
4050
4166
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
4051
|
-
|
|
4167
|
+
_context45.next = 4;
|
|
4052
4168
|
break;
|
|
4053
4169
|
}
|
|
4054
4170
|
this.logWarning('dispatchPrintOtherReceiptTask: deviceTask.dispatch 不可用');
|
|
4055
|
-
return
|
|
4171
|
+
return _context45.abrupt("return");
|
|
4056
4172
|
case 4:
|
|
4057
|
-
|
|
4173
|
+
_context45.prev = 4;
|
|
4058
4174
|
printIdentity = this.getPrintOrderIdentity(params.syncedOrder);
|
|
4059
|
-
|
|
4175
|
+
_context45.next = 8;
|
|
4060
4176
|
return this.getShortNumberOrDeviceId();
|
|
4061
4177
|
case 8:
|
|
4062
|
-
deviceId =
|
|
4063
|
-
|
|
4178
|
+
deviceId = _context45.sent;
|
|
4179
|
+
_context45.next = 11;
|
|
4064
4180
|
return deviceTask.dispatch({
|
|
4065
4181
|
action: 'print_all',
|
|
4066
4182
|
device_id: (_params$deviceId = params.deviceId) !== null && _params$deviceId !== void 0 ? _params$deviceId : deviceId,
|
|
@@ -4085,21 +4201,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
4085
4201
|
source_id: printIdentity
|
|
4086
4202
|
});
|
|
4087
4203
|
case 11:
|
|
4088
|
-
|
|
4204
|
+
_context45.next = 16;
|
|
4089
4205
|
break;
|
|
4090
4206
|
case 13:
|
|
4091
|
-
|
|
4092
|
-
|
|
4207
|
+
_context45.prev = 13;
|
|
4208
|
+
_context45.t0 = _context45["catch"](4);
|
|
4093
4209
|
this.logError('dispatchPrintOtherReceiptTask: 派发失败', {
|
|
4094
|
-
error:
|
|
4210
|
+
error: _context45.t0 instanceof Error ? _context45.t0.message : String(_context45.t0)
|
|
4095
4211
|
});
|
|
4096
4212
|
case 16:
|
|
4097
4213
|
case "end":
|
|
4098
|
-
return
|
|
4214
|
+
return _context45.stop();
|
|
4099
4215
|
}
|
|
4100
|
-
},
|
|
4216
|
+
}, _callee45, this, [[4, 13]]);
|
|
4101
4217
|
}));
|
|
4102
|
-
function dispatchPrintOtherReceiptTask(
|
|
4218
|
+
function dispatchPrintOtherReceiptTask(_x49) {
|
|
4103
4219
|
return _dispatchPrintOtherReceiptTask.apply(this, arguments);
|
|
4104
4220
|
}
|
|
4105
4221
|
return dispatchPrintOtherReceiptTask;
|
|
@@ -4119,38 +4235,38 @@ var Server = /*#__PURE__*/function () {
|
|
|
4119
4235
|
}, {
|
|
4120
4236
|
key: "dispatchLocalReceiptPrint",
|
|
4121
4237
|
value: function () {
|
|
4122
|
-
var _dispatchLocalReceiptPrint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4238
|
+
var _dispatchLocalReceiptPrint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
|
|
4123
4239
|
var _payment_info;
|
|
4124
4240
|
var printableOrder;
|
|
4125
|
-
return _regeneratorRuntime().wrap(function
|
|
4126
|
-
while (1) switch (
|
|
4241
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
4242
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
4127
4243
|
case 0:
|
|
4128
4244
|
if (!(params.requireFullyPaid && !this.isSalesOrderFullyPaid(params.order))) {
|
|
4129
|
-
|
|
4245
|
+
_context46.next = 2;
|
|
4130
4246
|
break;
|
|
4131
4247
|
}
|
|
4132
|
-
return
|
|
4248
|
+
return _context46.abrupt("return", {
|
|
4133
4249
|
printed: false,
|
|
4134
4250
|
order: params.order
|
|
4135
4251
|
});
|
|
4136
4252
|
case 2:
|
|
4137
|
-
|
|
4253
|
+
_context46.next = 4;
|
|
4138
4254
|
return this.withLocalSmallTicketData(params.order, {
|
|
4139
4255
|
requireFullyPaid: params.requireFullyPaid
|
|
4140
4256
|
});
|
|
4141
4257
|
case 4:
|
|
4142
|
-
printableOrder =
|
|
4258
|
+
printableOrder = _context46.sent;
|
|
4143
4259
|
if (hasSmallTicketData((_payment_info = printableOrder.payment_info) === null || _payment_info === void 0 ? void 0 : _payment_info.small_ticket_data)) {
|
|
4144
|
-
|
|
4260
|
+
_context46.next = 7;
|
|
4145
4261
|
break;
|
|
4146
4262
|
}
|
|
4147
|
-
return
|
|
4263
|
+
return _context46.abrupt("return", {
|
|
4148
4264
|
printed: false,
|
|
4149
4265
|
order: printableOrder
|
|
4150
4266
|
});
|
|
4151
4267
|
case 7:
|
|
4152
4268
|
debugger;
|
|
4153
|
-
|
|
4269
|
+
_context46.next = 10;
|
|
4154
4270
|
return this.dispatchPrintOtherReceiptTask({
|
|
4155
4271
|
checkoutData: params.checkoutData,
|
|
4156
4272
|
syncedOrder: printableOrder,
|
|
@@ -4158,17 +4274,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
4158
4274
|
receiptOnly: true
|
|
4159
4275
|
});
|
|
4160
4276
|
case 10:
|
|
4161
|
-
return
|
|
4277
|
+
return _context46.abrupt("return", {
|
|
4162
4278
|
printed: true,
|
|
4163
4279
|
order: printableOrder
|
|
4164
4280
|
});
|
|
4165
4281
|
case 11:
|
|
4166
4282
|
case "end":
|
|
4167
|
-
return
|
|
4283
|
+
return _context46.stop();
|
|
4168
4284
|
}
|
|
4169
|
-
},
|
|
4285
|
+
}, _callee46, this);
|
|
4170
4286
|
}));
|
|
4171
|
-
function dispatchLocalReceiptPrint(
|
|
4287
|
+
function dispatchLocalReceiptPrint(_x50) {
|
|
4172
4288
|
return _dispatchLocalReceiptPrint.apply(this, arguments);
|
|
4173
4289
|
}
|
|
4174
4290
|
return dispatchLocalReceiptPrint;
|
|
@@ -4195,10 +4311,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
4195
4311
|
}, {
|
|
4196
4312
|
key: "handleOrderCheckoutSubmit",
|
|
4197
4313
|
value: function () {
|
|
4198
|
-
var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4314
|
+
var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
|
|
4199
4315
|
var backendPath, data, title, normalizedData, checkoutData, pendingResult, pendingOrder;
|
|
4200
|
-
return _regeneratorRuntime().wrap(function
|
|
4201
|
-
while (1) switch (
|
|
4316
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4317
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
4202
4318
|
case 0:
|
|
4203
4319
|
backendPath = params.backendPath, data = params.data, title = params.title;
|
|
4204
4320
|
this.logInfo("".concat(title, ": \u5F00\u59CB\u5904\u7406"), {
|
|
@@ -4207,25 +4323,35 @@ var Server = /*#__PURE__*/function () {
|
|
|
4207
4323
|
external_sale_number: data === null || data === void 0 ? void 0 : data.external_sale_number,
|
|
4208
4324
|
order_number: data === null || data === void 0 ? void 0 : data.order_number
|
|
4209
4325
|
});
|
|
4210
|
-
|
|
4211
|
-
|
|
4326
|
+
if (!(data !== null && data !== void 0 && data.sync_mode || data !== null && data !== void 0 && data.syncMode)) {
|
|
4327
|
+
_context47.next = 4;
|
|
4328
|
+
break;
|
|
4329
|
+
}
|
|
4330
|
+
return _context47.abrupt("return", this.handleSyncCheckoutSubmit({
|
|
4331
|
+
backendPath: backendPath,
|
|
4332
|
+
data: data,
|
|
4333
|
+
title: title
|
|
4334
|
+
}));
|
|
4212
4335
|
case 4:
|
|
4213
|
-
|
|
4214
|
-
|
|
4336
|
+
_context47.next = 6;
|
|
4337
|
+
return this.normalizeCheckoutSubmitData(data, title);
|
|
4338
|
+
case 6:
|
|
4339
|
+
normalizedData = _context47.sent;
|
|
4340
|
+
_context47.next = 9;
|
|
4215
4341
|
return this.ensureCheckoutOrderNumbers(normalizedData, title);
|
|
4216
|
-
case
|
|
4217
|
-
checkoutData =
|
|
4218
|
-
|
|
4342
|
+
case 9:
|
|
4343
|
+
checkoutData = _context47.sent;
|
|
4344
|
+
_context47.next = 12;
|
|
4219
4345
|
return this.handlePendingSyncCheckoutOrder({
|
|
4220
4346
|
backendPath: backendPath,
|
|
4221
4347
|
data: checkoutData,
|
|
4222
4348
|
title: title,
|
|
4223
4349
|
reason: 'checkout 已转入设备任务同步'
|
|
4224
4350
|
});
|
|
4225
|
-
case
|
|
4226
|
-
pendingResult =
|
|
4351
|
+
case 12:
|
|
4352
|
+
pendingResult = _context47.sent;
|
|
4227
4353
|
if (!((pendingResult === null || pendingResult === void 0 ? void 0 : pendingResult.status) === true)) {
|
|
4228
|
-
|
|
4354
|
+
_context47.next = 20;
|
|
4229
4355
|
break;
|
|
4230
4356
|
}
|
|
4231
4357
|
pendingOrder = pendingResult.data;
|
|
@@ -4233,69 +4359,151 @@ var Server = /*#__PURE__*/function () {
|
|
|
4233
4359
|
// TODO 这里先加个兼容,只有 type 为 virtual 才走打印
|
|
4234
4360
|
// 后期需要迁移到 picoding ,根据工作流配置
|
|
4235
4361
|
checkoutData.type === 'virtual')) {
|
|
4236
|
-
|
|
4362
|
+
_context47.next = 18;
|
|
4237
4363
|
break;
|
|
4238
4364
|
}
|
|
4239
|
-
|
|
4365
|
+
_context47.next = 18;
|
|
4240
4366
|
return this.dispatchLocalReceiptPrint({
|
|
4241
4367
|
checkoutData: checkoutData,
|
|
4242
4368
|
order: pendingOrder,
|
|
4243
4369
|
response: pendingResult,
|
|
4244
4370
|
requireFullyPaid: true
|
|
4245
4371
|
});
|
|
4246
|
-
case
|
|
4247
|
-
|
|
4372
|
+
case 18:
|
|
4373
|
+
_context47.next = 20;
|
|
4248
4374
|
return this.dispatchCheckoutSyncTask({
|
|
4249
4375
|
backendPath: backendPath,
|
|
4250
4376
|
data: checkoutData,
|
|
4251
4377
|
title: title
|
|
4252
4378
|
});
|
|
4253
|
-
case
|
|
4379
|
+
case 20:
|
|
4254
4380
|
if (pendingResult.data.order_id) {
|
|
4255
|
-
|
|
4381
|
+
_context47.next = 22;
|
|
4256
4382
|
break;
|
|
4257
4383
|
}
|
|
4258
|
-
return
|
|
4384
|
+
return _context47.abrupt("return", _objectSpread(_objectSpread({}, pendingResult), {}, {
|
|
4259
4385
|
data: _objectSpread(_objectSpread({}, pendingResult.data), {}, {
|
|
4260
4386
|
order_id: pendingResult.data.external_sale_number
|
|
4261
4387
|
})
|
|
4262
4388
|
}));
|
|
4263
|
-
case
|
|
4264
|
-
return
|
|
4265
|
-
case
|
|
4389
|
+
case 22:
|
|
4390
|
+
return _context47.abrupt("return", pendingResult);
|
|
4391
|
+
case 23:
|
|
4266
4392
|
case "end":
|
|
4267
|
-
return
|
|
4393
|
+
return _context47.stop();
|
|
4268
4394
|
}
|
|
4269
|
-
},
|
|
4395
|
+
}, _callee47, this);
|
|
4270
4396
|
}));
|
|
4271
|
-
function handleOrderCheckoutSubmit(
|
|
4397
|
+
function handleOrderCheckoutSubmit(_x51) {
|
|
4272
4398
|
return _handleOrderCheckoutSubmit.apply(this, arguments);
|
|
4273
4399
|
}
|
|
4274
4400
|
return handleOrderCheckoutSubmit;
|
|
4275
4401
|
}()
|
|
4402
|
+
}, {
|
|
4403
|
+
key: "handleSyncCheckoutSubmit",
|
|
4404
|
+
value: function () {
|
|
4405
|
+
var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
|
|
4406
|
+
var _this$app15;
|
|
4407
|
+
var backendPath, data, title, syncResult, _normalized$data, normalized, backendError, _normalized$data2, _normalized, message;
|
|
4408
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
4409
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
4410
|
+
case 0:
|
|
4411
|
+
backendPath = params.backendPath, data = params.data, title = params.title;
|
|
4412
|
+
if ((_this$app15 = this.app) !== null && _this$app15 !== void 0 && (_this$app15 = _this$app15.request) !== null && _this$app15 !== void 0 && _this$app15.post) {
|
|
4413
|
+
_context48.next = 4;
|
|
4414
|
+
break;
|
|
4415
|
+
}
|
|
4416
|
+
this.logError("".concat(title, ": sync checkout app.request \u4E0D\u53EF\u7528"));
|
|
4417
|
+
return _context48.abrupt("return", {
|
|
4418
|
+
code: 500,
|
|
4419
|
+
status: false,
|
|
4420
|
+
message: 'app.request 不可用',
|
|
4421
|
+
data: null
|
|
4422
|
+
});
|
|
4423
|
+
case 4:
|
|
4424
|
+
_context48.prev = 4;
|
|
4425
|
+
_context48.next = 7;
|
|
4426
|
+
return this.runCheckoutSync({
|
|
4427
|
+
backendPath: backendPath,
|
|
4428
|
+
data: data,
|
|
4429
|
+
title: title,
|
|
4430
|
+
persistCheckoutDataWithResponse: true
|
|
4431
|
+
});
|
|
4432
|
+
case 7:
|
|
4433
|
+
syncResult = _context48.sent;
|
|
4434
|
+
if (!syncResult.rejected) {
|
|
4435
|
+
_context48.next = 11;
|
|
4436
|
+
break;
|
|
4437
|
+
}
|
|
4438
|
+
normalized = this.normalizeCheckoutResponse(syncResult.errorResponse);
|
|
4439
|
+
return _context48.abrupt("return", _objectSpread(_objectSpread({}, normalized), {}, {
|
|
4440
|
+
status: false,
|
|
4441
|
+
message: syncResult.message || (normalized === null || normalized === void 0 ? void 0 : normalized.message) || '后端明确拒绝 checkout',
|
|
4442
|
+
data: (_normalized$data = normalized === null || normalized === void 0 ? void 0 : normalized.data) !== null && _normalized$data !== void 0 ? _normalized$data : null
|
|
4443
|
+
}));
|
|
4444
|
+
case 11:
|
|
4445
|
+
return _context48.abrupt("return", this.withSyncedOrderIdInCheckoutResponse(syncResult.normalizedResponse, syncResult.syncedOrder));
|
|
4446
|
+
case 14:
|
|
4447
|
+
_context48.prev = 14;
|
|
4448
|
+
_context48.t0 = _context48["catch"](4);
|
|
4449
|
+
backendError = this.extractBackendErrorResponse(_context48.t0);
|
|
4450
|
+
if (!backendError) {
|
|
4451
|
+
_context48.next = 20;
|
|
4452
|
+
break;
|
|
4453
|
+
}
|
|
4454
|
+
_normalized = this.normalizeCheckoutResponse(backendError);
|
|
4455
|
+
return _context48.abrupt("return", _objectSpread(_objectSpread({}, _normalized), {}, {
|
|
4456
|
+
status: false,
|
|
4457
|
+
message: (backendError === null || backendError === void 0 ? void 0 : backendError.message) || (_normalized === null || _normalized === void 0 ? void 0 : _normalized.message) || '后端明确拒绝 checkout',
|
|
4458
|
+
data: (_normalized$data2 = _normalized === null || _normalized === void 0 ? void 0 : _normalized.data) !== null && _normalized$data2 !== void 0 ? _normalized$data2 : null
|
|
4459
|
+
}));
|
|
4460
|
+
case 20:
|
|
4461
|
+
message = this.getUnknownErrorMessage(_context48.t0);
|
|
4462
|
+
this.logError("".concat(title, ": sync checkout \u8BF7\u6C42\u672A\u660E\u786E\u6210\u529F"), {
|
|
4463
|
+
backendPath: backendPath,
|
|
4464
|
+
error: message,
|
|
4465
|
+
error_detail: this.normalizeUnknownError(_context48.t0)
|
|
4466
|
+
});
|
|
4467
|
+
return _context48.abrupt("return", {
|
|
4468
|
+
code: 500,
|
|
4469
|
+
status: false,
|
|
4470
|
+
message: message,
|
|
4471
|
+
data: null
|
|
4472
|
+
});
|
|
4473
|
+
case 23:
|
|
4474
|
+
case "end":
|
|
4475
|
+
return _context48.stop();
|
|
4476
|
+
}
|
|
4477
|
+
}, _callee48, this, [[4, 14]]);
|
|
4478
|
+
}));
|
|
4479
|
+
function handleSyncCheckoutSubmit(_x52) {
|
|
4480
|
+
return _handleSyncCheckoutSubmit.apply(this, arguments);
|
|
4481
|
+
}
|
|
4482
|
+
return handleSyncCheckoutSubmit;
|
|
4483
|
+
}()
|
|
4276
4484
|
}, {
|
|
4277
4485
|
key: "handlePendingSyncCheckoutOrder",
|
|
4278
4486
|
value: function () {
|
|
4279
|
-
var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4487
|
+
var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
|
|
4280
4488
|
var _this10 = this;
|
|
4281
4489
|
var backendPath, data, title, reason, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
|
|
4282
|
-
return _regeneratorRuntime().wrap(function
|
|
4283
|
-
while (1) switch (
|
|
4490
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4491
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
4284
4492
|
case 0:
|
|
4285
4493
|
backendPath = params.backendPath, data = params.data, title = params.title, reason = params.reason;
|
|
4286
|
-
|
|
4494
|
+
_context49.next = 3;
|
|
4287
4495
|
return this.buildPendingSyncCheckoutOrder(data);
|
|
4288
4496
|
case 3:
|
|
4289
|
-
pendingOrder =
|
|
4497
|
+
pendingOrder = _context49.sent;
|
|
4290
4498
|
if (pendingOrder) {
|
|
4291
|
-
|
|
4499
|
+
_context49.next = 7;
|
|
4292
4500
|
break;
|
|
4293
4501
|
}
|
|
4294
4502
|
this.logError("".concat(title, ": checkout \u5931\u8D25\u4E14\u8BA2\u5355\u7F3A\u5C11\u672C\u5730\u5B58\u50A8\u6807\u8BC6"), {
|
|
4295
4503
|
backendPath: backendPath,
|
|
4296
4504
|
reason: reason
|
|
4297
4505
|
});
|
|
4298
|
-
return
|
|
4506
|
+
return _context49.abrupt("return", {
|
|
4299
4507
|
code: 500,
|
|
4300
4508
|
status: false,
|
|
4301
4509
|
message: '订单缺少本地存储标识,无法写入待同步队列',
|
|
@@ -4303,22 +4511,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
4303
4511
|
});
|
|
4304
4512
|
case 7:
|
|
4305
4513
|
if (!(!this.order || typeof this.order.upsertPendingSyncOrders !== 'function')) {
|
|
4306
|
-
|
|
4514
|
+
_context49.next = 10;
|
|
4307
4515
|
break;
|
|
4308
4516
|
}
|
|
4309
4517
|
this.logError("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u5F85\u540C\u6B65\u5199\u5165"), {
|
|
4310
4518
|
backendPath: backendPath,
|
|
4311
4519
|
reason: reason
|
|
4312
4520
|
});
|
|
4313
|
-
return
|
|
4521
|
+
return _context49.abrupt("return", {
|
|
4314
4522
|
code: 500,
|
|
4315
4523
|
status: false,
|
|
4316
4524
|
message: 'Order 模块不支持本地待同步写入',
|
|
4317
4525
|
data: null
|
|
4318
4526
|
});
|
|
4319
4527
|
case 10:
|
|
4320
|
-
|
|
4321
|
-
|
|
4528
|
+
_context49.prev = 10;
|
|
4529
|
+
_context49.next = 13;
|
|
4322
4530
|
return this.order.upsertPendingSyncOrders([pendingOrder]);
|
|
4323
4531
|
case 13:
|
|
4324
4532
|
this.logInfo("".concat(title, ": \u8BA2\u5355\u5DF2\u5199\u5165\u672C\u5730\u5F85\u540C\u6B65"), {
|
|
@@ -4332,7 +4540,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4332
4540
|
var _payment$metadata;
|
|
4333
4541
|
return sum + _this10.toAmountNumber(payment === null || payment === void 0 || (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.change_given_amount);
|
|
4334
4542
|
}, 0);
|
|
4335
|
-
return
|
|
4543
|
+
return _context49.abrupt("return", {
|
|
4336
4544
|
code: 200,
|
|
4337
4545
|
status: true,
|
|
4338
4546
|
message: '',
|
|
@@ -4347,15 +4555,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
4347
4555
|
})
|
|
4348
4556
|
});
|
|
4349
4557
|
case 18:
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
errorMessage =
|
|
4558
|
+
_context49.prev = 18;
|
|
4559
|
+
_context49.t0 = _context49["catch"](10);
|
|
4560
|
+
errorMessage = _context49.t0 instanceof Error ? _context49.t0.message : String(_context49.t0);
|
|
4353
4561
|
this.logError("".concat(title, ": \u5199\u5165\u672C\u5730\u5F85\u540C\u6B65\u8BA2\u5355\u5931\u8D25"), {
|
|
4354
4562
|
backendPath: backendPath,
|
|
4355
4563
|
reason: reason,
|
|
4356
4564
|
error: errorMessage
|
|
4357
4565
|
});
|
|
4358
|
-
return
|
|
4566
|
+
return _context49.abrupt("return", {
|
|
4359
4567
|
code: 500,
|
|
4360
4568
|
status: false,
|
|
4361
4569
|
message: errorMessage,
|
|
@@ -4363,11 +4571,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4363
4571
|
});
|
|
4364
4572
|
case 23:
|
|
4365
4573
|
case "end":
|
|
4366
|
-
return
|
|
4574
|
+
return _context49.stop();
|
|
4367
4575
|
}
|
|
4368
|
-
},
|
|
4576
|
+
}, _callee49, this, [[10, 18]]);
|
|
4369
4577
|
}));
|
|
4370
|
-
function handlePendingSyncCheckoutOrder(
|
|
4578
|
+
function handlePendingSyncCheckoutOrder(_x53) {
|
|
4371
4579
|
return _handlePendingSyncCheckoutOrder.apply(this, arguments);
|
|
4372
4580
|
}
|
|
4373
4581
|
return handlePendingSyncCheckoutOrder;
|
|
@@ -4375,43 +4583,43 @@ var Server = /*#__PURE__*/function () {
|
|
|
4375
4583
|
}, {
|
|
4376
4584
|
key: "buildPendingSyncCheckoutOrder",
|
|
4377
4585
|
value: function () {
|
|
4378
|
-
var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4586
|
+
var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(data) {
|
|
4379
4587
|
var hasStorageKey, pendingOrder, productMap, orderWithProductTitles;
|
|
4380
|
-
return _regeneratorRuntime().wrap(function
|
|
4381
|
-
while (1) switch (
|
|
4588
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
4589
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
4382
4590
|
case 0:
|
|
4383
4591
|
if (!(!data || _typeof(data) !== 'object')) {
|
|
4384
|
-
|
|
4592
|
+
_context50.next = 2;
|
|
4385
4593
|
break;
|
|
4386
4594
|
}
|
|
4387
|
-
return
|
|
4595
|
+
return _context50.abrupt("return", null);
|
|
4388
4596
|
case 2:
|
|
4389
4597
|
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 !== '';
|
|
4390
4598
|
if (hasStorageKey) {
|
|
4391
|
-
|
|
4599
|
+
_context50.next = 5;
|
|
4392
4600
|
break;
|
|
4393
4601
|
}
|
|
4394
|
-
return
|
|
4602
|
+
return _context50.abrupt("return", null);
|
|
4395
4603
|
case 5:
|
|
4396
4604
|
pendingOrder = _objectSpread(_objectSpread({}, data), {}, {
|
|
4397
4605
|
need_sync: 1
|
|
4398
4606
|
});
|
|
4399
|
-
|
|
4607
|
+
_context50.next = 8;
|
|
4400
4608
|
return this.buildSmallTicketProductMap(pendingOrder);
|
|
4401
4609
|
case 8:
|
|
4402
|
-
productMap =
|
|
4610
|
+
productMap = _context50.sent;
|
|
4403
4611
|
orderWithProductTitles = this.withPendingSyncProductTitles(pendingOrder, productMap);
|
|
4404
|
-
return
|
|
4612
|
+
return _context50.abrupt("return", this.withLocalSmallTicketData(orderWithProductTitles, {
|
|
4405
4613
|
requireFullyPaid: true,
|
|
4406
4614
|
productMap: productMap
|
|
4407
4615
|
}));
|
|
4408
4616
|
case 11:
|
|
4409
4617
|
case "end":
|
|
4410
|
-
return
|
|
4618
|
+
return _context50.stop();
|
|
4411
4619
|
}
|
|
4412
|
-
},
|
|
4620
|
+
}, _callee50, this);
|
|
4413
4621
|
}));
|
|
4414
|
-
function buildPendingSyncCheckoutOrder(
|
|
4622
|
+
function buildPendingSyncCheckoutOrder(_x54) {
|
|
4415
4623
|
return _buildPendingSyncCheckoutOrder.apply(this, arguments);
|
|
4416
4624
|
}
|
|
4417
4625
|
return buildPendingSyncCheckoutOrder;
|
|
@@ -4479,12 +4687,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
4479
4687
|
}, {
|
|
4480
4688
|
key: "buildSmallTicketProductMap",
|
|
4481
4689
|
value: function () {
|
|
4482
|
-
var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4690
|
+
var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(order) {
|
|
4483
4691
|
var _this$products,
|
|
4484
4692
|
_this12 = this;
|
|
4485
4693
|
var products, productIdSet, productIds, entries;
|
|
4486
|
-
return _regeneratorRuntime().wrap(function
|
|
4487
|
-
while (1) switch (
|
|
4694
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
4695
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
4488
4696
|
case 0:
|
|
4489
4697
|
products = Array.isArray(order === null || order === void 0 ? void 0 : order.products) ? order.products : [];
|
|
4490
4698
|
productIdSet = new Set();
|
|
@@ -4506,45 +4714,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
4506
4714
|
});
|
|
4507
4715
|
productIds = Array.from(productIdSet);
|
|
4508
4716
|
if (!(!productIds.length || typeof ((_this$products = this.products) === null || _this$products === void 0 ? void 0 : _this$products.getProductById) !== 'function')) {
|
|
4509
|
-
|
|
4717
|
+
_context52.next = 6;
|
|
4510
4718
|
break;
|
|
4511
4719
|
}
|
|
4512
|
-
return
|
|
4720
|
+
return _context52.abrupt("return", {});
|
|
4513
4721
|
case 6:
|
|
4514
|
-
|
|
4722
|
+
_context52.next = 8;
|
|
4515
4723
|
return Promise.all(productIds.map( /*#__PURE__*/function () {
|
|
4516
|
-
var _ref58 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4724
|
+
var _ref58 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(id) {
|
|
4517
4725
|
var _this12$products, _this12$products$getP, product;
|
|
4518
|
-
return _regeneratorRuntime().wrap(function
|
|
4519
|
-
while (1) switch (
|
|
4726
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
4727
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
4520
4728
|
case 0:
|
|
4521
|
-
|
|
4522
|
-
|
|
4729
|
+
_context51.prev = 0;
|
|
4730
|
+
_context51.next = 3;
|
|
4523
4731
|
return (_this12$products = _this12.products) === null || _this12$products === void 0 || (_this12$products$getP = _this12$products.getProductById) === null || _this12$products$getP === void 0 ? void 0 : _this12$products$getP.call(_this12$products, Number(id));
|
|
4524
4732
|
case 3:
|
|
4525
|
-
product =
|
|
4526
|
-
return
|
|
4733
|
+
product = _context51.sent;
|
|
4734
|
+
return _context51.abrupt("return", product ? [String(id), product] : null);
|
|
4527
4735
|
case 7:
|
|
4528
|
-
|
|
4529
|
-
|
|
4736
|
+
_context51.prev = 7;
|
|
4737
|
+
_context51.t0 = _context51["catch"](0);
|
|
4530
4738
|
_this12.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
|
|
4531
4739
|
product_id: id,
|
|
4532
|
-
error:
|
|
4740
|
+
error: _context51.t0 instanceof Error ? _context51.t0.message : String(_context51.t0)
|
|
4533
4741
|
});
|
|
4534
|
-
return
|
|
4742
|
+
return _context51.abrupt("return", null);
|
|
4535
4743
|
case 11:
|
|
4536
4744
|
case "end":
|
|
4537
|
-
return
|
|
4745
|
+
return _context51.stop();
|
|
4538
4746
|
}
|
|
4539
|
-
},
|
|
4747
|
+
}, _callee51, null, [[0, 7]]);
|
|
4540
4748
|
}));
|
|
4541
|
-
return function (
|
|
4749
|
+
return function (_x56) {
|
|
4542
4750
|
return _ref58.apply(this, arguments);
|
|
4543
4751
|
};
|
|
4544
4752
|
}()));
|
|
4545
4753
|
case 8:
|
|
4546
|
-
entries =
|
|
4547
|
-
return
|
|
4754
|
+
entries = _context52.sent;
|
|
4755
|
+
return _context52.abrupt("return", entries.reduce(function (map, entry) {
|
|
4548
4756
|
if (!entry) return map;
|
|
4549
4757
|
var _entry = _slicedToArray(entry, 2),
|
|
4550
4758
|
id = _entry[0],
|
|
@@ -4554,11 +4762,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4554
4762
|
}, {}));
|
|
4555
4763
|
case 10:
|
|
4556
4764
|
case "end":
|
|
4557
|
-
return
|
|
4765
|
+
return _context52.stop();
|
|
4558
4766
|
}
|
|
4559
|
-
},
|
|
4767
|
+
}, _callee52, this);
|
|
4560
4768
|
}));
|
|
4561
|
-
function buildSmallTicketProductMap(
|
|
4769
|
+
function buildSmallTicketProductMap(_x55) {
|
|
4562
4770
|
return _buildSmallTicketProductMap.apply(this, arguments);
|
|
4563
4771
|
}
|
|
4564
4772
|
return buildSmallTicketProductMap;
|
|
@@ -4666,62 +4874,62 @@ var Server = /*#__PURE__*/function () {
|
|
|
4666
4874
|
}, {
|
|
4667
4875
|
key: "withLocalSmallTicketData",
|
|
4668
4876
|
value: function () {
|
|
4669
|
-
var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4877
|
+
var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(order, options) {
|
|
4670
4878
|
var _options$productMap, productMap, smallTicketData;
|
|
4671
|
-
return _regeneratorRuntime().wrap(function
|
|
4672
|
-
while (1) switch (
|
|
4879
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
4880
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
4673
4881
|
case 0:
|
|
4674
4882
|
if (this.shouldBuildSmallTicketData(order)) {
|
|
4675
|
-
|
|
4883
|
+
_context53.next = 2;
|
|
4676
4884
|
break;
|
|
4677
4885
|
}
|
|
4678
|
-
return
|
|
4886
|
+
return _context53.abrupt("return", order);
|
|
4679
4887
|
case 2:
|
|
4680
4888
|
if (!(options !== null && options !== void 0 && options.requireFullyPaid && !this.isSalesOrderFullyPaid(order))) {
|
|
4681
|
-
|
|
4889
|
+
_context53.next = 4;
|
|
4682
4890
|
break;
|
|
4683
4891
|
}
|
|
4684
|
-
return
|
|
4892
|
+
return _context53.abrupt("return", order);
|
|
4685
4893
|
case 4:
|
|
4686
|
-
|
|
4894
|
+
_context53.prev = 4;
|
|
4687
4895
|
if (!((_options$productMap = options === null || options === void 0 ? void 0 : options.productMap) !== null && _options$productMap !== void 0)) {
|
|
4688
|
-
|
|
4896
|
+
_context53.next = 9;
|
|
4689
4897
|
break;
|
|
4690
4898
|
}
|
|
4691
|
-
|
|
4692
|
-
|
|
4899
|
+
_context53.t0 = _options$productMap;
|
|
4900
|
+
_context53.next = 12;
|
|
4693
4901
|
break;
|
|
4694
4902
|
case 9:
|
|
4695
|
-
|
|
4903
|
+
_context53.next = 11;
|
|
4696
4904
|
return this.buildSmallTicketProductMap(order);
|
|
4697
4905
|
case 11:
|
|
4698
|
-
|
|
4906
|
+
_context53.t0 = _context53.sent;
|
|
4699
4907
|
case 12:
|
|
4700
|
-
productMap =
|
|
4908
|
+
productMap = _context53.t0;
|
|
4701
4909
|
smallTicketData = buildSmallTicketData({
|
|
4702
4910
|
order: order,
|
|
4703
4911
|
shopInfo: this.getSmallTicketShopInfo(),
|
|
4704
4912
|
productMap: productMap
|
|
4705
4913
|
});
|
|
4706
|
-
return
|
|
4914
|
+
return _context53.abrupt("return", _objectSpread(_objectSpread({}, order), {}, {
|
|
4707
4915
|
payment_info: _objectSpread(_objectSpread({}, order.payment_info || {}), {}, {
|
|
4708
4916
|
small_ticket_data: smallTicketData
|
|
4709
4917
|
})
|
|
4710
4918
|
}));
|
|
4711
4919
|
case 17:
|
|
4712
|
-
|
|
4713
|
-
|
|
4920
|
+
_context53.prev = 17;
|
|
4921
|
+
_context53.t1 = _context53["catch"](4);
|
|
4714
4922
|
this.logError('withLocalSmallTicketData: 生成本地小票数据失败', {
|
|
4715
|
-
error:
|
|
4923
|
+
error: _context53.t1 instanceof Error ? _context53.t1.message : String(_context53.t1)
|
|
4716
4924
|
});
|
|
4717
|
-
return
|
|
4925
|
+
return _context53.abrupt("return", order);
|
|
4718
4926
|
case 21:
|
|
4719
4927
|
case "end":
|
|
4720
|
-
return
|
|
4928
|
+
return _context53.stop();
|
|
4721
4929
|
}
|
|
4722
|
-
},
|
|
4930
|
+
}, _callee53, this, [[4, 17]]);
|
|
4723
4931
|
}));
|
|
4724
|
-
function withLocalSmallTicketData(
|
|
4932
|
+
function withLocalSmallTicketData(_x57, _x58) {
|
|
4725
4933
|
return _withLocalSmallTicketData.apply(this, arguments);
|
|
4726
4934
|
}
|
|
4727
4935
|
return withLocalSmallTicketData;
|
|
@@ -4783,34 +4991,34 @@ var Server = /*#__PURE__*/function () {
|
|
|
4783
4991
|
}, {
|
|
4784
4992
|
key: "handleUpdateLocalOrdersBatch",
|
|
4785
4993
|
value: (function () {
|
|
4786
|
-
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4787
|
-
var _this$
|
|
4788
|
-
var existedBefore, _iterator12, _step12, id, fetched, message, fetchedMap, _iterator13, _step13, order, oid, freshOrders, succeedIds, failed, _iterator14, _step14, _id, fresh,
|
|
4789
|
-
return _regeneratorRuntime().wrap(function
|
|
4790
|
-
while (1) switch (
|
|
4994
|
+
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(orderIds) {
|
|
4995
|
+
var _this$app16;
|
|
4996
|
+
var existedBefore, _iterator12, _step12, id, fetched, message, fetchedMap, _iterator13, _step13, order, oid, freshOrders, succeedIds, failed, _iterator14, _step14, _id, fresh, _message, overwritten, inserted;
|
|
4997
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
4998
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
4791
4999
|
case 0:
|
|
4792
5000
|
this.logInfo('handleUpdateLocalOrdersBatch: 开始处理', {
|
|
4793
5001
|
count: orderIds.length,
|
|
4794
5002
|
orderIds: orderIds
|
|
4795
5003
|
});
|
|
4796
5004
|
if (this.order) {
|
|
4797
|
-
|
|
5005
|
+
_context54.next = 4;
|
|
4798
5006
|
break;
|
|
4799
5007
|
}
|
|
4800
5008
|
this.logError('handleUpdateLocalOrdersBatch: Order 模块未注册');
|
|
4801
|
-
return
|
|
5009
|
+
return _context54.abrupt("return", {
|
|
4802
5010
|
code: 500,
|
|
4803
5011
|
status: false,
|
|
4804
5012
|
message: 'Order 模块未注册',
|
|
4805
5013
|
data: null
|
|
4806
5014
|
});
|
|
4807
5015
|
case 4:
|
|
4808
|
-
if ((_this$
|
|
4809
|
-
|
|
5016
|
+
if ((_this$app16 = this.app) !== null && _this$app16 !== void 0 && _this$app16.request) {
|
|
5017
|
+
_context54.next = 7;
|
|
4810
5018
|
break;
|
|
4811
5019
|
}
|
|
4812
5020
|
this.logError('handleUpdateLocalOrdersBatch: app.request 不可用');
|
|
4813
|
-
return
|
|
5021
|
+
return _context54.abrupt("return", {
|
|
4814
5022
|
code: 500,
|
|
4815
5023
|
status: false,
|
|
4816
5024
|
message: 'app.request 不可用',
|
|
@@ -4833,21 +5041,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
4833
5041
|
_iterator12.f();
|
|
4834
5042
|
}
|
|
4835
5043
|
fetched = [];
|
|
4836
|
-
|
|
4837
|
-
|
|
5044
|
+
_context54.prev = 11;
|
|
5045
|
+
_context54.next = 14;
|
|
4838
5046
|
return this.order.fetchOrdersByHttp(orderIds);
|
|
4839
5047
|
case 14:
|
|
4840
|
-
fetched =
|
|
4841
|
-
|
|
5048
|
+
fetched = _context54.sent;
|
|
5049
|
+
_context54.next = 22;
|
|
4842
5050
|
break;
|
|
4843
5051
|
case 17:
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
message =
|
|
5052
|
+
_context54.prev = 17;
|
|
5053
|
+
_context54.t0 = _context54["catch"](11);
|
|
5054
|
+
message = _context54.t0 instanceof Error ? _context54.t0.message : String(_context54.t0);
|
|
4847
5055
|
this.logError('handleUpdateLocalOrdersBatch: 批量拉取失败', {
|
|
4848
5056
|
message: message
|
|
4849
5057
|
});
|
|
4850
|
-
return
|
|
5058
|
+
return _context54.abrupt("return", {
|
|
4851
5059
|
code: 500,
|
|
4852
5060
|
status: false,
|
|
4853
5061
|
message: message,
|
|
@@ -4857,36 +5065,36 @@ var Server = /*#__PURE__*/function () {
|
|
|
4857
5065
|
// 按返回结果中的 order_id 建索引,未命中即视为单笔失败
|
|
4858
5066
|
fetchedMap = new Map();
|
|
4859
5067
|
_iterator13 = _createForOfIteratorHelper(fetched);
|
|
4860
|
-
|
|
5068
|
+
_context54.prev = 24;
|
|
4861
5069
|
_iterator13.s();
|
|
4862
5070
|
case 26:
|
|
4863
5071
|
if ((_step13 = _iterator13.n()).done) {
|
|
4864
|
-
|
|
5072
|
+
_context54.next = 34;
|
|
4865
5073
|
break;
|
|
4866
5074
|
}
|
|
4867
5075
|
order = _step13.value;
|
|
4868
5076
|
oid = order === null || order === void 0 ? void 0 : order.order_id;
|
|
4869
5077
|
if (!(oid === undefined || oid === null)) {
|
|
4870
|
-
|
|
5078
|
+
_context54.next = 31;
|
|
4871
5079
|
break;
|
|
4872
5080
|
}
|
|
4873
|
-
return
|
|
5081
|
+
return _context54.abrupt("continue", 32);
|
|
4874
5082
|
case 31:
|
|
4875
5083
|
fetchedMap.set(String(oid), order);
|
|
4876
5084
|
case 32:
|
|
4877
|
-
|
|
5085
|
+
_context54.next = 26;
|
|
4878
5086
|
break;
|
|
4879
5087
|
case 34:
|
|
4880
|
-
|
|
5088
|
+
_context54.next = 39;
|
|
4881
5089
|
break;
|
|
4882
5090
|
case 36:
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
_iterator13.e(
|
|
5091
|
+
_context54.prev = 36;
|
|
5092
|
+
_context54.t1 = _context54["catch"](24);
|
|
5093
|
+
_iterator13.e(_context54.t1);
|
|
4886
5094
|
case 39:
|
|
4887
|
-
|
|
5095
|
+
_context54.prev = 39;
|
|
4888
5096
|
_iterator13.f();
|
|
4889
|
-
return
|
|
5097
|
+
return _context54.finish(39);
|
|
4890
5098
|
case 42:
|
|
4891
5099
|
freshOrders = [];
|
|
4892
5100
|
succeedIds = [];
|
|
@@ -4912,26 +5120,26 @@ var Server = /*#__PURE__*/function () {
|
|
|
4912
5120
|
_iterator14.f();
|
|
4913
5121
|
}
|
|
4914
5122
|
if (!(freshOrders.length > 0)) {
|
|
4915
|
-
|
|
5123
|
+
_context54.next = 58;
|
|
4916
5124
|
break;
|
|
4917
5125
|
}
|
|
4918
|
-
|
|
4919
|
-
|
|
5126
|
+
_context54.prev = 48;
|
|
5127
|
+
_context54.next = 51;
|
|
4920
5128
|
return this.order.upsertOrdersFromRemote(freshOrders);
|
|
4921
5129
|
case 51:
|
|
4922
|
-
|
|
5130
|
+
_context54.next = 58;
|
|
4923
5131
|
break;
|
|
4924
5132
|
case 53:
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
5133
|
+
_context54.prev = 53;
|
|
5134
|
+
_context54.t2 = _context54["catch"](48);
|
|
5135
|
+
_message = _context54.t2 instanceof Error ? _context54.t2.message : String(_context54.t2);
|
|
4928
5136
|
this.logError('handleUpdateLocalOrdersBatch: 合并写入失败', {
|
|
4929
|
-
message:
|
|
5137
|
+
message: _message
|
|
4930
5138
|
});
|
|
4931
|
-
return
|
|
5139
|
+
return _context54.abrupt("return", {
|
|
4932
5140
|
code: 500,
|
|
4933
5141
|
status: false,
|
|
4934
|
-
message:
|
|
5142
|
+
message: _message,
|
|
4935
5143
|
data: null
|
|
4936
5144
|
});
|
|
4937
5145
|
case 58:
|
|
@@ -4947,7 +5155,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4947
5155
|
insertedCount: inserted.length,
|
|
4948
5156
|
failedCount: failed.length
|
|
4949
5157
|
});
|
|
4950
|
-
return
|
|
5158
|
+
return _context54.abrupt("return", {
|
|
4951
5159
|
code: 200,
|
|
4952
5160
|
status: true,
|
|
4953
5161
|
message: '',
|
|
@@ -4959,11 +5167,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4959
5167
|
});
|
|
4960
5168
|
case 62:
|
|
4961
5169
|
case "end":
|
|
4962
|
-
return
|
|
5170
|
+
return _context54.stop();
|
|
4963
5171
|
}
|
|
4964
|
-
},
|
|
5172
|
+
}, _callee54, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
|
|
4965
5173
|
}));
|
|
4966
|
-
function handleUpdateLocalOrdersBatch(
|
|
5174
|
+
function handleUpdateLocalOrdersBatch(_x59) {
|
|
4967
5175
|
return _handleUpdateLocalOrdersBatch.apply(this, arguments);
|
|
4968
5176
|
}
|
|
4969
5177
|
return handleUpdateLocalOrdersBatch;
|
|
@@ -5123,6 +5331,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
5123
5331
|
data: response
|
|
5124
5332
|
};
|
|
5125
5333
|
}
|
|
5334
|
+
}, {
|
|
5335
|
+
key: "withSyncedOrderIdInCheckoutResponse",
|
|
5336
|
+
value: function withSyncedOrderIdInCheckoutResponse(response, syncedOrder) {
|
|
5337
|
+
var _normalized$data$orde;
|
|
5338
|
+
var normalized = this.normalizeCheckoutResponse(response);
|
|
5339
|
+
var orderId = syncedOrder === null || syncedOrder === void 0 ? void 0 : syncedOrder.order_id;
|
|
5340
|
+
if (orderId === undefined || orderId === null) return normalized;
|
|
5341
|
+
if (!(normalized !== null && normalized !== void 0 && normalized.data) || _typeof(normalized.data) !== 'object') return normalized;
|
|
5342
|
+
return _objectSpread(_objectSpread({}, normalized), {}, {
|
|
5343
|
+
data: _objectSpread(_objectSpread({}, normalized.data), {}, {
|
|
5344
|
+
order_id: (_normalized$data$orde = normalized.data.order_id) !== null && _normalized$data$orde !== void 0 ? _normalized$data$orde : orderId
|
|
5345
|
+
})
|
|
5346
|
+
});
|
|
5347
|
+
}
|
|
5126
5348
|
}, {
|
|
5127
5349
|
key: "isCheckoutResponseRejected",
|
|
5128
5350
|
value: function isCheckoutResponseRejected(response) {
|
|
@@ -5313,16 +5535,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
5313
5535
|
}, {
|
|
5314
5536
|
key: "recomputeAndNotifyFloorPlanQuery",
|
|
5315
5537
|
value: (function () {
|
|
5316
|
-
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5538
|
+
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55() {
|
|
5317
5539
|
var _iterator16, _step16, _step16$value, subscriberId, sub, result, errorMessage;
|
|
5318
|
-
return _regeneratorRuntime().wrap(function
|
|
5319
|
-
while (1) switch (
|
|
5540
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
5541
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
5320
5542
|
case 0:
|
|
5321
5543
|
if (!(this.floorPlanQuerySubscribers.size === 0)) {
|
|
5322
|
-
|
|
5544
|
+
_context55.next = 2;
|
|
5323
5545
|
break;
|
|
5324
5546
|
}
|
|
5325
|
-
return
|
|
5547
|
+
return _context55.abrupt("return");
|
|
5326
5548
|
case 2:
|
|
5327
5549
|
this.logInfo('recomputeAndNotifyFloorPlanQuery: 开始推送', {
|
|
5328
5550
|
subscriberCount: this.floorPlanQuerySubscribers.size
|
|
@@ -5352,9 +5574,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
5352
5574
|
}
|
|
5353
5575
|
case 5:
|
|
5354
5576
|
case "end":
|
|
5355
|
-
return
|
|
5577
|
+
return _context55.stop();
|
|
5356
5578
|
}
|
|
5357
|
-
},
|
|
5579
|
+
}, _callee55, this);
|
|
5358
5580
|
}));
|
|
5359
5581
|
function recomputeAndNotifyFloorPlanQuery() {
|
|
5360
5582
|
return _recomputeAndNotifyFloorPlanQuery.apply(this, arguments);
|
|
@@ -5384,21 +5606,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
5384
5606
|
* filter 逻辑暂为 mock,仅记录参数
|
|
5385
5607
|
*/
|
|
5386
5608
|
function () {
|
|
5387
|
-
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5609
|
+
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(data) {
|
|
5388
5610
|
var rawList, result;
|
|
5389
|
-
return _regeneratorRuntime().wrap(function
|
|
5390
|
-
while (1) switch (
|
|
5611
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
|
5612
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
5391
5613
|
case 0:
|
|
5392
5614
|
this.logInfo('computeOrderQueryResult: 开始过滤', {
|
|
5393
5615
|
data: data
|
|
5394
5616
|
});
|
|
5395
5617
|
console.log('[Server] computeOrderQueryResult', data);
|
|
5396
5618
|
if (this.order) {
|
|
5397
|
-
|
|
5619
|
+
_context56.next = 5;
|
|
5398
5620
|
break;
|
|
5399
5621
|
}
|
|
5400
5622
|
this.logError('computeOrderQueryResult: Order 模块未注册');
|
|
5401
|
-
return
|
|
5623
|
+
return _context56.abrupt("return", {
|
|
5402
5624
|
code: 500,
|
|
5403
5625
|
message: 'Order 模块未注册',
|
|
5404
5626
|
data: {
|
|
@@ -5422,7 +5644,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5422
5644
|
skip: result.skip,
|
|
5423
5645
|
rejected: result.rejected
|
|
5424
5646
|
});
|
|
5425
|
-
return
|
|
5647
|
+
return _context56.abrupt("return", {
|
|
5426
5648
|
code: 200,
|
|
5427
5649
|
data: result,
|
|
5428
5650
|
message: '',
|
|
@@ -5430,11 +5652,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
5430
5652
|
});
|
|
5431
5653
|
case 10:
|
|
5432
5654
|
case "end":
|
|
5433
|
-
return
|
|
5655
|
+
return _context56.stop();
|
|
5434
5656
|
}
|
|
5435
|
-
},
|
|
5657
|
+
}, _callee56, this);
|
|
5436
5658
|
}));
|
|
5437
|
-
function computeOrderQueryResult(
|
|
5659
|
+
function computeOrderQueryResult(_x60) {
|
|
5438
5660
|
return _computeOrderQueryResult.apply(this, arguments);
|
|
5439
5661
|
}
|
|
5440
5662
|
return computeOrderQueryResult;
|
|
@@ -5447,17 +5669,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
5447
5669
|
}, {
|
|
5448
5670
|
key: "computeBookingQueryResult",
|
|
5449
5671
|
value: (function () {
|
|
5450
|
-
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5672
|
+
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(data) {
|
|
5451
5673
|
var rawOrders, result;
|
|
5452
|
-
return _regeneratorRuntime().wrap(function
|
|
5453
|
-
while (1) switch (
|
|
5674
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
|
5675
|
+
while (1) switch (_context57.prev = _context57.next) {
|
|
5454
5676
|
case 0:
|
|
5455
5677
|
if (this.order) {
|
|
5456
|
-
|
|
5678
|
+
_context57.next = 3;
|
|
5457
5679
|
break;
|
|
5458
5680
|
}
|
|
5459
5681
|
this.logError('computeBookingQueryResult: Order 模块未注册');
|
|
5460
|
-
return
|
|
5682
|
+
return _context57.abrupt("return", {
|
|
5461
5683
|
code: 500,
|
|
5462
5684
|
message: 'Order 模块未注册',
|
|
5463
5685
|
data: {
|
|
@@ -5476,7 +5698,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5476
5698
|
size: result.size,
|
|
5477
5699
|
skip: result.skip
|
|
5478
5700
|
});
|
|
5479
|
-
return
|
|
5701
|
+
return _context57.abrupt("return", {
|
|
5480
5702
|
code: 200,
|
|
5481
5703
|
data: result,
|
|
5482
5704
|
message: '',
|
|
@@ -5484,11 +5706,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
5484
5706
|
});
|
|
5485
5707
|
case 8:
|
|
5486
5708
|
case "end":
|
|
5487
|
-
return
|
|
5709
|
+
return _context57.stop();
|
|
5488
5710
|
}
|
|
5489
|
-
},
|
|
5711
|
+
}, _callee57, this);
|
|
5490
5712
|
}));
|
|
5491
|
-
function computeBookingQueryResult(
|
|
5713
|
+
function computeBookingQueryResult(_x61) {
|
|
5492
5714
|
return _computeBookingQueryResult.apply(this, arguments);
|
|
5493
5715
|
}
|
|
5494
5716
|
return computeBookingQueryResult;
|
|
@@ -5547,12 +5769,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
5547
5769
|
}, {
|
|
5548
5770
|
key: "computeProductQueryResult",
|
|
5549
5771
|
value: (function () {
|
|
5550
|
-
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5772
|
+
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(context, options) {
|
|
5551
5773
|
var _menu_list_ids$length3,
|
|
5552
5774
|
_this16 = this;
|
|
5553
5775
|
var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, extension_type, product_id, queryIds, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, extensionFilteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, _tPrice3, _filteredProducts2, _tStatus, _beforeStatusCount, _tExtensionType, _beforeExtensionTypeCount, _tSort, activeMenuList, tMenu, menuList, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tExtensionType, beforeExtensionTypeCount, tSort;
|
|
5554
|
-
return _regeneratorRuntime().wrap(function
|
|
5555
|
-
while (1) switch (
|
|
5776
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
|
5777
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
5556
5778
|
case 0:
|
|
5557
5779
|
tTotal = performance.now();
|
|
5558
5780
|
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, extension_type = context.extension_type, product_id = context.product_id;
|
|
@@ -5572,11 +5794,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
5572
5794
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
5573
5795
|
});
|
|
5574
5796
|
if (this.products) {
|
|
5575
|
-
|
|
5797
|
+
_context58.next = 7;
|
|
5576
5798
|
break;
|
|
5577
5799
|
}
|
|
5578
5800
|
this.logError('computeProductQueryResult: Products 模块未注册');
|
|
5579
|
-
return
|
|
5801
|
+
return _context58.abrupt("return", {
|
|
5580
5802
|
message: 'Products 模块未注册',
|
|
5581
5803
|
data: {
|
|
5582
5804
|
list: [],
|
|
@@ -5585,12 +5807,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
5585
5807
|
});
|
|
5586
5808
|
case 7:
|
|
5587
5809
|
if (!(queryIds.length > 0)) {
|
|
5588
|
-
|
|
5810
|
+
_context58.next = 19;
|
|
5589
5811
|
break;
|
|
5590
5812
|
}
|
|
5591
5813
|
uniqueIds = Array.from(new Set(queryIds));
|
|
5592
5814
|
_tPrice = performance.now();
|
|
5593
|
-
|
|
5815
|
+
_context58.next = 12;
|
|
5594
5816
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
5595
5817
|
scheduleModule: this.getSchedule(),
|
|
5596
5818
|
schedule_datetime: schedule_datetime,
|
|
@@ -5600,7 +5822,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5600
5822
|
productIds: uniqueIds
|
|
5601
5823
|
});
|
|
5602
5824
|
case 12:
|
|
5603
|
-
productsWithPrice =
|
|
5825
|
+
productsWithPrice = _context58.sent;
|
|
5604
5826
|
perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
|
|
5605
5827
|
count: productsWithPrice.length,
|
|
5606
5828
|
ids: uniqueIds
|
|
@@ -5620,7 +5842,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5620
5842
|
ids: uniqueIds,
|
|
5621
5843
|
count: extensionFilteredProducts.length
|
|
5622
5844
|
});
|
|
5623
|
-
return
|
|
5845
|
+
return _context58.abrupt("return", {
|
|
5624
5846
|
code: 200,
|
|
5625
5847
|
data: {
|
|
5626
5848
|
list: extensionFilteredProducts,
|
|
@@ -5631,19 +5853,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
5631
5853
|
});
|
|
5632
5854
|
case 19:
|
|
5633
5855
|
if (!(product_id != null && Number.isFinite(Number(product_id)))) {
|
|
5634
|
-
|
|
5856
|
+
_context58.next = 31;
|
|
5635
5857
|
break;
|
|
5636
5858
|
}
|
|
5637
5859
|
pid = Number(product_id);
|
|
5638
5860
|
_tPrice2 = performance.now();
|
|
5639
|
-
|
|
5861
|
+
_context58.next = 24;
|
|
5640
5862
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
5641
5863
|
scheduleModule: this.getSchedule()
|
|
5642
5864
|
}, {
|
|
5643
5865
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
5644
5866
|
});
|
|
5645
5867
|
case 24:
|
|
5646
|
-
allProductsWithPrice =
|
|
5868
|
+
allProductsWithPrice = _context58.sent;
|
|
5647
5869
|
perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
|
|
5648
5870
|
count: allProductsWithPrice.length,
|
|
5649
5871
|
productId: pid
|
|
@@ -5663,7 +5885,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5663
5885
|
productId: pid,
|
|
5664
5886
|
found: !!item
|
|
5665
5887
|
});
|
|
5666
|
-
return
|
|
5888
|
+
return _context58.abrupt("return", {
|
|
5667
5889
|
code: 200,
|
|
5668
5890
|
data: item,
|
|
5669
5891
|
message: item ? '' : '商品不存在或未发布',
|
|
@@ -5671,11 +5893,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
5671
5893
|
});
|
|
5672
5894
|
case 31:
|
|
5673
5895
|
if (!this.shouldQueryProductsByExtensionTypes(extension_type)) {
|
|
5674
|
-
|
|
5896
|
+
_context58.next = 51;
|
|
5675
5897
|
break;
|
|
5676
5898
|
}
|
|
5677
5899
|
_tPrice3 = performance.now();
|
|
5678
|
-
|
|
5900
|
+
_context58.next = 35;
|
|
5679
5901
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
5680
5902
|
scheduleModule: this.getSchedule(),
|
|
5681
5903
|
schedule_datetime: schedule_datetime,
|
|
@@ -5684,7 +5906,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5684
5906
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
5685
5907
|
});
|
|
5686
5908
|
case 35:
|
|
5687
|
-
_filteredProducts2 =
|
|
5909
|
+
_filteredProducts2 = _context58.sent;
|
|
5688
5910
|
perfMark('computeQuery.getProductsWithPrice(extensionType)', performance.now() - _tPrice3, {
|
|
5689
5911
|
count: _filteredProducts2.length,
|
|
5690
5912
|
extension_type: extension_type
|
|
@@ -5723,7 +5945,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5723
5945
|
filteredCount: _filteredProducts2.length,
|
|
5724
5946
|
extension_type: extension_type
|
|
5725
5947
|
});
|
|
5726
|
-
return
|
|
5948
|
+
return _context58.abrupt("return", {
|
|
5727
5949
|
code: 200,
|
|
5728
5950
|
data: {
|
|
5729
5951
|
list: _filteredProducts2,
|
|
@@ -5734,11 +5956,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
5734
5956
|
});
|
|
5735
5957
|
case 51:
|
|
5736
5958
|
if (this.menu) {
|
|
5737
|
-
|
|
5959
|
+
_context58.next = 54;
|
|
5738
5960
|
break;
|
|
5739
5961
|
}
|
|
5740
5962
|
this.logError('computeProductQueryResult: Menu 模块未注册');
|
|
5741
|
-
return
|
|
5963
|
+
return _context58.abrupt("return", {
|
|
5742
5964
|
message: 'Menu 模块未注册',
|
|
5743
5965
|
data: {
|
|
5744
5966
|
list: [],
|
|
@@ -5747,11 +5969,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
5747
5969
|
});
|
|
5748
5970
|
case 54:
|
|
5749
5971
|
if (this.schedule) {
|
|
5750
|
-
|
|
5972
|
+
_context58.next = 57;
|
|
5751
5973
|
break;
|
|
5752
5974
|
}
|
|
5753
5975
|
this.logError('computeProductQueryResult: Schedule 模块未注册');
|
|
5754
|
-
return
|
|
5976
|
+
return _context58.abrupt("return", {
|
|
5755
5977
|
message: 'Schedule 模块未注册',
|
|
5756
5978
|
data: {
|
|
5757
5979
|
list: [],
|
|
@@ -5782,10 +6004,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
5782
6004
|
});
|
|
5783
6005
|
tPrice = performance.now();
|
|
5784
6006
|
if (!(scopedProductIds.length > 0)) {
|
|
5785
|
-
|
|
6007
|
+
_context58.next = 70;
|
|
5786
6008
|
break;
|
|
5787
6009
|
}
|
|
5788
|
-
|
|
6010
|
+
_context58.next = 67;
|
|
5789
6011
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
5790
6012
|
scheduleModule: this.getSchedule(),
|
|
5791
6013
|
schedule_datetime: schedule_datetime,
|
|
@@ -5795,13 +6017,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
5795
6017
|
productIds: productScope.isAllProducts ? undefined : scopedProductIds
|
|
5796
6018
|
});
|
|
5797
6019
|
case 67:
|
|
5798
|
-
|
|
5799
|
-
|
|
6020
|
+
_context58.t0 = _context58.sent;
|
|
6021
|
+
_context58.next = 71;
|
|
5800
6022
|
break;
|
|
5801
6023
|
case 70:
|
|
5802
|
-
|
|
6024
|
+
_context58.t0 = [];
|
|
5803
6025
|
case 71:
|
|
5804
|
-
filteredProducts =
|
|
6026
|
+
filteredProducts = _context58.t0;
|
|
5805
6027
|
perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
|
|
5806
6028
|
count: filteredProducts.length,
|
|
5807
6029
|
scopedProductCount: scopedProductIds.length
|
|
@@ -5842,7 +6064,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5842
6064
|
filteredCount: filteredProducts.length,
|
|
5843
6065
|
activeMenuCount: activeMenuList.length
|
|
5844
6066
|
});
|
|
5845
|
-
return
|
|
6067
|
+
return _context58.abrupt("return", {
|
|
5846
6068
|
code: 200,
|
|
5847
6069
|
data: {
|
|
5848
6070
|
list: filteredProducts,
|
|
@@ -5853,11 +6075,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
5853
6075
|
});
|
|
5854
6076
|
case 87:
|
|
5855
6077
|
case "end":
|
|
5856
|
-
return
|
|
6078
|
+
return _context58.stop();
|
|
5857
6079
|
}
|
|
5858
|
-
},
|
|
6080
|
+
}, _callee58, this);
|
|
5859
6081
|
}));
|
|
5860
|
-
function computeProductQueryResult(
|
|
6082
|
+
function computeProductQueryResult(_x62, _x63) {
|
|
5861
6083
|
return _computeProductQueryResult.apply(this, arguments);
|
|
5862
6084
|
}
|
|
5863
6085
|
return computeProductQueryResult;
|
|
@@ -5872,72 +6094,72 @@ var Server = /*#__PURE__*/function () {
|
|
|
5872
6094
|
}, {
|
|
5873
6095
|
key: "recomputeAndNotifyProductQuery",
|
|
5874
6096
|
value: (function () {
|
|
5875
|
-
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6097
|
+
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(options) {
|
|
5876
6098
|
var _iterator17, _step17, _step17$value, subscriberId, subscriber, result, errorMessage;
|
|
5877
|
-
return _regeneratorRuntime().wrap(function
|
|
5878
|
-
while (1) switch (
|
|
6099
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
|
6100
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
5879
6101
|
case 0:
|
|
5880
6102
|
if (!(this.productQuerySubscribers.size === 0)) {
|
|
5881
|
-
|
|
6103
|
+
_context59.next = 2;
|
|
5882
6104
|
break;
|
|
5883
6105
|
}
|
|
5884
|
-
return
|
|
6106
|
+
return _context59.abrupt("return");
|
|
5885
6107
|
case 2:
|
|
5886
6108
|
this.logInfo('recomputeAndNotifyProductQuery: 开始推送', {
|
|
5887
6109
|
subscriberCount: this.productQuerySubscribers.size,
|
|
5888
6110
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
5889
6111
|
});
|
|
5890
6112
|
_iterator17 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
|
|
5891
|
-
|
|
6113
|
+
_context59.prev = 4;
|
|
5892
6114
|
_iterator17.s();
|
|
5893
6115
|
case 6:
|
|
5894
6116
|
if ((_step17 = _iterator17.n()).done) {
|
|
5895
|
-
|
|
6117
|
+
_context59.next = 22;
|
|
5896
6118
|
break;
|
|
5897
6119
|
}
|
|
5898
6120
|
_step17$value = _slicedToArray(_step17.value, 2), subscriberId = _step17$value[0], subscriber = _step17$value[1];
|
|
5899
|
-
|
|
5900
|
-
|
|
6121
|
+
_context59.prev = 8;
|
|
6122
|
+
_context59.next = 11;
|
|
5901
6123
|
return this.computeProductQueryResult(subscriber.context, {
|
|
5902
6124
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
5903
6125
|
});
|
|
5904
6126
|
case 11:
|
|
5905
|
-
result =
|
|
6127
|
+
result = _context59.sent;
|
|
5906
6128
|
subscriber.callback(result);
|
|
5907
6129
|
this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
|
|
5908
6130
|
subscriberId: subscriberId
|
|
5909
6131
|
});
|
|
5910
|
-
|
|
6132
|
+
_context59.next = 20;
|
|
5911
6133
|
break;
|
|
5912
6134
|
case 16:
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
errorMessage =
|
|
6135
|
+
_context59.prev = 16;
|
|
6136
|
+
_context59.t0 = _context59["catch"](8);
|
|
6137
|
+
errorMessage = _context59.t0 instanceof Error ? _context59.t0.message : String(_context59.t0);
|
|
5916
6138
|
this.logError('recomputeAndNotifyProductQuery: 推送失败', {
|
|
5917
6139
|
subscriberId: subscriberId,
|
|
5918
6140
|
error: errorMessage
|
|
5919
6141
|
});
|
|
5920
6142
|
case 20:
|
|
5921
|
-
|
|
6143
|
+
_context59.next = 6;
|
|
5922
6144
|
break;
|
|
5923
6145
|
case 22:
|
|
5924
|
-
|
|
6146
|
+
_context59.next = 27;
|
|
5925
6147
|
break;
|
|
5926
6148
|
case 24:
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
_iterator17.e(
|
|
6149
|
+
_context59.prev = 24;
|
|
6150
|
+
_context59.t1 = _context59["catch"](4);
|
|
6151
|
+
_iterator17.e(_context59.t1);
|
|
5930
6152
|
case 27:
|
|
5931
|
-
|
|
6153
|
+
_context59.prev = 27;
|
|
5932
6154
|
_iterator17.f();
|
|
5933
|
-
return
|
|
6155
|
+
return _context59.finish(27);
|
|
5934
6156
|
case 30:
|
|
5935
6157
|
case "end":
|
|
5936
|
-
return
|
|
6158
|
+
return _context59.stop();
|
|
5937
6159
|
}
|
|
5938
|
-
},
|
|
6160
|
+
}, _callee59, this, [[4, 24, 27, 30], [8, 16]]);
|
|
5939
6161
|
}));
|
|
5940
|
-
function recomputeAndNotifyProductQuery(
|
|
6162
|
+
function recomputeAndNotifyProductQuery(_x64) {
|
|
5941
6163
|
return _recomputeAndNotifyProductQuery.apply(this, arguments);
|
|
5942
6164
|
}
|
|
5943
6165
|
return recomputeAndNotifyProductQuery;
|
|
@@ -5949,16 +6171,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
5949
6171
|
}, {
|
|
5950
6172
|
key: "recomputeAndNotifyOrderQuery",
|
|
5951
6173
|
value: (function () {
|
|
5952
|
-
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6174
|
+
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60() {
|
|
5953
6175
|
var notifyStartAt, _iterator18, _step18, _step18$value, subscriberId, subscriber, computeStartAt, result, computeEndAt, callbackStartAt, callbackEndAt, errorMessage, notifyEndAt;
|
|
5954
|
-
return _regeneratorRuntime().wrap(function
|
|
5955
|
-
while (1) switch (
|
|
6176
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
|
6177
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
5956
6178
|
case 0:
|
|
5957
6179
|
if (!(this.orderQuerySubscribers.size === 0)) {
|
|
5958
|
-
|
|
6180
|
+
_context60.next = 2;
|
|
5959
6181
|
break;
|
|
5960
6182
|
}
|
|
5961
|
-
return
|
|
6183
|
+
return _context60.abrupt("return");
|
|
5962
6184
|
case 2:
|
|
5963
6185
|
notifyStartAt = Date.now();
|
|
5964
6186
|
this.logInfo('recomputeAndNotifyOrderQuery: 开始推送', {
|
|
@@ -5966,20 +6188,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
5966
6188
|
notifyStartAt: new Date(notifyStartAt).toISOString()
|
|
5967
6189
|
});
|
|
5968
6190
|
_iterator18 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
|
|
5969
|
-
|
|
6191
|
+
_context60.prev = 5;
|
|
5970
6192
|
_iterator18.s();
|
|
5971
6193
|
case 7:
|
|
5972
6194
|
if ((_step18 = _iterator18.n()).done) {
|
|
5973
|
-
|
|
6195
|
+
_context60.next = 27;
|
|
5974
6196
|
break;
|
|
5975
6197
|
}
|
|
5976
6198
|
_step18$value = _slicedToArray(_step18.value, 2), subscriberId = _step18$value[0], subscriber = _step18$value[1];
|
|
5977
|
-
|
|
6199
|
+
_context60.prev = 9;
|
|
5978
6200
|
computeStartAt = Date.now();
|
|
5979
|
-
|
|
6201
|
+
_context60.next = 13;
|
|
5980
6202
|
return this.computeOrderQueryResult(subscriber.context);
|
|
5981
6203
|
case 13:
|
|
5982
|
-
result =
|
|
6204
|
+
result = _context60.sent;
|
|
5983
6205
|
computeEndAt = Date.now();
|
|
5984
6206
|
callbackStartAt = Date.now();
|
|
5985
6207
|
subscriber.callback(result);
|
|
@@ -5990,30 +6212,30 @@ var Server = /*#__PURE__*/function () {
|
|
|
5990
6212
|
callbackDurationMs: callbackEndAt - callbackStartAt,
|
|
5991
6213
|
totalDurationMs: callbackEndAt - computeStartAt
|
|
5992
6214
|
});
|
|
5993
|
-
|
|
6215
|
+
_context60.next = 25;
|
|
5994
6216
|
break;
|
|
5995
6217
|
case 21:
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
errorMessage =
|
|
6218
|
+
_context60.prev = 21;
|
|
6219
|
+
_context60.t0 = _context60["catch"](9);
|
|
6220
|
+
errorMessage = _context60.t0 instanceof Error ? _context60.t0.message : String(_context60.t0);
|
|
5999
6221
|
this.logError('recomputeAndNotifyOrderQuery: 推送失败', {
|
|
6000
6222
|
subscriberId: subscriberId,
|
|
6001
6223
|
error: errorMessage
|
|
6002
6224
|
});
|
|
6003
6225
|
case 25:
|
|
6004
|
-
|
|
6226
|
+
_context60.next = 7;
|
|
6005
6227
|
break;
|
|
6006
6228
|
case 27:
|
|
6007
|
-
|
|
6229
|
+
_context60.next = 32;
|
|
6008
6230
|
break;
|
|
6009
6231
|
case 29:
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
_iterator18.e(
|
|
6232
|
+
_context60.prev = 29;
|
|
6233
|
+
_context60.t1 = _context60["catch"](5);
|
|
6234
|
+
_iterator18.e(_context60.t1);
|
|
6013
6235
|
case 32:
|
|
6014
|
-
|
|
6236
|
+
_context60.prev = 32;
|
|
6015
6237
|
_iterator18.f();
|
|
6016
|
-
return
|
|
6238
|
+
return _context60.finish(32);
|
|
6017
6239
|
case 35:
|
|
6018
6240
|
notifyEndAt = Date.now();
|
|
6019
6241
|
this.logInfo('recomputeAndNotifyOrderQuery: 推送完成', {
|
|
@@ -6022,9 +6244,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
6022
6244
|
});
|
|
6023
6245
|
case 37:
|
|
6024
6246
|
case "end":
|
|
6025
|
-
return
|
|
6247
|
+
return _context60.stop();
|
|
6026
6248
|
}
|
|
6027
|
-
},
|
|
6249
|
+
}, _callee60, this, [[5, 29, 32, 35], [9, 21]]);
|
|
6028
6250
|
}));
|
|
6029
6251
|
function recomputeAndNotifyOrderQuery() {
|
|
6030
6252
|
return _recomputeAndNotifyOrderQuery.apply(this, arguments);
|
|
@@ -6162,67 +6384,67 @@ var Server = /*#__PURE__*/function () {
|
|
|
6162
6384
|
}, {
|
|
6163
6385
|
key: "recomputeAndNotifyBookingQuery",
|
|
6164
6386
|
value: (function () {
|
|
6165
|
-
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6387
|
+
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61() {
|
|
6166
6388
|
var _iterator20, _step20, _step20$value, subscriberId, subscriber, result, errorMessage;
|
|
6167
|
-
return _regeneratorRuntime().wrap(function
|
|
6168
|
-
while (1) switch (
|
|
6389
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
|
6390
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
6169
6391
|
case 0:
|
|
6170
6392
|
if (!(this.bookingQuerySubscribers.size === 0)) {
|
|
6171
|
-
|
|
6393
|
+
_context61.next = 2;
|
|
6172
6394
|
break;
|
|
6173
6395
|
}
|
|
6174
|
-
return
|
|
6396
|
+
return _context61.abrupt("return");
|
|
6175
6397
|
case 2:
|
|
6176
6398
|
this.logInfo('recomputeAndNotifyBookingQuery: 开始推送', {
|
|
6177
6399
|
subscriberCount: this.bookingQuerySubscribers.size
|
|
6178
6400
|
});
|
|
6179
6401
|
_iterator20 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
|
|
6180
|
-
|
|
6402
|
+
_context61.prev = 4;
|
|
6181
6403
|
_iterator20.s();
|
|
6182
6404
|
case 6:
|
|
6183
6405
|
if ((_step20 = _iterator20.n()).done) {
|
|
6184
|
-
|
|
6406
|
+
_context61.next = 22;
|
|
6185
6407
|
break;
|
|
6186
6408
|
}
|
|
6187
6409
|
_step20$value = _slicedToArray(_step20.value, 2), subscriberId = _step20$value[0], subscriber = _step20$value[1];
|
|
6188
|
-
|
|
6189
|
-
|
|
6410
|
+
_context61.prev = 8;
|
|
6411
|
+
_context61.next = 11;
|
|
6190
6412
|
return this.computeBookingQueryResult(subscriber.context);
|
|
6191
6413
|
case 11:
|
|
6192
|
-
result =
|
|
6414
|
+
result = _context61.sent;
|
|
6193
6415
|
subscriber.callback(result);
|
|
6194
6416
|
this.logInfo('recomputeAndNotifyBookingQuery: 已推送', {
|
|
6195
6417
|
subscriberId: subscriberId
|
|
6196
6418
|
});
|
|
6197
|
-
|
|
6419
|
+
_context61.next = 20;
|
|
6198
6420
|
break;
|
|
6199
6421
|
case 16:
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
errorMessage =
|
|
6422
|
+
_context61.prev = 16;
|
|
6423
|
+
_context61.t0 = _context61["catch"](8);
|
|
6424
|
+
errorMessage = _context61.t0 instanceof Error ? _context61.t0.message : String(_context61.t0);
|
|
6203
6425
|
this.logError('recomputeAndNotifyBookingQuery: 推送失败', {
|
|
6204
6426
|
subscriberId: subscriberId,
|
|
6205
6427
|
error: errorMessage
|
|
6206
6428
|
});
|
|
6207
6429
|
case 20:
|
|
6208
|
-
|
|
6430
|
+
_context61.next = 6;
|
|
6209
6431
|
break;
|
|
6210
6432
|
case 22:
|
|
6211
|
-
|
|
6433
|
+
_context61.next = 27;
|
|
6212
6434
|
break;
|
|
6213
6435
|
case 24:
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
_iterator20.e(
|
|
6436
|
+
_context61.prev = 24;
|
|
6437
|
+
_context61.t1 = _context61["catch"](4);
|
|
6438
|
+
_iterator20.e(_context61.t1);
|
|
6217
6439
|
case 27:
|
|
6218
|
-
|
|
6440
|
+
_context61.prev = 27;
|
|
6219
6441
|
_iterator20.f();
|
|
6220
|
-
return
|
|
6442
|
+
return _context61.finish(27);
|
|
6221
6443
|
case 30:
|
|
6222
6444
|
case "end":
|
|
6223
|
-
return
|
|
6445
|
+
return _context61.stop();
|
|
6224
6446
|
}
|
|
6225
|
-
},
|
|
6447
|
+
}, _callee61, this, [[4, 24, 27, 30], [8, 16]]);
|
|
6226
6448
|
}));
|
|
6227
6449
|
function recomputeAndNotifyBookingQuery() {
|
|
6228
6450
|
return _recomputeAndNotifyBookingQuery.apply(this, arguments);
|