@pisell/pisellos 2.2.257 → 2.2.258
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +17 -13
- package/dist/modules/Order/index.d.ts +30 -2
- package/dist/modules/Order/index.js +508 -241
- package/dist/modules/Order/types.d.ts +20 -2
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
- package/dist/modules/Order/utils.d.ts +4 -0
- package/dist/modules/Order/utils.js +114 -28
- package/dist/modules/Rules/index.d.ts +3 -3
- package/dist/modules/Rules/index.js +8 -3
- package/dist/modules/Rules/types.d.ts +2 -1
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +1208 -920
- package/dist/server/modules/order/index.d.ts +22 -3
- package/dist/server/modules/order/index.js +397 -314
- package/dist/solution/BaseSales/index.d.ts +16 -2
- package/dist/solution/BaseSales/index.js +484 -314
- package/dist/solution/BaseSales/types.d.ts +1 -0
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +9 -1
- package/dist/solution/BookingTicket/index.js +162 -6
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +11 -1
- package/lib/modules/Order/index.d.ts +30 -2
- package/lib/modules/Order/index.js +340 -57
- package/lib/modules/Order/types.d.ts +20 -2
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
- package/lib/modules/Order/utils.d.ts +4 -0
- package/lib/modules/Order/utils.js +84 -2
- package/lib/modules/Rules/index.d.ts +3 -3
- package/lib/modules/Rules/index.js +4 -3
- package/lib/modules/Rules/types.d.ts +2 -1
- package/lib/server/index.d.ts +3 -0
- package/lib/server/index.js +201 -9
- package/lib/server/modules/order/index.d.ts +22 -3
- package/lib/server/modules/order/index.js +102 -51
- package/lib/solution/BaseSales/index.d.ts +16 -2
- package/lib/solution/BaseSales/index.js +143 -31
- package/lib/solution/BaseSales/types.d.ts +1 -0
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +9 -1
- package/lib/solution/BookingTicket/index.js +112 -0
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -62,7 +62,7 @@ var PRODUCT_TITLE_SNAPSHOT_KEYS = ['en', 'ja', 'pt', 'auto', 'zh-CN', 'zh-HK', '
|
|
|
62
62
|
var Server = /*#__PURE__*/function () {
|
|
63
63
|
function Server(core) {
|
|
64
64
|
var _this = this,
|
|
65
|
-
_this$
|
|
65
|
+
_this$app4;
|
|
66
66
|
_classCallCheck(this, Server);
|
|
67
67
|
_defineProperty(this, "core", void 0);
|
|
68
68
|
_defineProperty(this, "app", void 0);
|
|
@@ -1029,7 +1029,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
1029
1029
|
checkoutData: checkoutData,
|
|
1030
1030
|
order: printableOrder,
|
|
1031
1031
|
response: null,
|
|
1032
|
-
requireFullyPaid: false
|
|
1032
|
+
requireFullyPaid: false,
|
|
1033
|
+
isManualPrint: true
|
|
1033
1034
|
});
|
|
1034
1035
|
case 27:
|
|
1035
1036
|
printResult = _context16.sent;
|
|
@@ -1068,14 +1069,129 @@ var Server = /*#__PURE__*/function () {
|
|
|
1068
1069
|
return _ref39.apply(this, arguments);
|
|
1069
1070
|
};
|
|
1070
1071
|
}());
|
|
1071
|
-
_defineProperty(this, "
|
|
1072
|
+
_defineProperty(this, "handleMachinecodeBatchMetadata", /*#__PURE__*/function () {
|
|
1072
1073
|
var _ref43 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(_ref42) {
|
|
1073
|
-
var _this$app2;
|
|
1074
|
-
var
|
|
1074
|
+
var _this$resolveMachinec, _this$app2;
|
|
1075
|
+
var data, title, backendPath, batchMetadata, message, _response$code, _response$status, _response$message, _response$data2, response, backendError, _backendError$code, _backendError$status, _backendError$message, _backendError$data, _message;
|
|
1075
1076
|
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1076
1077
|
while (1) switch (_context17.prev = _context17.next) {
|
|
1077
1078
|
case 0:
|
|
1078
|
-
|
|
1079
|
+
data = _ref42.data;
|
|
1080
|
+
title = 'handleMachinecodeBatchMetadata';
|
|
1081
|
+
backendPath = '/shop/machinecode/batch-metadata';
|
|
1082
|
+
batchMetadata = Array.isArray(data === null || data === void 0 ? void 0 : data.data) ? data.data : [];
|
|
1083
|
+
_this.logInfo("".concat(title, ": \u5F00\u59CB\u5904\u7406"), {
|
|
1084
|
+
backendPath: backendPath,
|
|
1085
|
+
batchSize: batchMetadata.length,
|
|
1086
|
+
order_lookup: (_this$resolveMachinec = _this.resolveMachinecodeBatchMetadataLookup(data)) !== null && _this$resolveMachinec !== void 0 ? _this$resolveMachinec : null
|
|
1087
|
+
});
|
|
1088
|
+
if (!(batchMetadata.length === 0)) {
|
|
1089
|
+
_context17.next = 7;
|
|
1090
|
+
break;
|
|
1091
|
+
}
|
|
1092
|
+
return _context17.abrupt("return", {
|
|
1093
|
+
code: 200,
|
|
1094
|
+
status: true,
|
|
1095
|
+
message: '',
|
|
1096
|
+
data: []
|
|
1097
|
+
});
|
|
1098
|
+
case 7:
|
|
1099
|
+
_context17.prev = 7;
|
|
1100
|
+
_context17.next = 10;
|
|
1101
|
+
return _this.syncMachinecodeBatchMetadataToLocalOrder(data, batchMetadata);
|
|
1102
|
+
case 10:
|
|
1103
|
+
_context17.next = 17;
|
|
1104
|
+
break;
|
|
1105
|
+
case 12:
|
|
1106
|
+
_context17.prev = 12;
|
|
1107
|
+
_context17.t0 = _context17["catch"](7);
|
|
1108
|
+
message = _this.getUnknownErrorMessage(_context17.t0);
|
|
1109
|
+
_this.logError("".concat(title, ": \u672C\u5730\u8BA2\u5355 metadata \u66F4\u65B0\u5931\u8D25"), {
|
|
1110
|
+
error: message,
|
|
1111
|
+
error_detail: _this.normalizeUnknownError(_context17.t0)
|
|
1112
|
+
});
|
|
1113
|
+
return _context17.abrupt("return", {
|
|
1114
|
+
code: 500,
|
|
1115
|
+
status: false,
|
|
1116
|
+
message: message,
|
|
1117
|
+
data: null
|
|
1118
|
+
});
|
|
1119
|
+
case 17:
|
|
1120
|
+
if ((_this$app2 = _this.app) !== null && _this$app2 !== void 0 && (_this$app2 = _this$app2.request) !== null && _this$app2 !== void 0 && _this$app2.post) {
|
|
1121
|
+
_context17.next = 20;
|
|
1122
|
+
break;
|
|
1123
|
+
}
|
|
1124
|
+
_this.logError("".concat(title, ": app.request \u4E0D\u53EF\u7528"), {
|
|
1125
|
+
backendPath: backendPath
|
|
1126
|
+
});
|
|
1127
|
+
return _context17.abrupt("return", {
|
|
1128
|
+
code: 500,
|
|
1129
|
+
status: false,
|
|
1130
|
+
message: 'app.request 不可用',
|
|
1131
|
+
data: null
|
|
1132
|
+
});
|
|
1133
|
+
case 20:
|
|
1134
|
+
_context17.prev = 20;
|
|
1135
|
+
_context17.next = 23;
|
|
1136
|
+
return _this.app.request.post(backendPath, {
|
|
1137
|
+
data: batchMetadata
|
|
1138
|
+
}, {
|
|
1139
|
+
isShopApi: true,
|
|
1140
|
+
customToast: function customToast() {}
|
|
1141
|
+
});
|
|
1142
|
+
case 23:
|
|
1143
|
+
response = _context17.sent;
|
|
1144
|
+
return _context17.abrupt("return", {
|
|
1145
|
+
code: (_response$code = response === null || response === void 0 ? void 0 : response.code) !== null && _response$code !== void 0 ? _response$code : 200,
|
|
1146
|
+
status: (_response$status = response === null || response === void 0 ? void 0 : response.status) !== null && _response$status !== void 0 ? _response$status : true,
|
|
1147
|
+
message: (_response$message = response === null || response === void 0 ? void 0 : response.message) !== null && _response$message !== void 0 ? _response$message : '',
|
|
1148
|
+
data: (_response$data2 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data2 !== void 0 ? _response$data2 : response
|
|
1149
|
+
});
|
|
1150
|
+
case 27:
|
|
1151
|
+
_context17.prev = 27;
|
|
1152
|
+
_context17.t1 = _context17["catch"](20);
|
|
1153
|
+
backendError = _this.extractBackendErrorResponse(_context17.t1);
|
|
1154
|
+
if (!backendError) {
|
|
1155
|
+
_context17.next = 32;
|
|
1156
|
+
break;
|
|
1157
|
+
}
|
|
1158
|
+
return _context17.abrupt("return", {
|
|
1159
|
+
code: (_backendError$code = backendError.code) !== null && _backendError$code !== void 0 ? _backendError$code : 500,
|
|
1160
|
+
status: (_backendError$status = backendError.status) !== null && _backendError$status !== void 0 ? _backendError$status : false,
|
|
1161
|
+
message: (_backendError$message = backendError.message) !== null && _backendError$message !== void 0 ? _backendError$message : '后端拒绝 batch-metadata',
|
|
1162
|
+
data: (_backendError$data = backendError.data) !== null && _backendError$data !== void 0 ? _backendError$data : null
|
|
1163
|
+
});
|
|
1164
|
+
case 32:
|
|
1165
|
+
_message = _this.getUnknownErrorMessage(_context17.t1);
|
|
1166
|
+
_this.logError("".concat(title, ": \u8BF7\u6C42\u5931\u8D25"), {
|
|
1167
|
+
backendPath: backendPath,
|
|
1168
|
+
error: _message,
|
|
1169
|
+
error_detail: _this.normalizeUnknownError(_context17.t1)
|
|
1170
|
+
});
|
|
1171
|
+
return _context17.abrupt("return", {
|
|
1172
|
+
code: 500,
|
|
1173
|
+
status: false,
|
|
1174
|
+
message: _message,
|
|
1175
|
+
data: null
|
|
1176
|
+
});
|
|
1177
|
+
case 35:
|
|
1178
|
+
case "end":
|
|
1179
|
+
return _context17.stop();
|
|
1180
|
+
}
|
|
1181
|
+
}, _callee17, null, [[7, 12], [20, 27]]);
|
|
1182
|
+
}));
|
|
1183
|
+
return function (_x17) {
|
|
1184
|
+
return _ref43.apply(this, arguments);
|
|
1185
|
+
};
|
|
1186
|
+
}());
|
|
1187
|
+
_defineProperty(this, "handleOrderSalesDetail", /*#__PURE__*/function () {
|
|
1188
|
+
var _ref45 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref44) {
|
|
1189
|
+
var _this$app3;
|
|
1190
|
+
var url, data, path, requestPath, lookup, localOrder, backendPath, _response$data3, response, fresh, savedOrder, errorMessage;
|
|
1191
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1192
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1193
|
+
case 0:
|
|
1194
|
+
url = _ref44.url, data = _ref44.data, path = _ref44.path;
|
|
1079
1195
|
requestPath = _this.parseRequestPath(url, path);
|
|
1080
1196
|
lookup = _this.extractOrderSalesDetailLookup(requestPath);
|
|
1081
1197
|
_this.logInfo('handleOrderSalesDetail: 开始处理', {
|
|
@@ -1084,14 +1200,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
1084
1200
|
lookup: lookup
|
|
1085
1201
|
});
|
|
1086
1202
|
if (lookup) {
|
|
1087
|
-
|
|
1203
|
+
_context18.next = 7;
|
|
1088
1204
|
break;
|
|
1089
1205
|
}
|
|
1090
1206
|
_this.logWarning('handleOrderSalesDetail: lookup 缺失', {
|
|
1091
1207
|
url: url,
|
|
1092
1208
|
path: requestPath
|
|
1093
1209
|
});
|
|
1094
|
-
return
|
|
1210
|
+
return _context18.abrupt("return", {
|
|
1095
1211
|
code: 400,
|
|
1096
1212
|
status: false,
|
|
1097
1213
|
message: '订单 lookup 缺失',
|
|
@@ -1099,11 +1215,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1099
1215
|
});
|
|
1100
1216
|
case 7:
|
|
1101
1217
|
if (_this.order) {
|
|
1102
|
-
|
|
1218
|
+
_context18.next = 10;
|
|
1103
1219
|
break;
|
|
1104
1220
|
}
|
|
1105
1221
|
_this.logError('handleOrderSalesDetail: Order 模块未注册');
|
|
1106
|
-
return
|
|
1222
|
+
return _context18.abrupt("return", {
|
|
1107
1223
|
code: 500,
|
|
1108
1224
|
status: false,
|
|
1109
1225
|
message: 'Order 模块未注册',
|
|
@@ -1111,33 +1227,33 @@ var Server = /*#__PURE__*/function () {
|
|
|
1111
1227
|
});
|
|
1112
1228
|
case 10:
|
|
1113
1229
|
if (_this.shouldForceRemoteSalesDetail(data)) {
|
|
1114
|
-
|
|
1230
|
+
_context18.next = 17;
|
|
1115
1231
|
break;
|
|
1116
1232
|
}
|
|
1117
|
-
|
|
1233
|
+
_context18.next = 13;
|
|
1118
1234
|
return _this.order.getLocalOrderByLookup(lookup);
|
|
1119
1235
|
case 13:
|
|
1120
|
-
localOrder =
|
|
1236
|
+
localOrder = _context18.sent;
|
|
1121
1237
|
if (!localOrder) {
|
|
1122
|
-
|
|
1238
|
+
_context18.next = 17;
|
|
1123
1239
|
break;
|
|
1124
1240
|
}
|
|
1125
1241
|
_this.logInfo('handleOrderSalesDetail: 命中本地订单', {
|
|
1126
1242
|
lookup: lookup
|
|
1127
1243
|
});
|
|
1128
|
-
return
|
|
1244
|
+
return _context18.abrupt("return", {
|
|
1129
1245
|
code: 200,
|
|
1130
1246
|
status: true,
|
|
1131
1247
|
message: '',
|
|
1132
1248
|
data: localOrder
|
|
1133
1249
|
});
|
|
1134
1250
|
case 17:
|
|
1135
|
-
if ((_this$
|
|
1136
|
-
|
|
1251
|
+
if ((_this$app3 = _this.app) !== null && _this$app3 !== void 0 && _this$app3.request) {
|
|
1252
|
+
_context18.next = 20;
|
|
1137
1253
|
break;
|
|
1138
1254
|
}
|
|
1139
1255
|
_this.logError('handleOrderSalesDetail: app.request 不可用');
|
|
1140
|
-
return
|
|
1256
|
+
return _context18.abrupt("return", {
|
|
1141
1257
|
code: 500,
|
|
1142
1258
|
status: false,
|
|
1143
1259
|
message: 'app.request 不可用',
|
|
@@ -1145,8 +1261,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
1145
1261
|
});
|
|
1146
1262
|
case 20:
|
|
1147
1263
|
backendPath = _this.buildOrderSalesDetailBackendPath(lookup, data);
|
|
1148
|
-
|
|
1149
|
-
|
|
1264
|
+
_context18.prev = 21;
|
|
1265
|
+
_context18.next = 24;
|
|
1150
1266
|
return _this.app.request.get(backendPath, {
|
|
1151
1267
|
lookup_mode: 'multi'
|
|
1152
1268
|
}, {
|
|
@@ -1154,38 +1270,38 @@ var Server = /*#__PURE__*/function () {
|
|
|
1154
1270
|
customToast: function customToast() {}
|
|
1155
1271
|
});
|
|
1156
1272
|
case 24:
|
|
1157
|
-
response =
|
|
1158
|
-
fresh = (_response$
|
|
1273
|
+
response = _context18.sent;
|
|
1274
|
+
fresh = (_response$data3 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data3 !== void 0 ? _response$data3 : response;
|
|
1159
1275
|
if (!(!fresh || _typeof(fresh) !== 'object' || fresh.order_id == null)) {
|
|
1160
|
-
|
|
1276
|
+
_context18.next = 29;
|
|
1161
1277
|
break;
|
|
1162
1278
|
}
|
|
1163
1279
|
_this.logInfo('handleOrderSalesDetail: 后端返回订单为空', {
|
|
1164
1280
|
lookup: lookup,
|
|
1165
1281
|
backendPath: backendPath
|
|
1166
1282
|
});
|
|
1167
|
-
return
|
|
1283
|
+
return _context18.abrupt("return", {
|
|
1168
1284
|
code: 500,
|
|
1169
1285
|
status: false,
|
|
1170
1286
|
message: '后端返回订单为空',
|
|
1171
1287
|
data: null
|
|
1172
1288
|
});
|
|
1173
1289
|
case 29:
|
|
1174
|
-
|
|
1290
|
+
_context18.next = 31;
|
|
1175
1291
|
return _this.order.upsertOrdersFromRemote([fresh]);
|
|
1176
1292
|
case 31:
|
|
1177
|
-
|
|
1293
|
+
_context18.next = 33;
|
|
1178
1294
|
return _this.order.getLocalOrderByLookup(lookup);
|
|
1179
1295
|
case 33:
|
|
1180
|
-
savedOrder =
|
|
1296
|
+
savedOrder = _context18.sent;
|
|
1181
1297
|
if (savedOrder) {
|
|
1182
|
-
|
|
1298
|
+
_context18.next = 37;
|
|
1183
1299
|
break;
|
|
1184
1300
|
}
|
|
1185
1301
|
_this.logError('handleOrderSalesDetail: 订单写入后回读失败', {
|
|
1186
1302
|
lookup: lookup
|
|
1187
1303
|
});
|
|
1188
|
-
return
|
|
1304
|
+
return _context18.abrupt("return", {
|
|
1189
1305
|
code: 500,
|
|
1190
1306
|
status: false,
|
|
1191
1307
|
message: '订单写入后回读失败',
|
|
@@ -1195,22 +1311,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
1195
1311
|
_this.logInfo('handleOrderSalesDetail: 远端订单已同步到本地', {
|
|
1196
1312
|
lookup: lookup
|
|
1197
1313
|
});
|
|
1198
|
-
return
|
|
1314
|
+
return _context18.abrupt("return", {
|
|
1199
1315
|
code: 200,
|
|
1200
1316
|
status: true,
|
|
1201
1317
|
message: '',
|
|
1202
1318
|
data: savedOrder
|
|
1203
1319
|
});
|
|
1204
1320
|
case 41:
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
errorMessage =
|
|
1208
|
-
_this.
|
|
1321
|
+
_context18.prev = 41;
|
|
1322
|
+
_context18.t0 = _context18["catch"](21);
|
|
1323
|
+
errorMessage = _context18.t0 instanceof Error ? _context18.t0.message : String(_context18.t0);
|
|
1324
|
+
_this.logInfo('handleOrderSalesDetail: 请求失败', {
|
|
1209
1325
|
lookup: lookup,
|
|
1210
1326
|
backendPath: backendPath,
|
|
1211
1327
|
error: errorMessage
|
|
1212
1328
|
});
|
|
1213
|
-
return
|
|
1329
|
+
return _context18.abrupt("return", {
|
|
1214
1330
|
code: 500,
|
|
1215
1331
|
status: false,
|
|
1216
1332
|
message: errorMessage,
|
|
@@ -1218,28 +1334,28 @@ var Server = /*#__PURE__*/function () {
|
|
|
1218
1334
|
});
|
|
1219
1335
|
case 46:
|
|
1220
1336
|
case "end":
|
|
1221
|
-
return
|
|
1337
|
+
return _context18.stop();
|
|
1222
1338
|
}
|
|
1223
|
-
},
|
|
1339
|
+
}, _callee18, null, [[21, 41]]);
|
|
1224
1340
|
}));
|
|
1225
|
-
return function (
|
|
1226
|
-
return
|
|
1341
|
+
return function (_x18) {
|
|
1342
|
+
return _ref45.apply(this, arguments);
|
|
1227
1343
|
};
|
|
1228
1344
|
}());
|
|
1229
1345
|
/**
|
|
1230
1346
|
* GET /shop/schedule/floor-plan* 前缀路由:读本地 store;支持 subscriberId + callback 订阅更新
|
|
1231
1347
|
*/
|
|
1232
1348
|
_defineProperty(this, "handleFloorPlanGet", /*#__PURE__*/function () {
|
|
1233
|
-
var
|
|
1234
|
-
var url, data, config, routePath, base, path, _subscriberId,
|
|
1235
|
-
return _regeneratorRuntime().wrap(function
|
|
1236
|
-
while (1) switch (
|
|
1349
|
+
var _ref47 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref46) {
|
|
1350
|
+
var url, data, config, routePath, base, path, _subscriberId, _ref48, callback, subscriberId, ctx;
|
|
1351
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1352
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1237
1353
|
case 0:
|
|
1238
|
-
url =
|
|
1354
|
+
url = _ref46.url, data = _ref46.data, config = _ref46.config, routePath = _ref46.path;
|
|
1239
1355
|
base = '/shop/schedule/floor-plan';
|
|
1240
1356
|
path = _this.parseRequestPath(url, routePath);
|
|
1241
1357
|
if (!(path === "".concat(base, "/unsubscribe") || path === "".concat(base, "/code/unsubscribe"))) {
|
|
1242
|
-
|
|
1358
|
+
_context19.next = 7;
|
|
1243
1359
|
break;
|
|
1244
1360
|
}
|
|
1245
1361
|
_subscriberId = data === null || data === void 0 ? void 0 : data.subscriberId;
|
|
@@ -1250,19 +1366,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
1250
1366
|
remaining: _this.floorPlanQuerySubscribers.size
|
|
1251
1367
|
});
|
|
1252
1368
|
}
|
|
1253
|
-
return
|
|
1369
|
+
return _context19.abrupt("return", {
|
|
1254
1370
|
code: 200,
|
|
1255
1371
|
message: 'ok',
|
|
1256
1372
|
status: true
|
|
1257
1373
|
});
|
|
1258
1374
|
case 7:
|
|
1259
|
-
|
|
1375
|
+
_ref48 = config || {}, callback = _ref48.callback, subscriberId = _ref48.subscriberId;
|
|
1260
1376
|
ctx = _this.resolveFloorPlanQueryContext(path, base);
|
|
1261
1377
|
if (ctx) {
|
|
1262
|
-
|
|
1378
|
+
_context19.next = 11;
|
|
1263
1379
|
break;
|
|
1264
1380
|
}
|
|
1265
|
-
return
|
|
1381
|
+
return _context19.abrupt("return", {
|
|
1266
1382
|
status: false,
|
|
1267
1383
|
code: 404,
|
|
1268
1384
|
message: 'Not Found',
|
|
@@ -1280,28 +1396,28 @@ var Server = /*#__PURE__*/function () {
|
|
|
1280
1396
|
total: _this.floorPlanQuerySubscribers.size
|
|
1281
1397
|
});
|
|
1282
1398
|
}
|
|
1283
|
-
return
|
|
1399
|
+
return _context19.abrupt("return", _this.computeFloorPlanQueryResult(ctx));
|
|
1284
1400
|
case 13:
|
|
1285
1401
|
case "end":
|
|
1286
|
-
return
|
|
1402
|
+
return _context19.stop();
|
|
1287
1403
|
}
|
|
1288
|
-
},
|
|
1404
|
+
}, _callee19);
|
|
1289
1405
|
}));
|
|
1290
|
-
return function (
|
|
1291
|
-
return
|
|
1406
|
+
return function (_x19) {
|
|
1407
|
+
return _ref47.apply(this, arguments);
|
|
1292
1408
|
};
|
|
1293
1409
|
}());
|
|
1294
1410
|
/**
|
|
1295
1411
|
* 取消预约列表查询订阅(HTTP 路由入口)
|
|
1296
1412
|
*/
|
|
1297
1413
|
_defineProperty(this, "handleUnsubscribeBookingQuery", /*#__PURE__*/function () {
|
|
1298
|
-
var
|
|
1299
|
-
var data,
|
|
1300
|
-
return _regeneratorRuntime().wrap(function
|
|
1301
|
-
while (1) switch (
|
|
1414
|
+
var _ref50 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(_ref49) {
|
|
1415
|
+
var data, _ref51, subscriberId;
|
|
1416
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1417
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1302
1418
|
case 0:
|
|
1303
|
-
data =
|
|
1304
|
-
|
|
1419
|
+
data = _ref49.data;
|
|
1420
|
+
_ref51 = data || {}, subscriberId = _ref51.subscriberId;
|
|
1305
1421
|
if (subscriberId) {
|
|
1306
1422
|
_this.bookingQuerySubscribers.delete(subscriberId);
|
|
1307
1423
|
_this.bookingRemoteQuerySubscribers.delete(subscriberId);
|
|
@@ -1311,19 +1427,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
1311
1427
|
remainingRemote: _this.bookingRemoteQuerySubscribers.size
|
|
1312
1428
|
});
|
|
1313
1429
|
}
|
|
1314
|
-
return
|
|
1430
|
+
return _context20.abrupt("return", {
|
|
1315
1431
|
code: 200,
|
|
1316
1432
|
message: 'ok',
|
|
1317
1433
|
status: true
|
|
1318
1434
|
});
|
|
1319
1435
|
case 4:
|
|
1320
1436
|
case "end":
|
|
1321
|
-
return
|
|
1437
|
+
return _context20.stop();
|
|
1322
1438
|
}
|
|
1323
|
-
},
|
|
1439
|
+
}, _callee20);
|
|
1324
1440
|
}));
|
|
1325
|
-
return function (
|
|
1326
|
-
return
|
|
1441
|
+
return function (_x20) {
|
|
1442
|
+
return _ref50.apply(this, arguments);
|
|
1327
1443
|
};
|
|
1328
1444
|
}());
|
|
1329
1445
|
/**
|
|
@@ -1331,13 +1447,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
1331
1447
|
* 通过餐牌ID列表获取所有相关日程的时间段点
|
|
1332
1448
|
*/
|
|
1333
1449
|
_defineProperty(this, "handleGetScheduleTimePoints", /*#__PURE__*/function () {
|
|
1334
|
-
var
|
|
1450
|
+
var _ref53 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(_ref52) {
|
|
1335
1451
|
var _menu_list_ids$length;
|
|
1336
1452
|
var url, method, data, config, menu_list_ids, _menu_list_ids$length2, menuList, scheduleIds, scheduleList, timePoints, errorMessage;
|
|
1337
|
-
return _regeneratorRuntime().wrap(function
|
|
1338
|
-
while (1) switch (
|
|
1453
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1454
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1339
1455
|
case 0:
|
|
1340
|
-
url =
|
|
1456
|
+
url = _ref52.url, method = _ref52.method, data = _ref52.data, config = _ref52.config;
|
|
1341
1457
|
console.log('[Server] handleGetScheduleTimePoints:', url, method, data, config);
|
|
1342
1458
|
menu_list_ids = data.menu_list_ids;
|
|
1343
1459
|
_this.logInfo('handleGetScheduleTimePoints 开始处理', {
|
|
@@ -1347,12 +1463,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
1347
1463
|
|
|
1348
1464
|
// 检查必要的模块是否已注册
|
|
1349
1465
|
if (_this.menu) {
|
|
1350
|
-
|
|
1466
|
+
_context21.next = 8;
|
|
1351
1467
|
break;
|
|
1352
1468
|
}
|
|
1353
1469
|
console.error('[Server] Menu 模块未注册');
|
|
1354
1470
|
_this.logError('handleGetScheduleTimePoints: Menu 模块未注册');
|
|
1355
|
-
return
|
|
1471
|
+
return _context21.abrupt("return", {
|
|
1356
1472
|
code: 500,
|
|
1357
1473
|
message: 'Menu 模块未注册',
|
|
1358
1474
|
data: [],
|
|
@@ -1360,12 +1476,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
1360
1476
|
});
|
|
1361
1477
|
case 8:
|
|
1362
1478
|
if (_this.schedule) {
|
|
1363
|
-
|
|
1479
|
+
_context21.next = 12;
|
|
1364
1480
|
break;
|
|
1365
1481
|
}
|
|
1366
1482
|
console.error('[Server] Schedule 模块未注册');
|
|
1367
1483
|
_this.logError('handleGetScheduleTimePoints: Schedule 模块未注册');
|
|
1368
|
-
return
|
|
1484
|
+
return _context21.abrupt("return", {
|
|
1369
1485
|
code: 500,
|
|
1370
1486
|
message: 'Schedule 模块未注册',
|
|
1371
1487
|
data: [],
|
|
@@ -1373,7 +1489,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1373
1489
|
});
|
|
1374
1490
|
case 12:
|
|
1375
1491
|
if (!(!menu_list_ids || !Array.isArray(menu_list_ids) || menu_list_ids.length === 0)) {
|
|
1376
|
-
|
|
1492
|
+
_context21.next = 16;
|
|
1377
1493
|
break;
|
|
1378
1494
|
}
|
|
1379
1495
|
console.error('[Server] menu_list_ids 参数无效');
|
|
@@ -1381,14 +1497,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
1381
1497
|
menuListIdsCount: (_menu_list_ids$length2 = menu_list_ids === null || menu_list_ids === void 0 ? void 0 : menu_list_ids.length) !== null && _menu_list_ids$length2 !== void 0 ? _menu_list_ids$length2 : 0,
|
|
1382
1498
|
menu_list_ids: menu_list_ids
|
|
1383
1499
|
});
|
|
1384
|
-
return
|
|
1500
|
+
return _context21.abrupt("return", {
|
|
1385
1501
|
code: 400,
|
|
1386
1502
|
message: 'menu_list_ids 参数无效',
|
|
1387
1503
|
data: [],
|
|
1388
1504
|
status: false
|
|
1389
1505
|
});
|
|
1390
1506
|
case 16:
|
|
1391
|
-
|
|
1507
|
+
_context21.prev = 16;
|
|
1392
1508
|
// 1. 获取餐牌列表
|
|
1393
1509
|
menuList = _this.menu.getMenuByIds(menu_list_ids);
|
|
1394
1510
|
console.log("[Server] \u627E\u5230 ".concat(menuList.length, " \u4E2A\u9910\u724C"));
|
|
@@ -1406,13 +1522,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
1406
1522
|
scheduleCount: scheduleIds.length
|
|
1407
1523
|
});
|
|
1408
1524
|
if (!(scheduleIds.length === 0)) {
|
|
1409
|
-
|
|
1525
|
+
_context21.next = 26;
|
|
1410
1526
|
break;
|
|
1411
1527
|
}
|
|
1412
1528
|
_this.logInfo('handleGetScheduleTimePoints: 没有找到相关日程', {
|
|
1413
1529
|
menuListIdsCount: menu_list_ids.length
|
|
1414
1530
|
});
|
|
1415
|
-
return
|
|
1531
|
+
return _context21.abrupt("return", {
|
|
1416
1532
|
code: 200,
|
|
1417
1533
|
message: '没有找到相关日程',
|
|
1418
1534
|
data: [],
|
|
@@ -1436,22 +1552,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
1436
1552
|
scheduleCount: scheduleList.length,
|
|
1437
1553
|
timePointCount: timePoints.length
|
|
1438
1554
|
});
|
|
1439
|
-
return
|
|
1555
|
+
return _context21.abrupt("return", {
|
|
1440
1556
|
code: 200,
|
|
1441
1557
|
message: '获取成功',
|
|
1442
1558
|
data: timePoints,
|
|
1443
1559
|
status: true
|
|
1444
1560
|
});
|
|
1445
1561
|
case 35:
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
errorMessage =
|
|
1449
|
-
console.error('[Server] 获取日程时间点失败:',
|
|
1562
|
+
_context21.prev = 35;
|
|
1563
|
+
_context21.t0 = _context21["catch"](16);
|
|
1564
|
+
errorMessage = _context21.t0 instanceof Error ? _context21.t0.message : '未知错误';
|
|
1565
|
+
console.error('[Server] 获取日程时间点失败:', _context21.t0);
|
|
1450
1566
|
_this.logError('handleGetScheduleTimePoints: 获取日程时间点失败', {
|
|
1451
1567
|
menuListIdsCount: menu_list_ids.length,
|
|
1452
1568
|
error: errorMessage
|
|
1453
1569
|
});
|
|
1454
|
-
return
|
|
1570
|
+
return _context21.abrupt("return", {
|
|
1455
1571
|
code: 500,
|
|
1456
1572
|
message: "\u83B7\u53D6\u5931\u8D25: ".concat(errorMessage),
|
|
1457
1573
|
data: [],
|
|
@@ -1459,18 +1575,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
1459
1575
|
});
|
|
1460
1576
|
case 41:
|
|
1461
1577
|
case "end":
|
|
1462
|
-
return
|
|
1578
|
+
return _context21.stop();
|
|
1463
1579
|
}
|
|
1464
|
-
},
|
|
1580
|
+
}, _callee21, null, [[16, 35]]);
|
|
1465
1581
|
}));
|
|
1466
|
-
return function (
|
|
1467
|
-
return
|
|
1582
|
+
return function (_x21) {
|
|
1583
|
+
return _ref53.apply(this, arguments);
|
|
1468
1584
|
};
|
|
1469
1585
|
}());
|
|
1470
1586
|
this.core = core;
|
|
1471
1587
|
var appPlugin = core.getPlugin('app');
|
|
1472
1588
|
this.app = (appPlugin === null || appPlugin === void 0 ? void 0 : appPlugin.getApp()) || null;
|
|
1473
|
-
this.logger = ((_this$
|
|
1589
|
+
this.logger = ((_this$app4 = this.app) === null || _this$app4 === void 0 ? void 0 : _this$app4.logger) || null;
|
|
1474
1590
|
console.log('[Server] Server 初始化', this.core);
|
|
1475
1591
|
this.logInfo('Server 初始化', {
|
|
1476
1592
|
hasApp: !!this.app,
|
|
@@ -1585,10 +1701,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1585
1701
|
}, {
|
|
1586
1702
|
key: "registerModuleWithRoutes",
|
|
1587
1703
|
value: (function () {
|
|
1588
|
-
var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1704
|
+
var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(module, options, moduleName) {
|
|
1589
1705
|
var routes;
|
|
1590
|
-
return _regeneratorRuntime().wrap(function
|
|
1591
|
-
while (1) switch (
|
|
1706
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1707
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1592
1708
|
case 0:
|
|
1593
1709
|
this.logInfo("\u5F00\u59CB\u6CE8\u518C\u6A21\u5757: ".concat(moduleName), {
|
|
1594
1710
|
moduleName: moduleName,
|
|
@@ -1596,7 +1712,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1596
1712
|
});
|
|
1597
1713
|
|
|
1598
1714
|
// 注册模块到 Core
|
|
1599
|
-
|
|
1715
|
+
_context22.next = 3;
|
|
1600
1716
|
return this.core.registerModule(module, options);
|
|
1601
1717
|
case 3:
|
|
1602
1718
|
console.log("[Server] \u2705 ".concat(moduleName, " \u6A21\u5757\u5DF2\u6CE8\u518C"));
|
|
@@ -1617,11 +1733,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1617
1733
|
}
|
|
1618
1734
|
case 6:
|
|
1619
1735
|
case "end":
|
|
1620
|
-
return
|
|
1736
|
+
return _context22.stop();
|
|
1621
1737
|
}
|
|
1622
|
-
},
|
|
1738
|
+
}, _callee22, this);
|
|
1623
1739
|
}));
|
|
1624
|
-
function registerModuleWithRoutes(
|
|
1740
|
+
function registerModuleWithRoutes(_x22, _x23, _x24) {
|
|
1625
1741
|
return _registerModuleWithRoutes.apply(this, arguments);
|
|
1626
1742
|
}
|
|
1627
1743
|
return registerModuleWithRoutes;
|
|
@@ -1634,10 +1750,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1634
1750
|
}, {
|
|
1635
1751
|
key: "registerModuleByName",
|
|
1636
1752
|
value: (function () {
|
|
1637
|
-
var _registerModuleByName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1753
|
+
var _registerModuleByName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(moduleConfig) {
|
|
1638
1754
|
var moduleName, shouldPreload, customConfig, registryConfig, ModuleClass, moduleInstance, moduleOptions;
|
|
1639
|
-
return _regeneratorRuntime().wrap(function
|
|
1640
|
-
while (1) switch (
|
|
1755
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1756
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1641
1757
|
case 0:
|
|
1642
1758
|
// 解析配置
|
|
1643
1759
|
moduleName = typeof moduleConfig === 'string' ? moduleConfig : moduleConfig.name;
|
|
@@ -1652,7 +1768,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1652
1768
|
// 查找模块配置
|
|
1653
1769
|
registryConfig = this.moduleRegistry[moduleName];
|
|
1654
1770
|
if (registryConfig) {
|
|
1655
|
-
|
|
1771
|
+
_context23.next = 8;
|
|
1656
1772
|
break;
|
|
1657
1773
|
}
|
|
1658
1774
|
this.logError("\u672A\u627E\u5230\u6A21\u5757\u914D\u7F6E: ".concat(moduleName), {
|
|
@@ -1666,7 +1782,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1666
1782
|
moduleOptions = _objectSpread({
|
|
1667
1783
|
store: _objectSpread({}, registryConfig.defaultStore)
|
|
1668
1784
|
}, customConfig); // 注册模块和路由
|
|
1669
|
-
|
|
1785
|
+
_context23.next = 13;
|
|
1670
1786
|
return this.registerModuleWithRoutes(moduleInstance, moduleOptions, moduleName.charAt(0).toUpperCase() + moduleName.slice(1));
|
|
1671
1787
|
case 13:
|
|
1672
1788
|
// 保存模块实例
|
|
@@ -1676,18 +1792,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
1676
1792
|
shouldPreload: shouldPreload,
|
|
1677
1793
|
version: registryConfig.version
|
|
1678
1794
|
});
|
|
1679
|
-
return
|
|
1795
|
+
return _context23.abrupt("return", {
|
|
1680
1796
|
module: moduleInstance,
|
|
1681
1797
|
config: registryConfig,
|
|
1682
1798
|
shouldPreload: shouldPreload
|
|
1683
1799
|
});
|
|
1684
1800
|
case 16:
|
|
1685
1801
|
case "end":
|
|
1686
|
-
return
|
|
1802
|
+
return _context23.stop();
|
|
1687
1803
|
}
|
|
1688
|
-
},
|
|
1804
|
+
}, _callee23, this);
|
|
1689
1805
|
}));
|
|
1690
|
-
function registerModuleByName(
|
|
1806
|
+
function registerModuleByName(_x25) {
|
|
1691
1807
|
return _registerModuleByName.apply(this, arguments);
|
|
1692
1808
|
}
|
|
1693
1809
|
return registerModuleByName;
|
|
@@ -1700,10 +1816,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1700
1816
|
}, {
|
|
1701
1817
|
key: "registerModules",
|
|
1702
1818
|
value: (function () {
|
|
1703
|
-
var _registerModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1819
|
+
var _registerModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(moduleConfigs) {
|
|
1704
1820
|
var configs, registeredModules, _iterator2, _step2, config, configName, result, errorMessage;
|
|
1705
|
-
return _regeneratorRuntime().wrap(function
|
|
1706
|
-
while (1) switch (
|
|
1821
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1822
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1707
1823
|
case 0:
|
|
1708
1824
|
console.log('[Server] 开始注册模块...');
|
|
1709
1825
|
|
|
@@ -1715,47 +1831,47 @@ var Server = /*#__PURE__*/function () {
|
|
|
1715
1831
|
});
|
|
1716
1832
|
registeredModules = [];
|
|
1717
1833
|
_iterator2 = _createForOfIteratorHelper(configs);
|
|
1718
|
-
|
|
1834
|
+
_context24.prev = 5;
|
|
1719
1835
|
_iterator2.s();
|
|
1720
1836
|
case 7:
|
|
1721
1837
|
if ((_step2 = _iterator2.n()).done) {
|
|
1722
|
-
|
|
1838
|
+
_context24.next = 25;
|
|
1723
1839
|
break;
|
|
1724
1840
|
}
|
|
1725
1841
|
config = _step2.value;
|
|
1726
1842
|
configName = typeof config === 'string' ? config : config.name;
|
|
1727
|
-
|
|
1728
|
-
|
|
1843
|
+
_context24.prev = 10;
|
|
1844
|
+
_context24.next = 13;
|
|
1729
1845
|
return this.registerModuleByName(config);
|
|
1730
1846
|
case 13:
|
|
1731
|
-
result =
|
|
1847
|
+
result = _context24.sent;
|
|
1732
1848
|
registeredModules.push(result);
|
|
1733
|
-
|
|
1849
|
+
_context24.next = 23;
|
|
1734
1850
|
break;
|
|
1735
1851
|
case 17:
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
errorMessage =
|
|
1852
|
+
_context24.prev = 17;
|
|
1853
|
+
_context24.t0 = _context24["catch"](10);
|
|
1854
|
+
errorMessage = _context24.t0 instanceof Error ? _context24.t0.message : String(_context24.t0);
|
|
1739
1855
|
this.logError("\u6A21\u5757\u6CE8\u518C\u5931\u8D25: ".concat(configName), {
|
|
1740
1856
|
moduleName: configName,
|
|
1741
1857
|
error: errorMessage
|
|
1742
1858
|
});
|
|
1743
|
-
console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:",
|
|
1744
|
-
throw
|
|
1859
|
+
console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:", _context24.t0);
|
|
1860
|
+
throw _context24.t0;
|
|
1745
1861
|
case 23:
|
|
1746
|
-
|
|
1862
|
+
_context24.next = 7;
|
|
1747
1863
|
break;
|
|
1748
1864
|
case 25:
|
|
1749
|
-
|
|
1865
|
+
_context24.next = 30;
|
|
1750
1866
|
break;
|
|
1751
1867
|
case 27:
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
_iterator2.e(
|
|
1868
|
+
_context24.prev = 27;
|
|
1869
|
+
_context24.t1 = _context24["catch"](5);
|
|
1870
|
+
_iterator2.e(_context24.t1);
|
|
1755
1871
|
case 30:
|
|
1756
|
-
|
|
1872
|
+
_context24.prev = 30;
|
|
1757
1873
|
_iterator2.f();
|
|
1758
|
-
return
|
|
1874
|
+
return _context24.finish(30);
|
|
1759
1875
|
case 33:
|
|
1760
1876
|
console.log('[Server] ✅ 所有模块注册完成');
|
|
1761
1877
|
this.logInfo('所有模块注册完成', {
|
|
@@ -1765,14 +1881,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
1765
1881
|
return m === null || m === void 0 || (_m$config = m.config) === null || _m$config === void 0 ? void 0 : _m$config.name;
|
|
1766
1882
|
})
|
|
1767
1883
|
});
|
|
1768
|
-
return
|
|
1884
|
+
return _context24.abrupt("return", registeredModules);
|
|
1769
1885
|
case 36:
|
|
1770
1886
|
case "end":
|
|
1771
|
-
return
|
|
1887
|
+
return _context24.stop();
|
|
1772
1888
|
}
|
|
1773
|
-
},
|
|
1889
|
+
}, _callee24, this, [[5, 27, 30, 33], [10, 17]]);
|
|
1774
1890
|
}));
|
|
1775
|
-
function registerModules(
|
|
1891
|
+
function registerModules(_x26) {
|
|
1776
1892
|
return _registerModules.apply(this, arguments);
|
|
1777
1893
|
}
|
|
1778
1894
|
return registerModules;
|
|
@@ -1785,10 +1901,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1785
1901
|
}, {
|
|
1786
1902
|
key: "preloadModulesData",
|
|
1787
1903
|
value: (function () {
|
|
1788
|
-
var _preloadModulesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1904
|
+
var _preloadModulesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(registeredModules, options) {
|
|
1789
1905
|
var modulesToPreload, preloadResults, _iterator3, _step3, _step3$value, module, config, shouldPreload, startTime, _options$onModuleLoad, _options$onModuleLoad2, duration, _duration, errorMessage, successCount, failCount;
|
|
1790
|
-
return _regeneratorRuntime().wrap(function
|
|
1791
|
-
while (1) switch (
|
|
1906
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1907
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1792
1908
|
case 0:
|
|
1793
1909
|
console.log('[Server] 开始预加载模块数据...');
|
|
1794
1910
|
modulesToPreload = registeredModules.filter(function (m) {
|
|
@@ -1801,16 +1917,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
1801
1917
|
});
|
|
1802
1918
|
preloadResults = [];
|
|
1803
1919
|
_iterator3 = _createForOfIteratorHelper(registeredModules);
|
|
1804
|
-
|
|
1920
|
+
_context25.prev = 5;
|
|
1805
1921
|
_iterator3.s();
|
|
1806
1922
|
case 7:
|
|
1807
1923
|
if ((_step3 = _iterator3.n()).done) {
|
|
1808
|
-
|
|
1924
|
+
_context25.next = 40;
|
|
1809
1925
|
break;
|
|
1810
1926
|
}
|
|
1811
1927
|
_step3$value = _step3.value, module = _step3$value.module, config = _step3$value.config, shouldPreload = _step3$value.shouldPreload;
|
|
1812
1928
|
if (shouldPreload) {
|
|
1813
|
-
|
|
1929
|
+
_context25.next = 13;
|
|
1814
1930
|
break;
|
|
1815
1931
|
}
|
|
1816
1932
|
console.log("[Server] \u23ED\uFE0F \u8DF3\u8FC7 ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D"));
|
|
@@ -1818,19 +1934,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
1818
1934
|
moduleName: config.name,
|
|
1819
1935
|
reason: 'shouldPreload=false'
|
|
1820
1936
|
});
|
|
1821
|
-
return
|
|
1937
|
+
return _context25.abrupt("continue", 38);
|
|
1822
1938
|
case 13:
|
|
1823
1939
|
if (!(typeof module.preload === 'function')) {
|
|
1824
|
-
|
|
1940
|
+
_context25.next = 36;
|
|
1825
1941
|
break;
|
|
1826
1942
|
}
|
|
1827
1943
|
startTime = Date.now();
|
|
1828
|
-
|
|
1944
|
+
_context25.prev = 15;
|
|
1829
1945
|
this.logInfo("\u5F00\u59CB\u9884\u52A0\u8F7D\u6A21\u5757: ".concat(config.name), {
|
|
1830
1946
|
moduleName: config.name
|
|
1831
1947
|
});
|
|
1832
1948
|
options === null || options === void 0 || (_options$onModuleLoad = options.onModuleLoad) === null || _options$onModuleLoad === void 0 || _options$onModuleLoad.call(options, config.name);
|
|
1833
|
-
|
|
1949
|
+
_context25.next = 20;
|
|
1834
1950
|
return module.preload();
|
|
1835
1951
|
case 20:
|
|
1836
1952
|
options === null || options === void 0 || (_options$onModuleLoad2 = options.onModuleLoadComplete) === null || _options$onModuleLoad2 === void 0 || _options$onModuleLoad2.call(options, config.name);
|
|
@@ -1844,14 +1960,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
1844
1960
|
name: config.name,
|
|
1845
1961
|
success: true
|
|
1846
1962
|
});
|
|
1847
|
-
|
|
1963
|
+
_context25.next = 34;
|
|
1848
1964
|
break;
|
|
1849
1965
|
case 27:
|
|
1850
|
-
|
|
1851
|
-
|
|
1966
|
+
_context25.prev = 27;
|
|
1967
|
+
_context25.t0 = _context25["catch"](15);
|
|
1852
1968
|
_duration = Date.now() - startTime;
|
|
1853
|
-
errorMessage =
|
|
1854
|
-
console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"),
|
|
1969
|
+
errorMessage = _context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0);
|
|
1970
|
+
console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"), _context25.t0);
|
|
1855
1971
|
this.logError("\u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25: ".concat(config.name), {
|
|
1856
1972
|
moduleName: config.name,
|
|
1857
1973
|
duration: "".concat(_duration, "ms"),
|
|
@@ -1863,7 +1979,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1863
1979
|
error: errorMessage
|
|
1864
1980
|
});
|
|
1865
1981
|
case 34:
|
|
1866
|
-
|
|
1982
|
+
_context25.next = 38;
|
|
1867
1983
|
break;
|
|
1868
1984
|
case 36:
|
|
1869
1985
|
console.log("[Server] \u26A0\uFE0F ".concat(config.name, " \u6A21\u5757\u672A\u5B9E\u73B0 preload() \u65B9\u6CD5"));
|
|
@@ -1871,19 +1987,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
1871
1987
|
moduleName: config.name
|
|
1872
1988
|
});
|
|
1873
1989
|
case 38:
|
|
1874
|
-
|
|
1990
|
+
_context25.next = 7;
|
|
1875
1991
|
break;
|
|
1876
1992
|
case 40:
|
|
1877
|
-
|
|
1993
|
+
_context25.next = 45;
|
|
1878
1994
|
break;
|
|
1879
1995
|
case 42:
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
_iterator3.e(
|
|
1996
|
+
_context25.prev = 42;
|
|
1997
|
+
_context25.t1 = _context25["catch"](5);
|
|
1998
|
+
_iterator3.e(_context25.t1);
|
|
1883
1999
|
case 45:
|
|
1884
|
-
|
|
2000
|
+
_context25.prev = 45;
|
|
1885
2001
|
_iterator3.f();
|
|
1886
|
-
return
|
|
2002
|
+
return _context25.finish(45);
|
|
1887
2003
|
case 48:
|
|
1888
2004
|
successCount = preloadResults.filter(function (r) {
|
|
1889
2005
|
return r.success;
|
|
@@ -1898,11 +2014,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1898
2014
|
});
|
|
1899
2015
|
case 52:
|
|
1900
2016
|
case "end":
|
|
1901
|
-
return
|
|
2017
|
+
return _context25.stop();
|
|
1902
2018
|
}
|
|
1903
|
-
},
|
|
2019
|
+
}, _callee25, this, [[5, 42, 45, 48], [15, 27]]);
|
|
1904
2020
|
}));
|
|
1905
|
-
function preloadModulesData(
|
|
2021
|
+
function preloadModulesData(_x27, _x28) {
|
|
1906
2022
|
return _preloadModulesData.apply(this, arguments);
|
|
1907
2023
|
}
|
|
1908
2024
|
return preloadModulesData;
|
|
@@ -1916,7 +2032,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1916
2032
|
}, {
|
|
1917
2033
|
key: "initialize",
|
|
1918
2034
|
value: (function () {
|
|
1919
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2035
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(moduleConfigs) {
|
|
1920
2036
|
var _moduleConfigs$length,
|
|
1921
2037
|
_this3 = this;
|
|
1922
2038
|
var autoPreload,
|
|
@@ -1924,12 +2040,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
1924
2040
|
startTime,
|
|
1925
2041
|
registeredModules,
|
|
1926
2042
|
duration,
|
|
1927
|
-
|
|
1928
|
-
return _regeneratorRuntime().wrap(function
|
|
1929
|
-
while (1) switch (
|
|
2043
|
+
_args26 = arguments;
|
|
2044
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2045
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1930
2046
|
case 0:
|
|
1931
|
-
autoPreload =
|
|
1932
|
-
options =
|
|
2047
|
+
autoPreload = _args26.length > 1 && _args26[1] !== undefined ? _args26[1] : true;
|
|
2048
|
+
options = _args26.length > 2 ? _args26[2] : undefined;
|
|
1933
2049
|
startTime = Date.now();
|
|
1934
2050
|
this.logInfo('Server 初始化开始', {
|
|
1935
2051
|
moduleConfigCount: (_moduleConfigs$length = moduleConfigs === null || moduleConfigs === void 0 ? void 0 : moduleConfigs.length) !== null && _moduleConfigs$length !== void 0 ? _moduleConfigs$length : 'all',
|
|
@@ -1942,25 +2058,25 @@ var Server = /*#__PURE__*/function () {
|
|
|
1942
2058
|
this.registerDeviceTaskActions();
|
|
1943
2059
|
|
|
1944
2060
|
// 注册模块
|
|
1945
|
-
|
|
2061
|
+
_context26.next = 8;
|
|
1946
2062
|
return this.registerModules(moduleConfigs);
|
|
1947
2063
|
case 8:
|
|
1948
|
-
registeredModules =
|
|
2064
|
+
registeredModules = _context26.sent;
|
|
1949
2065
|
if (!autoPreload) {
|
|
1950
|
-
|
|
2066
|
+
_context26.next = 14;
|
|
1951
2067
|
break;
|
|
1952
2068
|
}
|
|
1953
|
-
|
|
2069
|
+
_context26.next = 12;
|
|
1954
2070
|
return this.preloadModulesData(registeredModules, options);
|
|
1955
2071
|
case 12:
|
|
1956
|
-
|
|
2072
|
+
_context26.next = 15;
|
|
1957
2073
|
break;
|
|
1958
2074
|
case 14:
|
|
1959
2075
|
this.logInfo('跳过自动预加载', {
|
|
1960
2076
|
autoPreload: autoPreload
|
|
1961
2077
|
});
|
|
1962
2078
|
case 15:
|
|
1963
|
-
|
|
2079
|
+
_context26.next = 17;
|
|
1964
2080
|
return this.setupProductsQuotationPriceBridge();
|
|
1965
2081
|
case 17:
|
|
1966
2082
|
// 监听 ProductsModule 同步完成事件,重新计算并推送查询结果
|
|
@@ -1987,14 +2103,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
1987
2103
|
duration: "".concat(duration, "ms"),
|
|
1988
2104
|
registeredModuleCount: registeredModules.length
|
|
1989
2105
|
});
|
|
1990
|
-
return
|
|
2106
|
+
return _context26.abrupt("return", registeredModules);
|
|
1991
2107
|
case 23:
|
|
1992
2108
|
case "end":
|
|
1993
|
-
return
|
|
2109
|
+
return _context26.stop();
|
|
1994
2110
|
}
|
|
1995
|
-
},
|
|
2111
|
+
}, _callee26, this);
|
|
1996
2112
|
}));
|
|
1997
|
-
function initialize(
|
|
2113
|
+
function initialize(_x29) {
|
|
1998
2114
|
return _initialize.apply(this, arguments);
|
|
1999
2115
|
}
|
|
2000
2116
|
return initialize;
|
|
@@ -2036,31 +2152,31 @@ var Server = /*#__PURE__*/function () {
|
|
|
2036
2152
|
}, {
|
|
2037
2153
|
key: "handleSyncSalesTask",
|
|
2038
2154
|
value: function () {
|
|
2039
|
-
var _handleSyncSalesTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2040
|
-
var _ctx$task, _this$
|
|
2155
|
+
var _handleSyncSalesTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(ctx) {
|
|
2156
|
+
var _ctx$task, _this$app5;
|
|
2041
2157
|
var payload, backendPath, data, title, _ctx$task2, _syncResult$syncedOrd, syncResult, backendError, message, errorMessage;
|
|
2042
|
-
return _regeneratorRuntime().wrap(function
|
|
2043
|
-
while (1) switch (
|
|
2158
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2159
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2044
2160
|
case 0:
|
|
2045
2161
|
payload = ((_ctx$task = ctx.task) === null || _ctx$task === void 0 ? void 0 : _ctx$task.payload) || {};
|
|
2046
2162
|
backendPath = payload.backendPath;
|
|
2047
2163
|
data = payload.data;
|
|
2048
2164
|
title = payload.title || 'sync_sales';
|
|
2049
2165
|
if (!(!backendPath || !data)) {
|
|
2050
|
-
|
|
2166
|
+
_context27.next = 6;
|
|
2051
2167
|
break;
|
|
2052
2168
|
}
|
|
2053
|
-
return
|
|
2169
|
+
return _context27.abrupt("return", this.taskFail('INVALID_PAYLOAD', '缺少 backendPath 或 data'));
|
|
2054
2170
|
case 6:
|
|
2055
|
-
if ((_this$
|
|
2056
|
-
|
|
2171
|
+
if ((_this$app5 = this.app) !== null && _this$app5 !== void 0 && _this$app5.request) {
|
|
2172
|
+
_context27.next = 9;
|
|
2057
2173
|
break;
|
|
2058
2174
|
}
|
|
2059
2175
|
this.logError("".concat(title, ": sync_sales app.request \u4E0D\u53EF\u7528"));
|
|
2060
|
-
return
|
|
2176
|
+
return _context27.abrupt("return", this.taskTimeout('app.request 不可用'));
|
|
2061
2177
|
case 9:
|
|
2062
|
-
|
|
2063
|
-
|
|
2178
|
+
_context27.prev = 9;
|
|
2179
|
+
_context27.next = 12;
|
|
2064
2180
|
return this.runCheckoutSync({
|
|
2065
2181
|
backendPath: backendPath,
|
|
2066
2182
|
data: data,
|
|
@@ -2070,27 +2186,27 @@ var Server = /*#__PURE__*/function () {
|
|
|
2070
2186
|
persistCheckoutDataWithResponse: false
|
|
2071
2187
|
});
|
|
2072
2188
|
case 12:
|
|
2073
|
-
syncResult =
|
|
2189
|
+
syncResult = _context27.sent;
|
|
2074
2190
|
if (!syncResult.rejected) {
|
|
2075
|
-
|
|
2191
|
+
_context27.next = 16;
|
|
2076
2192
|
break;
|
|
2077
2193
|
}
|
|
2078
2194
|
this.logError("".concat(title, ": sync_sales \u540E\u7AEF\u660E\u786E\u5931\u8D25"), {
|
|
2079
2195
|
backendPath: backendPath,
|
|
2080
2196
|
response: syncResult.errorResponse
|
|
2081
2197
|
});
|
|
2082
|
-
return
|
|
2198
|
+
return _context27.abrupt("return", this.taskFail('BACKEND_REJECTED', syncResult.message || '后端明确拒绝 checkout', syncResult.errorResponse));
|
|
2083
2199
|
case 16:
|
|
2084
|
-
return
|
|
2200
|
+
return _context27.abrupt("return", this.taskOk({
|
|
2085
2201
|
order: (_syncResult$syncedOrd = syncResult.syncedOrder) !== null && _syncResult$syncedOrd !== void 0 ? _syncResult$syncedOrd : null,
|
|
2086
2202
|
response: syncResult.normalizedResponse
|
|
2087
2203
|
}));
|
|
2088
2204
|
case 19:
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
backendError = this.extractBackendErrorResponse(
|
|
2205
|
+
_context27.prev = 19;
|
|
2206
|
+
_context27.t0 = _context27["catch"](9);
|
|
2207
|
+
backendError = this.extractBackendErrorResponse(_context27.t0);
|
|
2092
2208
|
if (!backendError) {
|
|
2093
|
-
|
|
2209
|
+
_context27.next = 26;
|
|
2094
2210
|
break;
|
|
2095
2211
|
}
|
|
2096
2212
|
message = (backendError === null || backendError === void 0 ? void 0 : backendError.message) || '后端明确拒绝 checkout';
|
|
@@ -2098,22 +2214,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
2098
2214
|
backendPath: backendPath,
|
|
2099
2215
|
backendError: backendError
|
|
2100
2216
|
});
|
|
2101
|
-
return
|
|
2217
|
+
return _context27.abrupt("return", this.taskFail('BACKEND_REJECTED', message, backendError));
|
|
2102
2218
|
case 26:
|
|
2103
|
-
errorMessage = this.getUnknownErrorMessage(
|
|
2219
|
+
errorMessage = this.getUnknownErrorMessage(_context27.t0);
|
|
2104
2220
|
this.logError("".concat(title, ": sync_sales \u8BF7\u6C42\u672A\u660E\u786E\u6210\u529F"), {
|
|
2105
2221
|
backendPath: backendPath,
|
|
2106
2222
|
error: errorMessage,
|
|
2107
|
-
error_detail: this.normalizeUnknownError(
|
|
2223
|
+
error_detail: this.normalizeUnknownError(_context27.t0)
|
|
2108
2224
|
});
|
|
2109
|
-
return
|
|
2225
|
+
return _context27.abrupt("return", this.taskTimeout(errorMessage));
|
|
2110
2226
|
case 29:
|
|
2111
2227
|
case "end":
|
|
2112
|
-
return
|
|
2228
|
+
return _context27.stop();
|
|
2113
2229
|
}
|
|
2114
|
-
},
|
|
2230
|
+
}, _callee27, this, [[9, 19]]);
|
|
2115
2231
|
}));
|
|
2116
|
-
function handleSyncSalesTask(
|
|
2232
|
+
function handleSyncSalesTask(_x30) {
|
|
2117
2233
|
return _handleSyncSalesTask.apply(this, arguments);
|
|
2118
2234
|
}
|
|
2119
2235
|
return handleSyncSalesTask;
|
|
@@ -2121,40 +2237,40 @@ var Server = /*#__PURE__*/function () {
|
|
|
2121
2237
|
}, {
|
|
2122
2238
|
key: "runCheckoutSync",
|
|
2123
2239
|
value: function () {
|
|
2124
|
-
var _runCheckoutSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2125
|
-
var _this$
|
|
2240
|
+
var _runCheckoutSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2241
|
+
var _this$app6;
|
|
2126
2242
|
var backendPath, title, normalizedData, checkoutData, remoteCheckoutData, response, fresh, externalSaleNumber, syncedOrder, printableSyncedOrder;
|
|
2127
|
-
return _regeneratorRuntime().wrap(function
|
|
2128
|
-
while (1) switch (
|
|
2243
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2244
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2129
2245
|
case 0:
|
|
2130
2246
|
backendPath = params.backendPath, title = params.title;
|
|
2131
|
-
|
|
2247
|
+
_context28.next = 3;
|
|
2132
2248
|
return this.normalizeCheckoutSubmitData(params.data, title);
|
|
2133
2249
|
case 3:
|
|
2134
|
-
normalizedData =
|
|
2135
|
-
|
|
2250
|
+
normalizedData = _context28.sent;
|
|
2251
|
+
_context28.next = 6;
|
|
2136
2252
|
return this.ensureCheckoutOrderNumbers(normalizedData, title);
|
|
2137
2253
|
case 6:
|
|
2138
|
-
checkoutData =
|
|
2254
|
+
checkoutData = _context28.sent;
|
|
2139
2255
|
remoteCheckoutData = this.omitCheckoutSyncMode(checkoutData);
|
|
2140
|
-
if ((_this$
|
|
2141
|
-
|
|
2256
|
+
if ((_this$app6 = this.app) !== null && _this$app6 !== void 0 && (_this$app6 = _this$app6.request) !== null && _this$app6 !== void 0 && _this$app6.post) {
|
|
2257
|
+
_context28.next = 10;
|
|
2142
2258
|
break;
|
|
2143
2259
|
}
|
|
2144
2260
|
throw new Error('app.request 不可用');
|
|
2145
2261
|
case 10:
|
|
2146
|
-
|
|
2262
|
+
_context28.next = 12;
|
|
2147
2263
|
return this.app.request.post(backendPath, remoteCheckoutData, {
|
|
2148
2264
|
isShopApi: true,
|
|
2149
2265
|
customToast: function customToast() {}
|
|
2150
2266
|
});
|
|
2151
2267
|
case 12:
|
|
2152
|
-
response =
|
|
2268
|
+
response = _context28.sent;
|
|
2153
2269
|
if (!this.isCheckoutResponseRejected(response)) {
|
|
2154
|
-
|
|
2270
|
+
_context28.next = 15;
|
|
2155
2271
|
break;
|
|
2156
2272
|
}
|
|
2157
|
-
return
|
|
2273
|
+
return _context28.abrupt("return", {
|
|
2158
2274
|
rejected: true,
|
|
2159
2275
|
message: (response === null || response === void 0 ? void 0 : response.message) || '后端明确拒绝 checkout',
|
|
2160
2276
|
errorResponse: response,
|
|
@@ -2168,7 +2284,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2168
2284
|
external_sale_number: params.externalSaleNumber,
|
|
2169
2285
|
data: remoteCheckoutData
|
|
2170
2286
|
});
|
|
2171
|
-
|
|
2287
|
+
_context28.next = 19;
|
|
2172
2288
|
return this.persistSyncedCheckoutOrder({
|
|
2173
2289
|
backendPath: backendPath,
|
|
2174
2290
|
checkoutData: remoteCheckoutData,
|
|
@@ -2178,7 +2294,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2178
2294
|
persistCheckoutDataWithResponse: params.persistCheckoutDataWithResponse === true
|
|
2179
2295
|
});
|
|
2180
2296
|
case 19:
|
|
2181
|
-
syncedOrder =
|
|
2297
|
+
syncedOrder = _context28.sent;
|
|
2182
2298
|
printableSyncedOrder = syncedOrder ? this.buildSyncedOrderForPrint({
|
|
2183
2299
|
syncedOrder: syncedOrder,
|
|
2184
2300
|
checkoutResponseOrder: fresh
|
|
@@ -2187,10 +2303,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
2187
2303
|
checkoutData: remoteCheckoutData,
|
|
2188
2304
|
syncedOrder: printableSyncedOrder
|
|
2189
2305
|
}))) {
|
|
2190
|
-
|
|
2306
|
+
_context28.next = 24;
|
|
2191
2307
|
break;
|
|
2192
2308
|
}
|
|
2193
|
-
|
|
2309
|
+
_context28.next = 24;
|
|
2194
2310
|
return this.dispatchPrintOtherReceiptTask({
|
|
2195
2311
|
checkoutData: remoteCheckoutData,
|
|
2196
2312
|
syncedOrder: printableSyncedOrder,
|
|
@@ -2198,7 +2314,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2198
2314
|
deviceId: params.deviceId
|
|
2199
2315
|
});
|
|
2200
2316
|
case 24:
|
|
2201
|
-
return
|
|
2317
|
+
return _context28.abrupt("return", {
|
|
2202
2318
|
rejected: false,
|
|
2203
2319
|
response: response,
|
|
2204
2320
|
normalizedResponse: this.normalizeCheckoutResponse(response),
|
|
@@ -2208,11 +2324,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2208
2324
|
});
|
|
2209
2325
|
case 25:
|
|
2210
2326
|
case "end":
|
|
2211
|
-
return
|
|
2327
|
+
return _context28.stop();
|
|
2212
2328
|
}
|
|
2213
|
-
},
|
|
2329
|
+
}, _callee28, this);
|
|
2214
2330
|
}));
|
|
2215
|
-
function runCheckoutSync(
|
|
2331
|
+
function runCheckoutSync(_x31) {
|
|
2216
2332
|
return _runCheckoutSync.apply(this, arguments);
|
|
2217
2333
|
}
|
|
2218
2334
|
return runCheckoutSync;
|
|
@@ -2229,15 +2345,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
2229
2345
|
}, {
|
|
2230
2346
|
key: "persistSyncedCheckoutOrder",
|
|
2231
2347
|
value: function () {
|
|
2232
|
-
var _persistSyncedCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2348
|
+
var _persistSyncedCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
2233
2349
|
var backendPath, checkoutData, externalSaleNumber, fresh, title, persistCheckoutDataWithResponse, shouldMergeRemoteOrder, syncedOrder, _external_sale_number2, _external_sale_number3, _syncedOrder$order_id, _syncedOrder, patch, result;
|
|
2234
|
-
return _regeneratorRuntime().wrap(function
|
|
2235
|
-
while (1) switch (
|
|
2350
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2351
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2236
2352
|
case 0:
|
|
2237
2353
|
backendPath = params.backendPath, checkoutData = params.checkoutData, externalSaleNumber = params.externalSaleNumber, fresh = params.fresh, title = params.title, persistCheckoutDataWithResponse = params.persistCheckoutDataWithResponse;
|
|
2238
2354
|
shouldMergeRemoteOrder = fresh ? this.isMergeableCheckoutOrder(fresh, externalSaleNumber) : false;
|
|
2239
2355
|
if (!(this.order && fresh && (shouldMergeRemoteOrder || persistCheckoutDataWithResponse))) {
|
|
2240
|
-
|
|
2356
|
+
_context29.next = 9;
|
|
2241
2357
|
break;
|
|
2242
2358
|
}
|
|
2243
2359
|
syncedOrder = persistCheckoutDataWithResponse ? _objectSpread(_objectSpread(_objectSpread({}, checkoutData), fresh), {}, {
|
|
@@ -2247,7 +2363,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2247
2363
|
external_sale_number: (_external_sale_number3 = fresh.external_sale_number) !== null && _external_sale_number3 !== void 0 ? _external_sale_number3 : externalSaleNumber,
|
|
2248
2364
|
need_sync: 0
|
|
2249
2365
|
});
|
|
2250
|
-
|
|
2366
|
+
_context29.next = 6;
|
|
2251
2367
|
return this.order.upsertOrdersFromRemote([syncedOrder]);
|
|
2252
2368
|
case 6:
|
|
2253
2369
|
this.logInfo("".concat(title, ": sync_sales \u5B8C\u6574\u8BA2\u5355\u5DF2\u540C\u6B65\u5230\u672C\u5730"), {
|
|
@@ -2257,21 +2373,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
2257
2373
|
mergedRemoteOrder: shouldMergeRemoteOrder,
|
|
2258
2374
|
persistedCheckoutDataWithResponse: persistCheckoutDataWithResponse
|
|
2259
2375
|
});
|
|
2260
|
-
|
|
2376
|
+
_context29.next = 19;
|
|
2261
2377
|
break;
|
|
2262
2378
|
case 9:
|
|
2263
2379
|
if (!(this.order && externalSaleNumber && typeof this.order.markOrderSyncedByExternalSaleNumber === 'function')) {
|
|
2264
|
-
|
|
2380
|
+
_context29.next = 18;
|
|
2265
2381
|
break;
|
|
2266
2382
|
}
|
|
2267
2383
|
patch = this.buildCheckoutSyncSuccessPatch(fresh);
|
|
2268
|
-
|
|
2384
|
+
_context29.next = 13;
|
|
2269
2385
|
return this.order.markOrderSyncedByExternalSaleNumber({
|
|
2270
2386
|
externalSaleNumber: externalSaleNumber,
|
|
2271
2387
|
patch: patch
|
|
2272
2388
|
});
|
|
2273
2389
|
case 13:
|
|
2274
|
-
result =
|
|
2390
|
+
result = _context29.sent;
|
|
2275
2391
|
syncedOrder = (result === null || result === void 0 ? void 0 : result.order) || _objectSpread(_objectSpread(_objectSpread({}, checkoutData), patch), {}, {
|
|
2276
2392
|
external_sale_number: externalSaleNumber,
|
|
2277
2393
|
need_sync: 0
|
|
@@ -2282,7 +2398,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2282
2398
|
hasRemoteOrder: !!fresh,
|
|
2283
2399
|
mergedRemoteOrder: false
|
|
2284
2400
|
});
|
|
2285
|
-
|
|
2401
|
+
_context29.next = 19;
|
|
2286
2402
|
break;
|
|
2287
2403
|
case 18:
|
|
2288
2404
|
this.logWarning("".concat(title, ": sync_sales Order \u6A21\u5757\u672A\u6CE8\u518C"), {
|
|
@@ -2291,14 +2407,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
2291
2407
|
order_id: fresh === null || fresh === void 0 ? void 0 : fresh.order_id
|
|
2292
2408
|
});
|
|
2293
2409
|
case 19:
|
|
2294
|
-
return
|
|
2410
|
+
return _context29.abrupt("return", syncedOrder);
|
|
2295
2411
|
case 20:
|
|
2296
2412
|
case "end":
|
|
2297
|
-
return
|
|
2413
|
+
return _context29.stop();
|
|
2298
2414
|
}
|
|
2299
|
-
},
|
|
2415
|
+
}, _callee29, this);
|
|
2300
2416
|
}));
|
|
2301
|
-
function persistSyncedCheckoutOrder(
|
|
2417
|
+
function persistSyncedCheckoutOrder(_x32) {
|
|
2302
2418
|
return _persistSyncedCheckoutOrder.apply(this, arguments);
|
|
2303
2419
|
}
|
|
2304
2420
|
return persistSyncedCheckoutOrder;
|
|
@@ -2309,51 +2425,51 @@ var Server = /*#__PURE__*/function () {
|
|
|
2309
2425
|
}, {
|
|
2310
2426
|
key: "setupProductsQuotationPriceBridge",
|
|
2311
2427
|
value: (function () {
|
|
2312
|
-
var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2428
|
+
var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2313
2429
|
var _this$core$context, errorMessage;
|
|
2314
|
-
return _regeneratorRuntime().wrap(function
|
|
2315
|
-
while (1) switch (
|
|
2430
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2431
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2316
2432
|
case 0:
|
|
2317
2433
|
if (this.products) {
|
|
2318
|
-
|
|
2434
|
+
_context30.next = 3;
|
|
2319
2435
|
break;
|
|
2320
2436
|
}
|
|
2321
2437
|
this.logInfo('setupProductsQuotationPriceBridge: Products 模块未注册');
|
|
2322
|
-
return
|
|
2438
|
+
return _context30.abrupt("return");
|
|
2323
2439
|
case 3:
|
|
2324
2440
|
if (this.schedule) {
|
|
2325
|
-
|
|
2441
|
+
_context30.next = 6;
|
|
2326
2442
|
break;
|
|
2327
2443
|
}
|
|
2328
2444
|
this.logInfo('setupProductsQuotationPriceBridge: Schedule 模块未注册');
|
|
2329
|
-
return
|
|
2445
|
+
return _context30.abrupt("return");
|
|
2330
2446
|
case 6:
|
|
2331
|
-
|
|
2332
|
-
|
|
2447
|
+
_context30.prev = 6;
|
|
2448
|
+
_context30.next = 9;
|
|
2333
2449
|
return this.schedule.loadAllSchedule();
|
|
2334
2450
|
case 9:
|
|
2335
2451
|
this.products.clearPriceCache();
|
|
2336
|
-
|
|
2452
|
+
_context30.next = 12;
|
|
2337
2453
|
return this.products.setupQuotationPriceBridge({
|
|
2338
2454
|
scheduleModule: this.schedule,
|
|
2339
2455
|
channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel
|
|
2340
2456
|
});
|
|
2341
2457
|
case 12:
|
|
2342
2458
|
this.logInfo('Products 报价单价格桥接初始化完成');
|
|
2343
|
-
|
|
2459
|
+
_context30.next = 19;
|
|
2344
2460
|
break;
|
|
2345
2461
|
case 15:
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
errorMessage =
|
|
2462
|
+
_context30.prev = 15;
|
|
2463
|
+
_context30.t0 = _context30["catch"](6);
|
|
2464
|
+
errorMessage = _context30.t0 instanceof Error ? _context30.t0.message : String(_context30.t0);
|
|
2349
2465
|
this.logError('Products 报价单价格桥接初始化失败', {
|
|
2350
2466
|
error: errorMessage
|
|
2351
2467
|
});
|
|
2352
2468
|
case 19:
|
|
2353
2469
|
case "end":
|
|
2354
|
-
return
|
|
2470
|
+
return _context30.stop();
|
|
2355
2471
|
}
|
|
2356
|
-
},
|
|
2472
|
+
}, _callee30, this, [[6, 15]]);
|
|
2357
2473
|
}));
|
|
2358
2474
|
function setupProductsQuotationPriceBridge() {
|
|
2359
2475
|
return _setupProductsQuotationPriceBridge.apply(this, arguments);
|
|
@@ -2422,45 +2538,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
2422
2538
|
}, {
|
|
2423
2539
|
key: "refreshProductsInBackground",
|
|
2424
2540
|
value: (function () {
|
|
2425
|
-
var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2541
|
+
var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2426
2542
|
var startTime, duration, _duration2, errorMessage;
|
|
2427
|
-
return _regeneratorRuntime().wrap(function
|
|
2428
|
-
while (1) switch (
|
|
2543
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2544
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2429
2545
|
case 0:
|
|
2430
2546
|
if (this.products) {
|
|
2431
|
-
|
|
2547
|
+
_context31.next = 3;
|
|
2432
2548
|
break;
|
|
2433
2549
|
}
|
|
2434
2550
|
this.logWarning('refreshProductsInBackground: Products 模块未注册');
|
|
2435
|
-
return
|
|
2551
|
+
return _context31.abrupt("return");
|
|
2436
2552
|
case 3:
|
|
2437
2553
|
this.logInfo('refreshProductsInBackground 开始');
|
|
2438
2554
|
startTime = Date.now();
|
|
2439
|
-
|
|
2440
|
-
|
|
2555
|
+
_context31.prev = 5;
|
|
2556
|
+
_context31.next = 8;
|
|
2441
2557
|
return this.products.silentRefresh();
|
|
2442
2558
|
case 8:
|
|
2443
2559
|
duration = Date.now() - startTime;
|
|
2444
2560
|
this.logInfo('refreshProductsInBackground 完成', {
|
|
2445
2561
|
duration: "".concat(duration, "ms")
|
|
2446
2562
|
});
|
|
2447
|
-
|
|
2563
|
+
_context31.next = 18;
|
|
2448
2564
|
break;
|
|
2449
2565
|
case 12:
|
|
2450
|
-
|
|
2451
|
-
|
|
2566
|
+
_context31.prev = 12;
|
|
2567
|
+
_context31.t0 = _context31["catch"](5);
|
|
2452
2568
|
_duration2 = Date.now() - startTime;
|
|
2453
|
-
errorMessage =
|
|
2454
|
-
console.error('[Server] refreshProductsInBackground 失败:',
|
|
2569
|
+
errorMessage = _context31.t0 instanceof Error ? _context31.t0.message : String(_context31.t0);
|
|
2570
|
+
console.error('[Server] refreshProductsInBackground 失败:', _context31.t0);
|
|
2455
2571
|
this.logError('refreshProductsInBackground 失败', {
|
|
2456
2572
|
duration: "".concat(_duration2, "ms"),
|
|
2457
2573
|
error: errorMessage
|
|
2458
2574
|
});
|
|
2459
2575
|
case 18:
|
|
2460
2576
|
case "end":
|
|
2461
|
-
return
|
|
2577
|
+
return _context31.stop();
|
|
2462
2578
|
}
|
|
2463
|
-
},
|
|
2579
|
+
}, _callee31, this, [[5, 12]]);
|
|
2464
2580
|
}));
|
|
2465
2581
|
function refreshProductsInBackground() {
|
|
2466
2582
|
return _refreshProductsInBackground.apply(this, arguments);
|
|
@@ -2476,45 +2592,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
2476
2592
|
}, {
|
|
2477
2593
|
key: "refreshOrdersInBackground",
|
|
2478
2594
|
value: (function () {
|
|
2479
|
-
var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2595
|
+
var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
2480
2596
|
var startTime, duration, _duration3, errorMessage;
|
|
2481
|
-
return _regeneratorRuntime().wrap(function
|
|
2482
|
-
while (1) switch (
|
|
2597
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2598
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2483
2599
|
case 0:
|
|
2484
2600
|
if (this.order) {
|
|
2485
|
-
|
|
2601
|
+
_context32.next = 3;
|
|
2486
2602
|
break;
|
|
2487
2603
|
}
|
|
2488
2604
|
this.logWarning('refreshOrdersInBackground: Order 模块未注册');
|
|
2489
|
-
return
|
|
2605
|
+
return _context32.abrupt("return");
|
|
2490
2606
|
case 3:
|
|
2491
2607
|
this.logInfo('refreshOrdersInBackground 开始');
|
|
2492
2608
|
startTime = Date.now();
|
|
2493
|
-
|
|
2494
|
-
|
|
2609
|
+
_context32.prev = 5;
|
|
2610
|
+
_context32.next = 8;
|
|
2495
2611
|
return this.order.silentRefresh();
|
|
2496
2612
|
case 8:
|
|
2497
2613
|
duration = Date.now() - startTime;
|
|
2498
2614
|
this.logInfo('refreshOrdersInBackground 完成', {
|
|
2499
2615
|
duration: "".concat(duration, "ms")
|
|
2500
2616
|
});
|
|
2501
|
-
|
|
2617
|
+
_context32.next = 18;
|
|
2502
2618
|
break;
|
|
2503
2619
|
case 12:
|
|
2504
|
-
|
|
2505
|
-
|
|
2620
|
+
_context32.prev = 12;
|
|
2621
|
+
_context32.t0 = _context32["catch"](5);
|
|
2506
2622
|
_duration3 = Date.now() - startTime;
|
|
2507
|
-
errorMessage =
|
|
2508
|
-
console.error('[Server] refreshOrdersInBackground 失败:',
|
|
2623
|
+
errorMessage = _context32.t0 instanceof Error ? _context32.t0.message : String(_context32.t0);
|
|
2624
|
+
console.error('[Server] refreshOrdersInBackground 失败:', _context32.t0);
|
|
2509
2625
|
this.logError('refreshOrdersInBackground 失败', {
|
|
2510
2626
|
duration: "".concat(_duration3, "ms"),
|
|
2511
2627
|
error: errorMessage
|
|
2512
2628
|
});
|
|
2513
2629
|
case 18:
|
|
2514
2630
|
case "end":
|
|
2515
|
-
return
|
|
2631
|
+
return _context32.stop();
|
|
2516
2632
|
}
|
|
2517
|
-
},
|
|
2633
|
+
}, _callee32, this, [[5, 12]]);
|
|
2518
2634
|
}));
|
|
2519
2635
|
function refreshOrdersInBackground() {
|
|
2520
2636
|
return _refreshOrdersInBackground.apply(this, arguments);
|
|
@@ -2529,10 +2645,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
2529
2645
|
}, {
|
|
2530
2646
|
key: "clearAllIndexDB",
|
|
2531
2647
|
value: (function () {
|
|
2532
|
-
var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2648
|
+
var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2533
2649
|
var clearTasks, moduleNames, errorMessage;
|
|
2534
|
-
return _regeneratorRuntime().wrap(function
|
|
2535
|
-
while (1) switch (
|
|
2650
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2651
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2536
2652
|
case 0:
|
|
2537
2653
|
console.log('[Server] 开始清空所有模块的IndexedDB缓存...');
|
|
2538
2654
|
this.logInfo('开始清空所有模块的 IndexedDB 缓存');
|
|
@@ -2567,41 +2683,41 @@ var Server = /*#__PURE__*/function () {
|
|
|
2567
2683
|
moduleNames.push('FloorPlan');
|
|
2568
2684
|
}
|
|
2569
2685
|
if (!(clearTasks.length === 0)) {
|
|
2570
|
-
|
|
2686
|
+
_context33.next = 15;
|
|
2571
2687
|
break;
|
|
2572
2688
|
}
|
|
2573
2689
|
console.warn('[Server] 没有找到已注册的模块,无需清空');
|
|
2574
2690
|
this.logWarning('没有找到已注册的模块,无需清空 IndexedDB');
|
|
2575
|
-
return
|
|
2691
|
+
return _context33.abrupt("return");
|
|
2576
2692
|
case 15:
|
|
2577
2693
|
this.logInfo('准备清空模块缓存', {
|
|
2578
2694
|
moduleNames: moduleNames
|
|
2579
2695
|
});
|
|
2580
|
-
|
|
2581
|
-
|
|
2696
|
+
_context33.prev = 16;
|
|
2697
|
+
_context33.next = 19;
|
|
2582
2698
|
return Promise.all(clearTasks);
|
|
2583
2699
|
case 19:
|
|
2584
2700
|
console.log("[Server] \u2705 \u5DF2\u6210\u529F\u6E05\u7A7A\u6240\u6709\u6A21\u5757\u7684IndexedDB\u7F13\u5B58: ".concat(moduleNames.join(', ')));
|
|
2585
2701
|
this.logInfo('成功清空所有模块的 IndexedDB 缓存', {
|
|
2586
2702
|
moduleNames: moduleNames
|
|
2587
2703
|
});
|
|
2588
|
-
|
|
2704
|
+
_context33.next = 29;
|
|
2589
2705
|
break;
|
|
2590
2706
|
case 23:
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
errorMessage =
|
|
2594
|
-
console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:',
|
|
2707
|
+
_context33.prev = 23;
|
|
2708
|
+
_context33.t0 = _context33["catch"](16);
|
|
2709
|
+
errorMessage = _context33.t0 instanceof Error ? _context33.t0.message : String(_context33.t0);
|
|
2710
|
+
console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context33.t0);
|
|
2595
2711
|
this.logError('清空 IndexedDB 缓存时发生错误', {
|
|
2596
2712
|
moduleNames: moduleNames,
|
|
2597
2713
|
error: errorMessage
|
|
2598
2714
|
});
|
|
2599
|
-
throw
|
|
2715
|
+
throw _context33.t0;
|
|
2600
2716
|
case 29:
|
|
2601
2717
|
case "end":
|
|
2602
|
-
return
|
|
2718
|
+
return _context33.stop();
|
|
2603
2719
|
}
|
|
2604
|
-
},
|
|
2720
|
+
}, _callee33, this, [[16, 23]]);
|
|
2605
2721
|
}));
|
|
2606
2722
|
function clearAllIndexDB() {
|
|
2607
2723
|
return _clearAllIndexDB.apply(this, arguments);
|
|
@@ -2676,10 +2792,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
2676
2792
|
}, {
|
|
2677
2793
|
key: "handleRoute",
|
|
2678
2794
|
value: (function () {
|
|
2679
|
-
var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2795
|
+
var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(method, path, params) {
|
|
2680
2796
|
var startTime, handler, result, duration, _duration4, errorMessage;
|
|
2681
|
-
return _regeneratorRuntime().wrap(function
|
|
2682
|
-
while (1) switch (
|
|
2797
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2798
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2683
2799
|
case 0:
|
|
2684
2800
|
startTime = Date.now();
|
|
2685
2801
|
this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5F00\u59CB: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
@@ -2690,7 +2806,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2690
2806
|
});
|
|
2691
2807
|
handler = this.getRouteHandler(method, path);
|
|
2692
2808
|
if (handler) {
|
|
2693
|
-
|
|
2809
|
+
_context34.next = 6;
|
|
2694
2810
|
break;
|
|
2695
2811
|
}
|
|
2696
2812
|
this.logError("\u8DEF\u7531\u672A\u627E\u5230: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
@@ -2699,13 +2815,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
2699
2815
|
});
|
|
2700
2816
|
throw new Error("Route not found: ".concat(method.toUpperCase(), " ").concat(path));
|
|
2701
2817
|
case 6:
|
|
2702
|
-
|
|
2703
|
-
|
|
2818
|
+
_context34.prev = 6;
|
|
2819
|
+
_context34.next = 9;
|
|
2704
2820
|
return handler(_objectSpread(_objectSpread({}, params), {}, {
|
|
2705
2821
|
path: path
|
|
2706
2822
|
}));
|
|
2707
2823
|
case 9:
|
|
2708
|
-
result =
|
|
2824
|
+
result = _context34.sent;
|
|
2709
2825
|
duration = Date.now() - startTime;
|
|
2710
2826
|
this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5B8C\u6210: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
2711
2827
|
method: method.toUpperCase(),
|
|
@@ -2714,12 +2830,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
2714
2830
|
resultCode: result === null || result === void 0 ? void 0 : result.code,
|
|
2715
2831
|
resultStatus: result === null || result === void 0 ? void 0 : result.status
|
|
2716
2832
|
});
|
|
2717
|
-
return
|
|
2833
|
+
return _context34.abrupt("return", result);
|
|
2718
2834
|
case 15:
|
|
2719
|
-
|
|
2720
|
-
|
|
2835
|
+
_context34.prev = 15;
|
|
2836
|
+
_context34.t0 = _context34["catch"](6);
|
|
2721
2837
|
_duration4 = Date.now() - startTime;
|
|
2722
|
-
errorMessage =
|
|
2838
|
+
errorMessage = _context34.t0 instanceof Error ? _context34.t0.message : String(_context34.t0);
|
|
2723
2839
|
this.logError("\u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
2724
2840
|
method: method.toUpperCase(),
|
|
2725
2841
|
path: path,
|
|
@@ -2727,15 +2843,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
2727
2843
|
error: errorMessage,
|
|
2728
2844
|
data: params.data
|
|
2729
2845
|
});
|
|
2730
|
-
console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path),
|
|
2731
|
-
throw
|
|
2846
|
+
console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), _context34.t0);
|
|
2847
|
+
throw _context34.t0;
|
|
2732
2848
|
case 22:
|
|
2733
2849
|
case "end":
|
|
2734
|
-
return
|
|
2850
|
+
return _context34.stop();
|
|
2735
2851
|
}
|
|
2736
|
-
},
|
|
2852
|
+
}, _callee34, this, [[6, 15]]);
|
|
2737
2853
|
}));
|
|
2738
|
-
function handleRoute(
|
|
2854
|
+
function handleRoute(_x33, _x34, _x35) {
|
|
2739
2855
|
return _handleRoute.apply(this, arguments);
|
|
2740
2856
|
}
|
|
2741
2857
|
return handleRoute;
|
|
@@ -2845,6 +2961,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
2845
2961
|
method: 'post',
|
|
2846
2962
|
path: '/shop/local/print-order',
|
|
2847
2963
|
handler: this.handleLocalPrintOrder.bind(this)
|
|
2964
|
+
}, {
|
|
2965
|
+
method: 'post',
|
|
2966
|
+
path: '/shop/machinecode/batch-metadata',
|
|
2967
|
+
handler: this.handleMachinecodeBatchMetadata.bind(this)
|
|
2968
|
+
}, {
|
|
2969
|
+
method: 'post',
|
|
2970
|
+
path: '/machinecode/batch-metadata',
|
|
2971
|
+
handler: this.handleMachinecodeBatchMetadata.bind(this)
|
|
2848
2972
|
}]);
|
|
2849
2973
|
this.registerPrefixRoutes([{
|
|
2850
2974
|
method: 'get',
|
|
@@ -2859,36 +2983,36 @@ var Server = /*#__PURE__*/function () {
|
|
|
2859
2983
|
}, {
|
|
2860
2984
|
key: "getPaymentRouteModule",
|
|
2861
2985
|
value: function () {
|
|
2862
|
-
var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2986
|
+
var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
2863
2987
|
var _this6 = this;
|
|
2864
|
-
return _regeneratorRuntime().wrap(function
|
|
2865
|
-
while (1) switch (
|
|
2988
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2989
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2866
2990
|
case 0:
|
|
2867
2991
|
if (!this.payment) {
|
|
2868
|
-
|
|
2992
|
+
_context36.next = 2;
|
|
2869
2993
|
break;
|
|
2870
2994
|
}
|
|
2871
|
-
return
|
|
2995
|
+
return _context36.abrupt("return", this.payment);
|
|
2872
2996
|
case 2:
|
|
2873
2997
|
if (!this.paymentRouteModule) {
|
|
2874
|
-
|
|
2998
|
+
_context36.next = 4;
|
|
2875
2999
|
break;
|
|
2876
3000
|
}
|
|
2877
|
-
return
|
|
3001
|
+
return _context36.abrupt("return", this.paymentRouteModule);
|
|
2878
3002
|
case 4:
|
|
2879
3003
|
if (!this.paymentRouteModuleInFlight) {
|
|
2880
|
-
|
|
3004
|
+
_context36.next = 6;
|
|
2881
3005
|
break;
|
|
2882
3006
|
}
|
|
2883
|
-
return
|
|
3007
|
+
return _context36.abrupt("return", this.paymentRouteModuleInFlight);
|
|
2884
3008
|
case 6:
|
|
2885
|
-
this.paymentRouteModuleInFlight = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3009
|
+
this.paymentRouteModuleInFlight = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2886
3010
|
var module;
|
|
2887
|
-
return _regeneratorRuntime().wrap(function
|
|
2888
|
-
while (1) switch (
|
|
3011
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3012
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2889
3013
|
case 0:
|
|
2890
3014
|
module = new PaymentServerModule('server_payment_route', '1.0.0');
|
|
2891
|
-
|
|
3015
|
+
_context35.next = 3;
|
|
2892
3016
|
return module.initialize(_this6.core, {
|
|
2893
3017
|
store: {
|
|
2894
3018
|
payMethods: []
|
|
@@ -2896,21 +3020,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
2896
3020
|
});
|
|
2897
3021
|
case 3:
|
|
2898
3022
|
_this6.paymentRouteModule = module;
|
|
2899
|
-
return
|
|
3023
|
+
return _context35.abrupt("return", module);
|
|
2900
3024
|
case 5:
|
|
2901
3025
|
case "end":
|
|
2902
|
-
return
|
|
3026
|
+
return _context35.stop();
|
|
2903
3027
|
}
|
|
2904
|
-
},
|
|
3028
|
+
}, _callee35);
|
|
2905
3029
|
}))().finally(function () {
|
|
2906
3030
|
_this6.paymentRouteModuleInFlight = undefined;
|
|
2907
3031
|
});
|
|
2908
|
-
return
|
|
3032
|
+
return _context36.abrupt("return", this.paymentRouteModuleInFlight);
|
|
2909
3033
|
case 8:
|
|
2910
3034
|
case "end":
|
|
2911
|
-
return
|
|
3035
|
+
return _context36.stop();
|
|
2912
3036
|
}
|
|
2913
|
-
},
|
|
3037
|
+
}, _callee36, this);
|
|
2914
3038
|
}));
|
|
2915
3039
|
function getPaymentRouteModule() {
|
|
2916
3040
|
return _getPaymentRouteModule.apply(this, arguments);
|
|
@@ -2920,19 +3044,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
2920
3044
|
}, {
|
|
2921
3045
|
key: "fetchQuotationAvailableFromAPI",
|
|
2922
3046
|
value: function () {
|
|
2923
|
-
var _fetchQuotationAvailableFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2924
|
-
var _this$
|
|
3047
|
+
var _fetchQuotationAvailableFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(data) {
|
|
3048
|
+
var _this$app7;
|
|
2925
3049
|
var requester;
|
|
2926
|
-
return _regeneratorRuntime().wrap(function
|
|
2927
|
-
while (1) switch (
|
|
3050
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3051
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2928
3052
|
case 0:
|
|
2929
|
-
requester = ((_this$
|
|
3053
|
+
requester = ((_this$app7 = this.app) === null || _this$app7 === void 0 ? void 0 : _this$app7.request) || this.core.getPlugin('request');
|
|
2930
3054
|
if (requester !== null && requester !== void 0 && requester.get) {
|
|
2931
|
-
|
|
3055
|
+
_context37.next = 4;
|
|
2932
3056
|
break;
|
|
2933
3057
|
}
|
|
2934
3058
|
this.logError('fetchQuotationAvailableFromAPI: request 不可用');
|
|
2935
|
-
return
|
|
3059
|
+
return _context37.abrupt("return", {
|
|
2936
3060
|
code: 500,
|
|
2937
3061
|
message: 'request 不可用',
|
|
2938
3062
|
data: {
|
|
@@ -2941,14 +3065,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
2941
3065
|
status: false
|
|
2942
3066
|
});
|
|
2943
3067
|
case 4:
|
|
2944
|
-
return
|
|
3068
|
+
return _context37.abrupt("return", requester.get('/shop/quotation/available', data));
|
|
2945
3069
|
case 5:
|
|
2946
3070
|
case "end":
|
|
2947
|
-
return
|
|
3071
|
+
return _context37.stop();
|
|
2948
3072
|
}
|
|
2949
|
-
},
|
|
3073
|
+
}, _callee37, this);
|
|
2950
3074
|
}));
|
|
2951
|
-
function fetchQuotationAvailableFromAPI(
|
|
3075
|
+
function fetchQuotationAvailableFromAPI(_x36) {
|
|
2952
3076
|
return _fetchQuotationAvailableFromAPI.apply(this, arguments);
|
|
2953
3077
|
}
|
|
2954
3078
|
return fetchQuotationAvailableFromAPI;
|
|
@@ -2988,17 +3112,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
2988
3112
|
* const result = await this.handleSalesSearchRequest('single', '/shop/es/search/sales', { keyword: '1001' }, {})
|
|
2989
3113
|
*/
|
|
2990
3114
|
function () {
|
|
2991
|
-
var _handleSalesSearchRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2992
|
-
var queryPayload, result,
|
|
2993
|
-
return _regeneratorRuntime().wrap(function
|
|
2994
|
-
while (1) switch (
|
|
3115
|
+
var _handleSalesSearchRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(kind, backendPath, data, config) {
|
|
3116
|
+
var queryPayload, result, _ref55, callback, subscriberId, resetVisibleOrderIds, contextSignature, existing, shouldReset, visibleOrderIds, _iterator5, _step5, orderId;
|
|
3117
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3118
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
2995
3119
|
case 0:
|
|
2996
3120
|
queryPayload = data && _typeof(data) === 'object' ? _objectSpread({}, data) : {};
|
|
2997
|
-
|
|
3121
|
+
_context38.next = 3;
|
|
2998
3122
|
return this.fetchSalesSearchFromAPI(backendPath, queryPayload);
|
|
2999
3123
|
case 3:
|
|
3000
|
-
result =
|
|
3001
|
-
|
|
3124
|
+
result = _context38.sent;
|
|
3125
|
+
_ref55 = config || {}, callback = _ref55.callback, subscriberId = _ref55.subscriberId, resetVisibleOrderIds = _ref55.resetVisibleOrderIds;
|
|
3002
3126
|
if (subscriberId && typeof callback === 'function') {
|
|
3003
3127
|
contextSignature = this.buildSalesSearchSignature(kind, queryPayload);
|
|
3004
3128
|
existing = this.salesSearchSubscribers.get(subscriberId);
|
|
@@ -3029,14 +3153,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
3029
3153
|
visibleCount: visibleOrderIds.size
|
|
3030
3154
|
});
|
|
3031
3155
|
}
|
|
3032
|
-
return
|
|
3156
|
+
return _context38.abrupt("return", result);
|
|
3033
3157
|
case 7:
|
|
3034
3158
|
case "end":
|
|
3035
|
-
return
|
|
3159
|
+
return _context38.stop();
|
|
3036
3160
|
}
|
|
3037
|
-
},
|
|
3161
|
+
}, _callee38, this);
|
|
3038
3162
|
}));
|
|
3039
|
-
function handleSalesSearchRequest(
|
|
3163
|
+
function handleSalesSearchRequest(_x37, _x38, _x39, _x40) {
|
|
3040
3164
|
return _handleSalesSearchRequest.apply(this, arguments);
|
|
3041
3165
|
}
|
|
3042
3166
|
return handleSalesSearchRequest;
|
|
@@ -3051,20 +3175,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
3051
3175
|
}, {
|
|
3052
3176
|
key: "fetchSalesSearchFromAPI",
|
|
3053
3177
|
value: (function () {
|
|
3054
|
-
var _fetchSalesSearchFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3055
|
-
var _this$
|
|
3056
|
-
var _response$
|
|
3057
|
-
return _regeneratorRuntime().wrap(function
|
|
3058
|
-
while (1) switch (
|
|
3178
|
+
var _fetchSalesSearchFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(backendPath, data) {
|
|
3179
|
+
var _this$app8;
|
|
3180
|
+
var _response$data4, _response$code2, _response$status2, _response$message2, response, _payload, errorMessage;
|
|
3181
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3182
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3059
3183
|
case 0:
|
|
3060
|
-
if ((_this$
|
|
3061
|
-
|
|
3184
|
+
if ((_this$app8 = this.app) !== null && _this$app8 !== void 0 && _this$app8.request) {
|
|
3185
|
+
_context39.next = 3;
|
|
3062
3186
|
break;
|
|
3063
3187
|
}
|
|
3064
3188
|
this.logError('fetchSalesSearchFromAPI: app.request 不可用', {
|
|
3065
3189
|
backendPath: backendPath
|
|
3066
3190
|
});
|
|
3067
|
-
return
|
|
3191
|
+
return _context39.abrupt("return", {
|
|
3068
3192
|
code: 500,
|
|
3069
3193
|
message: 'app.request 不可用',
|
|
3070
3194
|
data: backendPath === '/shop/es/search' ? {
|
|
@@ -3076,29 +3200,29 @@ var Server = /*#__PURE__*/function () {
|
|
|
3076
3200
|
status: false
|
|
3077
3201
|
});
|
|
3078
3202
|
case 3:
|
|
3079
|
-
|
|
3080
|
-
|
|
3203
|
+
_context39.prev = 3;
|
|
3204
|
+
_context39.next = 6;
|
|
3081
3205
|
return this.app.request.post(backendPath, data, {
|
|
3082
3206
|
isShopApi: true
|
|
3083
3207
|
});
|
|
3084
3208
|
case 6:
|
|
3085
|
-
response =
|
|
3086
|
-
_payload = (_response$
|
|
3087
|
-
return
|
|
3088
|
-
code: (_response$
|
|
3089
|
-
status: (_response$
|
|
3090
|
-
message: (_response$
|
|
3209
|
+
response = _context39.sent;
|
|
3210
|
+
_payload = (_response$data4 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data4 !== void 0 ? _response$data4 : response;
|
|
3211
|
+
return _context39.abrupt("return", {
|
|
3212
|
+
code: (_response$code2 = response === null || response === void 0 ? void 0 : response.code) !== null && _response$code2 !== void 0 ? _response$code2 : 200,
|
|
3213
|
+
status: (_response$status2 = response === null || response === void 0 ? void 0 : response.status) !== null && _response$status2 !== void 0 ? _response$status2 : true,
|
|
3214
|
+
message: (_response$message2 = response === null || response === void 0 ? void 0 : response.message) !== null && _response$message2 !== void 0 ? _response$message2 : '',
|
|
3091
3215
|
data: _payload
|
|
3092
3216
|
});
|
|
3093
3217
|
case 11:
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
errorMessage =
|
|
3218
|
+
_context39.prev = 11;
|
|
3219
|
+
_context39.t0 = _context39["catch"](3);
|
|
3220
|
+
errorMessage = _context39.t0 instanceof Error ? _context39.t0.message : String(_context39.t0);
|
|
3097
3221
|
this.logError('fetchSalesSearchFromAPI: 请求失败', {
|
|
3098
3222
|
backendPath: backendPath,
|
|
3099
3223
|
error: errorMessage
|
|
3100
3224
|
});
|
|
3101
|
-
return
|
|
3225
|
+
return _context39.abrupt("return", {
|
|
3102
3226
|
code: 500,
|
|
3103
3227
|
message: errorMessage,
|
|
3104
3228
|
data: backendPath === '/shop/es/search' ? {
|
|
@@ -3111,11 +3235,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3111
3235
|
});
|
|
3112
3236
|
case 16:
|
|
3113
3237
|
case "end":
|
|
3114
|
-
return
|
|
3238
|
+
return _context39.stop();
|
|
3115
3239
|
}
|
|
3116
|
-
},
|
|
3240
|
+
}, _callee39, this, [[3, 11]]);
|
|
3117
3241
|
}));
|
|
3118
|
-
function fetchSalesSearchFromAPI(
|
|
3242
|
+
function fetchSalesSearchFromAPI(_x41, _x42) {
|
|
3119
3243
|
return _fetchSalesSearchFromAPI.apply(this, arguments);
|
|
3120
3244
|
}
|
|
3121
3245
|
return fetchSalesSearchFromAPI;
|
|
@@ -3636,18 +3760,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
3636
3760
|
}, {
|
|
3637
3761
|
key: "fetchOrderListFromAPI",
|
|
3638
3762
|
value: (function () {
|
|
3639
|
-
var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3640
|
-
var _this$
|
|
3641
|
-
var _response$
|
|
3642
|
-
return _regeneratorRuntime().wrap(function
|
|
3643
|
-
while (1) switch (
|
|
3763
|
+
var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(data) {
|
|
3764
|
+
var _this$app9;
|
|
3765
|
+
var _response$data5, response, _payload2, list, count, errorMessage;
|
|
3766
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3767
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3644
3768
|
case 0:
|
|
3645
|
-
if ((_this$
|
|
3646
|
-
|
|
3769
|
+
if ((_this$app9 = this.app) !== null && _this$app9 !== void 0 && _this$app9.request) {
|
|
3770
|
+
_context40.next = 3;
|
|
3647
3771
|
break;
|
|
3648
3772
|
}
|
|
3649
3773
|
this.logError('fetchOrderListFromAPI: app.request 不可用');
|
|
3650
|
-
return
|
|
3774
|
+
return _context40.abrupt("return", {
|
|
3651
3775
|
code: 500,
|
|
3652
3776
|
message: 'app.request 不可用',
|
|
3653
3777
|
data: {
|
|
@@ -3657,17 +3781,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
3657
3781
|
status: false
|
|
3658
3782
|
});
|
|
3659
3783
|
case 3:
|
|
3660
|
-
|
|
3661
|
-
|
|
3784
|
+
_context40.prev = 3;
|
|
3785
|
+
_context40.next = 6;
|
|
3662
3786
|
return this.app.request.post('/shop/order/v2/list', data, {
|
|
3663
3787
|
isShopApi: true
|
|
3664
3788
|
});
|
|
3665
3789
|
case 6:
|
|
3666
|
-
response =
|
|
3667
|
-
_payload2 = (_response$
|
|
3790
|
+
response = _context40.sent;
|
|
3791
|
+
_payload2 = (_response$data5 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data5 !== void 0 ? _response$data5 : response;
|
|
3668
3792
|
list = Array.isArray(_payload2 === null || _payload2 === void 0 ? void 0 : _payload2.list) ? _payload2.list : [];
|
|
3669
3793
|
count = typeof (_payload2 === null || _payload2 === void 0 ? void 0 : _payload2.count) === 'number' ? _payload2.count : list.length;
|
|
3670
|
-
return
|
|
3794
|
+
return _context40.abrupt("return", {
|
|
3671
3795
|
code: 200,
|
|
3672
3796
|
data: _objectSpread(_objectSpread({}, _payload2), {}, {
|
|
3673
3797
|
list: list,
|
|
@@ -3677,13 +3801,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
3677
3801
|
status: true
|
|
3678
3802
|
});
|
|
3679
3803
|
case 13:
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
errorMessage =
|
|
3804
|
+
_context40.prev = 13;
|
|
3805
|
+
_context40.t0 = _context40["catch"](3);
|
|
3806
|
+
errorMessage = _context40.t0 instanceof Error ? _context40.t0.message : String(_context40.t0);
|
|
3683
3807
|
this.logError('fetchOrderListFromAPI: 请求失败', {
|
|
3684
3808
|
error: errorMessage
|
|
3685
3809
|
});
|
|
3686
|
-
return
|
|
3810
|
+
return _context40.abrupt("return", {
|
|
3687
3811
|
code: 500,
|
|
3688
3812
|
message: errorMessage,
|
|
3689
3813
|
data: {
|
|
@@ -3694,11 +3818,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3694
3818
|
});
|
|
3695
3819
|
case 18:
|
|
3696
3820
|
case "end":
|
|
3697
|
-
return
|
|
3821
|
+
return _context40.stop();
|
|
3698
3822
|
}
|
|
3699
|
-
},
|
|
3823
|
+
}, _callee40, this, [[3, 13]]);
|
|
3700
3824
|
}));
|
|
3701
|
-
function fetchOrderListFromAPI(
|
|
3825
|
+
function fetchOrderListFromAPI(_x43) {
|
|
3702
3826
|
return _fetchOrderListFromAPI.apply(this, arguments);
|
|
3703
3827
|
}
|
|
3704
3828
|
return fetchOrderListFromAPI;
|
|
@@ -3710,17 +3834,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
3710
3834
|
}, {
|
|
3711
3835
|
key: "fetchBookingListFromAPI",
|
|
3712
3836
|
value: (function () {
|
|
3713
|
-
var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3837
|
+
var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(data) {
|
|
3714
3838
|
var memoryCacheEnabled, withFields, requestPayload, cacheKey, cached, rawList, bookingResult, _bookingResult$list, errorMessage;
|
|
3715
|
-
return _regeneratorRuntime().wrap(function
|
|
3716
|
-
while (1) switch (
|
|
3839
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3840
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3717
3841
|
case 0:
|
|
3718
3842
|
if (this.order) {
|
|
3719
|
-
|
|
3843
|
+
_context41.next = 3;
|
|
3720
3844
|
break;
|
|
3721
3845
|
}
|
|
3722
3846
|
this.logError('fetchBookingListFromAPI: Order 模块不可用');
|
|
3723
|
-
return
|
|
3847
|
+
return _context41.abrupt("return", {
|
|
3724
3848
|
code: 500,
|
|
3725
3849
|
message: 'Order 模块不可用',
|
|
3726
3850
|
data: {
|
|
@@ -3730,18 +3854,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
3730
3854
|
status: false
|
|
3731
3855
|
});
|
|
3732
3856
|
case 3:
|
|
3733
|
-
|
|
3857
|
+
_context41.prev = 3;
|
|
3734
3858
|
memoryCacheEnabled = this.isBookingRemoteMemoryCacheEnabled(data);
|
|
3735
3859
|
withFields = this.resolveBookingSalesWith(data);
|
|
3736
3860
|
requestPayload = this.normalizeBookingRemoteQueryPayload(data, withFields);
|
|
3737
3861
|
cacheKey = this.buildBookingRemoteCacheKey(requestPayload);
|
|
3738
3862
|
if (!memoryCacheEnabled) {
|
|
3739
|
-
|
|
3863
|
+
_context41.next = 13;
|
|
3740
3864
|
break;
|
|
3741
3865
|
}
|
|
3742
3866
|
cached = this.readBookingRemoteCache(cacheKey);
|
|
3743
3867
|
if (!cached) {
|
|
3744
|
-
|
|
3868
|
+
_context41.next = 13;
|
|
3745
3869
|
break;
|
|
3746
3870
|
}
|
|
3747
3871
|
this.logInfo('fetchBookingListFromAPI: 命中内存缓存', {
|
|
@@ -3749,14 +3873,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
3749
3873
|
listCount: cached.bookingResult.count,
|
|
3750
3874
|
withFields: cached.withFields
|
|
3751
3875
|
});
|
|
3752
|
-
return
|
|
3876
|
+
return _context41.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
|
|
3753
3877
|
cache_hit: true
|
|
3754
3878
|
}));
|
|
3755
3879
|
case 13:
|
|
3756
|
-
|
|
3880
|
+
_context41.next = 15;
|
|
3757
3881
|
return this.order.fetchOrdersBySSE(requestPayload);
|
|
3758
3882
|
case 15:
|
|
3759
|
-
rawList =
|
|
3883
|
+
rawList = _context41.sent;
|
|
3760
3884
|
bookingResult = sortBookings(filterBookingsFromOrders(rawList, data), data); // DEBUG: 挂到 window 上方便排查 SSE → 日历数据丢失问题
|
|
3761
3885
|
if (typeof globalThis !== 'undefined') {
|
|
3762
3886
|
globalThis.__SSE_BOOKING_DEBUG__ = {
|
|
@@ -3803,15 +3927,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
3803
3927
|
cacheKey: cacheKey,
|
|
3804
3928
|
withFields: withFields
|
|
3805
3929
|
});
|
|
3806
|
-
return
|
|
3930
|
+
return _context41.abrupt("return", this.buildBookingResponse(bookingResult));
|
|
3807
3931
|
case 23:
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
errorMessage =
|
|
3932
|
+
_context41.prev = 23;
|
|
3933
|
+
_context41.t0 = _context41["catch"](3);
|
|
3934
|
+
errorMessage = _context41.t0 instanceof Error ? _context41.t0.message : String(_context41.t0);
|
|
3811
3935
|
this.logError('fetchBookingListFromAPI: SSE 请求失败', {
|
|
3812
3936
|
error: errorMessage
|
|
3813
3937
|
});
|
|
3814
|
-
return
|
|
3938
|
+
return _context41.abrupt("return", {
|
|
3815
3939
|
code: 500,
|
|
3816
3940
|
message: errorMessage,
|
|
3817
3941
|
data: {
|
|
@@ -3822,11 +3946,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3822
3946
|
});
|
|
3823
3947
|
case 28:
|
|
3824
3948
|
case "end":
|
|
3825
|
-
return
|
|
3949
|
+
return _context41.stop();
|
|
3826
3950
|
}
|
|
3827
|
-
},
|
|
3951
|
+
}, _callee41, this, [[3, 23]]);
|
|
3828
3952
|
}));
|
|
3829
|
-
function fetchBookingListFromAPI(
|
|
3953
|
+
function fetchBookingListFromAPI(_x44) {
|
|
3830
3954
|
return _fetchBookingListFromAPI.apply(this, arguments);
|
|
3831
3955
|
}
|
|
3832
3956
|
return fetchBookingListFromAPI;
|
|
@@ -3834,24 +3958,24 @@ var Server = /*#__PURE__*/function () {
|
|
|
3834
3958
|
}, {
|
|
3835
3959
|
key: "getDeviceTaskPlugin",
|
|
3836
3960
|
value: function getDeviceTaskPlugin() {
|
|
3837
|
-
var _this$
|
|
3838
|
-
return ((_this$
|
|
3961
|
+
var _this$app10, _this$app10$getPlugin;
|
|
3962
|
+
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, 'deviceTask')) || null;
|
|
3839
3963
|
}
|
|
3840
3964
|
}, {
|
|
3841
3965
|
key: "getIdGeneratorPlugin",
|
|
3842
3966
|
value: function getIdGeneratorPlugin() {
|
|
3843
|
-
var _this$
|
|
3844
|
-
return ((_this$
|
|
3967
|
+
var _this$app11, _this$app11$getPlugin;
|
|
3968
|
+
return ((_this$app11 = this.app) === null || _this$app11 === void 0 || (_this$app11$getPlugin = _this$app11.getPlugin) === null || _this$app11$getPlugin === void 0 ? void 0 : _this$app11$getPlugin.call(_this$app11, 'idGenerator')) || null;
|
|
3845
3969
|
}
|
|
3846
3970
|
}, {
|
|
3847
3971
|
key: "getAppData",
|
|
3848
3972
|
value: function getAppData(key) {
|
|
3849
|
-
var _this$core$getPlugin, _this$core$getPlugin$, _this$
|
|
3973
|
+
var _this$core$getPlugin, _this$core$getPlugin$, _this$app12, _this$app12$getData, _this$app13, _this$app13$getStore, _this$app13$getStore$, _this$app13$getStore$2, _this$app14, _this$app14$getStore, _this$app14$getStore$, _this$app14$getStore$2, _this$app15, _this$app15$getStore, _this$app15$getStore$, _this$app15$getStore$2;
|
|
3850
3974
|
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);
|
|
3851
3975
|
if (typeof getData === 'function') return getData(key);
|
|
3852
|
-
var directValue = (_this$
|
|
3976
|
+
var directValue = (_this$app12 = this.app) === null || _this$app12 === void 0 || (_this$app12$getData = _this$app12.getData) === null || _this$app12$getData === void 0 ? void 0 : _this$app12$getData.call(_this$app12, key);
|
|
3853
3977
|
if (directValue !== undefined) return directValue;
|
|
3854
|
-
var coreData = ((_this$
|
|
3978
|
+
var coreData = ((_this$app13 = this.app) === null || _this$app13 === void 0 || (_this$app13 = _this$app13.models) === 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 ? void 0 : _this$app14$getStore$.call(_this$app14$getStore$2, 'core', 'core')) || ((_this$app15 = this.app) === null || _this$app15 === void 0 || (_this$app15 = _this$app15.data) === null || _this$app15 === void 0 || (_this$app15 = _this$app15.store) === null || _this$app15 === void 0 || (_this$app15$getStore = _this$app15.getStore) === null || _this$app15$getStore === void 0 || (_this$app15$getStore$ = (_this$app15$getStore$2 = _this$app15$getStore.call(_this$app15)).getDataByModel) === null || _this$app15$getStore$ === void 0 || (_this$app15$getStore$ = _this$app15$getStore$.call(_this$app15$getStore$2, 'core')) === null || _this$app15$getStore$ === void 0 ? void 0 : _this$app15$getStore$.core);
|
|
3855
3979
|
return coreData === null || coreData === void 0 ? void 0 : coreData[key];
|
|
3856
3980
|
}
|
|
3857
3981
|
}, {
|
|
@@ -3902,32 +4026,32 @@ var Server = /*#__PURE__*/function () {
|
|
|
3902
4026
|
}, {
|
|
3903
4027
|
key: "getShortNumberOrDeviceId",
|
|
3904
4028
|
value: function () {
|
|
3905
|
-
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4029
|
+
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
3906
4030
|
var getAsyncIotDeviceInfo, res;
|
|
3907
|
-
return _regeneratorRuntime().wrap(function
|
|
3908
|
-
while (1) switch (
|
|
4031
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4032
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3909
4033
|
case 0:
|
|
3910
4034
|
getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
|
|
3911
4035
|
if (!getAsyncIotDeviceInfo) {
|
|
3912
|
-
|
|
4036
|
+
_context42.next = 7;
|
|
3913
4037
|
break;
|
|
3914
4038
|
}
|
|
3915
|
-
|
|
4039
|
+
_context42.next = 4;
|
|
3916
4040
|
return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
|
|
3917
4041
|
case 4:
|
|
3918
|
-
res =
|
|
4042
|
+
res = _context42.sent;
|
|
3919
4043
|
if (!(res !== null && res !== void 0 && res.short_number)) {
|
|
3920
|
-
|
|
4044
|
+
_context42.next = 7;
|
|
3921
4045
|
break;
|
|
3922
4046
|
}
|
|
3923
|
-
return
|
|
4047
|
+
return _context42.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
|
|
3924
4048
|
case 7:
|
|
3925
|
-
return
|
|
4049
|
+
return _context42.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
|
|
3926
4050
|
case 8:
|
|
3927
4051
|
case "end":
|
|
3928
|
-
return
|
|
4052
|
+
return _context42.stop();
|
|
3929
4053
|
}
|
|
3930
|
-
},
|
|
4054
|
+
}, _callee42, this);
|
|
3931
4055
|
}));
|
|
3932
4056
|
function getShortNumberOrDeviceId() {
|
|
3933
4057
|
return _getShortNumberOrDeviceId.apply(this, arguments);
|
|
@@ -3954,16 +4078,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
3954
4078
|
}, {
|
|
3955
4079
|
key: "normalizeCheckoutSubmitData",
|
|
3956
4080
|
value: function () {
|
|
3957
|
-
var _normalizeCheckoutSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4081
|
+
var _normalizeCheckoutSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(data, title) {
|
|
3958
4082
|
var next, externalSaleNumber, shouldClearLocalOrderId, hasCheckoutOrderNumbers, localOrder;
|
|
3959
|
-
return _regeneratorRuntime().wrap(function
|
|
3960
|
-
while (1) switch (
|
|
4083
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4084
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3961
4085
|
case 0:
|
|
3962
4086
|
if (!(!data || _typeof(data) !== 'object')) {
|
|
3963
|
-
|
|
4087
|
+
_context43.next = 2;
|
|
3964
4088
|
break;
|
|
3965
4089
|
}
|
|
3966
|
-
return
|
|
4090
|
+
return _context43.abrupt("return", data);
|
|
3967
4091
|
case 2:
|
|
3968
4092
|
next = _objectSpread({}, data);
|
|
3969
4093
|
externalSaleNumber = next.external_sale_number;
|
|
@@ -3973,7 +4097,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3973
4097
|
delete next.vouchers;
|
|
3974
4098
|
hasCheckoutOrderNumbers = !this.isBlankCheckoutValue(next.shop_order_number) && !this.isBlankCheckoutValue(next.shop_full_order_number);
|
|
3975
4099
|
if (!hasCheckoutOrderNumbers) {
|
|
3976
|
-
|
|
4100
|
+
_context43.next = 11;
|
|
3977
4101
|
break;
|
|
3978
4102
|
}
|
|
3979
4103
|
this.logInfo("".concat(title, ": checkout \u5DF2\u643A\u5E26\u8BA2\u5355\u53F7\uFF0C\u8DF3\u8FC7\u67E5\u91CD"), {
|
|
@@ -3983,10 +4107,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3983
4107
|
shop_order_number: next.shop_order_number,
|
|
3984
4108
|
shop_full_order_number: next.shop_full_order_number
|
|
3985
4109
|
});
|
|
3986
|
-
return
|
|
4110
|
+
return _context43.abrupt("return", next);
|
|
3987
4111
|
case 11:
|
|
3988
4112
|
if (!this.isBlankCheckoutValue(externalSaleNumber)) {
|
|
3989
|
-
|
|
4113
|
+
_context43.next = 14;
|
|
3990
4114
|
break;
|
|
3991
4115
|
}
|
|
3992
4116
|
if (shouldClearLocalOrderId) {
|
|
@@ -3995,10 +4119,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3995
4119
|
order_id: next.order_id
|
|
3996
4120
|
});
|
|
3997
4121
|
}
|
|
3998
|
-
return
|
|
4122
|
+
return _context43.abrupt("return", next);
|
|
3999
4123
|
case 14:
|
|
4000
4124
|
if (!(!this.order || typeof this.order.getLocalOrderFromMemoryByLookup !== 'function')) {
|
|
4001
|
-
|
|
4125
|
+
_context43.next = 17;
|
|
4002
4126
|
break;
|
|
4003
4127
|
}
|
|
4004
4128
|
if (shouldClearLocalOrderId) {
|
|
@@ -4007,12 +4131,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
4007
4131
|
external_sale_number: externalSaleNumber
|
|
4008
4132
|
});
|
|
4009
4133
|
}
|
|
4010
|
-
return
|
|
4134
|
+
return _context43.abrupt("return", next);
|
|
4011
4135
|
case 17:
|
|
4012
|
-
|
|
4136
|
+
_context43.prev = 17;
|
|
4013
4137
|
localOrder = this.order.getLocalOrderFromMemoryByLookup(externalSaleNumber);
|
|
4014
4138
|
if (localOrder) {
|
|
4015
|
-
|
|
4139
|
+
_context43.next = 22;
|
|
4016
4140
|
break;
|
|
4017
4141
|
}
|
|
4018
4142
|
if (shouldClearLocalOrderId) {
|
|
@@ -4022,7 +4146,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4022
4146
|
localOrderFound: false
|
|
4023
4147
|
});
|
|
4024
4148
|
}
|
|
4025
|
-
return
|
|
4149
|
+
return _context43.abrupt("return", next);
|
|
4026
4150
|
case 22:
|
|
4027
4151
|
if (this.isBlankCheckoutValue(next.shop_order_number)) {
|
|
4028
4152
|
next.shop_order_number = localOrder.shop_order_number;
|
|
@@ -4039,23 +4163,23 @@ var Server = /*#__PURE__*/function () {
|
|
|
4039
4163
|
shop_full_order_number: next.shop_full_order_number
|
|
4040
4164
|
});
|
|
4041
4165
|
// 删除 数据体中的 vouchers,对小票和后端来说他们不需要,这个字段只是单向同步给前端用的,而且目前对订单来说还没什么用
|
|
4042
|
-
return
|
|
4166
|
+
return _context43.abrupt("return", next);
|
|
4043
4167
|
case 28:
|
|
4044
|
-
|
|
4045
|
-
|
|
4168
|
+
_context43.prev = 28;
|
|
4169
|
+
_context43.t0 = _context43["catch"](17);
|
|
4046
4170
|
this.logWarning("".concat(title, ": checkout \u67E5\u627E\u672C\u5730\u8BA2\u5355\u5931\u8D25"), {
|
|
4047
4171
|
external_sale_number: externalSaleNumber,
|
|
4048
|
-
error: this.getUnknownErrorMessage(
|
|
4049
|
-
error_detail: this.normalizeUnknownError(
|
|
4172
|
+
error: this.getUnknownErrorMessage(_context43.t0),
|
|
4173
|
+
error_detail: this.normalizeUnknownError(_context43.t0)
|
|
4050
4174
|
});
|
|
4051
|
-
return
|
|
4175
|
+
return _context43.abrupt("return", next);
|
|
4052
4176
|
case 32:
|
|
4053
4177
|
case "end":
|
|
4054
|
-
return
|
|
4178
|
+
return _context43.stop();
|
|
4055
4179
|
}
|
|
4056
|
-
},
|
|
4180
|
+
}, _callee43, this, [[17, 28]]);
|
|
4057
4181
|
}));
|
|
4058
|
-
function normalizeCheckoutSubmitData(
|
|
4182
|
+
function normalizeCheckoutSubmitData(_x45, _x46) {
|
|
4059
4183
|
return _normalizeCheckoutSubmitData.apply(this, arguments);
|
|
4060
4184
|
}
|
|
4061
4185
|
return normalizeCheckoutSubmitData;
|
|
@@ -4063,81 +4187,81 @@ var Server = /*#__PURE__*/function () {
|
|
|
4063
4187
|
}, {
|
|
4064
4188
|
key: "ensureCheckoutOrderNumbers",
|
|
4065
4189
|
value: function () {
|
|
4066
|
-
var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4190
|
+
var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(data, title) {
|
|
4067
4191
|
var next, needsShopOrderNumber, needsShopFullOrderNumber, idGenerator;
|
|
4068
|
-
return _regeneratorRuntime().wrap(function
|
|
4069
|
-
while (1) switch (
|
|
4192
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4193
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4070
4194
|
case 0:
|
|
4071
4195
|
if (!(!data || _typeof(data) !== 'object')) {
|
|
4072
|
-
|
|
4196
|
+
_context44.next = 2;
|
|
4073
4197
|
break;
|
|
4074
4198
|
}
|
|
4075
|
-
return
|
|
4199
|
+
return _context44.abrupt("return", data);
|
|
4076
4200
|
case 2:
|
|
4077
4201
|
next = _objectSpread({}, data);
|
|
4078
4202
|
needsShopOrderNumber = next.shop_order_number === undefined || next.shop_order_number === null || next.shop_order_number === '';
|
|
4079
4203
|
needsShopFullOrderNumber = next.shop_full_order_number === undefined || next.shop_full_order_number === null || next.shop_full_order_number === '';
|
|
4080
4204
|
if (!(!needsShopOrderNumber && !needsShopFullOrderNumber)) {
|
|
4081
|
-
|
|
4205
|
+
_context44.next = 7;
|
|
4082
4206
|
break;
|
|
4083
4207
|
}
|
|
4084
|
-
return
|
|
4208
|
+
return _context44.abrupt("return", next);
|
|
4085
4209
|
case 7:
|
|
4086
4210
|
idGenerator = this.getIdGeneratorPlugin();
|
|
4087
4211
|
if (idGenerator) {
|
|
4088
|
-
|
|
4212
|
+
_context44.next = 11;
|
|
4089
4213
|
break;
|
|
4090
4214
|
}
|
|
4091
4215
|
this.logWarning("".concat(title, ": idGenerator \u63D2\u4EF6\u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u751F\u6210\u8BA2\u5355\u53F7"), {
|
|
4092
4216
|
needsShopOrderNumber: needsShopOrderNumber,
|
|
4093
4217
|
needsShopFullOrderNumber: needsShopFullOrderNumber
|
|
4094
4218
|
});
|
|
4095
|
-
return
|
|
4219
|
+
return _context44.abrupt("return", next);
|
|
4096
4220
|
case 11:
|
|
4097
|
-
|
|
4221
|
+
_context44.prev = 11;
|
|
4098
4222
|
if (!(needsShopOrderNumber && idGenerator.generateShopOrderNumber)) {
|
|
4099
|
-
|
|
4223
|
+
_context44.next = 16;
|
|
4100
4224
|
break;
|
|
4101
4225
|
}
|
|
4102
|
-
|
|
4226
|
+
_context44.next = 15;
|
|
4103
4227
|
return idGenerator.generateShopOrderNumber({
|
|
4104
4228
|
biz: next.business_code || 'ticket'
|
|
4105
4229
|
});
|
|
4106
4230
|
case 15:
|
|
4107
|
-
next.shop_order_number =
|
|
4231
|
+
next.shop_order_number = _context44.sent;
|
|
4108
4232
|
case 16:
|
|
4109
4233
|
if (!(needsShopFullOrderNumber && idGenerator.generateReceiptId)) {
|
|
4110
|
-
|
|
4234
|
+
_context44.next = 20;
|
|
4111
4235
|
break;
|
|
4112
4236
|
}
|
|
4113
|
-
|
|
4237
|
+
_context44.next = 19;
|
|
4114
4238
|
return idGenerator.generateReceiptId({
|
|
4115
4239
|
biz: next.business_code || 'ticket'
|
|
4116
4240
|
});
|
|
4117
4241
|
case 19:
|
|
4118
|
-
next.shop_full_order_number =
|
|
4242
|
+
next.shop_full_order_number = _context44.sent;
|
|
4119
4243
|
case 20:
|
|
4120
4244
|
this.logInfo("".concat(title, ": checkout \u8BA2\u5355\u53F7\u5DF2\u51C6\u5907"), {
|
|
4121
4245
|
shop_order_number: next.shop_order_number,
|
|
4122
4246
|
shop_full_order_number: next.shop_full_order_number
|
|
4123
4247
|
});
|
|
4124
|
-
|
|
4248
|
+
_context44.next = 26;
|
|
4125
4249
|
break;
|
|
4126
4250
|
case 23:
|
|
4127
|
-
|
|
4128
|
-
|
|
4251
|
+
_context44.prev = 23;
|
|
4252
|
+
_context44.t0 = _context44["catch"](11);
|
|
4129
4253
|
this.logError("".concat(title, ": \u751F\u6210 checkout \u8BA2\u5355\u53F7\u5931\u8D25"), {
|
|
4130
|
-
error:
|
|
4254
|
+
error: _context44.t0 instanceof Error ? _context44.t0.message : String(_context44.t0)
|
|
4131
4255
|
});
|
|
4132
4256
|
case 26:
|
|
4133
|
-
return
|
|
4257
|
+
return _context44.abrupt("return", next);
|
|
4134
4258
|
case 27:
|
|
4135
4259
|
case "end":
|
|
4136
|
-
return
|
|
4260
|
+
return _context44.stop();
|
|
4137
4261
|
}
|
|
4138
|
-
},
|
|
4262
|
+
}, _callee44, this, [[11, 23]]);
|
|
4139
4263
|
}));
|
|
4140
|
-
function ensureCheckoutOrderNumbers(
|
|
4264
|
+
function ensureCheckoutOrderNumbers(_x47, _x48) {
|
|
4141
4265
|
return _ensureCheckoutOrderNumbers.apply(this, arguments);
|
|
4142
4266
|
}
|
|
4143
4267
|
return ensureCheckoutOrderNumbers;
|
|
@@ -4145,27 +4269,27 @@ var Server = /*#__PURE__*/function () {
|
|
|
4145
4269
|
}, {
|
|
4146
4270
|
key: "dispatchCheckoutSyncTask",
|
|
4147
4271
|
value: function () {
|
|
4148
|
-
var _dispatchCheckoutSyncTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4272
|
+
var _dispatchCheckoutSyncTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
|
|
4149
4273
|
var deviceTask, debugDeviceId, debugIdempotencyKey, _params$data, _params$data2, _params$data3, _params$data4, result;
|
|
4150
|
-
return _regeneratorRuntime().wrap(function
|
|
4151
|
-
while (1) switch (
|
|
4274
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
4275
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4152
4276
|
case 0:
|
|
4153
4277
|
this.registerDeviceTaskActions();
|
|
4154
4278
|
deviceTask = this.getDeviceTaskPlugin();
|
|
4155
|
-
|
|
4279
|
+
_context45.next = 4;
|
|
4156
4280
|
return this.getShortNumberOrDeviceId();
|
|
4157
4281
|
case 4:
|
|
4158
|
-
debugDeviceId =
|
|
4282
|
+
debugDeviceId = _context45.sent;
|
|
4159
4283
|
debugIdempotencyKey = this.buildCheckoutTaskIdempotencyKey(params.data);
|
|
4160
4284
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
4161
|
-
|
|
4285
|
+
_context45.next = 9;
|
|
4162
4286
|
break;
|
|
4163
4287
|
}
|
|
4164
4288
|
this.logError("".concat(params.title, ": deviceTask.dispatch \u4E0D\u53EF\u7528"));
|
|
4165
|
-
return
|
|
4289
|
+
return _context45.abrupt("return");
|
|
4166
4290
|
case 9:
|
|
4167
|
-
|
|
4168
|
-
|
|
4291
|
+
_context45.prev = 9;
|
|
4292
|
+
_context45.next = 12;
|
|
4169
4293
|
return deviceTask.dispatch({
|
|
4170
4294
|
action: 'sync_sales',
|
|
4171
4295
|
device_id: debugDeviceId,
|
|
@@ -4183,27 +4307,27 @@ var Server = /*#__PURE__*/function () {
|
|
|
4183
4307
|
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)
|
|
4184
4308
|
});
|
|
4185
4309
|
case 12:
|
|
4186
|
-
result =
|
|
4310
|
+
result = _context45.sent;
|
|
4187
4311
|
this.logInfo("".concat(params.title, ": sync_sales \u4EFB\u52A1\u5DF2\u6D3E\u53D1"), {
|
|
4188
4312
|
uuid: result === null || result === void 0 ? void 0 : result.uuid,
|
|
4189
4313
|
status: result === null || result === void 0 ? void 0 : result.status,
|
|
4190
4314
|
reused: result === null || result === void 0 ? void 0 : result.reused
|
|
4191
4315
|
});
|
|
4192
|
-
|
|
4316
|
+
_context45.next = 19;
|
|
4193
4317
|
break;
|
|
4194
4318
|
case 16:
|
|
4195
|
-
|
|
4196
|
-
|
|
4319
|
+
_context45.prev = 16;
|
|
4320
|
+
_context45.t0 = _context45["catch"](9);
|
|
4197
4321
|
this.logError("".concat(params.title, ": \u6D3E\u53D1 sync_sales \u4EFB\u52A1\u5931\u8D25"), {
|
|
4198
|
-
error:
|
|
4322
|
+
error: _context45.t0 instanceof Error ? _context45.t0.message : String(_context45.t0)
|
|
4199
4323
|
});
|
|
4200
4324
|
case 19:
|
|
4201
4325
|
case "end":
|
|
4202
|
-
return
|
|
4326
|
+
return _context45.stop();
|
|
4203
4327
|
}
|
|
4204
|
-
},
|
|
4328
|
+
}, _callee45, this, [[9, 16]]);
|
|
4205
4329
|
}));
|
|
4206
|
-
function dispatchCheckoutSyncTask(
|
|
4330
|
+
function dispatchCheckoutSyncTask(_x49) {
|
|
4207
4331
|
return _dispatchCheckoutSyncTask.apply(this, arguments);
|
|
4208
4332
|
}
|
|
4209
4333
|
return dispatchCheckoutSyncTask;
|
|
@@ -4211,34 +4335,36 @@ var Server = /*#__PURE__*/function () {
|
|
|
4211
4335
|
}, {
|
|
4212
4336
|
key: "dispatchPrintOtherReceiptTask",
|
|
4213
4337
|
value: function () {
|
|
4214
|
-
var _dispatchPrintOtherReceiptTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4338
|
+
var _dispatchPrintOtherReceiptTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
|
|
4215
4339
|
var deviceTask, _params$deviceId, _params$syncedOrder, _params$syncedOrder2, _params$syncedOrder3, printIdentity, deviceId;
|
|
4216
|
-
return _regeneratorRuntime().wrap(function
|
|
4217
|
-
while (1) switch (
|
|
4340
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
4341
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
4218
4342
|
case 0:
|
|
4219
4343
|
deviceTask = this.getDeviceTaskPlugin();
|
|
4220
4344
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
4221
|
-
|
|
4345
|
+
_context46.next = 4;
|
|
4222
4346
|
break;
|
|
4223
4347
|
}
|
|
4224
4348
|
this.logWarning('dispatchPrintOtherReceiptTask: deviceTask.dispatch 不可用');
|
|
4225
|
-
return
|
|
4349
|
+
return _context46.abrupt("return");
|
|
4226
4350
|
case 4:
|
|
4227
|
-
|
|
4351
|
+
_context46.prev = 4;
|
|
4228
4352
|
printIdentity = this.getPrintOrderIdentity(params.syncedOrder);
|
|
4229
|
-
|
|
4353
|
+
_context46.next = 8;
|
|
4230
4354
|
return this.getShortNumberOrDeviceId();
|
|
4231
4355
|
case 8:
|
|
4232
|
-
deviceId =
|
|
4233
|
-
|
|
4356
|
+
deviceId = _context46.sent;
|
|
4357
|
+
_context46.next = 11;
|
|
4234
4358
|
return deviceTask.dispatch({
|
|
4235
4359
|
action: 'print_all',
|
|
4236
4360
|
device_id: (_params$deviceId = params.deviceId) !== null && _params$deviceId !== void 0 ? _params$deviceId : deviceId,
|
|
4237
4361
|
payload: {
|
|
4238
|
-
type: params.
|
|
4362
|
+
type: params.isManualPrint ? '0' : '99',
|
|
4239
4363
|
data: params.receiptOnly ? {
|
|
4240
4364
|
order_id: printIdentity,
|
|
4241
|
-
small_ticket_data: (_params$syncedOrder = params.syncedOrder) === null || _params$syncedOrder === void 0 || (_params$syncedOrder = _params$syncedOrder.payment_info) === null || _params$syncedOrder === void 0 ? void 0 : _params$syncedOrder.small_ticket_data
|
|
4365
|
+
small_ticket_data: (_params$syncedOrder = params.syncedOrder) === null || _params$syncedOrder === void 0 || (_params$syncedOrder = _params$syncedOrder.payment_info) === null || _params$syncedOrder === void 0 ? void 0 : _params$syncedOrder.small_ticket_data,
|
|
4366
|
+
skip_wristband: true,
|
|
4367
|
+
skip_voucher: true
|
|
4242
4368
|
} : {
|
|
4243
4369
|
order_id: printIdentity,
|
|
4244
4370
|
machine_code_print_info: (_params$syncedOrder2 = params.syncedOrder) === null || _params$syncedOrder2 === void 0 || (_params$syncedOrder2 = _params$syncedOrder2.payment_info) === null || _params$syncedOrder2 === void 0 ? void 0 : _params$syncedOrder2.machine_code_print_info,
|
|
@@ -4249,27 +4375,27 @@ var Server = /*#__PURE__*/function () {
|
|
|
4249
4375
|
idempotency_key: this.buildPrintOtherReceiptIdempotencyKey(params.syncedOrder, {
|
|
4250
4376
|
receiptOnly: params.receiptOnly
|
|
4251
4377
|
}),
|
|
4252
|
-
name: '
|
|
4378
|
+
name: 'PRINT_V1',
|
|
4253
4379
|
source: 'server',
|
|
4254
4380
|
source_type: 'order',
|
|
4255
4381
|
source_id: printIdentity
|
|
4256
4382
|
});
|
|
4257
4383
|
case 11:
|
|
4258
|
-
|
|
4384
|
+
_context46.next = 16;
|
|
4259
4385
|
break;
|
|
4260
4386
|
case 13:
|
|
4261
|
-
|
|
4262
|
-
|
|
4387
|
+
_context46.prev = 13;
|
|
4388
|
+
_context46.t0 = _context46["catch"](4);
|
|
4263
4389
|
this.logError('dispatchPrintOtherReceiptTask: 派发失败', {
|
|
4264
|
-
error:
|
|
4390
|
+
error: _context46.t0 instanceof Error ? _context46.t0.message : String(_context46.t0)
|
|
4265
4391
|
});
|
|
4266
4392
|
case 16:
|
|
4267
4393
|
case "end":
|
|
4268
|
-
return
|
|
4394
|
+
return _context46.stop();
|
|
4269
4395
|
}
|
|
4270
|
-
},
|
|
4396
|
+
}, _callee46, this, [[4, 13]]);
|
|
4271
4397
|
}));
|
|
4272
|
-
function dispatchPrintOtherReceiptTask(
|
|
4398
|
+
function dispatchPrintOtherReceiptTask(_x50) {
|
|
4273
4399
|
return _dispatchPrintOtherReceiptTask.apply(this, arguments);
|
|
4274
4400
|
}
|
|
4275
4401
|
return dispatchPrintOtherReceiptTask;
|
|
@@ -4289,32 +4415,32 @@ var Server = /*#__PURE__*/function () {
|
|
|
4289
4415
|
}, {
|
|
4290
4416
|
key: "dispatchLocalReceiptPrint",
|
|
4291
4417
|
value: function () {
|
|
4292
|
-
var _dispatchLocalReceiptPrint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4418
|
+
var _dispatchLocalReceiptPrint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
|
|
4293
4419
|
var _payment_info;
|
|
4294
4420
|
var printableOrder;
|
|
4295
|
-
return _regeneratorRuntime().wrap(function
|
|
4296
|
-
while (1) switch (
|
|
4421
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4422
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
4297
4423
|
case 0:
|
|
4298
4424
|
if (!(params.requireFullyPaid && !this.isSalesOrderFullyPaid(params.order))) {
|
|
4299
|
-
|
|
4425
|
+
_context47.next = 2;
|
|
4300
4426
|
break;
|
|
4301
4427
|
}
|
|
4302
|
-
return
|
|
4428
|
+
return _context47.abrupt("return", {
|
|
4303
4429
|
printed: false,
|
|
4304
4430
|
order: params.order
|
|
4305
4431
|
});
|
|
4306
4432
|
case 2:
|
|
4307
|
-
|
|
4433
|
+
_context47.next = 4;
|
|
4308
4434
|
return this.withLocalSmallTicketData(params.order, {
|
|
4309
4435
|
requireFullyPaid: params.requireFullyPaid
|
|
4310
4436
|
});
|
|
4311
4437
|
case 4:
|
|
4312
|
-
printableOrder =
|
|
4438
|
+
printableOrder = _context47.sent;
|
|
4313
4439
|
if (hasSmallTicketData((_payment_info = printableOrder.payment_info) === null || _payment_info === void 0 ? void 0 : _payment_info.small_ticket_data)) {
|
|
4314
|
-
|
|
4440
|
+
_context47.next = 7;
|
|
4315
4441
|
break;
|
|
4316
4442
|
}
|
|
4317
|
-
return
|
|
4443
|
+
return _context47.abrupt("return", {
|
|
4318
4444
|
printed: false,
|
|
4319
4445
|
order: printableOrder
|
|
4320
4446
|
});
|
|
@@ -4324,25 +4450,26 @@ var Server = /*#__PURE__*/function () {
|
|
|
4324
4450
|
printableOrder: printableOrder,
|
|
4325
4451
|
response: params.response
|
|
4326
4452
|
});
|
|
4327
|
-
|
|
4453
|
+
_context47.next = 10;
|
|
4328
4454
|
return this.dispatchPrintOtherReceiptTask({
|
|
4329
4455
|
checkoutData: params.checkoutData,
|
|
4330
4456
|
syncedOrder: printableOrder,
|
|
4331
4457
|
response: params.response,
|
|
4332
|
-
receiptOnly: true
|
|
4458
|
+
receiptOnly: true,
|
|
4459
|
+
isManualPrint: params.isManualPrint
|
|
4333
4460
|
});
|
|
4334
4461
|
case 10:
|
|
4335
|
-
return
|
|
4462
|
+
return _context47.abrupt("return", {
|
|
4336
4463
|
printed: true,
|
|
4337
4464
|
order: printableOrder
|
|
4338
4465
|
});
|
|
4339
4466
|
case 11:
|
|
4340
4467
|
case "end":
|
|
4341
|
-
return
|
|
4468
|
+
return _context47.stop();
|
|
4342
4469
|
}
|
|
4343
|
-
},
|
|
4470
|
+
}, _callee47, this);
|
|
4344
4471
|
}));
|
|
4345
|
-
function dispatchLocalReceiptPrint(
|
|
4472
|
+
function dispatchLocalReceiptPrint(_x51) {
|
|
4346
4473
|
return _dispatchLocalReceiptPrint.apply(this, arguments);
|
|
4347
4474
|
}
|
|
4348
4475
|
return dispatchLocalReceiptPrint;
|
|
@@ -4366,13 +4493,174 @@ var Server = /*#__PURE__*/function () {
|
|
|
4366
4493
|
}
|
|
4367
4494
|
return undefined;
|
|
4368
4495
|
}
|
|
4496
|
+
}, {
|
|
4497
|
+
key: "resolveMachinecodeBatchMetadataLookup",
|
|
4498
|
+
value: function resolveMachinecodeBatchMetadataLookup(data) {
|
|
4499
|
+
var candidates = [data === null || data === void 0 ? void 0 : data.order_lookup, data === null || data === void 0 ? void 0 : data.orderLookup, data === null || data === void 0 ? void 0 : data.external_sale_number, data === null || data === void 0 ? void 0 : data.externalSaleNumber, data === null || data === void 0 ? void 0 : data.order_id, data === null || data === void 0 ? void 0 : data.orderId, data === null || data === void 0 ? void 0 : data.order_number, data === null || data === void 0 ? void 0 : data.orderNumber, data === null || data === void 0 ? void 0 : data.shop_order_number, data === null || data === void 0 ? void 0 : data.shopOrderNumber, data === null || data === void 0 ? void 0 : data.shop_full_order_number, data === null || data === void 0 ? void 0 : data.shopFullOrderNumber];
|
|
4500
|
+
return candidates.find(function (candidate) {
|
|
4501
|
+
return candidate !== undefined && candidate !== null && candidate !== '';
|
|
4502
|
+
});
|
|
4503
|
+
}
|
|
4504
|
+
}, {
|
|
4505
|
+
key: "syncMachinecodeBatchMetadataToLocalOrder",
|
|
4506
|
+
value: function () {
|
|
4507
|
+
var _syncMachinecodeBatchMetadataToLocalOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(data, batchMetadata) {
|
|
4508
|
+
var _this$order3;
|
|
4509
|
+
var title, lookup, localOrder, metadataByVoucherId, _iterator12, _step12, _item$voucher_id, item, voucherId, vouchers, hasUpdatedVoucher, nextVouchers;
|
|
4510
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
4511
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
4512
|
+
case 0:
|
|
4513
|
+
title = 'handleMachinecodeBatchMetadata';
|
|
4514
|
+
lookup = this.resolveMachinecodeBatchMetadataLookup(data);
|
|
4515
|
+
if (!(lookup === undefined)) {
|
|
4516
|
+
_context48.next = 5;
|
|
4517
|
+
break;
|
|
4518
|
+
}
|
|
4519
|
+
this.logWarning("".concat(title, ": order lookup \u7F3A\u5931\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355 metadata \u66F4\u65B0"), {
|
|
4520
|
+
batchSize: batchMetadata.length
|
|
4521
|
+
});
|
|
4522
|
+
return _context48.abrupt("return");
|
|
4523
|
+
case 5:
|
|
4524
|
+
if ((_this$order3 = this.order) !== null && _this$order3 !== void 0 && _this$order3.getLocalOrderByLookup) {
|
|
4525
|
+
_context48.next = 8;
|
|
4526
|
+
break;
|
|
4527
|
+
}
|
|
4528
|
+
this.logWarning("".concat(title, ": Order \u6A21\u5757\u672A\u6CE8\u518C\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355 metadata \u66F4\u65B0"), {
|
|
4529
|
+
lookup: lookup
|
|
4530
|
+
});
|
|
4531
|
+
return _context48.abrupt("return");
|
|
4532
|
+
case 8:
|
|
4533
|
+
_context48.next = 10;
|
|
4534
|
+
return this.order.getLocalOrderByLookup(lookup);
|
|
4535
|
+
case 10:
|
|
4536
|
+
localOrder = _context48.sent;
|
|
4537
|
+
if (localOrder) {
|
|
4538
|
+
_context48.next = 14;
|
|
4539
|
+
break;
|
|
4540
|
+
}
|
|
4541
|
+
this.logWarning("".concat(title, ": \u672C\u5730\u8BA2\u5355\u4E0D\u5B58\u5728\uFF0C\u8DF3\u8FC7 metadata \u66F4\u65B0"), {
|
|
4542
|
+
lookup: lookup
|
|
4543
|
+
});
|
|
4544
|
+
return _context48.abrupt("return");
|
|
4545
|
+
case 14:
|
|
4546
|
+
metadataByVoucherId = new Map();
|
|
4547
|
+
_iterator12 = _createForOfIteratorHelper(batchMetadata);
|
|
4548
|
+
_context48.prev = 16;
|
|
4549
|
+
_iterator12.s();
|
|
4550
|
+
case 18:
|
|
4551
|
+
if ((_step12 = _iterator12.n()).done) {
|
|
4552
|
+
_context48.next = 26;
|
|
4553
|
+
break;
|
|
4554
|
+
}
|
|
4555
|
+
item = _step12.value;
|
|
4556
|
+
voucherId = (_item$voucher_id = item === null || item === void 0 ? void 0 : item.voucher_id) !== null && _item$voucher_id !== void 0 ? _item$voucher_id : item === null || item === void 0 ? void 0 : item.voucherId;
|
|
4557
|
+
if (!(voucherId === undefined || voucherId === null || voucherId === '')) {
|
|
4558
|
+
_context48.next = 23;
|
|
4559
|
+
break;
|
|
4560
|
+
}
|
|
4561
|
+
return _context48.abrupt("continue", 24);
|
|
4562
|
+
case 23:
|
|
4563
|
+
metadataByVoucherId.set(String(voucherId), (item === null || item === void 0 ? void 0 : item.metadata) || {});
|
|
4564
|
+
case 24:
|
|
4565
|
+
_context48.next = 18;
|
|
4566
|
+
break;
|
|
4567
|
+
case 26:
|
|
4568
|
+
_context48.next = 31;
|
|
4569
|
+
break;
|
|
4570
|
+
case 28:
|
|
4571
|
+
_context48.prev = 28;
|
|
4572
|
+
_context48.t0 = _context48["catch"](16);
|
|
4573
|
+
_iterator12.e(_context48.t0);
|
|
4574
|
+
case 31:
|
|
4575
|
+
_context48.prev = 31;
|
|
4576
|
+
_iterator12.f();
|
|
4577
|
+
return _context48.finish(31);
|
|
4578
|
+
case 34:
|
|
4579
|
+
if (!(metadataByVoucherId.size === 0)) {
|
|
4580
|
+
_context48.next = 37;
|
|
4581
|
+
break;
|
|
4582
|
+
}
|
|
4583
|
+
this.logWarning("".concat(title, ": voucher metadata \u7F3A\u5931\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355 metadata \u66F4\u65B0"), {
|
|
4584
|
+
lookup: lookup
|
|
4585
|
+
});
|
|
4586
|
+
return _context48.abrupt("return");
|
|
4587
|
+
case 37:
|
|
4588
|
+
vouchers = Array.isArray(localOrder.vouchers) ? localOrder.vouchers : [];
|
|
4589
|
+
hasUpdatedVoucher = false;
|
|
4590
|
+
nextVouchers = vouchers.map(function (voucher) {
|
|
4591
|
+
var voucherId = voucher === null || voucher === void 0 ? void 0 : voucher.voucher_id;
|
|
4592
|
+
if (voucherId === undefined || voucherId === null) return voucher;
|
|
4593
|
+
var metadata = metadataByVoucherId.get(String(voucherId));
|
|
4594
|
+
if (!metadata) return voucher;
|
|
4595
|
+
hasUpdatedVoucher = true;
|
|
4596
|
+
return _objectSpread(_objectSpread({}, voucher), {}, {
|
|
4597
|
+
metadata: metadata
|
|
4598
|
+
});
|
|
4599
|
+
});
|
|
4600
|
+
if (hasUpdatedVoucher) {
|
|
4601
|
+
_context48.next = 43;
|
|
4602
|
+
break;
|
|
4603
|
+
}
|
|
4604
|
+
this.logWarning("".concat(title, ": \u672C\u5730\u8BA2\u5355\u672A\u547D\u4E2D\u4EFB\u4F55 voucher\uFF0C\u8DF3\u8FC7 metadata \u66F4\u65B0"), {
|
|
4605
|
+
lookup: lookup,
|
|
4606
|
+
voucher_ids: Array.from(metadataByVoucherId.keys())
|
|
4607
|
+
});
|
|
4608
|
+
return _context48.abrupt("return");
|
|
4609
|
+
case 43:
|
|
4610
|
+
if (!(typeof this.order.overwriteExistingOrder === 'function')) {
|
|
4611
|
+
_context48.next = 48;
|
|
4612
|
+
break;
|
|
4613
|
+
}
|
|
4614
|
+
_context48.next = 46;
|
|
4615
|
+
return this.order.overwriteExistingOrder(_objectSpread(_objectSpread({}, localOrder), {}, {
|
|
4616
|
+
vouchers: nextVouchers
|
|
4617
|
+
}));
|
|
4618
|
+
case 46:
|
|
4619
|
+
this.logInfo("".concat(title, ": \u672C\u5730\u8BA2\u5355 vouchers metadata \u5DF2\u66F4\u65B0"), {
|
|
4620
|
+
lookup: lookup,
|
|
4621
|
+
updatedCount: metadataByVoucherId.size
|
|
4622
|
+
});
|
|
4623
|
+
return _context48.abrupt("return");
|
|
4624
|
+
case 48:
|
|
4625
|
+
if (!(data !== null && data !== void 0 && data.external_sale_number && typeof this.order.markOrderSyncedByExternalSaleNumber === 'function')) {
|
|
4626
|
+
_context48.next = 53;
|
|
4627
|
+
break;
|
|
4628
|
+
}
|
|
4629
|
+
_context48.next = 51;
|
|
4630
|
+
return this.order.markOrderSyncedByExternalSaleNumber({
|
|
4631
|
+
externalSaleNumber: data.external_sale_number,
|
|
4632
|
+
patch: {
|
|
4633
|
+
vouchers: nextVouchers
|
|
4634
|
+
}
|
|
4635
|
+
});
|
|
4636
|
+
case 51:
|
|
4637
|
+
this.logInfo("".concat(title, ": \u672C\u5730\u8BA2\u5355 vouchers metadata \u5DF2\u66F4\u65B0"), {
|
|
4638
|
+
lookup: lookup,
|
|
4639
|
+
updatedCount: metadataByVoucherId.size
|
|
4640
|
+
});
|
|
4641
|
+
return _context48.abrupt("return");
|
|
4642
|
+
case 53:
|
|
4643
|
+
this.logWarning("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u8BA2\u5355\u8986\u76D6\uFF0C\u8DF3\u8FC7 metadata \u66F4\u65B0"), {
|
|
4644
|
+
lookup: lookup
|
|
4645
|
+
});
|
|
4646
|
+
case 54:
|
|
4647
|
+
case "end":
|
|
4648
|
+
return _context48.stop();
|
|
4649
|
+
}
|
|
4650
|
+
}, _callee48, this, [[16, 28, 31, 34]]);
|
|
4651
|
+
}));
|
|
4652
|
+
function syncMachinecodeBatchMetadataToLocalOrder(_x52, _x53) {
|
|
4653
|
+
return _syncMachinecodeBatchMetadataToLocalOrder.apply(this, arguments);
|
|
4654
|
+
}
|
|
4655
|
+
return syncMachinecodeBatchMetadataToLocalOrder;
|
|
4656
|
+
}()
|
|
4369
4657
|
}, {
|
|
4370
4658
|
key: "handleOrderCheckoutSubmit",
|
|
4371
4659
|
value: function () {
|
|
4372
|
-
var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4660
|
+
var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
|
|
4373
4661
|
var backendPath, data, title, normalizedData, checkoutData, pendingResult, pendingOrder;
|
|
4374
|
-
return _regeneratorRuntime().wrap(function
|
|
4375
|
-
while (1) switch (
|
|
4662
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4663
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
4376
4664
|
case 0:
|
|
4377
4665
|
backendPath = params.backendPath, data = params.data, title = params.title;
|
|
4378
4666
|
this.logInfo("".concat(title, ": \u5F00\u59CB\u5904\u7406"), {
|
|
@@ -4382,24 +4670,24 @@ var Server = /*#__PURE__*/function () {
|
|
|
4382
4670
|
order_number: data === null || data === void 0 ? void 0 : data.order_number
|
|
4383
4671
|
});
|
|
4384
4672
|
if (!(data !== null && data !== void 0 && data.sync_mode || data !== null && data !== void 0 && data.syncMode)) {
|
|
4385
|
-
|
|
4673
|
+
_context49.next = 4;
|
|
4386
4674
|
break;
|
|
4387
4675
|
}
|
|
4388
|
-
return
|
|
4676
|
+
return _context49.abrupt("return", this.handleSyncCheckoutSubmit({
|
|
4389
4677
|
backendPath: backendPath,
|
|
4390
4678
|
data: data,
|
|
4391
4679
|
title: title
|
|
4392
4680
|
}));
|
|
4393
4681
|
case 4:
|
|
4394
|
-
|
|
4682
|
+
_context49.next = 6;
|
|
4395
4683
|
return this.normalizeCheckoutSubmitData(data, title);
|
|
4396
4684
|
case 6:
|
|
4397
|
-
normalizedData =
|
|
4398
|
-
|
|
4685
|
+
normalizedData = _context49.sent;
|
|
4686
|
+
_context49.next = 9;
|
|
4399
4687
|
return this.ensureCheckoutOrderNumbers(normalizedData, title);
|
|
4400
4688
|
case 9:
|
|
4401
|
-
checkoutData =
|
|
4402
|
-
|
|
4689
|
+
checkoutData = _context49.sent;
|
|
4690
|
+
_context49.next = 12;
|
|
4403
4691
|
return this.handlePendingSyncCheckoutOrder({
|
|
4404
4692
|
backendPath: backendPath,
|
|
4405
4693
|
data: checkoutData,
|
|
@@ -4407,9 +4695,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
4407
4695
|
reason: 'checkout 已转入设备任务同步'
|
|
4408
4696
|
});
|
|
4409
4697
|
case 12:
|
|
4410
|
-
pendingResult =
|
|
4698
|
+
pendingResult = _context49.sent;
|
|
4411
4699
|
if (!((pendingResult === null || pendingResult === void 0 ? void 0 : pendingResult.status) === true)) {
|
|
4412
|
-
|
|
4700
|
+
_context49.next = 20;
|
|
4413
4701
|
break;
|
|
4414
4702
|
}
|
|
4415
4703
|
pendingOrder = pendingResult.data;
|
|
@@ -4417,10 +4705,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
4417
4705
|
// TODO 这里先加个兼容,只有 type 为 virtual 才走打印
|
|
4418
4706
|
// 后期需要迁移到 picoding ,根据工作流配置
|
|
4419
4707
|
checkoutData.type === 'virtual')) {
|
|
4420
|
-
|
|
4708
|
+
_context49.next = 18;
|
|
4421
4709
|
break;
|
|
4422
4710
|
}
|
|
4423
|
-
|
|
4711
|
+
_context49.next = 18;
|
|
4424
4712
|
return this.dispatchLocalReceiptPrint({
|
|
4425
4713
|
checkoutData: checkoutData,
|
|
4426
4714
|
order: pendingOrder,
|
|
@@ -4428,7 +4716,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4428
4716
|
requireFullyPaid: true
|
|
4429
4717
|
});
|
|
4430
4718
|
case 18:
|
|
4431
|
-
|
|
4719
|
+
_context49.next = 20;
|
|
4432
4720
|
return this.dispatchCheckoutSyncTask({
|
|
4433
4721
|
backendPath: backendPath,
|
|
4434
4722
|
data: checkoutData,
|
|
@@ -4436,23 +4724,23 @@ var Server = /*#__PURE__*/function () {
|
|
|
4436
4724
|
});
|
|
4437
4725
|
case 20:
|
|
4438
4726
|
if (pendingResult.data.order_id) {
|
|
4439
|
-
|
|
4727
|
+
_context49.next = 22;
|
|
4440
4728
|
break;
|
|
4441
4729
|
}
|
|
4442
|
-
return
|
|
4730
|
+
return _context49.abrupt("return", _objectSpread(_objectSpread({}, pendingResult), {}, {
|
|
4443
4731
|
data: _objectSpread(_objectSpread({}, pendingResult.data), {}, {
|
|
4444
4732
|
order_id: pendingResult.data.external_sale_number
|
|
4445
4733
|
})
|
|
4446
4734
|
}));
|
|
4447
4735
|
case 22:
|
|
4448
|
-
return
|
|
4736
|
+
return _context49.abrupt("return", pendingResult);
|
|
4449
4737
|
case 23:
|
|
4450
4738
|
case "end":
|
|
4451
|
-
return
|
|
4739
|
+
return _context49.stop();
|
|
4452
4740
|
}
|
|
4453
|
-
},
|
|
4741
|
+
}, _callee49, this);
|
|
4454
4742
|
}));
|
|
4455
|
-
function handleOrderCheckoutSubmit(
|
|
4743
|
+
function handleOrderCheckoutSubmit(_x54) {
|
|
4456
4744
|
return _handleOrderCheckoutSubmit.apply(this, arguments);
|
|
4457
4745
|
}
|
|
4458
4746
|
return handleOrderCheckoutSubmit;
|
|
@@ -4460,27 +4748,27 @@ var Server = /*#__PURE__*/function () {
|
|
|
4460
4748
|
}, {
|
|
4461
4749
|
key: "handleSyncCheckoutSubmit",
|
|
4462
4750
|
value: function () {
|
|
4463
|
-
var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4464
|
-
var _this$
|
|
4751
|
+
var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
|
|
4752
|
+
var _this$app16;
|
|
4465
4753
|
var backendPath, data, title, syncResult, _normalized$data, normalized, backendError, _normalized$data2, _normalized, message;
|
|
4466
|
-
return _regeneratorRuntime().wrap(function
|
|
4467
|
-
while (1) switch (
|
|
4754
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
4755
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
4468
4756
|
case 0:
|
|
4469
4757
|
backendPath = params.backendPath, data = params.data, title = params.title;
|
|
4470
|
-
if ((_this$
|
|
4471
|
-
|
|
4758
|
+
if ((_this$app16 = this.app) !== null && _this$app16 !== void 0 && (_this$app16 = _this$app16.request) !== null && _this$app16 !== void 0 && _this$app16.post) {
|
|
4759
|
+
_context50.next = 4;
|
|
4472
4760
|
break;
|
|
4473
4761
|
}
|
|
4474
4762
|
this.logError("".concat(title, ": sync checkout app.request \u4E0D\u53EF\u7528"));
|
|
4475
|
-
return
|
|
4763
|
+
return _context50.abrupt("return", {
|
|
4476
4764
|
code: 500,
|
|
4477
4765
|
status: false,
|
|
4478
4766
|
message: 'app.request 不可用',
|
|
4479
4767
|
data: null
|
|
4480
4768
|
});
|
|
4481
4769
|
case 4:
|
|
4482
|
-
|
|
4483
|
-
|
|
4770
|
+
_context50.prev = 4;
|
|
4771
|
+
_context50.next = 7;
|
|
4484
4772
|
return this.runCheckoutSync({
|
|
4485
4773
|
backendPath: backendPath,
|
|
4486
4774
|
data: data,
|
|
@@ -4488,41 +4776,41 @@ var Server = /*#__PURE__*/function () {
|
|
|
4488
4776
|
persistCheckoutDataWithResponse: true
|
|
4489
4777
|
});
|
|
4490
4778
|
case 7:
|
|
4491
|
-
syncResult =
|
|
4779
|
+
syncResult = _context50.sent;
|
|
4492
4780
|
if (!syncResult.rejected) {
|
|
4493
|
-
|
|
4781
|
+
_context50.next = 11;
|
|
4494
4782
|
break;
|
|
4495
4783
|
}
|
|
4496
4784
|
normalized = this.normalizeCheckoutResponse(syncResult.errorResponse);
|
|
4497
|
-
return
|
|
4785
|
+
return _context50.abrupt("return", _objectSpread(_objectSpread({}, normalized), {}, {
|
|
4498
4786
|
status: false,
|
|
4499
4787
|
message: syncResult.message || (normalized === null || normalized === void 0 ? void 0 : normalized.message) || '后端明确拒绝 checkout',
|
|
4500
4788
|
data: (_normalized$data = normalized === null || normalized === void 0 ? void 0 : normalized.data) !== null && _normalized$data !== void 0 ? _normalized$data : null
|
|
4501
4789
|
}));
|
|
4502
4790
|
case 11:
|
|
4503
|
-
return
|
|
4791
|
+
return _context50.abrupt("return", this.withSyncedOrderIdInCheckoutResponse(syncResult.normalizedResponse, syncResult.syncedOrder));
|
|
4504
4792
|
case 14:
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
backendError = this.extractBackendErrorResponse(
|
|
4793
|
+
_context50.prev = 14;
|
|
4794
|
+
_context50.t0 = _context50["catch"](4);
|
|
4795
|
+
backendError = this.extractBackendErrorResponse(_context50.t0);
|
|
4508
4796
|
if (!backendError) {
|
|
4509
|
-
|
|
4797
|
+
_context50.next = 20;
|
|
4510
4798
|
break;
|
|
4511
4799
|
}
|
|
4512
4800
|
_normalized = this.normalizeCheckoutResponse(backendError);
|
|
4513
|
-
return
|
|
4801
|
+
return _context50.abrupt("return", _objectSpread(_objectSpread({}, _normalized), {}, {
|
|
4514
4802
|
status: false,
|
|
4515
4803
|
message: (backendError === null || backendError === void 0 ? void 0 : backendError.message) || (_normalized === null || _normalized === void 0 ? void 0 : _normalized.message) || '后端明确拒绝 checkout',
|
|
4516
4804
|
data: (_normalized$data2 = _normalized === null || _normalized === void 0 ? void 0 : _normalized.data) !== null && _normalized$data2 !== void 0 ? _normalized$data2 : null
|
|
4517
4805
|
}));
|
|
4518
4806
|
case 20:
|
|
4519
|
-
message = this.getUnknownErrorMessage(
|
|
4807
|
+
message = this.getUnknownErrorMessage(_context50.t0);
|
|
4520
4808
|
this.logError("".concat(title, ": sync checkout \u8BF7\u6C42\u672A\u660E\u786E\u6210\u529F"), {
|
|
4521
4809
|
backendPath: backendPath,
|
|
4522
4810
|
error: message,
|
|
4523
|
-
error_detail: this.normalizeUnknownError(
|
|
4811
|
+
error_detail: this.normalizeUnknownError(_context50.t0)
|
|
4524
4812
|
});
|
|
4525
|
-
return
|
|
4813
|
+
return _context50.abrupt("return", {
|
|
4526
4814
|
code: 500,
|
|
4527
4815
|
status: false,
|
|
4528
4816
|
message: message,
|
|
@@ -4530,11 +4818,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4530
4818
|
});
|
|
4531
4819
|
case 23:
|
|
4532
4820
|
case "end":
|
|
4533
|
-
return
|
|
4821
|
+
return _context50.stop();
|
|
4534
4822
|
}
|
|
4535
|
-
},
|
|
4823
|
+
}, _callee50, this, [[4, 14]]);
|
|
4536
4824
|
}));
|
|
4537
|
-
function handleSyncCheckoutSubmit(
|
|
4825
|
+
function handleSyncCheckoutSubmit(_x55) {
|
|
4538
4826
|
return _handleSyncCheckoutSubmit.apply(this, arguments);
|
|
4539
4827
|
}
|
|
4540
4828
|
return handleSyncCheckoutSubmit;
|
|
@@ -4542,26 +4830,26 @@ var Server = /*#__PURE__*/function () {
|
|
|
4542
4830
|
}, {
|
|
4543
4831
|
key: "handlePendingSyncCheckoutOrder",
|
|
4544
4832
|
value: function () {
|
|
4545
|
-
var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4833
|
+
var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
|
|
4546
4834
|
var _this10 = this;
|
|
4547
4835
|
var backendPath, data, title, reason, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
|
|
4548
|
-
return _regeneratorRuntime().wrap(function
|
|
4549
|
-
while (1) switch (
|
|
4836
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
4837
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
4550
4838
|
case 0:
|
|
4551
4839
|
backendPath = params.backendPath, data = params.data, title = params.title, reason = params.reason;
|
|
4552
|
-
|
|
4840
|
+
_context51.next = 3;
|
|
4553
4841
|
return this.buildPendingSyncCheckoutOrder(data);
|
|
4554
4842
|
case 3:
|
|
4555
|
-
pendingOrder =
|
|
4843
|
+
pendingOrder = _context51.sent;
|
|
4556
4844
|
if (pendingOrder) {
|
|
4557
|
-
|
|
4845
|
+
_context51.next = 7;
|
|
4558
4846
|
break;
|
|
4559
4847
|
}
|
|
4560
4848
|
this.logError("".concat(title, ": checkout \u5931\u8D25\u4E14\u8BA2\u5355\u7F3A\u5C11\u672C\u5730\u5B58\u50A8\u6807\u8BC6"), {
|
|
4561
4849
|
backendPath: backendPath,
|
|
4562
4850
|
reason: reason
|
|
4563
4851
|
});
|
|
4564
|
-
return
|
|
4852
|
+
return _context51.abrupt("return", {
|
|
4565
4853
|
code: 500,
|
|
4566
4854
|
status: false,
|
|
4567
4855
|
message: '订单缺少本地存储标识,无法写入待同步队列',
|
|
@@ -4569,22 +4857,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
4569
4857
|
});
|
|
4570
4858
|
case 7:
|
|
4571
4859
|
if (!(!this.order || typeof this.order.upsertPendingSyncOrders !== 'function')) {
|
|
4572
|
-
|
|
4860
|
+
_context51.next = 10;
|
|
4573
4861
|
break;
|
|
4574
4862
|
}
|
|
4575
4863
|
this.logError("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u5F85\u540C\u6B65\u5199\u5165"), {
|
|
4576
4864
|
backendPath: backendPath,
|
|
4577
4865
|
reason: reason
|
|
4578
4866
|
});
|
|
4579
|
-
return
|
|
4867
|
+
return _context51.abrupt("return", {
|
|
4580
4868
|
code: 500,
|
|
4581
4869
|
status: false,
|
|
4582
4870
|
message: 'Order 模块不支持本地待同步写入',
|
|
4583
4871
|
data: null
|
|
4584
4872
|
});
|
|
4585
4873
|
case 10:
|
|
4586
|
-
|
|
4587
|
-
|
|
4874
|
+
_context51.prev = 10;
|
|
4875
|
+
_context51.next = 13;
|
|
4588
4876
|
return this.order.upsertPendingSyncOrders([pendingOrder]);
|
|
4589
4877
|
case 13:
|
|
4590
4878
|
this.logInfo("".concat(title, ": \u8BA2\u5355\u5DF2\u5199\u5165\u672C\u5730\u5F85\u540C\u6B65"), {
|
|
@@ -4598,7 +4886,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4598
4886
|
var _payment$metadata;
|
|
4599
4887
|
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);
|
|
4600
4888
|
}, 0);
|
|
4601
|
-
return
|
|
4889
|
+
return _context51.abrupt("return", {
|
|
4602
4890
|
code: 200,
|
|
4603
4891
|
status: true,
|
|
4604
4892
|
message: '',
|
|
@@ -4613,15 +4901,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
4613
4901
|
})
|
|
4614
4902
|
});
|
|
4615
4903
|
case 18:
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
errorMessage =
|
|
4904
|
+
_context51.prev = 18;
|
|
4905
|
+
_context51.t0 = _context51["catch"](10);
|
|
4906
|
+
errorMessage = _context51.t0 instanceof Error ? _context51.t0.message : String(_context51.t0);
|
|
4619
4907
|
this.logError("".concat(title, ": \u5199\u5165\u672C\u5730\u5F85\u540C\u6B65\u8BA2\u5355\u5931\u8D25"), {
|
|
4620
4908
|
backendPath: backendPath,
|
|
4621
4909
|
reason: reason,
|
|
4622
4910
|
error: errorMessage
|
|
4623
4911
|
});
|
|
4624
|
-
return
|
|
4912
|
+
return _context51.abrupt("return", {
|
|
4625
4913
|
code: 500,
|
|
4626
4914
|
status: false,
|
|
4627
4915
|
message: errorMessage,
|
|
@@ -4629,11 +4917,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4629
4917
|
});
|
|
4630
4918
|
case 23:
|
|
4631
4919
|
case "end":
|
|
4632
|
-
return
|
|
4920
|
+
return _context51.stop();
|
|
4633
4921
|
}
|
|
4634
|
-
},
|
|
4922
|
+
}, _callee51, this, [[10, 18]]);
|
|
4635
4923
|
}));
|
|
4636
|
-
function handlePendingSyncCheckoutOrder(
|
|
4924
|
+
function handlePendingSyncCheckoutOrder(_x56) {
|
|
4637
4925
|
return _handlePendingSyncCheckoutOrder.apply(this, arguments);
|
|
4638
4926
|
}
|
|
4639
4927
|
return handlePendingSyncCheckoutOrder;
|
|
@@ -4641,43 +4929,43 @@ var Server = /*#__PURE__*/function () {
|
|
|
4641
4929
|
}, {
|
|
4642
4930
|
key: "buildPendingSyncCheckoutOrder",
|
|
4643
4931
|
value: function () {
|
|
4644
|
-
var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4932
|
+
var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(data) {
|
|
4645
4933
|
var hasStorageKey, pendingOrder, productMap, orderWithProductTitles;
|
|
4646
|
-
return _regeneratorRuntime().wrap(function
|
|
4647
|
-
while (1) switch (
|
|
4934
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
4935
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
4648
4936
|
case 0:
|
|
4649
4937
|
if (!(!data || _typeof(data) !== 'object')) {
|
|
4650
|
-
|
|
4938
|
+
_context52.next = 2;
|
|
4651
4939
|
break;
|
|
4652
4940
|
}
|
|
4653
|
-
return
|
|
4941
|
+
return _context52.abrupt("return", null);
|
|
4654
4942
|
case 2:
|
|
4655
4943
|
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 !== '';
|
|
4656
4944
|
if (hasStorageKey) {
|
|
4657
|
-
|
|
4945
|
+
_context52.next = 5;
|
|
4658
4946
|
break;
|
|
4659
4947
|
}
|
|
4660
|
-
return
|
|
4948
|
+
return _context52.abrupt("return", null);
|
|
4661
4949
|
case 5:
|
|
4662
4950
|
pendingOrder = _objectSpread(_objectSpread({}, data), {}, {
|
|
4663
4951
|
need_sync: 1
|
|
4664
4952
|
});
|
|
4665
|
-
|
|
4953
|
+
_context52.next = 8;
|
|
4666
4954
|
return this.buildSmallTicketProductMap(pendingOrder);
|
|
4667
4955
|
case 8:
|
|
4668
|
-
productMap =
|
|
4956
|
+
productMap = _context52.sent;
|
|
4669
4957
|
orderWithProductTitles = this.withPendingSyncProductTitles(pendingOrder, productMap);
|
|
4670
|
-
return
|
|
4958
|
+
return _context52.abrupt("return", this.withLocalSmallTicketData(orderWithProductTitles, {
|
|
4671
4959
|
requireFullyPaid: true,
|
|
4672
4960
|
productMap: productMap
|
|
4673
4961
|
}));
|
|
4674
4962
|
case 11:
|
|
4675
4963
|
case "end":
|
|
4676
|
-
return
|
|
4964
|
+
return _context52.stop();
|
|
4677
4965
|
}
|
|
4678
|
-
},
|
|
4966
|
+
}, _callee52, this);
|
|
4679
4967
|
}));
|
|
4680
|
-
function buildPendingSyncCheckoutOrder(
|
|
4968
|
+
function buildPendingSyncCheckoutOrder(_x57) {
|
|
4681
4969
|
return _buildPendingSyncCheckoutOrder.apply(this, arguments);
|
|
4682
4970
|
}
|
|
4683
4971
|
return buildPendingSyncCheckoutOrder;
|
|
@@ -4685,10 +4973,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
4685
4973
|
}, {
|
|
4686
4974
|
key: "shouldBuildSmallTicketData",
|
|
4687
4975
|
value: function shouldBuildSmallTicketData(order) {
|
|
4688
|
-
var
|
|
4976
|
+
var _ref56, _order$small_ticket_d;
|
|
4689
4977
|
if (!order || _typeof(order) !== 'object') return false;
|
|
4690
|
-
if (hasSmallTicketData(
|
|
4691
|
-
return Number((
|
|
4978
|
+
// if (hasSmallTicketData(order.payment_info?.small_ticket_data)) return false;
|
|
4979
|
+
return Number((_ref56 = (_order$small_ticket_d = order.small_ticket_data_flag) !== null && _order$small_ticket_d !== void 0 ? _order$small_ticket_d : order.smallTicketDataFlag) !== null && _ref56 !== void 0 ? _ref56 : 0) === 1;
|
|
4692
4980
|
}
|
|
4693
4981
|
}, {
|
|
4694
4982
|
key: "shouldPrintSyncedOrder",
|
|
@@ -4706,7 +4994,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4706
4994
|
}, {
|
|
4707
4995
|
key: "isSalesOrderFullyPaid",
|
|
4708
4996
|
value: function isSalesOrderFullyPaid(order) {
|
|
4709
|
-
var _order$summary$amount, _order$summary,
|
|
4997
|
+
var _order$summary$amount, _order$summary, _ref57, _ref58, _order$summary$expect, _order$summary2, _order$summary3;
|
|
4710
4998
|
if (!order || _typeof(order) !== 'object') return false;
|
|
4711
4999
|
var paymentStatus = String(order.payment_status || '').toLowerCase();
|
|
4712
5000
|
if (paymentStatus === 'paid' || paymentStatus === 'finished') return true;
|
|
@@ -4718,7 +5006,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4718
5006
|
return this.toAmountNumber(amountGap) <= 0;
|
|
4719
5007
|
}
|
|
4720
5008
|
var paidAmount = this.sumPaidOrderPayments(order.payments);
|
|
4721
|
-
var targetAmount = this.toAmountNumber((
|
|
5009
|
+
var targetAmount = this.toAmountNumber((_ref57 = (_ref58 = (_order$summary$expect = (_order$summary2 = order.summary) === null || _order$summary2 === void 0 ? void 0 : _order$summary2.expect_amount) !== null && _order$summary$expect !== void 0 ? _order$summary$expect : (_order$summary3 = order.summary) === null || _order$summary3 === void 0 ? void 0 : _order$summary3.total_amount) !== null && _ref58 !== void 0 ? _ref58 : order.expect_amount) !== null && _ref57 !== void 0 ? _ref57 : order.total_amount);
|
|
4722
5010
|
if (targetAmount <= 0) return paidAmount > 0;
|
|
4723
5011
|
return paidAmount >= targetAmount;
|
|
4724
5012
|
}
|
|
@@ -4745,12 +5033,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
4745
5033
|
}, {
|
|
4746
5034
|
key: "buildSmallTicketProductMap",
|
|
4747
5035
|
value: function () {
|
|
4748
|
-
var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5036
|
+
var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(order) {
|
|
4749
5037
|
var _this$products,
|
|
4750
5038
|
_this12 = this;
|
|
4751
5039
|
var products, productIdSet, productIds, entries;
|
|
4752
|
-
return _regeneratorRuntime().wrap(function
|
|
4753
|
-
while (1) switch (
|
|
5040
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
5041
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
4754
5042
|
case 0:
|
|
4755
5043
|
products = Array.isArray(order === null || order === void 0 ? void 0 : order.products) ? order.products : [];
|
|
4756
5044
|
productIdSet = new Set();
|
|
@@ -4762,8 +5050,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
4762
5050
|
}
|
|
4763
5051
|
if (Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) {
|
|
4764
5052
|
product.product_bundle.forEach(function (bundle) {
|
|
4765
|
-
var
|
|
4766
|
-
var bundleProductId = (
|
|
5053
|
+
var _ref59, _bundle$bundle_produc;
|
|
5054
|
+
var bundleProductId = (_ref59 = (_bundle$bundle_produc = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref59 !== void 0 ? _ref59 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
|
|
4767
5055
|
if (bundleProductId !== undefined && bundleProductId !== null && bundleProductId !== '') {
|
|
4768
5056
|
productIdSet.add(bundleProductId);
|
|
4769
5057
|
}
|
|
@@ -4772,45 +5060,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
4772
5060
|
});
|
|
4773
5061
|
productIds = Array.from(productIdSet);
|
|
4774
5062
|
if (!(!productIds.length || typeof ((_this$products = this.products) === null || _this$products === void 0 ? void 0 : _this$products.getProductById) !== 'function')) {
|
|
4775
|
-
|
|
5063
|
+
_context54.next = 6;
|
|
4776
5064
|
break;
|
|
4777
5065
|
}
|
|
4778
|
-
return
|
|
5066
|
+
return _context54.abrupt("return", {});
|
|
4779
5067
|
case 6:
|
|
4780
|
-
|
|
5068
|
+
_context54.next = 8;
|
|
4781
5069
|
return Promise.all(productIds.map( /*#__PURE__*/function () {
|
|
4782
|
-
var
|
|
5070
|
+
var _ref60 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(id) {
|
|
4783
5071
|
var _this12$products, _this12$products$getP, product;
|
|
4784
|
-
return _regeneratorRuntime().wrap(function
|
|
4785
|
-
while (1) switch (
|
|
5072
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
5073
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
4786
5074
|
case 0:
|
|
4787
|
-
|
|
4788
|
-
|
|
5075
|
+
_context53.prev = 0;
|
|
5076
|
+
_context53.next = 3;
|
|
4789
5077
|
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));
|
|
4790
5078
|
case 3:
|
|
4791
|
-
product =
|
|
4792
|
-
return
|
|
5079
|
+
product = _context53.sent;
|
|
5080
|
+
return _context53.abrupt("return", product ? [String(id), product] : null);
|
|
4793
5081
|
case 7:
|
|
4794
|
-
|
|
4795
|
-
|
|
5082
|
+
_context53.prev = 7;
|
|
5083
|
+
_context53.t0 = _context53["catch"](0);
|
|
4796
5084
|
_this12.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
|
|
4797
5085
|
product_id: id,
|
|
4798
|
-
error:
|
|
5086
|
+
error: _context53.t0 instanceof Error ? _context53.t0.message : String(_context53.t0)
|
|
4799
5087
|
});
|
|
4800
|
-
return
|
|
5088
|
+
return _context53.abrupt("return", null);
|
|
4801
5089
|
case 11:
|
|
4802
5090
|
case "end":
|
|
4803
|
-
return
|
|
5091
|
+
return _context53.stop();
|
|
4804
5092
|
}
|
|
4805
|
-
},
|
|
5093
|
+
}, _callee53, null, [[0, 7]]);
|
|
4806
5094
|
}));
|
|
4807
|
-
return function (
|
|
4808
|
-
return
|
|
5095
|
+
return function (_x59) {
|
|
5096
|
+
return _ref60.apply(this, arguments);
|
|
4809
5097
|
};
|
|
4810
5098
|
}()));
|
|
4811
5099
|
case 8:
|
|
4812
|
-
entries =
|
|
4813
|
-
return
|
|
5100
|
+
entries = _context54.sent;
|
|
5101
|
+
return _context54.abrupt("return", entries.reduce(function (map, entry) {
|
|
4814
5102
|
if (!entry) return map;
|
|
4815
5103
|
var _entry = _slicedToArray(entry, 2),
|
|
4816
5104
|
id = _entry[0],
|
|
@@ -4820,11 +5108,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4820
5108
|
}, {}));
|
|
4821
5109
|
case 10:
|
|
4822
5110
|
case "end":
|
|
4823
|
-
return
|
|
5111
|
+
return _context54.stop();
|
|
4824
5112
|
}
|
|
4825
|
-
},
|
|
5113
|
+
}, _callee54, this);
|
|
4826
5114
|
}));
|
|
4827
|
-
function buildSmallTicketProductMap(
|
|
5115
|
+
function buildSmallTicketProductMap(_x58) {
|
|
4828
5116
|
return _buildSmallTicketProductMap.apply(this, arguments);
|
|
4829
5117
|
}
|
|
4830
5118
|
return buildSmallTicketProductMap;
|
|
@@ -4882,7 +5170,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4882
5170
|
}, {
|
|
4883
5171
|
key: "resolveProductTitleValue",
|
|
4884
5172
|
value: function resolveProductTitleValue(value, key, currentLocale) {
|
|
4885
|
-
var
|
|
5173
|
+
var _ref61, _ref62, _value$key;
|
|
4886
5174
|
if (value === undefined || value === null || value === '') return null;
|
|
4887
5175
|
if (_typeof(value) !== 'object') {
|
|
4888
5176
|
var title = String(value);
|
|
@@ -4892,7 +5180,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4892
5180
|
}
|
|
4893
5181
|
var normalizedKey = key.replace('-', '_');
|
|
4894
5182
|
var dashedKey = key.replace('_', '-');
|
|
4895
|
-
var rawValue = (
|
|
5183
|
+
var rawValue = (_ref61 = (_ref62 = (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : value[normalizedKey]) !== null && _ref62 !== void 0 ? _ref62 : value[dashedKey]) !== null && _ref61 !== void 0 ? _ref61 : key === 'auto' ? value.default : undefined;
|
|
4896
5184
|
if (rawValue === undefined || rawValue === null || rawValue === '') return null;
|
|
4897
5185
|
if (_typeof(rawValue) === 'object') return this.resolveFirstProductTitleValue(rawValue);
|
|
4898
5186
|
return String(rawValue);
|
|
@@ -4955,44 +5243,44 @@ var Server = /*#__PURE__*/function () {
|
|
|
4955
5243
|
}, {
|
|
4956
5244
|
key: "enrichPaymentNamesByCode",
|
|
4957
5245
|
value: function () {
|
|
4958
|
-
var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5246
|
+
var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(order) {
|
|
4959
5247
|
var _this15 = this;
|
|
4960
|
-
var payments, hasMissingName, paymentModule, payMethods, nameByCode,
|
|
4961
|
-
return _regeneratorRuntime().wrap(function
|
|
4962
|
-
while (1) switch (
|
|
5248
|
+
var payments, hasMissingName, paymentModule, payMethods, nameByCode, _iterator13, _step13, method, codeKey, name, hasResolvedName, enrichedPayments;
|
|
5249
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
5250
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
4963
5251
|
case 0:
|
|
4964
5252
|
payments = Array.isArray(order === null || order === void 0 ? void 0 : order.payments) ? order.payments : [];
|
|
4965
5253
|
hasMissingName = payments.some(function (payment) {
|
|
4966
5254
|
return _this15.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this15.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
|
|
4967
5255
|
});
|
|
4968
5256
|
if (hasMissingName) {
|
|
4969
|
-
|
|
5257
|
+
_context55.next = 4;
|
|
4970
5258
|
break;
|
|
4971
5259
|
}
|
|
4972
|
-
return
|
|
5260
|
+
return _context55.abrupt("return", order);
|
|
4973
5261
|
case 4:
|
|
4974
|
-
|
|
4975
|
-
|
|
5262
|
+
_context55.prev = 4;
|
|
5263
|
+
_context55.next = 7;
|
|
4976
5264
|
return this.getPaymentRouteModule();
|
|
4977
5265
|
case 7:
|
|
4978
|
-
paymentModule =
|
|
4979
|
-
|
|
5266
|
+
paymentModule = _context55.sent;
|
|
5267
|
+
_context55.next = 10;
|
|
4980
5268
|
return paymentModule.getPayMethodListAsync();
|
|
4981
5269
|
case 10:
|
|
4982
|
-
payMethods =
|
|
5270
|
+
payMethods = _context55.sent;
|
|
4983
5271
|
nameByCode = new Map();
|
|
4984
|
-
|
|
5272
|
+
_iterator13 = _createForOfIteratorHelper(payMethods || []);
|
|
4985
5273
|
try {
|
|
4986
|
-
for (
|
|
4987
|
-
method =
|
|
5274
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
5275
|
+
method = _step13.value;
|
|
4988
5276
|
codeKey = this.getPaymentCodeKey(method === null || method === void 0 ? void 0 : method.code);
|
|
4989
5277
|
name = this.resolveFirstProductTitleValue(method === null || method === void 0 ? void 0 : method.name);
|
|
4990
5278
|
if (codeKey && name) nameByCode.set(codeKey, name);
|
|
4991
5279
|
}
|
|
4992
5280
|
} catch (err) {
|
|
4993
|
-
|
|
5281
|
+
_iterator13.e(err);
|
|
4994
5282
|
} finally {
|
|
4995
|
-
|
|
5283
|
+
_iterator13.f();
|
|
4996
5284
|
}
|
|
4997
5285
|
hasResolvedName = false;
|
|
4998
5286
|
enrichedPayments = payments.map(function (payment) {
|
|
@@ -5006,28 +5294,28 @@ var Server = /*#__PURE__*/function () {
|
|
|
5006
5294
|
});
|
|
5007
5295
|
});
|
|
5008
5296
|
if (hasResolvedName) {
|
|
5009
|
-
|
|
5297
|
+
_context55.next = 18;
|
|
5010
5298
|
break;
|
|
5011
5299
|
}
|
|
5012
|
-
return
|
|
5300
|
+
return _context55.abrupt("return", order);
|
|
5013
5301
|
case 18:
|
|
5014
|
-
return
|
|
5302
|
+
return _context55.abrupt("return", _objectSpread(_objectSpread({}, order), {}, {
|
|
5015
5303
|
payments: enrichedPayments
|
|
5016
5304
|
}));
|
|
5017
5305
|
case 21:
|
|
5018
|
-
|
|
5019
|
-
|
|
5306
|
+
_context55.prev = 21;
|
|
5307
|
+
_context55.t0 = _context55["catch"](4);
|
|
5020
5308
|
this.logWarning('enrichPaymentNamesByCode: 支付方式名称回填失败', {
|
|
5021
|
-
error:
|
|
5309
|
+
error: _context55.t0 instanceof Error ? _context55.t0.message : String(_context55.t0)
|
|
5022
5310
|
});
|
|
5023
|
-
return
|
|
5311
|
+
return _context55.abrupt("return", order);
|
|
5024
5312
|
case 25:
|
|
5025
5313
|
case "end":
|
|
5026
|
-
return
|
|
5314
|
+
return _context55.stop();
|
|
5027
5315
|
}
|
|
5028
|
-
},
|
|
5316
|
+
}, _callee55, this, [[4, 21]]);
|
|
5029
5317
|
}));
|
|
5030
|
-
function enrichPaymentNamesByCode(
|
|
5318
|
+
function enrichPaymentNamesByCode(_x60) {
|
|
5031
5319
|
return _enrichPaymentNamesByCode.apply(this, arguments);
|
|
5032
5320
|
}
|
|
5033
5321
|
return enrichPaymentNamesByCode;
|
|
@@ -5035,66 +5323,66 @@ var Server = /*#__PURE__*/function () {
|
|
|
5035
5323
|
}, {
|
|
5036
5324
|
key: "withLocalSmallTicketData",
|
|
5037
5325
|
value: function () {
|
|
5038
|
-
var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5326
|
+
var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(order, options) {
|
|
5039
5327
|
var _options$productMap, enrichedOrder, productMap, smallTicketData;
|
|
5040
|
-
return _regeneratorRuntime().wrap(function
|
|
5041
|
-
while (1) switch (
|
|
5328
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
|
5329
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
5042
5330
|
case 0:
|
|
5043
5331
|
if (this.shouldBuildSmallTicketData(order)) {
|
|
5044
|
-
|
|
5332
|
+
_context56.next = 2;
|
|
5045
5333
|
break;
|
|
5046
5334
|
}
|
|
5047
|
-
return
|
|
5335
|
+
return _context56.abrupt("return", order);
|
|
5048
5336
|
case 2:
|
|
5049
5337
|
if (!(options !== null && options !== void 0 && options.requireFullyPaid && !this.isSalesOrderFullyPaid(order))) {
|
|
5050
|
-
|
|
5338
|
+
_context56.next = 4;
|
|
5051
5339
|
break;
|
|
5052
5340
|
}
|
|
5053
|
-
return
|
|
5341
|
+
return _context56.abrupt("return", order);
|
|
5054
5342
|
case 4:
|
|
5055
|
-
|
|
5056
|
-
|
|
5343
|
+
_context56.prev = 4;
|
|
5344
|
+
_context56.next = 7;
|
|
5057
5345
|
return this.enrichPaymentNamesByCode(order);
|
|
5058
5346
|
case 7:
|
|
5059
|
-
enrichedOrder =
|
|
5347
|
+
enrichedOrder = _context56.sent;
|
|
5060
5348
|
if (!((_options$productMap = options === null || options === void 0 ? void 0 : options.productMap) !== null && _options$productMap !== void 0)) {
|
|
5061
|
-
|
|
5349
|
+
_context56.next = 12;
|
|
5062
5350
|
break;
|
|
5063
5351
|
}
|
|
5064
|
-
|
|
5065
|
-
|
|
5352
|
+
_context56.t0 = _options$productMap;
|
|
5353
|
+
_context56.next = 15;
|
|
5066
5354
|
break;
|
|
5067
5355
|
case 12:
|
|
5068
|
-
|
|
5356
|
+
_context56.next = 14;
|
|
5069
5357
|
return this.buildSmallTicketProductMap(enrichedOrder);
|
|
5070
5358
|
case 14:
|
|
5071
|
-
|
|
5359
|
+
_context56.t0 = _context56.sent;
|
|
5072
5360
|
case 15:
|
|
5073
|
-
productMap =
|
|
5361
|
+
productMap = _context56.t0;
|
|
5074
5362
|
smallTicketData = buildSmallTicketData({
|
|
5075
5363
|
order: enrichedOrder,
|
|
5076
5364
|
shopInfo: this.getSmallTicketShopInfo(),
|
|
5077
5365
|
productMap: productMap
|
|
5078
5366
|
});
|
|
5079
|
-
return
|
|
5367
|
+
return _context56.abrupt("return", _objectSpread(_objectSpread({}, enrichedOrder), {}, {
|
|
5080
5368
|
payment_info: _objectSpread(_objectSpread({}, enrichedOrder.payment_info || {}), {}, {
|
|
5081
5369
|
small_ticket_data: smallTicketData
|
|
5082
5370
|
})
|
|
5083
5371
|
}));
|
|
5084
5372
|
case 20:
|
|
5085
|
-
|
|
5086
|
-
|
|
5373
|
+
_context56.prev = 20;
|
|
5374
|
+
_context56.t1 = _context56["catch"](4);
|
|
5087
5375
|
this.logError('withLocalSmallTicketData: 生成本地小票数据失败', {
|
|
5088
|
-
error:
|
|
5376
|
+
error: _context56.t1 instanceof Error ? _context56.t1.message : String(_context56.t1)
|
|
5089
5377
|
});
|
|
5090
|
-
return
|
|
5378
|
+
return _context56.abrupt("return", order);
|
|
5091
5379
|
case 24:
|
|
5092
5380
|
case "end":
|
|
5093
|
-
return
|
|
5381
|
+
return _context56.stop();
|
|
5094
5382
|
}
|
|
5095
|
-
},
|
|
5383
|
+
}, _callee56, this, [[4, 20]]);
|
|
5096
5384
|
}));
|
|
5097
|
-
function withLocalSmallTicketData(
|
|
5385
|
+
function withLocalSmallTicketData(_x61, _x62) {
|
|
5098
5386
|
return _withLocalSmallTicketData.apply(this, arguments);
|
|
5099
5387
|
}
|
|
5100
5388
|
return withLocalSmallTicketData;
|
|
@@ -5156,34 +5444,34 @@ var Server = /*#__PURE__*/function () {
|
|
|
5156
5444
|
}, {
|
|
5157
5445
|
key: "handleUpdateLocalOrdersBatch",
|
|
5158
5446
|
value: (function () {
|
|
5159
|
-
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5160
|
-
var _this$
|
|
5161
|
-
var existedBefore,
|
|
5162
|
-
return _regeneratorRuntime().wrap(function
|
|
5163
|
-
while (1) switch (
|
|
5447
|
+
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(orderIds) {
|
|
5448
|
+
var _this$app17;
|
|
5449
|
+
var existedBefore, _iterator14, _step14, id, fetched, message, fetchedMap, _iterator15, _step15, order, oid, freshOrders, succeedIds, failed, _iterator16, _step16, _id, fresh, _message2, overwritten, inserted;
|
|
5450
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
|
5451
|
+
while (1) switch (_context57.prev = _context57.next) {
|
|
5164
5452
|
case 0:
|
|
5165
5453
|
this.logInfo('handleUpdateLocalOrdersBatch: 开始处理', {
|
|
5166
5454
|
count: orderIds.length,
|
|
5167
5455
|
orderIds: orderIds
|
|
5168
5456
|
});
|
|
5169
5457
|
if (this.order) {
|
|
5170
|
-
|
|
5458
|
+
_context57.next = 4;
|
|
5171
5459
|
break;
|
|
5172
5460
|
}
|
|
5173
5461
|
this.logError('handleUpdateLocalOrdersBatch: Order 模块未注册');
|
|
5174
|
-
return
|
|
5462
|
+
return _context57.abrupt("return", {
|
|
5175
5463
|
code: 500,
|
|
5176
5464
|
status: false,
|
|
5177
5465
|
message: 'Order 模块未注册',
|
|
5178
5466
|
data: null
|
|
5179
5467
|
});
|
|
5180
5468
|
case 4:
|
|
5181
|
-
if ((_this$
|
|
5182
|
-
|
|
5469
|
+
if ((_this$app17 = this.app) !== null && _this$app17 !== void 0 && _this$app17.request) {
|
|
5470
|
+
_context57.next = 7;
|
|
5183
5471
|
break;
|
|
5184
5472
|
}
|
|
5185
5473
|
this.logError('handleUpdateLocalOrdersBatch: app.request 不可用');
|
|
5186
|
-
return
|
|
5474
|
+
return _context57.abrupt("return", {
|
|
5187
5475
|
code: 500,
|
|
5188
5476
|
status: false,
|
|
5189
5477
|
message: 'app.request 不可用',
|
|
@@ -5192,35 +5480,35 @@ var Server = /*#__PURE__*/function () {
|
|
|
5192
5480
|
case 7:
|
|
5193
5481
|
// 拉取前先记录"本地是否已存在",用于区分 overwritten / inserted
|
|
5194
5482
|
existedBefore = new Map();
|
|
5195
|
-
|
|
5483
|
+
_iterator14 = _createForOfIteratorHelper(orderIds);
|
|
5196
5484
|
try {
|
|
5197
|
-
for (
|
|
5198
|
-
id =
|
|
5485
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
5486
|
+
id = _step14.value;
|
|
5199
5487
|
existedBefore.set(id, !!this.order.getOrderByOrderId(id));
|
|
5200
5488
|
}
|
|
5201
5489
|
|
|
5202
5490
|
// 走 orderDataSource 的批量 HTTP 通道,一次请求拉回多笔详情
|
|
5203
5491
|
} catch (err) {
|
|
5204
|
-
|
|
5492
|
+
_iterator14.e(err);
|
|
5205
5493
|
} finally {
|
|
5206
|
-
|
|
5494
|
+
_iterator14.f();
|
|
5207
5495
|
}
|
|
5208
5496
|
fetched = [];
|
|
5209
|
-
|
|
5210
|
-
|
|
5497
|
+
_context57.prev = 11;
|
|
5498
|
+
_context57.next = 14;
|
|
5211
5499
|
return this.order.fetchOrdersByHttp(orderIds);
|
|
5212
5500
|
case 14:
|
|
5213
|
-
fetched =
|
|
5214
|
-
|
|
5501
|
+
fetched = _context57.sent;
|
|
5502
|
+
_context57.next = 22;
|
|
5215
5503
|
break;
|
|
5216
5504
|
case 17:
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
message =
|
|
5505
|
+
_context57.prev = 17;
|
|
5506
|
+
_context57.t0 = _context57["catch"](11);
|
|
5507
|
+
message = _context57.t0 instanceof Error ? _context57.t0.message : String(_context57.t0);
|
|
5220
5508
|
this.logError('handleUpdateLocalOrdersBatch: 批量拉取失败', {
|
|
5221
5509
|
message: message
|
|
5222
5510
|
});
|
|
5223
|
-
return
|
|
5511
|
+
return _context57.abrupt("return", {
|
|
5224
5512
|
code: 500,
|
|
5225
5513
|
status: false,
|
|
5226
5514
|
message: message,
|
|
@@ -5229,45 +5517,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
5229
5517
|
case 22:
|
|
5230
5518
|
// 按返回结果中的 order_id 建索引,未命中即视为单笔失败
|
|
5231
5519
|
fetchedMap = new Map();
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5520
|
+
_iterator15 = _createForOfIteratorHelper(fetched);
|
|
5521
|
+
_context57.prev = 24;
|
|
5522
|
+
_iterator15.s();
|
|
5235
5523
|
case 26:
|
|
5236
|
-
if ((
|
|
5237
|
-
|
|
5524
|
+
if ((_step15 = _iterator15.n()).done) {
|
|
5525
|
+
_context57.next = 34;
|
|
5238
5526
|
break;
|
|
5239
5527
|
}
|
|
5240
|
-
order =
|
|
5528
|
+
order = _step15.value;
|
|
5241
5529
|
oid = order === null || order === void 0 ? void 0 : order.order_id;
|
|
5242
5530
|
if (!(oid === undefined || oid === null)) {
|
|
5243
|
-
|
|
5531
|
+
_context57.next = 31;
|
|
5244
5532
|
break;
|
|
5245
5533
|
}
|
|
5246
|
-
return
|
|
5534
|
+
return _context57.abrupt("continue", 32);
|
|
5247
5535
|
case 31:
|
|
5248
5536
|
fetchedMap.set(String(oid), order);
|
|
5249
5537
|
case 32:
|
|
5250
|
-
|
|
5538
|
+
_context57.next = 26;
|
|
5251
5539
|
break;
|
|
5252
5540
|
case 34:
|
|
5253
|
-
|
|
5541
|
+
_context57.next = 39;
|
|
5254
5542
|
break;
|
|
5255
5543
|
case 36:
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5544
|
+
_context57.prev = 36;
|
|
5545
|
+
_context57.t1 = _context57["catch"](24);
|
|
5546
|
+
_iterator15.e(_context57.t1);
|
|
5259
5547
|
case 39:
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
return
|
|
5548
|
+
_context57.prev = 39;
|
|
5549
|
+
_iterator15.f();
|
|
5550
|
+
return _context57.finish(39);
|
|
5263
5551
|
case 42:
|
|
5264
5552
|
freshOrders = [];
|
|
5265
5553
|
succeedIds = [];
|
|
5266
5554
|
failed = [];
|
|
5267
|
-
|
|
5555
|
+
_iterator16 = _createForOfIteratorHelper(orderIds);
|
|
5268
5556
|
try {
|
|
5269
|
-
for (
|
|
5270
|
-
_id =
|
|
5557
|
+
for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
|
|
5558
|
+
_id = _step16.value;
|
|
5271
5559
|
fresh = fetchedMap.get(_id);
|
|
5272
5560
|
if (fresh) {
|
|
5273
5561
|
freshOrders.push(fresh);
|
|
@@ -5280,31 +5568,31 @@ var Server = /*#__PURE__*/function () {
|
|
|
5280
5568
|
}
|
|
5281
5569
|
}
|
|
5282
5570
|
} catch (err) {
|
|
5283
|
-
|
|
5571
|
+
_iterator16.e(err);
|
|
5284
5572
|
} finally {
|
|
5285
|
-
|
|
5573
|
+
_iterator16.f();
|
|
5286
5574
|
}
|
|
5287
5575
|
if (!(freshOrders.length > 0)) {
|
|
5288
|
-
|
|
5576
|
+
_context57.next = 58;
|
|
5289
5577
|
break;
|
|
5290
5578
|
}
|
|
5291
|
-
|
|
5292
|
-
|
|
5579
|
+
_context57.prev = 48;
|
|
5580
|
+
_context57.next = 51;
|
|
5293
5581
|
return this.order.upsertOrdersFromRemote(freshOrders);
|
|
5294
5582
|
case 51:
|
|
5295
|
-
|
|
5583
|
+
_context57.next = 58;
|
|
5296
5584
|
break;
|
|
5297
5585
|
case 53:
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5586
|
+
_context57.prev = 53;
|
|
5587
|
+
_context57.t2 = _context57["catch"](48);
|
|
5588
|
+
_message2 = _context57.t2 instanceof Error ? _context57.t2.message : String(_context57.t2);
|
|
5301
5589
|
this.logError('handleUpdateLocalOrdersBatch: 合并写入失败', {
|
|
5302
|
-
message:
|
|
5590
|
+
message: _message2
|
|
5303
5591
|
});
|
|
5304
|
-
return
|
|
5592
|
+
return _context57.abrupt("return", {
|
|
5305
5593
|
code: 500,
|
|
5306
5594
|
status: false,
|
|
5307
|
-
message:
|
|
5595
|
+
message: _message2,
|
|
5308
5596
|
data: null
|
|
5309
5597
|
});
|
|
5310
5598
|
case 58:
|
|
@@ -5320,7 +5608,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5320
5608
|
insertedCount: inserted.length,
|
|
5321
5609
|
failedCount: failed.length
|
|
5322
5610
|
});
|
|
5323
|
-
return
|
|
5611
|
+
return _context57.abrupt("return", {
|
|
5324
5612
|
code: 200,
|
|
5325
5613
|
status: true,
|
|
5326
5614
|
message: '',
|
|
@@ -5332,11 +5620,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
5332
5620
|
});
|
|
5333
5621
|
case 62:
|
|
5334
5622
|
case "end":
|
|
5335
|
-
return
|
|
5623
|
+
return _context57.stop();
|
|
5336
5624
|
}
|
|
5337
|
-
},
|
|
5625
|
+
}, _callee57, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
|
|
5338
5626
|
}));
|
|
5339
|
-
function handleUpdateLocalOrdersBatch(
|
|
5627
|
+
function handleUpdateLocalOrdersBatch(_x63) {
|
|
5340
5628
|
return _handleUpdateLocalOrdersBatch.apply(this, arguments);
|
|
5341
5629
|
}
|
|
5342
5630
|
return handleUpdateLocalOrdersBatch;
|
|
@@ -5357,11 +5645,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
5357
5645
|
var queryIndex = url.indexOf('?');
|
|
5358
5646
|
if (queryIndex < 0) return null;
|
|
5359
5647
|
var query = url.slice(queryIndex + 1);
|
|
5360
|
-
var
|
|
5361
|
-
|
|
5648
|
+
var _iterator17 = _createForOfIteratorHelper(query.split('&')),
|
|
5649
|
+
_step17;
|
|
5362
5650
|
try {
|
|
5363
|
-
for (
|
|
5364
|
-
var pair =
|
|
5651
|
+
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
|
|
5652
|
+
var pair = _step17.value;
|
|
5365
5653
|
if (!pair) continue;
|
|
5366
5654
|
var _pair$split = pair.split('='),
|
|
5367
5655
|
_pair$split2 = _slicedToArray(_pair$split, 2),
|
|
@@ -5377,9 +5665,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
5377
5665
|
}
|
|
5378
5666
|
}
|
|
5379
5667
|
} catch (err) {
|
|
5380
|
-
|
|
5668
|
+
_iterator17.e(err);
|
|
5381
5669
|
} finally {
|
|
5382
|
-
|
|
5670
|
+
_iterator17.f();
|
|
5383
5671
|
}
|
|
5384
5672
|
return null;
|
|
5385
5673
|
}
|
|
@@ -5413,8 +5701,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
5413
5701
|
}, {
|
|
5414
5702
|
key: "extractOrderDataFromCheckoutResponse",
|
|
5415
5703
|
value: function extractOrderDataFromCheckoutResponse(response) {
|
|
5416
|
-
var _response$
|
|
5417
|
-
var candidates = [response === null || response === void 0 || (_response$
|
|
5704
|
+
var _response$data6, _response$data7;
|
|
5705
|
+
var candidates = [response === null || response === void 0 || (_response$data6 = response.data) === null || _response$data6 === void 0 ? void 0 : _response$data6.order, response === null || response === void 0 || (_response$data7 = response.data) === null || _response$data7 === void 0 ? void 0 : _response$data7.sales, response === null || response === void 0 ? void 0 : response.data, response === null || response === void 0 ? void 0 : response.order, response === null || response === void 0 ? void 0 : response.sales, response];
|
|
5418
5706
|
for (var _i4 = 0, _candidates = candidates; _i4 < _candidates.length; _i4++) {
|
|
5419
5707
|
var candidate = _candidates[_i4];
|
|
5420
5708
|
if (!candidate || _typeof(candidate) !== 'object') continue;
|
|
@@ -5700,24 +5988,24 @@ var Server = /*#__PURE__*/function () {
|
|
|
5700
5988
|
}, {
|
|
5701
5989
|
key: "recomputeAndNotifyFloorPlanQuery",
|
|
5702
5990
|
value: (function () {
|
|
5703
|
-
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5704
|
-
var
|
|
5705
|
-
return _regeneratorRuntime().wrap(function
|
|
5706
|
-
while (1) switch (
|
|
5991
|
+
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58() {
|
|
5992
|
+
var _iterator18, _step18, _step18$value, subscriberId, sub, result, errorMessage;
|
|
5993
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
|
5994
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
5707
5995
|
case 0:
|
|
5708
5996
|
if (!(this.floorPlanQuerySubscribers.size === 0)) {
|
|
5709
|
-
|
|
5997
|
+
_context58.next = 2;
|
|
5710
5998
|
break;
|
|
5711
5999
|
}
|
|
5712
|
-
return
|
|
6000
|
+
return _context58.abrupt("return");
|
|
5713
6001
|
case 2:
|
|
5714
6002
|
this.logInfo('recomputeAndNotifyFloorPlanQuery: 开始推送', {
|
|
5715
6003
|
subscriberCount: this.floorPlanQuerySubscribers.size
|
|
5716
6004
|
});
|
|
5717
|
-
|
|
6005
|
+
_iterator18 = _createForOfIteratorHelper(this.floorPlanQuerySubscribers.entries());
|
|
5718
6006
|
try {
|
|
5719
|
-
for (
|
|
5720
|
-
|
|
6007
|
+
for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
|
|
6008
|
+
_step18$value = _slicedToArray(_step18.value, 2), subscriberId = _step18$value[0], sub = _step18$value[1];
|
|
5721
6009
|
try {
|
|
5722
6010
|
result = this.computeFloorPlanQueryResult(sub.context);
|
|
5723
6011
|
sub.callback(result);
|
|
@@ -5733,15 +6021,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
5733
6021
|
}
|
|
5734
6022
|
}
|
|
5735
6023
|
} catch (err) {
|
|
5736
|
-
|
|
6024
|
+
_iterator18.e(err);
|
|
5737
6025
|
} finally {
|
|
5738
|
-
|
|
6026
|
+
_iterator18.f();
|
|
5739
6027
|
}
|
|
5740
6028
|
case 5:
|
|
5741
6029
|
case "end":
|
|
5742
|
-
return
|
|
6030
|
+
return _context58.stop();
|
|
5743
6031
|
}
|
|
5744
|
-
},
|
|
6032
|
+
}, _callee58, this);
|
|
5745
6033
|
}));
|
|
5746
6034
|
function recomputeAndNotifyFloorPlanQuery() {
|
|
5747
6035
|
return _recomputeAndNotifyFloorPlanQuery.apply(this, arguments);
|
|
@@ -5771,21 +6059,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
5771
6059
|
* filter 逻辑暂为 mock,仅记录参数
|
|
5772
6060
|
*/
|
|
5773
6061
|
function () {
|
|
5774
|
-
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6062
|
+
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(data) {
|
|
5775
6063
|
var rawList, result;
|
|
5776
|
-
return _regeneratorRuntime().wrap(function
|
|
5777
|
-
while (1) switch (
|
|
6064
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
|
6065
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
5778
6066
|
case 0:
|
|
5779
6067
|
this.logInfo('computeOrderQueryResult: 开始过滤', {
|
|
5780
6068
|
data: data
|
|
5781
6069
|
});
|
|
5782
6070
|
console.log('[Server] computeOrderQueryResult', data);
|
|
5783
6071
|
if (this.order) {
|
|
5784
|
-
|
|
6072
|
+
_context59.next = 5;
|
|
5785
6073
|
break;
|
|
5786
6074
|
}
|
|
5787
6075
|
this.logError('computeOrderQueryResult: Order 模块未注册');
|
|
5788
|
-
return
|
|
6076
|
+
return _context59.abrupt("return", {
|
|
5789
6077
|
code: 500,
|
|
5790
6078
|
message: 'Order 模块未注册',
|
|
5791
6079
|
data: {
|
|
@@ -5809,7 +6097,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5809
6097
|
skip: result.skip,
|
|
5810
6098
|
rejected: result.rejected
|
|
5811
6099
|
});
|
|
5812
|
-
return
|
|
6100
|
+
return _context59.abrupt("return", {
|
|
5813
6101
|
code: 200,
|
|
5814
6102
|
data: result,
|
|
5815
6103
|
message: '',
|
|
@@ -5817,11 +6105,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
5817
6105
|
});
|
|
5818
6106
|
case 10:
|
|
5819
6107
|
case "end":
|
|
5820
|
-
return
|
|
6108
|
+
return _context59.stop();
|
|
5821
6109
|
}
|
|
5822
|
-
},
|
|
6110
|
+
}, _callee59, this);
|
|
5823
6111
|
}));
|
|
5824
|
-
function computeOrderQueryResult(
|
|
6112
|
+
function computeOrderQueryResult(_x64) {
|
|
5825
6113
|
return _computeOrderQueryResult.apply(this, arguments);
|
|
5826
6114
|
}
|
|
5827
6115
|
return computeOrderQueryResult;
|
|
@@ -5834,17 +6122,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
5834
6122
|
}, {
|
|
5835
6123
|
key: "computeBookingQueryResult",
|
|
5836
6124
|
value: (function () {
|
|
5837
|
-
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6125
|
+
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(data) {
|
|
5838
6126
|
var rawOrders, result;
|
|
5839
|
-
return _regeneratorRuntime().wrap(function
|
|
5840
|
-
while (1) switch (
|
|
6127
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
|
6128
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
5841
6129
|
case 0:
|
|
5842
6130
|
if (this.order) {
|
|
5843
|
-
|
|
6131
|
+
_context60.next = 3;
|
|
5844
6132
|
break;
|
|
5845
6133
|
}
|
|
5846
6134
|
this.logError('computeBookingQueryResult: Order 模块未注册');
|
|
5847
|
-
return
|
|
6135
|
+
return _context60.abrupt("return", {
|
|
5848
6136
|
code: 500,
|
|
5849
6137
|
message: 'Order 模块未注册',
|
|
5850
6138
|
data: {
|
|
@@ -5863,7 +6151,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5863
6151
|
size: result.size,
|
|
5864
6152
|
skip: result.skip
|
|
5865
6153
|
});
|
|
5866
|
-
return
|
|
6154
|
+
return _context60.abrupt("return", {
|
|
5867
6155
|
code: 200,
|
|
5868
6156
|
data: result,
|
|
5869
6157
|
message: '',
|
|
@@ -5871,11 +6159,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
5871
6159
|
});
|
|
5872
6160
|
case 8:
|
|
5873
6161
|
case "end":
|
|
5874
|
-
return
|
|
6162
|
+
return _context60.stop();
|
|
5875
6163
|
}
|
|
5876
|
-
},
|
|
6164
|
+
}, _callee60, this);
|
|
5877
6165
|
}));
|
|
5878
|
-
function computeBookingQueryResult(
|
|
6166
|
+
function computeBookingQueryResult(_x65) {
|
|
5879
6167
|
return _computeBookingQueryResult.apply(this, arguments);
|
|
5880
6168
|
}
|
|
5881
6169
|
return computeBookingQueryResult;
|
|
@@ -5934,12 +6222,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
5934
6222
|
}, {
|
|
5935
6223
|
key: "computeProductQueryResult",
|
|
5936
6224
|
value: (function () {
|
|
5937
|
-
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6225
|
+
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(context, options) {
|
|
5938
6226
|
var _menu_list_ids$length3,
|
|
5939
6227
|
_this17 = this;
|
|
5940
6228
|
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;
|
|
5941
|
-
return _regeneratorRuntime().wrap(function
|
|
5942
|
-
while (1) switch (
|
|
6229
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
|
6230
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
5943
6231
|
case 0:
|
|
5944
6232
|
tTotal = performance.now();
|
|
5945
6233
|
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;
|
|
@@ -5959,11 +6247,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
5959
6247
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
5960
6248
|
});
|
|
5961
6249
|
if (this.products) {
|
|
5962
|
-
|
|
6250
|
+
_context61.next = 7;
|
|
5963
6251
|
break;
|
|
5964
6252
|
}
|
|
5965
6253
|
this.logError('computeProductQueryResult: Products 模块未注册');
|
|
5966
|
-
return
|
|
6254
|
+
return _context61.abrupt("return", {
|
|
5967
6255
|
message: 'Products 模块未注册',
|
|
5968
6256
|
data: {
|
|
5969
6257
|
list: [],
|
|
@@ -5972,12 +6260,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
5972
6260
|
});
|
|
5973
6261
|
case 7:
|
|
5974
6262
|
if (!(queryIds.length > 0)) {
|
|
5975
|
-
|
|
6263
|
+
_context61.next = 19;
|
|
5976
6264
|
break;
|
|
5977
6265
|
}
|
|
5978
6266
|
uniqueIds = Array.from(new Set(queryIds));
|
|
5979
6267
|
_tPrice = performance.now();
|
|
5980
|
-
|
|
6268
|
+
_context61.next = 12;
|
|
5981
6269
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
5982
6270
|
scheduleModule: this.getSchedule(),
|
|
5983
6271
|
schedule_datetime: schedule_datetime,
|
|
@@ -5987,7 +6275,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
5987
6275
|
productIds: uniqueIds
|
|
5988
6276
|
});
|
|
5989
6277
|
case 12:
|
|
5990
|
-
productsWithPrice =
|
|
6278
|
+
productsWithPrice = _context61.sent;
|
|
5991
6279
|
perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
|
|
5992
6280
|
count: productsWithPrice.length,
|
|
5993
6281
|
ids: uniqueIds
|
|
@@ -6007,7 +6295,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6007
6295
|
ids: uniqueIds,
|
|
6008
6296
|
count: extensionFilteredProducts.length
|
|
6009
6297
|
});
|
|
6010
|
-
return
|
|
6298
|
+
return _context61.abrupt("return", {
|
|
6011
6299
|
code: 200,
|
|
6012
6300
|
data: {
|
|
6013
6301
|
list: extensionFilteredProducts,
|
|
@@ -6018,19 +6306,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
6018
6306
|
});
|
|
6019
6307
|
case 19:
|
|
6020
6308
|
if (!(product_id != null && Number.isFinite(Number(product_id)))) {
|
|
6021
|
-
|
|
6309
|
+
_context61.next = 31;
|
|
6022
6310
|
break;
|
|
6023
6311
|
}
|
|
6024
6312
|
pid = Number(product_id);
|
|
6025
6313
|
_tPrice2 = performance.now();
|
|
6026
|
-
|
|
6314
|
+
_context61.next = 24;
|
|
6027
6315
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
6028
6316
|
scheduleModule: this.getSchedule()
|
|
6029
6317
|
}, {
|
|
6030
6318
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
6031
6319
|
});
|
|
6032
6320
|
case 24:
|
|
6033
|
-
allProductsWithPrice =
|
|
6321
|
+
allProductsWithPrice = _context61.sent;
|
|
6034
6322
|
perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
|
|
6035
6323
|
count: allProductsWithPrice.length,
|
|
6036
6324
|
productId: pid
|
|
@@ -6050,7 +6338,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6050
6338
|
productId: pid,
|
|
6051
6339
|
found: !!item
|
|
6052
6340
|
});
|
|
6053
|
-
return
|
|
6341
|
+
return _context61.abrupt("return", {
|
|
6054
6342
|
code: 200,
|
|
6055
6343
|
data: item,
|
|
6056
6344
|
message: item ? '' : '商品不存在或未发布',
|
|
@@ -6058,11 +6346,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
6058
6346
|
});
|
|
6059
6347
|
case 31:
|
|
6060
6348
|
if (!this.shouldQueryProductsByExtensionTypes(extension_type)) {
|
|
6061
|
-
|
|
6349
|
+
_context61.next = 51;
|
|
6062
6350
|
break;
|
|
6063
6351
|
}
|
|
6064
6352
|
_tPrice3 = performance.now();
|
|
6065
|
-
|
|
6353
|
+
_context61.next = 35;
|
|
6066
6354
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
6067
6355
|
scheduleModule: this.getSchedule(),
|
|
6068
6356
|
schedule_datetime: schedule_datetime,
|
|
@@ -6071,7 +6359,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6071
6359
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
6072
6360
|
});
|
|
6073
6361
|
case 35:
|
|
6074
|
-
_filteredProducts2 =
|
|
6362
|
+
_filteredProducts2 = _context61.sent;
|
|
6075
6363
|
perfMark('computeQuery.getProductsWithPrice(extensionType)', performance.now() - _tPrice3, {
|
|
6076
6364
|
count: _filteredProducts2.length,
|
|
6077
6365
|
extension_type: extension_type
|
|
@@ -6110,7 +6398,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6110
6398
|
filteredCount: _filteredProducts2.length,
|
|
6111
6399
|
extension_type: extension_type
|
|
6112
6400
|
});
|
|
6113
|
-
return
|
|
6401
|
+
return _context61.abrupt("return", {
|
|
6114
6402
|
code: 200,
|
|
6115
6403
|
data: {
|
|
6116
6404
|
list: _filteredProducts2,
|
|
@@ -6121,11 +6409,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
6121
6409
|
});
|
|
6122
6410
|
case 51:
|
|
6123
6411
|
if (this.menu) {
|
|
6124
|
-
|
|
6412
|
+
_context61.next = 54;
|
|
6125
6413
|
break;
|
|
6126
6414
|
}
|
|
6127
6415
|
this.logError('computeProductQueryResult: Menu 模块未注册');
|
|
6128
|
-
return
|
|
6416
|
+
return _context61.abrupt("return", {
|
|
6129
6417
|
message: 'Menu 模块未注册',
|
|
6130
6418
|
data: {
|
|
6131
6419
|
list: [],
|
|
@@ -6134,11 +6422,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
6134
6422
|
});
|
|
6135
6423
|
case 54:
|
|
6136
6424
|
if (this.schedule) {
|
|
6137
|
-
|
|
6425
|
+
_context61.next = 57;
|
|
6138
6426
|
break;
|
|
6139
6427
|
}
|
|
6140
6428
|
this.logError('computeProductQueryResult: Schedule 模块未注册');
|
|
6141
|
-
return
|
|
6429
|
+
return _context61.abrupt("return", {
|
|
6142
6430
|
message: 'Schedule 模块未注册',
|
|
6143
6431
|
data: {
|
|
6144
6432
|
list: [],
|
|
@@ -6169,10 +6457,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
6169
6457
|
});
|
|
6170
6458
|
tPrice = performance.now();
|
|
6171
6459
|
if (!(scopedProductIds.length > 0)) {
|
|
6172
|
-
|
|
6460
|
+
_context61.next = 70;
|
|
6173
6461
|
break;
|
|
6174
6462
|
}
|
|
6175
|
-
|
|
6463
|
+
_context61.next = 67;
|
|
6176
6464
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
6177
6465
|
scheduleModule: this.getSchedule(),
|
|
6178
6466
|
schedule_datetime: schedule_datetime,
|
|
@@ -6182,13 +6470,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6182
6470
|
productIds: productScope.isAllProducts ? undefined : scopedProductIds
|
|
6183
6471
|
});
|
|
6184
6472
|
case 67:
|
|
6185
|
-
|
|
6186
|
-
|
|
6473
|
+
_context61.t0 = _context61.sent;
|
|
6474
|
+
_context61.next = 71;
|
|
6187
6475
|
break;
|
|
6188
6476
|
case 70:
|
|
6189
|
-
|
|
6477
|
+
_context61.t0 = [];
|
|
6190
6478
|
case 71:
|
|
6191
|
-
filteredProducts =
|
|
6479
|
+
filteredProducts = _context61.t0;
|
|
6192
6480
|
perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
|
|
6193
6481
|
count: filteredProducts.length,
|
|
6194
6482
|
scopedProductCount: scopedProductIds.length
|
|
@@ -6229,7 +6517,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6229
6517
|
filteredCount: filteredProducts.length,
|
|
6230
6518
|
activeMenuCount: activeMenuList.length
|
|
6231
6519
|
});
|
|
6232
|
-
return
|
|
6520
|
+
return _context61.abrupt("return", {
|
|
6233
6521
|
code: 200,
|
|
6234
6522
|
data: {
|
|
6235
6523
|
list: filteredProducts,
|
|
@@ -6240,11 +6528,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
6240
6528
|
});
|
|
6241
6529
|
case 87:
|
|
6242
6530
|
case "end":
|
|
6243
|
-
return
|
|
6531
|
+
return _context61.stop();
|
|
6244
6532
|
}
|
|
6245
|
-
},
|
|
6533
|
+
}, _callee61, this);
|
|
6246
6534
|
}));
|
|
6247
|
-
function computeProductQueryResult(
|
|
6535
|
+
function computeProductQueryResult(_x66, _x67) {
|
|
6248
6536
|
return _computeProductQueryResult.apply(this, arguments);
|
|
6249
6537
|
}
|
|
6250
6538
|
return computeProductQueryResult;
|
|
@@ -6259,72 +6547,72 @@ var Server = /*#__PURE__*/function () {
|
|
|
6259
6547
|
}, {
|
|
6260
6548
|
key: "recomputeAndNotifyProductQuery",
|
|
6261
6549
|
value: (function () {
|
|
6262
|
-
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6263
|
-
var
|
|
6264
|
-
return _regeneratorRuntime().wrap(function
|
|
6265
|
-
while (1) switch (
|
|
6550
|
+
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(options) {
|
|
6551
|
+
var _iterator19, _step19, _step19$value, subscriberId, subscriber, result, errorMessage;
|
|
6552
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
|
6553
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
6266
6554
|
case 0:
|
|
6267
6555
|
if (!(this.productQuerySubscribers.size === 0)) {
|
|
6268
|
-
|
|
6556
|
+
_context62.next = 2;
|
|
6269
6557
|
break;
|
|
6270
6558
|
}
|
|
6271
|
-
return
|
|
6559
|
+
return _context62.abrupt("return");
|
|
6272
6560
|
case 2:
|
|
6273
6561
|
this.logInfo('recomputeAndNotifyProductQuery: 开始推送', {
|
|
6274
6562
|
subscriberCount: this.productQuerySubscribers.size,
|
|
6275
6563
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
6276
6564
|
});
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6565
|
+
_iterator19 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
|
|
6566
|
+
_context62.prev = 4;
|
|
6567
|
+
_iterator19.s();
|
|
6280
6568
|
case 6:
|
|
6281
|
-
if ((
|
|
6282
|
-
|
|
6569
|
+
if ((_step19 = _iterator19.n()).done) {
|
|
6570
|
+
_context62.next = 22;
|
|
6283
6571
|
break;
|
|
6284
6572
|
}
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6573
|
+
_step19$value = _slicedToArray(_step19.value, 2), subscriberId = _step19$value[0], subscriber = _step19$value[1];
|
|
6574
|
+
_context62.prev = 8;
|
|
6575
|
+
_context62.next = 11;
|
|
6288
6576
|
return this.computeProductQueryResult(subscriber.context, {
|
|
6289
6577
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
6290
6578
|
});
|
|
6291
6579
|
case 11:
|
|
6292
|
-
result =
|
|
6580
|
+
result = _context62.sent;
|
|
6293
6581
|
subscriber.callback(result);
|
|
6294
6582
|
this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
|
|
6295
6583
|
subscriberId: subscriberId
|
|
6296
6584
|
});
|
|
6297
|
-
|
|
6585
|
+
_context62.next = 20;
|
|
6298
6586
|
break;
|
|
6299
6587
|
case 16:
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
errorMessage =
|
|
6588
|
+
_context62.prev = 16;
|
|
6589
|
+
_context62.t0 = _context62["catch"](8);
|
|
6590
|
+
errorMessage = _context62.t0 instanceof Error ? _context62.t0.message : String(_context62.t0);
|
|
6303
6591
|
this.logError('recomputeAndNotifyProductQuery: 推送失败', {
|
|
6304
6592
|
subscriberId: subscriberId,
|
|
6305
6593
|
error: errorMessage
|
|
6306
6594
|
});
|
|
6307
6595
|
case 20:
|
|
6308
|
-
|
|
6596
|
+
_context62.next = 6;
|
|
6309
6597
|
break;
|
|
6310
6598
|
case 22:
|
|
6311
|
-
|
|
6599
|
+
_context62.next = 27;
|
|
6312
6600
|
break;
|
|
6313
6601
|
case 24:
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6602
|
+
_context62.prev = 24;
|
|
6603
|
+
_context62.t1 = _context62["catch"](4);
|
|
6604
|
+
_iterator19.e(_context62.t1);
|
|
6317
6605
|
case 27:
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
return
|
|
6606
|
+
_context62.prev = 27;
|
|
6607
|
+
_iterator19.f();
|
|
6608
|
+
return _context62.finish(27);
|
|
6321
6609
|
case 30:
|
|
6322
6610
|
case "end":
|
|
6323
|
-
return
|
|
6611
|
+
return _context62.stop();
|
|
6324
6612
|
}
|
|
6325
|
-
},
|
|
6613
|
+
}, _callee62, this, [[4, 24, 27, 30], [8, 16]]);
|
|
6326
6614
|
}));
|
|
6327
|
-
function recomputeAndNotifyProductQuery(
|
|
6615
|
+
function recomputeAndNotifyProductQuery(_x68) {
|
|
6328
6616
|
return _recomputeAndNotifyProductQuery.apply(this, arguments);
|
|
6329
6617
|
}
|
|
6330
6618
|
return recomputeAndNotifyProductQuery;
|
|
@@ -6336,37 +6624,37 @@ var Server = /*#__PURE__*/function () {
|
|
|
6336
6624
|
}, {
|
|
6337
6625
|
key: "recomputeAndNotifyOrderQuery",
|
|
6338
6626
|
value: (function () {
|
|
6339
|
-
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6340
|
-
var notifyStartAt,
|
|
6341
|
-
return _regeneratorRuntime().wrap(function
|
|
6342
|
-
while (1) switch (
|
|
6627
|
+
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63() {
|
|
6628
|
+
var notifyStartAt, _iterator20, _step20, _step20$value, subscriberId, subscriber, computeStartAt, result, computeEndAt, callbackStartAt, callbackEndAt, errorMessage, notifyEndAt;
|
|
6629
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
6630
|
+
while (1) switch (_context63.prev = _context63.next) {
|
|
6343
6631
|
case 0:
|
|
6344
6632
|
if (!(this.orderQuerySubscribers.size === 0)) {
|
|
6345
|
-
|
|
6633
|
+
_context63.next = 2;
|
|
6346
6634
|
break;
|
|
6347
6635
|
}
|
|
6348
|
-
return
|
|
6636
|
+
return _context63.abrupt("return");
|
|
6349
6637
|
case 2:
|
|
6350
6638
|
notifyStartAt = Date.now();
|
|
6351
6639
|
this.logInfo('recomputeAndNotifyOrderQuery: 开始推送', {
|
|
6352
6640
|
subscriberCount: this.orderQuerySubscribers.size,
|
|
6353
6641
|
notifyStartAt: new Date(notifyStartAt).toISOString()
|
|
6354
6642
|
});
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6643
|
+
_iterator20 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
|
|
6644
|
+
_context63.prev = 5;
|
|
6645
|
+
_iterator20.s();
|
|
6358
6646
|
case 7:
|
|
6359
|
-
if ((
|
|
6360
|
-
|
|
6647
|
+
if ((_step20 = _iterator20.n()).done) {
|
|
6648
|
+
_context63.next = 27;
|
|
6361
6649
|
break;
|
|
6362
6650
|
}
|
|
6363
|
-
|
|
6364
|
-
|
|
6651
|
+
_step20$value = _slicedToArray(_step20.value, 2), subscriberId = _step20$value[0], subscriber = _step20$value[1];
|
|
6652
|
+
_context63.prev = 9;
|
|
6365
6653
|
computeStartAt = Date.now();
|
|
6366
|
-
|
|
6654
|
+
_context63.next = 13;
|
|
6367
6655
|
return this.computeOrderQueryResult(subscriber.context);
|
|
6368
6656
|
case 13:
|
|
6369
|
-
result =
|
|
6657
|
+
result = _context63.sent;
|
|
6370
6658
|
computeEndAt = Date.now();
|
|
6371
6659
|
callbackStartAt = Date.now();
|
|
6372
6660
|
subscriber.callback(result);
|
|
@@ -6377,30 +6665,30 @@ var Server = /*#__PURE__*/function () {
|
|
|
6377
6665
|
callbackDurationMs: callbackEndAt - callbackStartAt,
|
|
6378
6666
|
totalDurationMs: callbackEndAt - computeStartAt
|
|
6379
6667
|
});
|
|
6380
|
-
|
|
6668
|
+
_context63.next = 25;
|
|
6381
6669
|
break;
|
|
6382
6670
|
case 21:
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
errorMessage =
|
|
6671
|
+
_context63.prev = 21;
|
|
6672
|
+
_context63.t0 = _context63["catch"](9);
|
|
6673
|
+
errorMessage = _context63.t0 instanceof Error ? _context63.t0.message : String(_context63.t0);
|
|
6386
6674
|
this.logError('recomputeAndNotifyOrderQuery: 推送失败', {
|
|
6387
6675
|
subscriberId: subscriberId,
|
|
6388
6676
|
error: errorMessage
|
|
6389
6677
|
});
|
|
6390
6678
|
case 25:
|
|
6391
|
-
|
|
6679
|
+
_context63.next = 7;
|
|
6392
6680
|
break;
|
|
6393
6681
|
case 27:
|
|
6394
|
-
|
|
6682
|
+
_context63.next = 32;
|
|
6395
6683
|
break;
|
|
6396
6684
|
case 29:
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6685
|
+
_context63.prev = 29;
|
|
6686
|
+
_context63.t1 = _context63["catch"](5);
|
|
6687
|
+
_iterator20.e(_context63.t1);
|
|
6400
6688
|
case 32:
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
return
|
|
6689
|
+
_context63.prev = 32;
|
|
6690
|
+
_iterator20.f();
|
|
6691
|
+
return _context63.finish(32);
|
|
6404
6692
|
case 35:
|
|
6405
6693
|
notifyEndAt = Date.now();
|
|
6406
6694
|
this.logInfo('recomputeAndNotifyOrderQuery: 推送完成', {
|
|
@@ -6409,9 +6697,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
6409
6697
|
});
|
|
6410
6698
|
case 37:
|
|
6411
6699
|
case "end":
|
|
6412
|
-
return
|
|
6700
|
+
return _context63.stop();
|
|
6413
6701
|
}
|
|
6414
|
-
},
|
|
6702
|
+
}, _callee63, this, [[5, 29, 32, 35], [9, 21]]);
|
|
6415
6703
|
}));
|
|
6416
6704
|
function recomputeAndNotifyOrderQuery() {
|
|
6417
6705
|
return _recomputeAndNotifyOrderQuery.apply(this, arguments);
|
|
@@ -6438,13 +6726,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6438
6726
|
// 如果当前开启了 checkout 弹窗,先不进行刷新,下面的代码会导致在全局搜索页调用 bookingTicket.destroy()
|
|
6439
6727
|
// 导致模块被销毁 ,checkout 弹窗永远无法关闭
|
|
6440
6728
|
if (window.isPaymentModalPluginOpen) return;
|
|
6441
|
-
var
|
|
6442
|
-
|
|
6729
|
+
var _iterator21 = _createForOfIteratorHelper(this.salesSearchSubscribers.entries()),
|
|
6730
|
+
_step21;
|
|
6443
6731
|
try {
|
|
6444
6732
|
var _loop = function _loop() {
|
|
6445
|
-
var
|
|
6446
|
-
subscriberId =
|
|
6447
|
-
subscriber =
|
|
6733
|
+
var _step21$value = _slicedToArray(_step21.value, 2),
|
|
6734
|
+
subscriberId = _step21$value[0],
|
|
6735
|
+
subscriber = _step21$value[1];
|
|
6448
6736
|
try {
|
|
6449
6737
|
var changedVisibleOrders = changedOrders.filter(function (order) {
|
|
6450
6738
|
var orderId = _this18.getSalesSearchOrderId(order);
|
|
@@ -6467,13 +6755,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6467
6755
|
});
|
|
6468
6756
|
}
|
|
6469
6757
|
};
|
|
6470
|
-
for (
|
|
6758
|
+
for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
|
|
6471
6759
|
if (_loop()) continue;
|
|
6472
6760
|
}
|
|
6473
6761
|
} catch (err) {
|
|
6474
|
-
|
|
6762
|
+
_iterator21.e(err);
|
|
6475
6763
|
} finally {
|
|
6476
|
-
|
|
6764
|
+
_iterator21.f();
|
|
6477
6765
|
}
|
|
6478
6766
|
}
|
|
6479
6767
|
|
|
@@ -6552,67 +6840,67 @@ var Server = /*#__PURE__*/function () {
|
|
|
6552
6840
|
}, {
|
|
6553
6841
|
key: "recomputeAndNotifyBookingQuery",
|
|
6554
6842
|
value: (function () {
|
|
6555
|
-
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6556
|
-
var
|
|
6557
|
-
return _regeneratorRuntime().wrap(function
|
|
6558
|
-
while (1) switch (
|
|
6843
|
+
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64() {
|
|
6844
|
+
var _iterator22, _step22, _step22$value, subscriberId, subscriber, result, errorMessage;
|
|
6845
|
+
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
|
6846
|
+
while (1) switch (_context64.prev = _context64.next) {
|
|
6559
6847
|
case 0:
|
|
6560
6848
|
if (!(this.bookingQuerySubscribers.size === 0)) {
|
|
6561
|
-
|
|
6849
|
+
_context64.next = 2;
|
|
6562
6850
|
break;
|
|
6563
6851
|
}
|
|
6564
|
-
return
|
|
6852
|
+
return _context64.abrupt("return");
|
|
6565
6853
|
case 2:
|
|
6566
6854
|
this.logInfo('recomputeAndNotifyBookingQuery: 开始推送', {
|
|
6567
6855
|
subscriberCount: this.bookingQuerySubscribers.size
|
|
6568
6856
|
});
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6857
|
+
_iterator22 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
|
|
6858
|
+
_context64.prev = 4;
|
|
6859
|
+
_iterator22.s();
|
|
6572
6860
|
case 6:
|
|
6573
|
-
if ((
|
|
6574
|
-
|
|
6861
|
+
if ((_step22 = _iterator22.n()).done) {
|
|
6862
|
+
_context64.next = 22;
|
|
6575
6863
|
break;
|
|
6576
6864
|
}
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6865
|
+
_step22$value = _slicedToArray(_step22.value, 2), subscriberId = _step22$value[0], subscriber = _step22$value[1];
|
|
6866
|
+
_context64.prev = 8;
|
|
6867
|
+
_context64.next = 11;
|
|
6580
6868
|
return this.computeBookingQueryResult(subscriber.context);
|
|
6581
6869
|
case 11:
|
|
6582
|
-
result =
|
|
6870
|
+
result = _context64.sent;
|
|
6583
6871
|
subscriber.callback(result);
|
|
6584
6872
|
this.logInfo('recomputeAndNotifyBookingQuery: 已推送', {
|
|
6585
6873
|
subscriberId: subscriberId
|
|
6586
6874
|
});
|
|
6587
|
-
|
|
6875
|
+
_context64.next = 20;
|
|
6588
6876
|
break;
|
|
6589
6877
|
case 16:
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
errorMessage =
|
|
6878
|
+
_context64.prev = 16;
|
|
6879
|
+
_context64.t0 = _context64["catch"](8);
|
|
6880
|
+
errorMessage = _context64.t0 instanceof Error ? _context64.t0.message : String(_context64.t0);
|
|
6593
6881
|
this.logError('recomputeAndNotifyBookingQuery: 推送失败', {
|
|
6594
6882
|
subscriberId: subscriberId,
|
|
6595
6883
|
error: errorMessage
|
|
6596
6884
|
});
|
|
6597
6885
|
case 20:
|
|
6598
|
-
|
|
6886
|
+
_context64.next = 6;
|
|
6599
6887
|
break;
|
|
6600
6888
|
case 22:
|
|
6601
|
-
|
|
6889
|
+
_context64.next = 27;
|
|
6602
6890
|
break;
|
|
6603
6891
|
case 24:
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6892
|
+
_context64.prev = 24;
|
|
6893
|
+
_context64.t1 = _context64["catch"](4);
|
|
6894
|
+
_iterator22.e(_context64.t1);
|
|
6607
6895
|
case 27:
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
return
|
|
6896
|
+
_context64.prev = 27;
|
|
6897
|
+
_iterator22.f();
|
|
6898
|
+
return _context64.finish(27);
|
|
6611
6899
|
case 30:
|
|
6612
6900
|
case "end":
|
|
6613
|
-
return
|
|
6901
|
+
return _context64.stop();
|
|
6614
6902
|
}
|
|
6615
|
-
},
|
|
6903
|
+
}, _callee64, this, [[4, 24, 27, 30], [8, 16]]);
|
|
6616
6904
|
}));
|
|
6617
6905
|
function recomputeAndNotifyBookingQuery() {
|
|
6618
6906
|
return _recomputeAndNotifyBookingQuery.apply(this, arguments);
|
|
@@ -6642,11 +6930,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
6642
6930
|
var allowedProductIds = new Set();
|
|
6643
6931
|
var allowedCollectionIds = new Set();
|
|
6644
6932
|
var hasProductAll = false;
|
|
6645
|
-
var
|
|
6646
|
-
|
|
6933
|
+
var _iterator23 = _createForOfIteratorHelper(activeMenuList),
|
|
6934
|
+
_step23;
|
|
6647
6935
|
try {
|
|
6648
|
-
for (
|
|
6649
|
-
var menu =
|
|
6936
|
+
for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) {
|
|
6937
|
+
var menu = _step23.value;
|
|
6650
6938
|
var config = menu.partyroom_package;
|
|
6651
6939
|
if (!config) {
|
|
6652
6940
|
console.warn('[Server] 餐牌缺少 partyroom_package 配置:', menu);
|
|
@@ -6706,9 +6994,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
6706
6994
|
|
|
6707
6995
|
// 如果有餐牌允许所有商品,返回所有商品
|
|
6708
6996
|
} catch (err) {
|
|
6709
|
-
|
|
6997
|
+
_iterator23.e(err);
|
|
6710
6998
|
} finally {
|
|
6711
|
-
|
|
6999
|
+
_iterator23.f();
|
|
6712
7000
|
}
|
|
6713
7001
|
if (hasProductAll) {
|
|
6714
7002
|
this.logInfo('getProductScopeByMenuConfig: 返回所有商品 scope(product_all)');
|