@pisell/pisellos 2.2.256 → 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.
Files changed (52) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +17 -13
  3. package/dist/modules/Order/index.d.ts +29 -1
  4. package/dist/modules/Order/index.js +508 -241
  5. package/dist/modules/Order/types.d.ts +20 -2
  6. package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  7. package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
  8. package/dist/modules/Order/utils.d.ts +4 -0
  9. package/dist/modules/Order/utils.js +114 -28
  10. package/dist/modules/Product/index.d.ts +1 -1
  11. package/dist/modules/Product/types.d.ts +6 -0
  12. package/dist/modules/Rules/index.d.ts +3 -3
  13. package/dist/modules/Rules/index.js +8 -3
  14. package/dist/modules/Rules/types.d.ts +2 -1
  15. package/dist/server/index.d.ts +12 -2
  16. package/dist/server/index.js +1227 -923
  17. package/dist/server/modules/order/index.d.ts +22 -3
  18. package/dist/server/modules/order/index.js +397 -314
  19. package/dist/solution/BaseSales/index.d.ts +16 -2
  20. package/dist/solution/BaseSales/index.js +484 -314
  21. package/dist/solution/BaseSales/types.d.ts +1 -0
  22. package/dist/solution/BaseSales/types.js +2 -1
  23. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +4 -2
  24. package/dist/solution/BookingByStep/index.d.ts +1 -1
  25. package/dist/solution/BookingTicket/index.d.ts +9 -1
  26. package/dist/solution/BookingTicket/index.js +162 -6
  27. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +11 -1
  28. package/lib/modules/Order/index.d.ts +29 -1
  29. package/lib/modules/Order/index.js +340 -57
  30. package/lib/modules/Order/types.d.ts +20 -2
  31. package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  32. package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
  33. package/lib/modules/Order/utils.d.ts +4 -0
  34. package/lib/modules/Order/utils.js +84 -2
  35. package/lib/modules/Product/index.d.ts +1 -1
  36. package/lib/modules/Product/types.d.ts +6 -0
  37. package/lib/modules/Rules/index.d.ts +3 -3
  38. package/lib/modules/Rules/index.js +4 -3
  39. package/lib/modules/Rules/types.d.ts +2 -1
  40. package/lib/server/index.d.ts +12 -2
  41. package/lib/server/index.js +218 -12
  42. package/lib/server/modules/order/index.d.ts +22 -3
  43. package/lib/server/modules/order/index.js +102 -51
  44. package/lib/solution/BaseSales/index.d.ts +16 -2
  45. package/lib/solution/BaseSales/index.js +143 -31
  46. package/lib/solution/BaseSales/types.d.ts +1 -0
  47. package/lib/solution/BaseSales/types.js +2 -1
  48. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +4 -5
  49. package/lib/solution/BookingByStep/index.d.ts +1 -1
  50. package/lib/solution/BookingTicket/index.d.ts +9 -1
  51. package/lib/solution/BookingTicket/index.js +112 -0
  52. package/package.json +1 -1
@@ -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$app3;
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, "handleOrderSalesDetail", /*#__PURE__*/function () {
1072
+ _defineProperty(this, "handleMachinecodeBatchMetadata", /*#__PURE__*/function () {
1072
1073
  var _ref43 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(_ref42) {
1073
- var _this$app2;
1074
- var url, data, path, requestPath, lookup, localOrder, backendPath, _response$data2, response, fresh, savedOrder, errorMessage;
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
- url = _ref42.url, data = _ref42.data, path = _ref42.path;
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
- _context17.next = 7;
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 _context17.abrupt("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
- _context17.next = 10;
1218
+ _context18.next = 10;
1103
1219
  break;
1104
1220
  }
1105
1221
  _this.logError('handleOrderSalesDetail: Order 模块未注册');
1106
- return _context17.abrupt("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
- _context17.next = 17;
1230
+ _context18.next = 17;
1115
1231
  break;
1116
1232
  }
1117
- _context17.next = 13;
1233
+ _context18.next = 13;
1118
1234
  return _this.order.getLocalOrderByLookup(lookup);
1119
1235
  case 13:
1120
- localOrder = _context17.sent;
1236
+ localOrder = _context18.sent;
1121
1237
  if (!localOrder) {
1122
- _context17.next = 17;
1238
+ _context18.next = 17;
1123
1239
  break;
1124
1240
  }
1125
1241
  _this.logInfo('handleOrderSalesDetail: 命中本地订单', {
1126
1242
  lookup: lookup
1127
1243
  });
1128
- return _context17.abrupt("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$app2 = _this.app) !== null && _this$app2 !== void 0 && _this$app2.request) {
1136
- _context17.next = 20;
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 _context17.abrupt("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
- _context17.prev = 21;
1149
- _context17.next = 24;
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 = _context17.sent;
1158
- fresh = (_response$data2 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data2 !== void 0 ? _response$data2 : 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
- _context17.next = 29;
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 _context17.abrupt("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
- _context17.next = 31;
1290
+ _context18.next = 31;
1175
1291
  return _this.order.upsertOrdersFromRemote([fresh]);
1176
1292
  case 31:
1177
- _context17.next = 33;
1293
+ _context18.next = 33;
1178
1294
  return _this.order.getLocalOrderByLookup(lookup);
1179
1295
  case 33:
1180
- savedOrder = _context17.sent;
1296
+ savedOrder = _context18.sent;
1181
1297
  if (savedOrder) {
1182
- _context17.next = 37;
1298
+ _context18.next = 37;
1183
1299
  break;
1184
1300
  }
1185
1301
  _this.logError('handleOrderSalesDetail: 订单写入后回读失败', {
1186
1302
  lookup: lookup
1187
1303
  });
1188
- return _context17.abrupt("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 _context17.abrupt("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
- _context17.prev = 41;
1206
- _context17.t0 = _context17["catch"](21);
1207
- errorMessage = _context17.t0 instanceof Error ? _context17.t0.message : String(_context17.t0);
1208
- _this.logError('handleOrderSalesDetail: 请求失败', {
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 _context17.abrupt("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 _context17.stop();
1337
+ return _context18.stop();
1222
1338
  }
1223
- }, _callee17, null, [[21, 41]]);
1339
+ }, _callee18, null, [[21, 41]]);
1224
1340
  }));
1225
- return function (_x17) {
1226
- return _ref43.apply(this, arguments);
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 _ref45 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref44) {
1234
- var url, data, config, routePath, base, path, _subscriberId, _ref46, callback, subscriberId, ctx;
1235
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1236
- while (1) switch (_context18.prev = _context18.next) {
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 = _ref44.url, data = _ref44.data, config = _ref44.config, routePath = _ref44.path;
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
- _context18.next = 7;
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 _context18.abrupt("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
- _ref46 = config || {}, callback = _ref46.callback, subscriberId = _ref46.subscriberId;
1375
+ _ref48 = config || {}, callback = _ref48.callback, subscriberId = _ref48.subscriberId;
1260
1376
  ctx = _this.resolveFloorPlanQueryContext(path, base);
1261
1377
  if (ctx) {
1262
- _context18.next = 11;
1378
+ _context19.next = 11;
1263
1379
  break;
1264
1380
  }
1265
- return _context18.abrupt("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 _context18.abrupt("return", _this.computeFloorPlanQueryResult(ctx));
1399
+ return _context19.abrupt("return", _this.computeFloorPlanQueryResult(ctx));
1284
1400
  case 13:
1285
1401
  case "end":
1286
- return _context18.stop();
1402
+ return _context19.stop();
1287
1403
  }
1288
- }, _callee18);
1404
+ }, _callee19);
1289
1405
  }));
1290
- return function (_x18) {
1291
- return _ref45.apply(this, arguments);
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 _ref48 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref47) {
1299
- var data, _ref49, subscriberId;
1300
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1301
- while (1) switch (_context19.prev = _context19.next) {
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 = _ref47.data;
1304
- _ref49 = data || {}, subscriberId = _ref49.subscriberId;
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 _context19.abrupt("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 _context19.stop();
1437
+ return _context20.stop();
1322
1438
  }
1323
- }, _callee19);
1439
+ }, _callee20);
1324
1440
  }));
1325
- return function (_x19) {
1326
- return _ref48.apply(this, arguments);
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 _ref51 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(_ref50) {
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 _callee20$(_context20) {
1338
- while (1) switch (_context20.prev = _context20.next) {
1453
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1454
+ while (1) switch (_context21.prev = _context21.next) {
1339
1455
  case 0:
1340
- url = _ref50.url, method = _ref50.method, data = _ref50.data, config = _ref50.config;
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
- _context20.next = 8;
1466
+ _context21.next = 8;
1351
1467
  break;
1352
1468
  }
1353
1469
  console.error('[Server] Menu 模块未注册');
1354
1470
  _this.logError('handleGetScheduleTimePoints: Menu 模块未注册');
1355
- return _context20.abrupt("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
- _context20.next = 12;
1479
+ _context21.next = 12;
1364
1480
  break;
1365
1481
  }
1366
1482
  console.error('[Server] Schedule 模块未注册');
1367
1483
  _this.logError('handleGetScheduleTimePoints: Schedule 模块未注册');
1368
- return _context20.abrupt("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
- _context20.next = 16;
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 _context20.abrupt("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
- _context20.prev = 16;
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
- _context20.next = 26;
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 _context20.abrupt("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 _context20.abrupt("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
- _context20.prev = 35;
1447
- _context20.t0 = _context20["catch"](16);
1448
- errorMessage = _context20.t0 instanceof Error ? _context20.t0.message : '未知错误';
1449
- console.error('[Server] 获取日程时间点失败:', _context20.t0);
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 _context20.abrupt("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 _context20.stop();
1578
+ return _context21.stop();
1463
1579
  }
1464
- }, _callee20, null, [[16, 35]]);
1580
+ }, _callee21, null, [[16, 35]]);
1465
1581
  }));
1466
- return function (_x20) {
1467
- return _ref51.apply(this, arguments);
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$app3 = this.app) === null || _this$app3 === void 0 ? void 0 : _this$app3.logger) || null;
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 _callee21(module, options, moduleName) {
1704
+ var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(module, options, moduleName) {
1589
1705
  var routes;
1590
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1591
- while (1) switch (_context21.prev = _context21.next) {
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
- _context21.next = 3;
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 _context21.stop();
1736
+ return _context22.stop();
1621
1737
  }
1622
- }, _callee21, this);
1738
+ }, _callee22, this);
1623
1739
  }));
1624
- function registerModuleWithRoutes(_x21, _x22, _x23) {
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 _callee22(moduleConfig) {
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 _callee22$(_context22) {
1640
- while (1) switch (_context22.prev = _context22.next) {
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
- _context22.next = 8;
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
- _context22.next = 13;
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 _context22.abrupt("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 _context22.stop();
1802
+ return _context23.stop();
1687
1803
  }
1688
- }, _callee22, this);
1804
+ }, _callee23, this);
1689
1805
  }));
1690
- function registerModuleByName(_x24) {
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 _callee23(moduleConfigs) {
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 _callee23$(_context23) {
1706
- while (1) switch (_context23.prev = _context23.next) {
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
- _context23.prev = 5;
1834
+ _context24.prev = 5;
1719
1835
  _iterator2.s();
1720
1836
  case 7:
1721
1837
  if ((_step2 = _iterator2.n()).done) {
1722
- _context23.next = 25;
1838
+ _context24.next = 25;
1723
1839
  break;
1724
1840
  }
1725
1841
  config = _step2.value;
1726
1842
  configName = typeof config === 'string' ? config : config.name;
1727
- _context23.prev = 10;
1728
- _context23.next = 13;
1843
+ _context24.prev = 10;
1844
+ _context24.next = 13;
1729
1845
  return this.registerModuleByName(config);
1730
1846
  case 13:
1731
- result = _context23.sent;
1847
+ result = _context24.sent;
1732
1848
  registeredModules.push(result);
1733
- _context23.next = 23;
1849
+ _context24.next = 23;
1734
1850
  break;
1735
1851
  case 17:
1736
- _context23.prev = 17;
1737
- _context23.t0 = _context23["catch"](10);
1738
- errorMessage = _context23.t0 instanceof Error ? _context23.t0.message : String(_context23.t0);
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:", _context23.t0);
1744
- throw _context23.t0;
1859
+ console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:", _context24.t0);
1860
+ throw _context24.t0;
1745
1861
  case 23:
1746
- _context23.next = 7;
1862
+ _context24.next = 7;
1747
1863
  break;
1748
1864
  case 25:
1749
- _context23.next = 30;
1865
+ _context24.next = 30;
1750
1866
  break;
1751
1867
  case 27:
1752
- _context23.prev = 27;
1753
- _context23.t1 = _context23["catch"](5);
1754
- _iterator2.e(_context23.t1);
1868
+ _context24.prev = 27;
1869
+ _context24.t1 = _context24["catch"](5);
1870
+ _iterator2.e(_context24.t1);
1755
1871
  case 30:
1756
- _context23.prev = 30;
1872
+ _context24.prev = 30;
1757
1873
  _iterator2.f();
1758
- return _context23.finish(30);
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 _context23.abrupt("return", registeredModules);
1884
+ return _context24.abrupt("return", registeredModules);
1769
1885
  case 36:
1770
1886
  case "end":
1771
- return _context23.stop();
1887
+ return _context24.stop();
1772
1888
  }
1773
- }, _callee23, this, [[5, 27, 30, 33], [10, 17]]);
1889
+ }, _callee24, this, [[5, 27, 30, 33], [10, 17]]);
1774
1890
  }));
1775
- function registerModules(_x25) {
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 _callee24(registeredModules, options) {
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 _callee24$(_context24) {
1791
- while (1) switch (_context24.prev = _context24.next) {
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
- _context24.prev = 5;
1920
+ _context25.prev = 5;
1805
1921
  _iterator3.s();
1806
1922
  case 7:
1807
1923
  if ((_step3 = _iterator3.n()).done) {
1808
- _context24.next = 40;
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
- _context24.next = 13;
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 _context24.abrupt("continue", 38);
1937
+ return _context25.abrupt("continue", 38);
1822
1938
  case 13:
1823
1939
  if (!(typeof module.preload === 'function')) {
1824
- _context24.next = 36;
1940
+ _context25.next = 36;
1825
1941
  break;
1826
1942
  }
1827
1943
  startTime = Date.now();
1828
- _context24.prev = 15;
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
- _context24.next = 20;
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
- _context24.next = 34;
1963
+ _context25.next = 34;
1848
1964
  break;
1849
1965
  case 27:
1850
- _context24.prev = 27;
1851
- _context24.t0 = _context24["catch"](15);
1966
+ _context25.prev = 27;
1967
+ _context25.t0 = _context25["catch"](15);
1852
1968
  _duration = Date.now() - startTime;
1853
- errorMessage = _context24.t0 instanceof Error ? _context24.t0.message : String(_context24.t0);
1854
- console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"), _context24.t0);
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
- _context24.next = 38;
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
- _context24.next = 7;
1990
+ _context25.next = 7;
1875
1991
  break;
1876
1992
  case 40:
1877
- _context24.next = 45;
1993
+ _context25.next = 45;
1878
1994
  break;
1879
1995
  case 42:
1880
- _context24.prev = 42;
1881
- _context24.t1 = _context24["catch"](5);
1882
- _iterator3.e(_context24.t1);
1996
+ _context25.prev = 42;
1997
+ _context25.t1 = _context25["catch"](5);
1998
+ _iterator3.e(_context25.t1);
1883
1999
  case 45:
1884
- _context24.prev = 45;
2000
+ _context25.prev = 45;
1885
2001
  _iterator3.f();
1886
- return _context24.finish(45);
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 _context24.stop();
2017
+ return _context25.stop();
1902
2018
  }
1903
- }, _callee24, this, [[5, 42, 45, 48], [15, 27]]);
2019
+ }, _callee25, this, [[5, 42, 45, 48], [15, 27]]);
1904
2020
  }));
1905
- function preloadModulesData(_x26, _x27) {
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 _callee25(moduleConfigs) {
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
- _args25 = arguments;
1928
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1929
- while (1) switch (_context25.prev = _context25.next) {
2043
+ _args26 = arguments;
2044
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2045
+ while (1) switch (_context26.prev = _context26.next) {
1930
2046
  case 0:
1931
- autoPreload = _args25.length > 1 && _args25[1] !== undefined ? _args25[1] : true;
1932
- options = _args25.length > 2 ? _args25[2] : undefined;
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
- _context25.next = 8;
2061
+ _context26.next = 8;
1946
2062
  return this.registerModules(moduleConfigs);
1947
2063
  case 8:
1948
- registeredModules = _context25.sent;
2064
+ registeredModules = _context26.sent;
1949
2065
  if (!autoPreload) {
1950
- _context25.next = 14;
2066
+ _context26.next = 14;
1951
2067
  break;
1952
2068
  }
1953
- _context25.next = 12;
2069
+ _context26.next = 12;
1954
2070
  return this.preloadModulesData(registeredModules, options);
1955
2071
  case 12:
1956
- _context25.next = 15;
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
- _context25.next = 17;
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 _context25.abrupt("return", registeredModules);
2106
+ return _context26.abrupt("return", registeredModules);
1991
2107
  case 23:
1992
2108
  case "end":
1993
- return _context25.stop();
2109
+ return _context26.stop();
1994
2110
  }
1995
- }, _callee25, this);
2111
+ }, _callee26, this);
1996
2112
  }));
1997
- function initialize(_x28) {
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 _callee26(ctx) {
2040
- var _ctx$task, _this$app4;
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 _callee26$(_context26) {
2043
- while (1) switch (_context26.prev = _context26.next) {
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
- _context26.next = 6;
2166
+ _context27.next = 6;
2051
2167
  break;
2052
2168
  }
2053
- return _context26.abrupt("return", this.taskFail('INVALID_PAYLOAD', '缺少 backendPath 或 data'));
2169
+ return _context27.abrupt("return", this.taskFail('INVALID_PAYLOAD', '缺少 backendPath 或 data'));
2054
2170
  case 6:
2055
- if ((_this$app4 = this.app) !== null && _this$app4 !== void 0 && _this$app4.request) {
2056
- _context26.next = 9;
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 _context26.abrupt("return", this.taskTimeout('app.request 不可用'));
2176
+ return _context27.abrupt("return", this.taskTimeout('app.request 不可用'));
2061
2177
  case 9:
2062
- _context26.prev = 9;
2063
- _context26.next = 12;
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 = _context26.sent;
2189
+ syncResult = _context27.sent;
2074
2190
  if (!syncResult.rejected) {
2075
- _context26.next = 16;
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 _context26.abrupt("return", this.taskFail('BACKEND_REJECTED', syncResult.message || '后端明确拒绝 checkout', syncResult.errorResponse));
2198
+ return _context27.abrupt("return", this.taskFail('BACKEND_REJECTED', syncResult.message || '后端明确拒绝 checkout', syncResult.errorResponse));
2083
2199
  case 16:
2084
- return _context26.abrupt("return", this.taskOk({
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
- _context26.prev = 19;
2090
- _context26.t0 = _context26["catch"](9);
2091
- backendError = this.extractBackendErrorResponse(_context26.t0);
2205
+ _context27.prev = 19;
2206
+ _context27.t0 = _context27["catch"](9);
2207
+ backendError = this.extractBackendErrorResponse(_context27.t0);
2092
2208
  if (!backendError) {
2093
- _context26.next = 26;
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 _context26.abrupt("return", this.taskFail('BACKEND_REJECTED', message, backendError));
2217
+ return _context27.abrupt("return", this.taskFail('BACKEND_REJECTED', message, backendError));
2102
2218
  case 26:
2103
- errorMessage = this.getUnknownErrorMessage(_context26.t0);
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(_context26.t0)
2223
+ error_detail: this.normalizeUnknownError(_context27.t0)
2108
2224
  });
2109
- return _context26.abrupt("return", this.taskTimeout(errorMessage));
2225
+ return _context27.abrupt("return", this.taskTimeout(errorMessage));
2110
2226
  case 29:
2111
2227
  case "end":
2112
- return _context26.stop();
2228
+ return _context27.stop();
2113
2229
  }
2114
- }, _callee26, this, [[9, 19]]);
2230
+ }, _callee27, this, [[9, 19]]);
2115
2231
  }));
2116
- function handleSyncSalesTask(_x29) {
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 _callee27(params) {
2125
- var _this$app5;
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 _callee27$(_context27) {
2128
- while (1) switch (_context27.prev = _context27.next) {
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
- _context27.next = 3;
2247
+ _context28.next = 3;
2132
2248
  return this.normalizeCheckoutSubmitData(params.data, title);
2133
2249
  case 3:
2134
- normalizedData = _context27.sent;
2135
- _context27.next = 6;
2250
+ normalizedData = _context28.sent;
2251
+ _context28.next = 6;
2136
2252
  return this.ensureCheckoutOrderNumbers(normalizedData, title);
2137
2253
  case 6:
2138
- checkoutData = _context27.sent;
2254
+ checkoutData = _context28.sent;
2139
2255
  remoteCheckoutData = this.omitCheckoutSyncMode(checkoutData);
2140
- if ((_this$app5 = this.app) !== null && _this$app5 !== void 0 && (_this$app5 = _this$app5.request) !== null && _this$app5 !== void 0 && _this$app5.post) {
2141
- _context27.next = 10;
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
- _context27.next = 12;
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 = _context27.sent;
2268
+ response = _context28.sent;
2153
2269
  if (!this.isCheckoutResponseRejected(response)) {
2154
- _context27.next = 15;
2270
+ _context28.next = 15;
2155
2271
  break;
2156
2272
  }
2157
- return _context27.abrupt("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
- _context27.next = 19;
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 = _context27.sent;
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
- _context27.next = 24;
2306
+ _context28.next = 24;
2191
2307
  break;
2192
2308
  }
2193
- _context27.next = 24;
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 _context27.abrupt("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 _context27.stop();
2327
+ return _context28.stop();
2212
2328
  }
2213
- }, _callee27, this);
2329
+ }, _callee28, this);
2214
2330
  }));
2215
- function runCheckoutSync(_x30) {
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 _callee28(params) {
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 _callee28$(_context28) {
2235
- while (1) switch (_context28.prev = _context28.next) {
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
- _context28.next = 9;
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
- _context28.next = 6;
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
- _context28.next = 19;
2376
+ _context29.next = 19;
2261
2377
  break;
2262
2378
  case 9:
2263
2379
  if (!(this.order && externalSaleNumber && typeof this.order.markOrderSyncedByExternalSaleNumber === 'function')) {
2264
- _context28.next = 18;
2380
+ _context29.next = 18;
2265
2381
  break;
2266
2382
  }
2267
2383
  patch = this.buildCheckoutSyncSuccessPatch(fresh);
2268
- _context28.next = 13;
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 = _context28.sent;
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
- _context28.next = 19;
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 _context28.abrupt("return", syncedOrder);
2410
+ return _context29.abrupt("return", syncedOrder);
2295
2411
  case 20:
2296
2412
  case "end":
2297
- return _context28.stop();
2413
+ return _context29.stop();
2298
2414
  }
2299
- }, _callee28, this);
2415
+ }, _callee29, this);
2300
2416
  }));
2301
- function persistSyncedCheckoutOrder(_x31) {
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 _callee29() {
2428
+ var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2313
2429
  var _this$core$context, errorMessage;
2314
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2315
- while (1) switch (_context29.prev = _context29.next) {
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
- _context29.next = 3;
2434
+ _context30.next = 3;
2319
2435
  break;
2320
2436
  }
2321
2437
  this.logInfo('setupProductsQuotationPriceBridge: Products 模块未注册');
2322
- return _context29.abrupt("return");
2438
+ return _context30.abrupt("return");
2323
2439
  case 3:
2324
2440
  if (this.schedule) {
2325
- _context29.next = 6;
2441
+ _context30.next = 6;
2326
2442
  break;
2327
2443
  }
2328
2444
  this.logInfo('setupProductsQuotationPriceBridge: Schedule 模块未注册');
2329
- return _context29.abrupt("return");
2445
+ return _context30.abrupt("return");
2330
2446
  case 6:
2331
- _context29.prev = 6;
2332
- _context29.next = 9;
2447
+ _context30.prev = 6;
2448
+ _context30.next = 9;
2333
2449
  return this.schedule.loadAllSchedule();
2334
2450
  case 9:
2335
2451
  this.products.clearPriceCache();
2336
- _context29.next = 12;
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
- _context29.next = 19;
2459
+ _context30.next = 19;
2344
2460
  break;
2345
2461
  case 15:
2346
- _context29.prev = 15;
2347
- _context29.t0 = _context29["catch"](6);
2348
- errorMessage = _context29.t0 instanceof Error ? _context29.t0.message : String(_context29.t0);
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 _context29.stop();
2470
+ return _context30.stop();
2355
2471
  }
2356
- }, _callee29, this, [[6, 15]]);
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 _callee30() {
2541
+ var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2426
2542
  var startTime, duration, _duration2, errorMessage;
2427
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2428
- while (1) switch (_context30.prev = _context30.next) {
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
- _context30.next = 3;
2547
+ _context31.next = 3;
2432
2548
  break;
2433
2549
  }
2434
2550
  this.logWarning('refreshProductsInBackground: Products 模块未注册');
2435
- return _context30.abrupt("return");
2551
+ return _context31.abrupt("return");
2436
2552
  case 3:
2437
2553
  this.logInfo('refreshProductsInBackground 开始');
2438
2554
  startTime = Date.now();
2439
- _context30.prev = 5;
2440
- _context30.next = 8;
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
- _context30.next = 18;
2563
+ _context31.next = 18;
2448
2564
  break;
2449
2565
  case 12:
2450
- _context30.prev = 12;
2451
- _context30.t0 = _context30["catch"](5);
2566
+ _context31.prev = 12;
2567
+ _context31.t0 = _context31["catch"](5);
2452
2568
  _duration2 = Date.now() - startTime;
2453
- errorMessage = _context30.t0 instanceof Error ? _context30.t0.message : String(_context30.t0);
2454
- console.error('[Server] refreshProductsInBackground 失败:', _context30.t0);
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 _context30.stop();
2577
+ return _context31.stop();
2462
2578
  }
2463
- }, _callee30, this, [[5, 12]]);
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 _callee31() {
2595
+ var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
2480
2596
  var startTime, duration, _duration3, errorMessage;
2481
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2482
- while (1) switch (_context31.prev = _context31.next) {
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
- _context31.next = 3;
2601
+ _context32.next = 3;
2486
2602
  break;
2487
2603
  }
2488
2604
  this.logWarning('refreshOrdersInBackground: Order 模块未注册');
2489
- return _context31.abrupt("return");
2605
+ return _context32.abrupt("return");
2490
2606
  case 3:
2491
2607
  this.logInfo('refreshOrdersInBackground 开始');
2492
2608
  startTime = Date.now();
2493
- _context31.prev = 5;
2494
- _context31.next = 8;
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
- _context31.next = 18;
2617
+ _context32.next = 18;
2502
2618
  break;
2503
2619
  case 12:
2504
- _context31.prev = 12;
2505
- _context31.t0 = _context31["catch"](5);
2620
+ _context32.prev = 12;
2621
+ _context32.t0 = _context32["catch"](5);
2506
2622
  _duration3 = Date.now() - startTime;
2507
- errorMessage = _context31.t0 instanceof Error ? _context31.t0.message : String(_context31.t0);
2508
- console.error('[Server] refreshOrdersInBackground 失败:', _context31.t0);
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 _context31.stop();
2631
+ return _context32.stop();
2516
2632
  }
2517
- }, _callee31, this, [[5, 12]]);
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 _callee32() {
2648
+ var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
2533
2649
  var clearTasks, moduleNames, errorMessage;
2534
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2535
- while (1) switch (_context32.prev = _context32.next) {
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
- _context32.next = 15;
2686
+ _context33.next = 15;
2571
2687
  break;
2572
2688
  }
2573
2689
  console.warn('[Server] 没有找到已注册的模块,无需清空');
2574
2690
  this.logWarning('没有找到已注册的模块,无需清空 IndexedDB');
2575
- return _context32.abrupt("return");
2691
+ return _context33.abrupt("return");
2576
2692
  case 15:
2577
2693
  this.logInfo('准备清空模块缓存', {
2578
2694
  moduleNames: moduleNames
2579
2695
  });
2580
- _context32.prev = 16;
2581
- _context32.next = 19;
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
- _context32.next = 29;
2704
+ _context33.next = 29;
2589
2705
  break;
2590
2706
  case 23:
2591
- _context32.prev = 23;
2592
- _context32.t0 = _context32["catch"](16);
2593
- errorMessage = _context32.t0 instanceof Error ? _context32.t0.message : String(_context32.t0);
2594
- console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context32.t0);
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 _context32.t0;
2715
+ throw _context33.t0;
2600
2716
  case 29:
2601
2717
  case "end":
2602
- return _context32.stop();
2718
+ return _context33.stop();
2603
2719
  }
2604
- }, _callee32, this, [[16, 23]]);
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 _callee33(method, path, params) {
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 _callee33$(_context33) {
2682
- while (1) switch (_context33.prev = _context33.next) {
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
- _context33.next = 6;
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
- _context33.prev = 6;
2703
- _context33.next = 9;
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 = _context33.sent;
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 _context33.abrupt("return", result);
2833
+ return _context34.abrupt("return", result);
2718
2834
  case 15:
2719
- _context33.prev = 15;
2720
- _context33.t0 = _context33["catch"](6);
2835
+ _context34.prev = 15;
2836
+ _context34.t0 = _context34["catch"](6);
2721
2837
  _duration4 = Date.now() - startTime;
2722
- errorMessage = _context33.t0 instanceof Error ? _context33.t0.message : String(_context33.t0);
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), _context33.t0);
2731
- throw _context33.t0;
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 _context33.stop();
2850
+ return _context34.stop();
2735
2851
  }
2736
- }, _callee33, this, [[6, 15]]);
2852
+ }, _callee34, this, [[6, 15]]);
2737
2853
  }));
2738
- function handleRoute(_x32, _x33, _x34) {
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 _callee35() {
2986
+ var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
2863
2987
  var _this6 = this;
2864
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2865
- while (1) switch (_context35.prev = _context35.next) {
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
- _context35.next = 2;
2992
+ _context36.next = 2;
2869
2993
  break;
2870
2994
  }
2871
- return _context35.abrupt("return", this.payment);
2995
+ return _context36.abrupt("return", this.payment);
2872
2996
  case 2:
2873
2997
  if (!this.paymentRouteModule) {
2874
- _context35.next = 4;
2998
+ _context36.next = 4;
2875
2999
  break;
2876
3000
  }
2877
- return _context35.abrupt("return", this.paymentRouteModule);
3001
+ return _context36.abrupt("return", this.paymentRouteModule);
2878
3002
  case 4:
2879
3003
  if (!this.paymentRouteModuleInFlight) {
2880
- _context35.next = 6;
3004
+ _context36.next = 6;
2881
3005
  break;
2882
3006
  }
2883
- return _context35.abrupt("return", this.paymentRouteModuleInFlight);
3007
+ return _context36.abrupt("return", this.paymentRouteModuleInFlight);
2884
3008
  case 6:
2885
- this.paymentRouteModuleInFlight = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
3009
+ this.paymentRouteModuleInFlight = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
2886
3010
  var module;
2887
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2888
- while (1) switch (_context34.prev = _context34.next) {
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
- _context34.next = 3;
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 _context34.abrupt("return", module);
3023
+ return _context35.abrupt("return", module);
2900
3024
  case 5:
2901
3025
  case "end":
2902
- return _context34.stop();
3026
+ return _context35.stop();
2903
3027
  }
2904
- }, _callee34);
3028
+ }, _callee35);
2905
3029
  }))().finally(function () {
2906
3030
  _this6.paymentRouteModuleInFlight = undefined;
2907
3031
  });
2908
- return _context35.abrupt("return", this.paymentRouteModuleInFlight);
3032
+ return _context36.abrupt("return", this.paymentRouteModuleInFlight);
2909
3033
  case 8:
2910
3034
  case "end":
2911
- return _context35.stop();
3035
+ return _context36.stop();
2912
3036
  }
2913
- }, _callee35, this);
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 _callee36(data) {
2924
- var _this$app6;
3047
+ var _fetchQuotationAvailableFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(data) {
3048
+ var _this$app7;
2925
3049
  var requester;
2926
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2927
- while (1) switch (_context36.prev = _context36.next) {
3050
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3051
+ while (1) switch (_context37.prev = _context37.next) {
2928
3052
  case 0:
2929
- requester = ((_this$app6 = this.app) === null || _this$app6 === void 0 ? void 0 : _this$app6.request) || this.core.getPlugin('request');
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
- _context36.next = 4;
3055
+ _context37.next = 4;
2932
3056
  break;
2933
3057
  }
2934
3058
  this.logError('fetchQuotationAvailableFromAPI: request 不可用');
2935
- return _context36.abrupt("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 _context36.abrupt("return", requester.get('/shop/quotation/available', data));
3068
+ return _context37.abrupt("return", requester.get('/shop/quotation/available', data));
2945
3069
  case 5:
2946
3070
  case "end":
2947
- return _context36.stop();
3071
+ return _context37.stop();
2948
3072
  }
2949
- }, _callee36, this);
3073
+ }, _callee37, this);
2950
3074
  }));
2951
- function fetchQuotationAvailableFromAPI(_x35) {
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 _callee37(kind, backendPath, data, config) {
2992
- var queryPayload, result, _ref53, callback, subscriberId, resetVisibleOrderIds, contextSignature, existing, shouldReset, visibleOrderIds, _iterator5, _step5, orderId;
2993
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
2994
- while (1) switch (_context37.prev = _context37.next) {
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
- _context37.next = 3;
3121
+ _context38.next = 3;
2998
3122
  return this.fetchSalesSearchFromAPI(backendPath, queryPayload);
2999
3123
  case 3:
3000
- result = _context37.sent;
3001
- _ref53 = config || {}, callback = _ref53.callback, subscriberId = _ref53.subscriberId, resetVisibleOrderIds = _ref53.resetVisibleOrderIds;
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 _context37.abrupt("return", result);
3156
+ return _context38.abrupt("return", result);
3033
3157
  case 7:
3034
3158
  case "end":
3035
- return _context37.stop();
3159
+ return _context38.stop();
3036
3160
  }
3037
- }, _callee37, this);
3161
+ }, _callee38, this);
3038
3162
  }));
3039
- function handleSalesSearchRequest(_x36, _x37, _x38, _x39) {
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 _callee38(backendPath, data) {
3055
- var _this$app7;
3056
- var _response$data3, _response$code, _response$status, _response$message, response, _payload, errorMessage;
3057
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3058
- while (1) switch (_context38.prev = _context38.next) {
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$app7 = this.app) !== null && _this$app7 !== void 0 && _this$app7.request) {
3061
- _context38.next = 3;
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 _context38.abrupt("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
- _context38.prev = 3;
3080
- _context38.next = 6;
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 = _context38.sent;
3086
- _payload = (_response$data3 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data3 !== void 0 ? _response$data3 : response;
3087
- return _context38.abrupt("return", {
3088
- code: (_response$code = response === null || response === void 0 ? void 0 : response.code) !== null && _response$code !== void 0 ? _response$code : 200,
3089
- status: (_response$status = response === null || response === void 0 ? void 0 : response.status) !== null && _response$status !== void 0 ? _response$status : true,
3090
- message: (_response$message = response === null || response === void 0 ? void 0 : response.message) !== null && _response$message !== void 0 ? _response$message : '',
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
- _context38.prev = 11;
3095
- _context38.t0 = _context38["catch"](3);
3096
- errorMessage = _context38.t0 instanceof Error ? _context38.t0.message : String(_context38.t0);
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 _context38.abrupt("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 _context38.stop();
3238
+ return _context39.stop();
3115
3239
  }
3116
- }, _callee38, this, [[3, 11]]);
3240
+ }, _callee39, this, [[3, 11]]);
3117
3241
  }));
3118
- function fetchSalesSearchFromAPI(_x40, _x41) {
3242
+ function fetchSalesSearchFromAPI(_x41, _x42) {
3119
3243
  return _fetchSalesSearchFromAPI.apply(this, arguments);
3120
3244
  }
3121
3245
  return fetchSalesSearchFromAPI;
@@ -3247,6 +3371,22 @@ var Server = /*#__PURE__*/function () {
3247
3371
  return text.split('T')[0].split(' ')[0] || null;
3248
3372
  }
3249
3373
 
3374
+ /**
3375
+ * 判断时间范围是否完整落在今天。
3376
+ *
3377
+ * @example
3378
+ * this.isRangeFullyToday('2026-04-15', '2026-04-15') // => true
3379
+ */
3380
+ }, {
3381
+ key: "isRangeFullyToday",
3382
+ value: function isRangeFullyToday(startRaw, endRaw) {
3383
+ var startDate = this.extractQueryDate(startRaw);
3384
+ var endDate = this.extractQueryDate(endRaw);
3385
+ if (!startDate || !endDate) return false;
3386
+ var today = dayjs().format('YYYY-MM-DD');
3387
+ return startDate === today && endDate === today;
3388
+ }
3389
+
3250
3390
  /**
3251
3391
  * 判断时间范围是否「开始和结束都不是今天」。
3252
3392
  *
@@ -3265,13 +3405,13 @@ var Server = /*#__PURE__*/function () {
3265
3405
 
3266
3406
  /**
3267
3407
  * 订单查询是否走本地:
3268
- * - start_time 与 end_time 都不是今天时,走远端;
3269
- * - 其余情况走本地。
3408
+ * - 仅当 start_time 与 end_time 都是今天时,走本地;
3409
+ * - 任意一端不是今天时,走云端,确保跨天查询能拉取非本地窗口数据。
3270
3410
  */
3271
3411
  }, {
3272
3412
  key: "shouldUseLocalOrderQuery",
3273
3413
  value: function shouldUseLocalOrderQuery(data) {
3274
- return !this.isRangeBothNotToday(data === null || data === void 0 ? void 0 : data.start_time, data === null || data === void 0 ? void 0 : data.end_time);
3414
+ return this.isRangeFullyToday(data === null || data === void 0 ? void 0 : data.start_time, data === null || data === void 0 ? void 0 : data.end_time);
3275
3415
  }
3276
3416
 
3277
3417
  /**
@@ -3620,18 +3760,18 @@ var Server = /*#__PURE__*/function () {
3620
3760
  }, {
3621
3761
  key: "fetchOrderListFromAPI",
3622
3762
  value: (function () {
3623
- var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(data) {
3624
- var _this$app8;
3625
- var _response$data4, response, _payload2, list, count, errorMessage;
3626
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3627
- while (1) switch (_context39.prev = _context39.next) {
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) {
3628
3768
  case 0:
3629
- if ((_this$app8 = this.app) !== null && _this$app8 !== void 0 && _this$app8.request) {
3630
- _context39.next = 3;
3769
+ if ((_this$app9 = this.app) !== null && _this$app9 !== void 0 && _this$app9.request) {
3770
+ _context40.next = 3;
3631
3771
  break;
3632
3772
  }
3633
3773
  this.logError('fetchOrderListFromAPI: app.request 不可用');
3634
- return _context39.abrupt("return", {
3774
+ return _context40.abrupt("return", {
3635
3775
  code: 500,
3636
3776
  message: 'app.request 不可用',
3637
3777
  data: {
@@ -3641,17 +3781,17 @@ var Server = /*#__PURE__*/function () {
3641
3781
  status: false
3642
3782
  });
3643
3783
  case 3:
3644
- _context39.prev = 3;
3645
- _context39.next = 6;
3784
+ _context40.prev = 3;
3785
+ _context40.next = 6;
3646
3786
  return this.app.request.post('/shop/order/v2/list', data, {
3647
3787
  isShopApi: true
3648
3788
  });
3649
3789
  case 6:
3650
- response = _context39.sent;
3651
- _payload2 = (_response$data4 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data4 !== void 0 ? _response$data4 : 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;
3652
3792
  list = Array.isArray(_payload2 === null || _payload2 === void 0 ? void 0 : _payload2.list) ? _payload2.list : [];
3653
3793
  count = typeof (_payload2 === null || _payload2 === void 0 ? void 0 : _payload2.count) === 'number' ? _payload2.count : list.length;
3654
- return _context39.abrupt("return", {
3794
+ return _context40.abrupt("return", {
3655
3795
  code: 200,
3656
3796
  data: _objectSpread(_objectSpread({}, _payload2), {}, {
3657
3797
  list: list,
@@ -3661,13 +3801,13 @@ var Server = /*#__PURE__*/function () {
3661
3801
  status: true
3662
3802
  });
3663
3803
  case 13:
3664
- _context39.prev = 13;
3665
- _context39.t0 = _context39["catch"](3);
3666
- errorMessage = _context39.t0 instanceof Error ? _context39.t0.message : String(_context39.t0);
3804
+ _context40.prev = 13;
3805
+ _context40.t0 = _context40["catch"](3);
3806
+ errorMessage = _context40.t0 instanceof Error ? _context40.t0.message : String(_context40.t0);
3667
3807
  this.logError('fetchOrderListFromAPI: 请求失败', {
3668
3808
  error: errorMessage
3669
3809
  });
3670
- return _context39.abrupt("return", {
3810
+ return _context40.abrupt("return", {
3671
3811
  code: 500,
3672
3812
  message: errorMessage,
3673
3813
  data: {
@@ -3678,11 +3818,11 @@ var Server = /*#__PURE__*/function () {
3678
3818
  });
3679
3819
  case 18:
3680
3820
  case "end":
3681
- return _context39.stop();
3821
+ return _context40.stop();
3682
3822
  }
3683
- }, _callee39, this, [[3, 13]]);
3823
+ }, _callee40, this, [[3, 13]]);
3684
3824
  }));
3685
- function fetchOrderListFromAPI(_x42) {
3825
+ function fetchOrderListFromAPI(_x43) {
3686
3826
  return _fetchOrderListFromAPI.apply(this, arguments);
3687
3827
  }
3688
3828
  return fetchOrderListFromAPI;
@@ -3694,17 +3834,17 @@ var Server = /*#__PURE__*/function () {
3694
3834
  }, {
3695
3835
  key: "fetchBookingListFromAPI",
3696
3836
  value: (function () {
3697
- var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(data) {
3837
+ var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(data) {
3698
3838
  var memoryCacheEnabled, withFields, requestPayload, cacheKey, cached, rawList, bookingResult, _bookingResult$list, errorMessage;
3699
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3700
- while (1) switch (_context40.prev = _context40.next) {
3839
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3840
+ while (1) switch (_context41.prev = _context41.next) {
3701
3841
  case 0:
3702
3842
  if (this.order) {
3703
- _context40.next = 3;
3843
+ _context41.next = 3;
3704
3844
  break;
3705
3845
  }
3706
3846
  this.logError('fetchBookingListFromAPI: Order 模块不可用');
3707
- return _context40.abrupt("return", {
3847
+ return _context41.abrupt("return", {
3708
3848
  code: 500,
3709
3849
  message: 'Order 模块不可用',
3710
3850
  data: {
@@ -3714,18 +3854,18 @@ var Server = /*#__PURE__*/function () {
3714
3854
  status: false
3715
3855
  });
3716
3856
  case 3:
3717
- _context40.prev = 3;
3857
+ _context41.prev = 3;
3718
3858
  memoryCacheEnabled = this.isBookingRemoteMemoryCacheEnabled(data);
3719
3859
  withFields = this.resolveBookingSalesWith(data);
3720
3860
  requestPayload = this.normalizeBookingRemoteQueryPayload(data, withFields);
3721
3861
  cacheKey = this.buildBookingRemoteCacheKey(requestPayload);
3722
3862
  if (!memoryCacheEnabled) {
3723
- _context40.next = 13;
3863
+ _context41.next = 13;
3724
3864
  break;
3725
3865
  }
3726
3866
  cached = this.readBookingRemoteCache(cacheKey);
3727
3867
  if (!cached) {
3728
- _context40.next = 13;
3868
+ _context41.next = 13;
3729
3869
  break;
3730
3870
  }
3731
3871
  this.logInfo('fetchBookingListFromAPI: 命中内存缓存', {
@@ -3733,14 +3873,14 @@ var Server = /*#__PURE__*/function () {
3733
3873
  listCount: cached.bookingResult.count,
3734
3874
  withFields: cached.withFields
3735
3875
  });
3736
- return _context40.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
3876
+ return _context41.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
3737
3877
  cache_hit: true
3738
3878
  }));
3739
3879
  case 13:
3740
- _context40.next = 15;
3880
+ _context41.next = 15;
3741
3881
  return this.order.fetchOrdersBySSE(requestPayload);
3742
3882
  case 15:
3743
- rawList = _context40.sent;
3883
+ rawList = _context41.sent;
3744
3884
  bookingResult = sortBookings(filterBookingsFromOrders(rawList, data), data); // DEBUG: 挂到 window 上方便排查 SSE → 日历数据丢失问题
3745
3885
  if (typeof globalThis !== 'undefined') {
3746
3886
  globalThis.__SSE_BOOKING_DEBUG__ = {
@@ -3787,15 +3927,15 @@ var Server = /*#__PURE__*/function () {
3787
3927
  cacheKey: cacheKey,
3788
3928
  withFields: withFields
3789
3929
  });
3790
- return _context40.abrupt("return", this.buildBookingResponse(bookingResult));
3930
+ return _context41.abrupt("return", this.buildBookingResponse(bookingResult));
3791
3931
  case 23:
3792
- _context40.prev = 23;
3793
- _context40.t0 = _context40["catch"](3);
3794
- errorMessage = _context40.t0 instanceof Error ? _context40.t0.message : String(_context40.t0);
3932
+ _context41.prev = 23;
3933
+ _context41.t0 = _context41["catch"](3);
3934
+ errorMessage = _context41.t0 instanceof Error ? _context41.t0.message : String(_context41.t0);
3795
3935
  this.logError('fetchBookingListFromAPI: SSE 请求失败', {
3796
3936
  error: errorMessage
3797
3937
  });
3798
- return _context40.abrupt("return", {
3938
+ return _context41.abrupt("return", {
3799
3939
  code: 500,
3800
3940
  message: errorMessage,
3801
3941
  data: {
@@ -3806,11 +3946,11 @@ var Server = /*#__PURE__*/function () {
3806
3946
  });
3807
3947
  case 28:
3808
3948
  case "end":
3809
- return _context40.stop();
3949
+ return _context41.stop();
3810
3950
  }
3811
- }, _callee40, this, [[3, 23]]);
3951
+ }, _callee41, this, [[3, 23]]);
3812
3952
  }));
3813
- function fetchBookingListFromAPI(_x43) {
3953
+ function fetchBookingListFromAPI(_x44) {
3814
3954
  return _fetchBookingListFromAPI.apply(this, arguments);
3815
3955
  }
3816
3956
  return fetchBookingListFromAPI;
@@ -3818,24 +3958,24 @@ var Server = /*#__PURE__*/function () {
3818
3958
  }, {
3819
3959
  key: "getDeviceTaskPlugin",
3820
3960
  value: function getDeviceTaskPlugin() {
3821
- var _this$app9, _this$app9$getPlugin;
3822
- return ((_this$app9 = this.app) === null || _this$app9 === void 0 || (_this$app9$getPlugin = _this$app9.getPlugin) === null || _this$app9$getPlugin === void 0 ? void 0 : _this$app9$getPlugin.call(_this$app9, 'deviceTask')) || null;
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;
3823
3963
  }
3824
3964
  }, {
3825
3965
  key: "getIdGeneratorPlugin",
3826
3966
  value: function getIdGeneratorPlugin() {
3827
- var _this$app10, _this$app10$getPlugin;
3828
- return ((_this$app10 = this.app) === null || _this$app10 === void 0 || (_this$app10$getPlugin = _this$app10.getPlugin) === null || _this$app10$getPlugin === void 0 ? void 0 : _this$app10$getPlugin.call(_this$app10, 'idGenerator')) || null;
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;
3829
3969
  }
3830
3970
  }, {
3831
3971
  key: "getAppData",
3832
3972
  value: function getAppData(key) {
3833
- var _this$core$getPlugin, _this$core$getPlugin$, _this$app11, _this$app11$getData, _this$app12, _this$app12$getStore, _this$app12$getStore$, _this$app12$getStore$2, _this$app13, _this$app13$getStore, _this$app13$getStore$, _this$app13$getStore$2, _this$app14, _this$app14$getStore, _this$app14$getStore$, _this$app14$getStore$2;
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;
3834
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);
3835
3975
  if (typeof getData === 'function') return getData(key);
3836
- var directValue = (_this$app11 = this.app) === null || _this$app11 === void 0 || (_this$app11$getData = _this$app11.getData) === null || _this$app11$getData === void 0 ? void 0 : _this$app11$getData.call(_this$app11, key);
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);
3837
3977
  if (directValue !== undefined) return directValue;
3838
- var coreData = ((_this$app12 = this.app) === null || _this$app12 === void 0 || (_this$app12 = _this$app12.models) === null || _this$app12 === void 0 || (_this$app12$getStore = _this$app12.getStore) === null || _this$app12$getStore === void 0 || (_this$app12$getStore$ = (_this$app12$getStore$2 = _this$app12$getStore.call(_this$app12)).getDataByModel) === null || _this$app12$getStore$ === void 0 ? void 0 : _this$app12$getStore$.call(_this$app12$getStore$2, 'core', 'core')) || ((_this$app13 = this.app) === null || _this$app13 === void 0 || (_this$app13 = _this$app13.data) === null || _this$app13 === void 0 || (_this$app13 = _this$app13.store) === null || _this$app13 === void 0 || (_this$app13$getStore = _this$app13.getStore) === null || _this$app13$getStore === void 0 || (_this$app13$getStore$ = (_this$app13$getStore$2 = _this$app13$getStore.call(_this$app13)).getDataByModel) === null || _this$app13$getStore$ === void 0 ? void 0 : _this$app13$getStore$.call(_this$app13$getStore$2, 'core', 'core')) || ((_this$app14 = this.app) === null || _this$app14 === void 0 || (_this$app14 = _this$app14.data) === null || _this$app14 === void 0 || (_this$app14 = _this$app14.store) === null || _this$app14 === void 0 || (_this$app14$getStore = _this$app14.getStore) === null || _this$app14$getStore === void 0 || (_this$app14$getStore$ = (_this$app14$getStore$2 = _this$app14$getStore.call(_this$app14)).getDataByModel) === null || _this$app14$getStore$ === void 0 || (_this$app14$getStore$ = _this$app14$getStore$.call(_this$app14$getStore$2, 'core')) === null || _this$app14$getStore$ === void 0 ? void 0 : _this$app14$getStore$.core);
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);
3839
3979
  return coreData === null || coreData === void 0 ? void 0 : coreData[key];
3840
3980
  }
3841
3981
  }, {
@@ -3886,32 +4026,32 @@ var Server = /*#__PURE__*/function () {
3886
4026
  }, {
3887
4027
  key: "getShortNumberOrDeviceId",
3888
4028
  value: function () {
3889
- var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
4029
+ var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
3890
4030
  var getAsyncIotDeviceInfo, res;
3891
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3892
- while (1) switch (_context41.prev = _context41.next) {
4031
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
4032
+ while (1) switch (_context42.prev = _context42.next) {
3893
4033
  case 0:
3894
4034
  getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
3895
4035
  if (!getAsyncIotDeviceInfo) {
3896
- _context41.next = 7;
4036
+ _context42.next = 7;
3897
4037
  break;
3898
4038
  }
3899
- _context41.next = 4;
4039
+ _context42.next = 4;
3900
4040
  return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
3901
4041
  case 4:
3902
- res = _context41.sent;
4042
+ res = _context42.sent;
3903
4043
  if (!(res !== null && res !== void 0 && res.short_number)) {
3904
- _context41.next = 7;
4044
+ _context42.next = 7;
3905
4045
  break;
3906
4046
  }
3907
- return _context41.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
4047
+ return _context42.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
3908
4048
  case 7:
3909
- return _context41.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
4049
+ return _context42.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
3910
4050
  case 8:
3911
4051
  case "end":
3912
- return _context41.stop();
4052
+ return _context42.stop();
3913
4053
  }
3914
- }, _callee41, this);
4054
+ }, _callee42, this);
3915
4055
  }));
3916
4056
  function getShortNumberOrDeviceId() {
3917
4057
  return _getShortNumberOrDeviceId.apply(this, arguments);
@@ -3938,16 +4078,16 @@ var Server = /*#__PURE__*/function () {
3938
4078
  }, {
3939
4079
  key: "normalizeCheckoutSubmitData",
3940
4080
  value: function () {
3941
- var _normalizeCheckoutSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(data, title) {
4081
+ var _normalizeCheckoutSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(data, title) {
3942
4082
  var next, externalSaleNumber, shouldClearLocalOrderId, hasCheckoutOrderNumbers, localOrder;
3943
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3944
- while (1) switch (_context42.prev = _context42.next) {
4083
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4084
+ while (1) switch (_context43.prev = _context43.next) {
3945
4085
  case 0:
3946
4086
  if (!(!data || _typeof(data) !== 'object')) {
3947
- _context42.next = 2;
4087
+ _context43.next = 2;
3948
4088
  break;
3949
4089
  }
3950
- return _context42.abrupt("return", data);
4090
+ return _context43.abrupt("return", data);
3951
4091
  case 2:
3952
4092
  next = _objectSpread({}, data);
3953
4093
  externalSaleNumber = next.external_sale_number;
@@ -3957,7 +4097,7 @@ var Server = /*#__PURE__*/function () {
3957
4097
  delete next.vouchers;
3958
4098
  hasCheckoutOrderNumbers = !this.isBlankCheckoutValue(next.shop_order_number) && !this.isBlankCheckoutValue(next.shop_full_order_number);
3959
4099
  if (!hasCheckoutOrderNumbers) {
3960
- _context42.next = 11;
4100
+ _context43.next = 11;
3961
4101
  break;
3962
4102
  }
3963
4103
  this.logInfo("".concat(title, ": checkout \u5DF2\u643A\u5E26\u8BA2\u5355\u53F7\uFF0C\u8DF3\u8FC7\u67E5\u91CD"), {
@@ -3967,10 +4107,10 @@ var Server = /*#__PURE__*/function () {
3967
4107
  shop_order_number: next.shop_order_number,
3968
4108
  shop_full_order_number: next.shop_full_order_number
3969
4109
  });
3970
- return _context42.abrupt("return", next);
4110
+ return _context43.abrupt("return", next);
3971
4111
  case 11:
3972
4112
  if (!this.isBlankCheckoutValue(externalSaleNumber)) {
3973
- _context42.next = 14;
4113
+ _context43.next = 14;
3974
4114
  break;
3975
4115
  }
3976
4116
  if (shouldClearLocalOrderId) {
@@ -3979,10 +4119,10 @@ var Server = /*#__PURE__*/function () {
3979
4119
  order_id: next.order_id
3980
4120
  });
3981
4121
  }
3982
- return _context42.abrupt("return", next);
4122
+ return _context43.abrupt("return", next);
3983
4123
  case 14:
3984
4124
  if (!(!this.order || typeof this.order.getLocalOrderFromMemoryByLookup !== 'function')) {
3985
- _context42.next = 17;
4125
+ _context43.next = 17;
3986
4126
  break;
3987
4127
  }
3988
4128
  if (shouldClearLocalOrderId) {
@@ -3991,12 +4131,12 @@ var Server = /*#__PURE__*/function () {
3991
4131
  external_sale_number: externalSaleNumber
3992
4132
  });
3993
4133
  }
3994
- return _context42.abrupt("return", next);
4134
+ return _context43.abrupt("return", next);
3995
4135
  case 17:
3996
- _context42.prev = 17;
4136
+ _context43.prev = 17;
3997
4137
  localOrder = this.order.getLocalOrderFromMemoryByLookup(externalSaleNumber);
3998
4138
  if (localOrder) {
3999
- _context42.next = 22;
4139
+ _context43.next = 22;
4000
4140
  break;
4001
4141
  }
4002
4142
  if (shouldClearLocalOrderId) {
@@ -4006,7 +4146,7 @@ var Server = /*#__PURE__*/function () {
4006
4146
  localOrderFound: false
4007
4147
  });
4008
4148
  }
4009
- return _context42.abrupt("return", next);
4149
+ return _context43.abrupt("return", next);
4010
4150
  case 22:
4011
4151
  if (this.isBlankCheckoutValue(next.shop_order_number)) {
4012
4152
  next.shop_order_number = localOrder.shop_order_number;
@@ -4023,23 +4163,23 @@ var Server = /*#__PURE__*/function () {
4023
4163
  shop_full_order_number: next.shop_full_order_number
4024
4164
  });
4025
4165
  // 删除 数据体中的 vouchers,对小票和后端来说他们不需要,这个字段只是单向同步给前端用的,而且目前对订单来说还没什么用
4026
- return _context42.abrupt("return", next);
4166
+ return _context43.abrupt("return", next);
4027
4167
  case 28:
4028
- _context42.prev = 28;
4029
- _context42.t0 = _context42["catch"](17);
4168
+ _context43.prev = 28;
4169
+ _context43.t0 = _context43["catch"](17);
4030
4170
  this.logWarning("".concat(title, ": checkout \u67E5\u627E\u672C\u5730\u8BA2\u5355\u5931\u8D25"), {
4031
4171
  external_sale_number: externalSaleNumber,
4032
- error: this.getUnknownErrorMessage(_context42.t0),
4033
- error_detail: this.normalizeUnknownError(_context42.t0)
4172
+ error: this.getUnknownErrorMessage(_context43.t0),
4173
+ error_detail: this.normalizeUnknownError(_context43.t0)
4034
4174
  });
4035
- return _context42.abrupt("return", next);
4175
+ return _context43.abrupt("return", next);
4036
4176
  case 32:
4037
4177
  case "end":
4038
- return _context42.stop();
4178
+ return _context43.stop();
4039
4179
  }
4040
- }, _callee42, this, [[17, 28]]);
4180
+ }, _callee43, this, [[17, 28]]);
4041
4181
  }));
4042
- function normalizeCheckoutSubmitData(_x44, _x45) {
4182
+ function normalizeCheckoutSubmitData(_x45, _x46) {
4043
4183
  return _normalizeCheckoutSubmitData.apply(this, arguments);
4044
4184
  }
4045
4185
  return normalizeCheckoutSubmitData;
@@ -4047,81 +4187,81 @@ var Server = /*#__PURE__*/function () {
4047
4187
  }, {
4048
4188
  key: "ensureCheckoutOrderNumbers",
4049
4189
  value: function () {
4050
- var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(data, title) {
4190
+ var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(data, title) {
4051
4191
  var next, needsShopOrderNumber, needsShopFullOrderNumber, idGenerator;
4052
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4053
- while (1) switch (_context43.prev = _context43.next) {
4192
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4193
+ while (1) switch (_context44.prev = _context44.next) {
4054
4194
  case 0:
4055
4195
  if (!(!data || _typeof(data) !== 'object')) {
4056
- _context43.next = 2;
4196
+ _context44.next = 2;
4057
4197
  break;
4058
4198
  }
4059
- return _context43.abrupt("return", data);
4199
+ return _context44.abrupt("return", data);
4060
4200
  case 2:
4061
4201
  next = _objectSpread({}, data);
4062
4202
  needsShopOrderNumber = next.shop_order_number === undefined || next.shop_order_number === null || next.shop_order_number === '';
4063
4203
  needsShopFullOrderNumber = next.shop_full_order_number === undefined || next.shop_full_order_number === null || next.shop_full_order_number === '';
4064
4204
  if (!(!needsShopOrderNumber && !needsShopFullOrderNumber)) {
4065
- _context43.next = 7;
4205
+ _context44.next = 7;
4066
4206
  break;
4067
4207
  }
4068
- return _context43.abrupt("return", next);
4208
+ return _context44.abrupt("return", next);
4069
4209
  case 7:
4070
4210
  idGenerator = this.getIdGeneratorPlugin();
4071
4211
  if (idGenerator) {
4072
- _context43.next = 11;
4212
+ _context44.next = 11;
4073
4213
  break;
4074
4214
  }
4075
4215
  this.logWarning("".concat(title, ": idGenerator \u63D2\u4EF6\u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u751F\u6210\u8BA2\u5355\u53F7"), {
4076
4216
  needsShopOrderNumber: needsShopOrderNumber,
4077
4217
  needsShopFullOrderNumber: needsShopFullOrderNumber
4078
4218
  });
4079
- return _context43.abrupt("return", next);
4219
+ return _context44.abrupt("return", next);
4080
4220
  case 11:
4081
- _context43.prev = 11;
4221
+ _context44.prev = 11;
4082
4222
  if (!(needsShopOrderNumber && idGenerator.generateShopOrderNumber)) {
4083
- _context43.next = 16;
4223
+ _context44.next = 16;
4084
4224
  break;
4085
4225
  }
4086
- _context43.next = 15;
4226
+ _context44.next = 15;
4087
4227
  return idGenerator.generateShopOrderNumber({
4088
4228
  biz: next.business_code || 'ticket'
4089
4229
  });
4090
4230
  case 15:
4091
- next.shop_order_number = _context43.sent;
4231
+ next.shop_order_number = _context44.sent;
4092
4232
  case 16:
4093
4233
  if (!(needsShopFullOrderNumber && idGenerator.generateReceiptId)) {
4094
- _context43.next = 20;
4234
+ _context44.next = 20;
4095
4235
  break;
4096
4236
  }
4097
- _context43.next = 19;
4237
+ _context44.next = 19;
4098
4238
  return idGenerator.generateReceiptId({
4099
4239
  biz: next.business_code || 'ticket'
4100
4240
  });
4101
4241
  case 19:
4102
- next.shop_full_order_number = _context43.sent;
4242
+ next.shop_full_order_number = _context44.sent;
4103
4243
  case 20:
4104
4244
  this.logInfo("".concat(title, ": checkout \u8BA2\u5355\u53F7\u5DF2\u51C6\u5907"), {
4105
4245
  shop_order_number: next.shop_order_number,
4106
4246
  shop_full_order_number: next.shop_full_order_number
4107
4247
  });
4108
- _context43.next = 26;
4248
+ _context44.next = 26;
4109
4249
  break;
4110
4250
  case 23:
4111
- _context43.prev = 23;
4112
- _context43.t0 = _context43["catch"](11);
4251
+ _context44.prev = 23;
4252
+ _context44.t0 = _context44["catch"](11);
4113
4253
  this.logError("".concat(title, ": \u751F\u6210 checkout \u8BA2\u5355\u53F7\u5931\u8D25"), {
4114
- error: _context43.t0 instanceof Error ? _context43.t0.message : String(_context43.t0)
4254
+ error: _context44.t0 instanceof Error ? _context44.t0.message : String(_context44.t0)
4115
4255
  });
4116
4256
  case 26:
4117
- return _context43.abrupt("return", next);
4257
+ return _context44.abrupt("return", next);
4118
4258
  case 27:
4119
4259
  case "end":
4120
- return _context43.stop();
4260
+ return _context44.stop();
4121
4261
  }
4122
- }, _callee43, this, [[11, 23]]);
4262
+ }, _callee44, this, [[11, 23]]);
4123
4263
  }));
4124
- function ensureCheckoutOrderNumbers(_x46, _x47) {
4264
+ function ensureCheckoutOrderNumbers(_x47, _x48) {
4125
4265
  return _ensureCheckoutOrderNumbers.apply(this, arguments);
4126
4266
  }
4127
4267
  return ensureCheckoutOrderNumbers;
@@ -4129,27 +4269,27 @@ var Server = /*#__PURE__*/function () {
4129
4269
  }, {
4130
4270
  key: "dispatchCheckoutSyncTask",
4131
4271
  value: function () {
4132
- var _dispatchCheckoutSyncTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
4272
+ var _dispatchCheckoutSyncTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
4133
4273
  var deviceTask, debugDeviceId, debugIdempotencyKey, _params$data, _params$data2, _params$data3, _params$data4, result;
4134
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4135
- while (1) switch (_context44.prev = _context44.next) {
4274
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
4275
+ while (1) switch (_context45.prev = _context45.next) {
4136
4276
  case 0:
4137
4277
  this.registerDeviceTaskActions();
4138
4278
  deviceTask = this.getDeviceTaskPlugin();
4139
- _context44.next = 4;
4279
+ _context45.next = 4;
4140
4280
  return this.getShortNumberOrDeviceId();
4141
4281
  case 4:
4142
- debugDeviceId = _context44.sent;
4282
+ debugDeviceId = _context45.sent;
4143
4283
  debugIdempotencyKey = this.buildCheckoutTaskIdempotencyKey(params.data);
4144
4284
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
4145
- _context44.next = 9;
4285
+ _context45.next = 9;
4146
4286
  break;
4147
4287
  }
4148
4288
  this.logError("".concat(params.title, ": deviceTask.dispatch \u4E0D\u53EF\u7528"));
4149
- return _context44.abrupt("return");
4289
+ return _context45.abrupt("return");
4150
4290
  case 9:
4151
- _context44.prev = 9;
4152
- _context44.next = 12;
4291
+ _context45.prev = 9;
4292
+ _context45.next = 12;
4153
4293
  return deviceTask.dispatch({
4154
4294
  action: 'sync_sales',
4155
4295
  device_id: debugDeviceId,
@@ -4167,27 +4307,27 @@ var Server = /*#__PURE__*/function () {
4167
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)
4168
4308
  });
4169
4309
  case 12:
4170
- result = _context44.sent;
4310
+ result = _context45.sent;
4171
4311
  this.logInfo("".concat(params.title, ": sync_sales \u4EFB\u52A1\u5DF2\u6D3E\u53D1"), {
4172
4312
  uuid: result === null || result === void 0 ? void 0 : result.uuid,
4173
4313
  status: result === null || result === void 0 ? void 0 : result.status,
4174
4314
  reused: result === null || result === void 0 ? void 0 : result.reused
4175
4315
  });
4176
- _context44.next = 19;
4316
+ _context45.next = 19;
4177
4317
  break;
4178
4318
  case 16:
4179
- _context44.prev = 16;
4180
- _context44.t0 = _context44["catch"](9);
4319
+ _context45.prev = 16;
4320
+ _context45.t0 = _context45["catch"](9);
4181
4321
  this.logError("".concat(params.title, ": \u6D3E\u53D1 sync_sales \u4EFB\u52A1\u5931\u8D25"), {
4182
- error: _context44.t0 instanceof Error ? _context44.t0.message : String(_context44.t0)
4322
+ error: _context45.t0 instanceof Error ? _context45.t0.message : String(_context45.t0)
4183
4323
  });
4184
4324
  case 19:
4185
4325
  case "end":
4186
- return _context44.stop();
4326
+ return _context45.stop();
4187
4327
  }
4188
- }, _callee44, this, [[9, 16]]);
4328
+ }, _callee45, this, [[9, 16]]);
4189
4329
  }));
4190
- function dispatchCheckoutSyncTask(_x48) {
4330
+ function dispatchCheckoutSyncTask(_x49) {
4191
4331
  return _dispatchCheckoutSyncTask.apply(this, arguments);
4192
4332
  }
4193
4333
  return dispatchCheckoutSyncTask;
@@ -4195,34 +4335,36 @@ var Server = /*#__PURE__*/function () {
4195
4335
  }, {
4196
4336
  key: "dispatchPrintOtherReceiptTask",
4197
4337
  value: function () {
4198
- var _dispatchPrintOtherReceiptTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
4338
+ var _dispatchPrintOtherReceiptTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
4199
4339
  var deviceTask, _params$deviceId, _params$syncedOrder, _params$syncedOrder2, _params$syncedOrder3, printIdentity, deviceId;
4200
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
4201
- while (1) switch (_context45.prev = _context45.next) {
4340
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
4341
+ while (1) switch (_context46.prev = _context46.next) {
4202
4342
  case 0:
4203
4343
  deviceTask = this.getDeviceTaskPlugin();
4204
4344
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
4205
- _context45.next = 4;
4345
+ _context46.next = 4;
4206
4346
  break;
4207
4347
  }
4208
4348
  this.logWarning('dispatchPrintOtherReceiptTask: deviceTask.dispatch 不可用');
4209
- return _context45.abrupt("return");
4349
+ return _context46.abrupt("return");
4210
4350
  case 4:
4211
- _context45.prev = 4;
4351
+ _context46.prev = 4;
4212
4352
  printIdentity = this.getPrintOrderIdentity(params.syncedOrder);
4213
- _context45.next = 8;
4353
+ _context46.next = 8;
4214
4354
  return this.getShortNumberOrDeviceId();
4215
4355
  case 8:
4216
- deviceId = _context45.sent;
4217
- _context45.next = 11;
4356
+ deviceId = _context46.sent;
4357
+ _context46.next = 11;
4218
4358
  return deviceTask.dispatch({
4219
4359
  action: 'print_all',
4220
4360
  device_id: (_params$deviceId = params.deviceId) !== null && _params$deviceId !== void 0 ? _params$deviceId : deviceId,
4221
4361
  payload: {
4222
- type: params.receiptOnly ? '0' : '99',
4362
+ type: params.isManualPrint ? '0' : '99',
4223
4363
  data: params.receiptOnly ? {
4224
4364
  order_id: printIdentity,
4225
- 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
4226
4368
  } : {
4227
4369
  order_id: printIdentity,
4228
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,
@@ -4233,27 +4375,27 @@ var Server = /*#__PURE__*/function () {
4233
4375
  idempotency_key: this.buildPrintOtherReceiptIdempotencyKey(params.syncedOrder, {
4234
4376
  receiptOnly: params.receiptOnly
4235
4377
  }),
4236
- name: '打印转发',
4378
+ name: 'PRINT_V1',
4237
4379
  source: 'server',
4238
4380
  source_type: 'order',
4239
4381
  source_id: printIdentity
4240
4382
  });
4241
4383
  case 11:
4242
- _context45.next = 16;
4384
+ _context46.next = 16;
4243
4385
  break;
4244
4386
  case 13:
4245
- _context45.prev = 13;
4246
- _context45.t0 = _context45["catch"](4);
4387
+ _context46.prev = 13;
4388
+ _context46.t0 = _context46["catch"](4);
4247
4389
  this.logError('dispatchPrintOtherReceiptTask: 派发失败', {
4248
- error: _context45.t0 instanceof Error ? _context45.t0.message : String(_context45.t0)
4390
+ error: _context46.t0 instanceof Error ? _context46.t0.message : String(_context46.t0)
4249
4391
  });
4250
4392
  case 16:
4251
4393
  case "end":
4252
- return _context45.stop();
4394
+ return _context46.stop();
4253
4395
  }
4254
- }, _callee45, this, [[4, 13]]);
4396
+ }, _callee46, this, [[4, 13]]);
4255
4397
  }));
4256
- function dispatchPrintOtherReceiptTask(_x49) {
4398
+ function dispatchPrintOtherReceiptTask(_x50) {
4257
4399
  return _dispatchPrintOtherReceiptTask.apply(this, arguments);
4258
4400
  }
4259
4401
  return dispatchPrintOtherReceiptTask;
@@ -4273,32 +4415,32 @@ var Server = /*#__PURE__*/function () {
4273
4415
  }, {
4274
4416
  key: "dispatchLocalReceiptPrint",
4275
4417
  value: function () {
4276
- var _dispatchLocalReceiptPrint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
4418
+ var _dispatchLocalReceiptPrint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
4277
4419
  var _payment_info;
4278
4420
  var printableOrder;
4279
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
4280
- while (1) switch (_context46.prev = _context46.next) {
4421
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
4422
+ while (1) switch (_context47.prev = _context47.next) {
4281
4423
  case 0:
4282
4424
  if (!(params.requireFullyPaid && !this.isSalesOrderFullyPaid(params.order))) {
4283
- _context46.next = 2;
4425
+ _context47.next = 2;
4284
4426
  break;
4285
4427
  }
4286
- return _context46.abrupt("return", {
4428
+ return _context47.abrupt("return", {
4287
4429
  printed: false,
4288
4430
  order: params.order
4289
4431
  });
4290
4432
  case 2:
4291
- _context46.next = 4;
4433
+ _context47.next = 4;
4292
4434
  return this.withLocalSmallTicketData(params.order, {
4293
4435
  requireFullyPaid: params.requireFullyPaid
4294
4436
  });
4295
4437
  case 4:
4296
- printableOrder = _context46.sent;
4438
+ printableOrder = _context47.sent;
4297
4439
  if (hasSmallTicketData((_payment_info = printableOrder.payment_info) === null || _payment_info === void 0 ? void 0 : _payment_info.small_ticket_data)) {
4298
- _context46.next = 7;
4440
+ _context47.next = 7;
4299
4441
  break;
4300
4442
  }
4301
- return _context46.abrupt("return", {
4443
+ return _context47.abrupt("return", {
4302
4444
  printed: false,
4303
4445
  order: printableOrder
4304
4446
  });
@@ -4308,25 +4450,26 @@ var Server = /*#__PURE__*/function () {
4308
4450
  printableOrder: printableOrder,
4309
4451
  response: params.response
4310
4452
  });
4311
- _context46.next = 10;
4453
+ _context47.next = 10;
4312
4454
  return this.dispatchPrintOtherReceiptTask({
4313
4455
  checkoutData: params.checkoutData,
4314
4456
  syncedOrder: printableOrder,
4315
4457
  response: params.response,
4316
- receiptOnly: true
4458
+ receiptOnly: true,
4459
+ isManualPrint: params.isManualPrint
4317
4460
  });
4318
4461
  case 10:
4319
- return _context46.abrupt("return", {
4462
+ return _context47.abrupt("return", {
4320
4463
  printed: true,
4321
4464
  order: printableOrder
4322
4465
  });
4323
4466
  case 11:
4324
4467
  case "end":
4325
- return _context46.stop();
4468
+ return _context47.stop();
4326
4469
  }
4327
- }, _callee46, this);
4470
+ }, _callee47, this);
4328
4471
  }));
4329
- function dispatchLocalReceiptPrint(_x50) {
4472
+ function dispatchLocalReceiptPrint(_x51) {
4330
4473
  return _dispatchLocalReceiptPrint.apply(this, arguments);
4331
4474
  }
4332
4475
  return dispatchLocalReceiptPrint;
@@ -4350,13 +4493,174 @@ var Server = /*#__PURE__*/function () {
4350
4493
  }
4351
4494
  return undefined;
4352
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
+ }()
4353
4657
  }, {
4354
4658
  key: "handleOrderCheckoutSubmit",
4355
4659
  value: function () {
4356
- var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
4660
+ var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
4357
4661
  var backendPath, data, title, normalizedData, checkoutData, pendingResult, pendingOrder;
4358
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
4359
- while (1) switch (_context47.prev = _context47.next) {
4662
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
4663
+ while (1) switch (_context49.prev = _context49.next) {
4360
4664
  case 0:
4361
4665
  backendPath = params.backendPath, data = params.data, title = params.title;
4362
4666
  this.logInfo("".concat(title, ": \u5F00\u59CB\u5904\u7406"), {
@@ -4366,24 +4670,24 @@ var Server = /*#__PURE__*/function () {
4366
4670
  order_number: data === null || data === void 0 ? void 0 : data.order_number
4367
4671
  });
4368
4672
  if (!(data !== null && data !== void 0 && data.sync_mode || data !== null && data !== void 0 && data.syncMode)) {
4369
- _context47.next = 4;
4673
+ _context49.next = 4;
4370
4674
  break;
4371
4675
  }
4372
- return _context47.abrupt("return", this.handleSyncCheckoutSubmit({
4676
+ return _context49.abrupt("return", this.handleSyncCheckoutSubmit({
4373
4677
  backendPath: backendPath,
4374
4678
  data: data,
4375
4679
  title: title
4376
4680
  }));
4377
4681
  case 4:
4378
- _context47.next = 6;
4682
+ _context49.next = 6;
4379
4683
  return this.normalizeCheckoutSubmitData(data, title);
4380
4684
  case 6:
4381
- normalizedData = _context47.sent;
4382
- _context47.next = 9;
4685
+ normalizedData = _context49.sent;
4686
+ _context49.next = 9;
4383
4687
  return this.ensureCheckoutOrderNumbers(normalizedData, title);
4384
4688
  case 9:
4385
- checkoutData = _context47.sent;
4386
- _context47.next = 12;
4689
+ checkoutData = _context49.sent;
4690
+ _context49.next = 12;
4387
4691
  return this.handlePendingSyncCheckoutOrder({
4388
4692
  backendPath: backendPath,
4389
4693
  data: checkoutData,
@@ -4391,9 +4695,9 @@ var Server = /*#__PURE__*/function () {
4391
4695
  reason: 'checkout 已转入设备任务同步'
4392
4696
  });
4393
4697
  case 12:
4394
- pendingResult = _context47.sent;
4698
+ pendingResult = _context49.sent;
4395
4699
  if (!((pendingResult === null || pendingResult === void 0 ? void 0 : pendingResult.status) === true)) {
4396
- _context47.next = 20;
4700
+ _context49.next = 20;
4397
4701
  break;
4398
4702
  }
4399
4703
  pendingOrder = pendingResult.data;
@@ -4401,10 +4705,10 @@ var Server = /*#__PURE__*/function () {
4401
4705
  // TODO 这里先加个兼容,只有 type 为 virtual 才走打印
4402
4706
  // 后期需要迁移到 picoding ,根据工作流配置
4403
4707
  checkoutData.type === 'virtual')) {
4404
- _context47.next = 18;
4708
+ _context49.next = 18;
4405
4709
  break;
4406
4710
  }
4407
- _context47.next = 18;
4711
+ _context49.next = 18;
4408
4712
  return this.dispatchLocalReceiptPrint({
4409
4713
  checkoutData: checkoutData,
4410
4714
  order: pendingOrder,
@@ -4412,7 +4716,7 @@ var Server = /*#__PURE__*/function () {
4412
4716
  requireFullyPaid: true
4413
4717
  });
4414
4718
  case 18:
4415
- _context47.next = 20;
4719
+ _context49.next = 20;
4416
4720
  return this.dispatchCheckoutSyncTask({
4417
4721
  backendPath: backendPath,
4418
4722
  data: checkoutData,
@@ -4420,23 +4724,23 @@ var Server = /*#__PURE__*/function () {
4420
4724
  });
4421
4725
  case 20:
4422
4726
  if (pendingResult.data.order_id) {
4423
- _context47.next = 22;
4727
+ _context49.next = 22;
4424
4728
  break;
4425
4729
  }
4426
- return _context47.abrupt("return", _objectSpread(_objectSpread({}, pendingResult), {}, {
4730
+ return _context49.abrupt("return", _objectSpread(_objectSpread({}, pendingResult), {}, {
4427
4731
  data: _objectSpread(_objectSpread({}, pendingResult.data), {}, {
4428
4732
  order_id: pendingResult.data.external_sale_number
4429
4733
  })
4430
4734
  }));
4431
4735
  case 22:
4432
- return _context47.abrupt("return", pendingResult);
4736
+ return _context49.abrupt("return", pendingResult);
4433
4737
  case 23:
4434
4738
  case "end":
4435
- return _context47.stop();
4739
+ return _context49.stop();
4436
4740
  }
4437
- }, _callee47, this);
4741
+ }, _callee49, this);
4438
4742
  }));
4439
- function handleOrderCheckoutSubmit(_x51) {
4743
+ function handleOrderCheckoutSubmit(_x54) {
4440
4744
  return _handleOrderCheckoutSubmit.apply(this, arguments);
4441
4745
  }
4442
4746
  return handleOrderCheckoutSubmit;
@@ -4444,27 +4748,27 @@ var Server = /*#__PURE__*/function () {
4444
4748
  }, {
4445
4749
  key: "handleSyncCheckoutSubmit",
4446
4750
  value: function () {
4447
- var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
4448
- var _this$app15;
4751
+ var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
4752
+ var _this$app16;
4449
4753
  var backendPath, data, title, syncResult, _normalized$data, normalized, backendError, _normalized$data2, _normalized, message;
4450
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
4451
- while (1) switch (_context48.prev = _context48.next) {
4754
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
4755
+ while (1) switch (_context50.prev = _context50.next) {
4452
4756
  case 0:
4453
4757
  backendPath = params.backendPath, data = params.data, title = params.title;
4454
- if ((_this$app15 = this.app) !== null && _this$app15 !== void 0 && (_this$app15 = _this$app15.request) !== null && _this$app15 !== void 0 && _this$app15.post) {
4455
- _context48.next = 4;
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;
4456
4760
  break;
4457
4761
  }
4458
4762
  this.logError("".concat(title, ": sync checkout app.request \u4E0D\u53EF\u7528"));
4459
- return _context48.abrupt("return", {
4763
+ return _context50.abrupt("return", {
4460
4764
  code: 500,
4461
4765
  status: false,
4462
4766
  message: 'app.request 不可用',
4463
4767
  data: null
4464
4768
  });
4465
4769
  case 4:
4466
- _context48.prev = 4;
4467
- _context48.next = 7;
4770
+ _context50.prev = 4;
4771
+ _context50.next = 7;
4468
4772
  return this.runCheckoutSync({
4469
4773
  backendPath: backendPath,
4470
4774
  data: data,
@@ -4472,41 +4776,41 @@ var Server = /*#__PURE__*/function () {
4472
4776
  persistCheckoutDataWithResponse: true
4473
4777
  });
4474
4778
  case 7:
4475
- syncResult = _context48.sent;
4779
+ syncResult = _context50.sent;
4476
4780
  if (!syncResult.rejected) {
4477
- _context48.next = 11;
4781
+ _context50.next = 11;
4478
4782
  break;
4479
4783
  }
4480
4784
  normalized = this.normalizeCheckoutResponse(syncResult.errorResponse);
4481
- return _context48.abrupt("return", _objectSpread(_objectSpread({}, normalized), {}, {
4785
+ return _context50.abrupt("return", _objectSpread(_objectSpread({}, normalized), {}, {
4482
4786
  status: false,
4483
4787
  message: syncResult.message || (normalized === null || normalized === void 0 ? void 0 : normalized.message) || '后端明确拒绝 checkout',
4484
4788
  data: (_normalized$data = normalized === null || normalized === void 0 ? void 0 : normalized.data) !== null && _normalized$data !== void 0 ? _normalized$data : null
4485
4789
  }));
4486
4790
  case 11:
4487
- return _context48.abrupt("return", this.withSyncedOrderIdInCheckoutResponse(syncResult.normalizedResponse, syncResult.syncedOrder));
4791
+ return _context50.abrupt("return", this.withSyncedOrderIdInCheckoutResponse(syncResult.normalizedResponse, syncResult.syncedOrder));
4488
4792
  case 14:
4489
- _context48.prev = 14;
4490
- _context48.t0 = _context48["catch"](4);
4491
- backendError = this.extractBackendErrorResponse(_context48.t0);
4793
+ _context50.prev = 14;
4794
+ _context50.t0 = _context50["catch"](4);
4795
+ backendError = this.extractBackendErrorResponse(_context50.t0);
4492
4796
  if (!backendError) {
4493
- _context48.next = 20;
4797
+ _context50.next = 20;
4494
4798
  break;
4495
4799
  }
4496
4800
  _normalized = this.normalizeCheckoutResponse(backendError);
4497
- return _context48.abrupt("return", _objectSpread(_objectSpread({}, _normalized), {}, {
4801
+ return _context50.abrupt("return", _objectSpread(_objectSpread({}, _normalized), {}, {
4498
4802
  status: false,
4499
4803
  message: (backendError === null || backendError === void 0 ? void 0 : backendError.message) || (_normalized === null || _normalized === void 0 ? void 0 : _normalized.message) || '后端明确拒绝 checkout',
4500
4804
  data: (_normalized$data2 = _normalized === null || _normalized === void 0 ? void 0 : _normalized.data) !== null && _normalized$data2 !== void 0 ? _normalized$data2 : null
4501
4805
  }));
4502
4806
  case 20:
4503
- message = this.getUnknownErrorMessage(_context48.t0);
4807
+ message = this.getUnknownErrorMessage(_context50.t0);
4504
4808
  this.logError("".concat(title, ": sync checkout \u8BF7\u6C42\u672A\u660E\u786E\u6210\u529F"), {
4505
4809
  backendPath: backendPath,
4506
4810
  error: message,
4507
- error_detail: this.normalizeUnknownError(_context48.t0)
4811
+ error_detail: this.normalizeUnknownError(_context50.t0)
4508
4812
  });
4509
- return _context48.abrupt("return", {
4813
+ return _context50.abrupt("return", {
4510
4814
  code: 500,
4511
4815
  status: false,
4512
4816
  message: message,
@@ -4514,11 +4818,11 @@ var Server = /*#__PURE__*/function () {
4514
4818
  });
4515
4819
  case 23:
4516
4820
  case "end":
4517
- return _context48.stop();
4821
+ return _context50.stop();
4518
4822
  }
4519
- }, _callee48, this, [[4, 14]]);
4823
+ }, _callee50, this, [[4, 14]]);
4520
4824
  }));
4521
- function handleSyncCheckoutSubmit(_x52) {
4825
+ function handleSyncCheckoutSubmit(_x55) {
4522
4826
  return _handleSyncCheckoutSubmit.apply(this, arguments);
4523
4827
  }
4524
4828
  return handleSyncCheckoutSubmit;
@@ -4526,26 +4830,26 @@ var Server = /*#__PURE__*/function () {
4526
4830
  }, {
4527
4831
  key: "handlePendingSyncCheckoutOrder",
4528
4832
  value: function () {
4529
- var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
4833
+ var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
4530
4834
  var _this10 = this;
4531
4835
  var backendPath, data, title, reason, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
4532
- return _regeneratorRuntime().wrap(function _callee49$(_context49) {
4533
- while (1) switch (_context49.prev = _context49.next) {
4836
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
4837
+ while (1) switch (_context51.prev = _context51.next) {
4534
4838
  case 0:
4535
4839
  backendPath = params.backendPath, data = params.data, title = params.title, reason = params.reason;
4536
- _context49.next = 3;
4840
+ _context51.next = 3;
4537
4841
  return this.buildPendingSyncCheckoutOrder(data);
4538
4842
  case 3:
4539
- pendingOrder = _context49.sent;
4843
+ pendingOrder = _context51.sent;
4540
4844
  if (pendingOrder) {
4541
- _context49.next = 7;
4845
+ _context51.next = 7;
4542
4846
  break;
4543
4847
  }
4544
4848
  this.logError("".concat(title, ": checkout \u5931\u8D25\u4E14\u8BA2\u5355\u7F3A\u5C11\u672C\u5730\u5B58\u50A8\u6807\u8BC6"), {
4545
4849
  backendPath: backendPath,
4546
4850
  reason: reason
4547
4851
  });
4548
- return _context49.abrupt("return", {
4852
+ return _context51.abrupt("return", {
4549
4853
  code: 500,
4550
4854
  status: false,
4551
4855
  message: '订单缺少本地存储标识,无法写入待同步队列',
@@ -4553,22 +4857,22 @@ var Server = /*#__PURE__*/function () {
4553
4857
  });
4554
4858
  case 7:
4555
4859
  if (!(!this.order || typeof this.order.upsertPendingSyncOrders !== 'function')) {
4556
- _context49.next = 10;
4860
+ _context51.next = 10;
4557
4861
  break;
4558
4862
  }
4559
4863
  this.logError("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u5F85\u540C\u6B65\u5199\u5165"), {
4560
4864
  backendPath: backendPath,
4561
4865
  reason: reason
4562
4866
  });
4563
- return _context49.abrupt("return", {
4867
+ return _context51.abrupt("return", {
4564
4868
  code: 500,
4565
4869
  status: false,
4566
4870
  message: 'Order 模块不支持本地待同步写入',
4567
4871
  data: null
4568
4872
  });
4569
4873
  case 10:
4570
- _context49.prev = 10;
4571
- _context49.next = 13;
4874
+ _context51.prev = 10;
4875
+ _context51.next = 13;
4572
4876
  return this.order.upsertPendingSyncOrders([pendingOrder]);
4573
4877
  case 13:
4574
4878
  this.logInfo("".concat(title, ": \u8BA2\u5355\u5DF2\u5199\u5165\u672C\u5730\u5F85\u540C\u6B65"), {
@@ -4582,7 +4886,7 @@ var Server = /*#__PURE__*/function () {
4582
4886
  var _payment$metadata;
4583
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);
4584
4888
  }, 0);
4585
- return _context49.abrupt("return", {
4889
+ return _context51.abrupt("return", {
4586
4890
  code: 200,
4587
4891
  status: true,
4588
4892
  message: '',
@@ -4597,15 +4901,15 @@ var Server = /*#__PURE__*/function () {
4597
4901
  })
4598
4902
  });
4599
4903
  case 18:
4600
- _context49.prev = 18;
4601
- _context49.t0 = _context49["catch"](10);
4602
- errorMessage = _context49.t0 instanceof Error ? _context49.t0.message : String(_context49.t0);
4904
+ _context51.prev = 18;
4905
+ _context51.t0 = _context51["catch"](10);
4906
+ errorMessage = _context51.t0 instanceof Error ? _context51.t0.message : String(_context51.t0);
4603
4907
  this.logError("".concat(title, ": \u5199\u5165\u672C\u5730\u5F85\u540C\u6B65\u8BA2\u5355\u5931\u8D25"), {
4604
4908
  backendPath: backendPath,
4605
4909
  reason: reason,
4606
4910
  error: errorMessage
4607
4911
  });
4608
- return _context49.abrupt("return", {
4912
+ return _context51.abrupt("return", {
4609
4913
  code: 500,
4610
4914
  status: false,
4611
4915
  message: errorMessage,
@@ -4613,11 +4917,11 @@ var Server = /*#__PURE__*/function () {
4613
4917
  });
4614
4918
  case 23:
4615
4919
  case "end":
4616
- return _context49.stop();
4920
+ return _context51.stop();
4617
4921
  }
4618
- }, _callee49, this, [[10, 18]]);
4922
+ }, _callee51, this, [[10, 18]]);
4619
4923
  }));
4620
- function handlePendingSyncCheckoutOrder(_x53) {
4924
+ function handlePendingSyncCheckoutOrder(_x56) {
4621
4925
  return _handlePendingSyncCheckoutOrder.apply(this, arguments);
4622
4926
  }
4623
4927
  return handlePendingSyncCheckoutOrder;
@@ -4625,43 +4929,43 @@ var Server = /*#__PURE__*/function () {
4625
4929
  }, {
4626
4930
  key: "buildPendingSyncCheckoutOrder",
4627
4931
  value: function () {
4628
- var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(data) {
4932
+ var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(data) {
4629
4933
  var hasStorageKey, pendingOrder, productMap, orderWithProductTitles;
4630
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
4631
- while (1) switch (_context50.prev = _context50.next) {
4934
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
4935
+ while (1) switch (_context52.prev = _context52.next) {
4632
4936
  case 0:
4633
4937
  if (!(!data || _typeof(data) !== 'object')) {
4634
- _context50.next = 2;
4938
+ _context52.next = 2;
4635
4939
  break;
4636
4940
  }
4637
- return _context50.abrupt("return", null);
4941
+ return _context52.abrupt("return", null);
4638
4942
  case 2:
4639
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 !== '';
4640
4944
  if (hasStorageKey) {
4641
- _context50.next = 5;
4945
+ _context52.next = 5;
4642
4946
  break;
4643
4947
  }
4644
- return _context50.abrupt("return", null);
4948
+ return _context52.abrupt("return", null);
4645
4949
  case 5:
4646
4950
  pendingOrder = _objectSpread(_objectSpread({}, data), {}, {
4647
4951
  need_sync: 1
4648
4952
  });
4649
- _context50.next = 8;
4953
+ _context52.next = 8;
4650
4954
  return this.buildSmallTicketProductMap(pendingOrder);
4651
4955
  case 8:
4652
- productMap = _context50.sent;
4956
+ productMap = _context52.sent;
4653
4957
  orderWithProductTitles = this.withPendingSyncProductTitles(pendingOrder, productMap);
4654
- return _context50.abrupt("return", this.withLocalSmallTicketData(orderWithProductTitles, {
4958
+ return _context52.abrupt("return", this.withLocalSmallTicketData(orderWithProductTitles, {
4655
4959
  requireFullyPaid: true,
4656
4960
  productMap: productMap
4657
4961
  }));
4658
4962
  case 11:
4659
4963
  case "end":
4660
- return _context50.stop();
4964
+ return _context52.stop();
4661
4965
  }
4662
- }, _callee50, this);
4966
+ }, _callee52, this);
4663
4967
  }));
4664
- function buildPendingSyncCheckoutOrder(_x54) {
4968
+ function buildPendingSyncCheckoutOrder(_x57) {
4665
4969
  return _buildPendingSyncCheckoutOrder.apply(this, arguments);
4666
4970
  }
4667
4971
  return buildPendingSyncCheckoutOrder;
@@ -4669,10 +4973,10 @@ var Server = /*#__PURE__*/function () {
4669
4973
  }, {
4670
4974
  key: "shouldBuildSmallTicketData",
4671
4975
  value: function shouldBuildSmallTicketData(order) {
4672
- var _order$payment_info, _ref54, _order$small_ticket_d;
4976
+ var _ref56, _order$small_ticket_d;
4673
4977
  if (!order || _typeof(order) !== 'object') return false;
4674
- if (hasSmallTicketData((_order$payment_info = order.payment_info) === null || _order$payment_info === void 0 ? void 0 : _order$payment_info.small_ticket_data)) return false;
4675
- return Number((_ref54 = (_order$small_ticket_d = order.small_ticket_data_flag) !== null && _order$small_ticket_d !== void 0 ? _order$small_ticket_d : order.smallTicketDataFlag) !== null && _ref54 !== void 0 ? _ref54 : 0) === 1;
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;
4676
4980
  }
4677
4981
  }, {
4678
4982
  key: "shouldPrintSyncedOrder",
@@ -4690,7 +4994,7 @@ var Server = /*#__PURE__*/function () {
4690
4994
  }, {
4691
4995
  key: "isSalesOrderFullyPaid",
4692
4996
  value: function isSalesOrderFullyPaid(order) {
4693
- var _order$summary$amount, _order$summary, _ref55, _ref56, _order$summary$expect, _order$summary2, _order$summary3;
4997
+ var _order$summary$amount, _order$summary, _ref57, _ref58, _order$summary$expect, _order$summary2, _order$summary3;
4694
4998
  if (!order || _typeof(order) !== 'object') return false;
4695
4999
  var paymentStatus = String(order.payment_status || '').toLowerCase();
4696
5000
  if (paymentStatus === 'paid' || paymentStatus === 'finished') return true;
@@ -4702,7 +5006,7 @@ var Server = /*#__PURE__*/function () {
4702
5006
  return this.toAmountNumber(amountGap) <= 0;
4703
5007
  }
4704
5008
  var paidAmount = this.sumPaidOrderPayments(order.payments);
4705
- var targetAmount = this.toAmountNumber((_ref55 = (_ref56 = (_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 && _ref56 !== void 0 ? _ref56 : order.expect_amount) !== null && _ref55 !== void 0 ? _ref55 : order.total_amount);
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);
4706
5010
  if (targetAmount <= 0) return paidAmount > 0;
4707
5011
  return paidAmount >= targetAmount;
4708
5012
  }
@@ -4729,12 +5033,12 @@ var Server = /*#__PURE__*/function () {
4729
5033
  }, {
4730
5034
  key: "buildSmallTicketProductMap",
4731
5035
  value: function () {
4732
- var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(order) {
5036
+ var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(order) {
4733
5037
  var _this$products,
4734
5038
  _this12 = this;
4735
5039
  var products, productIdSet, productIds, entries;
4736
- return _regeneratorRuntime().wrap(function _callee52$(_context52) {
4737
- while (1) switch (_context52.prev = _context52.next) {
5040
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5041
+ while (1) switch (_context54.prev = _context54.next) {
4738
5042
  case 0:
4739
5043
  products = Array.isArray(order === null || order === void 0 ? void 0 : order.products) ? order.products : [];
4740
5044
  productIdSet = new Set();
@@ -4746,8 +5050,8 @@ var Server = /*#__PURE__*/function () {
4746
5050
  }
4747
5051
  if (Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) {
4748
5052
  product.product_bundle.forEach(function (bundle) {
4749
- var _ref57, _bundle$bundle_produc;
4750
- var bundleProductId = (_ref57 = (_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 && _ref57 !== void 0 ? _ref57 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
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;
4751
5055
  if (bundleProductId !== undefined && bundleProductId !== null && bundleProductId !== '') {
4752
5056
  productIdSet.add(bundleProductId);
4753
5057
  }
@@ -4756,45 +5060,45 @@ var Server = /*#__PURE__*/function () {
4756
5060
  });
4757
5061
  productIds = Array.from(productIdSet);
4758
5062
  if (!(!productIds.length || typeof ((_this$products = this.products) === null || _this$products === void 0 ? void 0 : _this$products.getProductById) !== 'function')) {
4759
- _context52.next = 6;
5063
+ _context54.next = 6;
4760
5064
  break;
4761
5065
  }
4762
- return _context52.abrupt("return", {});
5066
+ return _context54.abrupt("return", {});
4763
5067
  case 6:
4764
- _context52.next = 8;
5068
+ _context54.next = 8;
4765
5069
  return Promise.all(productIds.map( /*#__PURE__*/function () {
4766
- var _ref58 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(id) {
5070
+ var _ref60 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(id) {
4767
5071
  var _this12$products, _this12$products$getP, product;
4768
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
4769
- while (1) switch (_context51.prev = _context51.next) {
5072
+ return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5073
+ while (1) switch (_context53.prev = _context53.next) {
4770
5074
  case 0:
4771
- _context51.prev = 0;
4772
- _context51.next = 3;
5075
+ _context53.prev = 0;
5076
+ _context53.next = 3;
4773
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));
4774
5078
  case 3:
4775
- product = _context51.sent;
4776
- return _context51.abrupt("return", product ? [String(id), product] : null);
5079
+ product = _context53.sent;
5080
+ return _context53.abrupt("return", product ? [String(id), product] : null);
4777
5081
  case 7:
4778
- _context51.prev = 7;
4779
- _context51.t0 = _context51["catch"](0);
5082
+ _context53.prev = 7;
5083
+ _context53.t0 = _context53["catch"](0);
4780
5084
  _this12.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
4781
5085
  product_id: id,
4782
- error: _context51.t0 instanceof Error ? _context51.t0.message : String(_context51.t0)
5086
+ error: _context53.t0 instanceof Error ? _context53.t0.message : String(_context53.t0)
4783
5087
  });
4784
- return _context51.abrupt("return", null);
5088
+ return _context53.abrupt("return", null);
4785
5089
  case 11:
4786
5090
  case "end":
4787
- return _context51.stop();
5091
+ return _context53.stop();
4788
5092
  }
4789
- }, _callee51, null, [[0, 7]]);
5093
+ }, _callee53, null, [[0, 7]]);
4790
5094
  }));
4791
- return function (_x56) {
4792
- return _ref58.apply(this, arguments);
5095
+ return function (_x59) {
5096
+ return _ref60.apply(this, arguments);
4793
5097
  };
4794
5098
  }()));
4795
5099
  case 8:
4796
- entries = _context52.sent;
4797
- return _context52.abrupt("return", entries.reduce(function (map, entry) {
5100
+ entries = _context54.sent;
5101
+ return _context54.abrupt("return", entries.reduce(function (map, entry) {
4798
5102
  if (!entry) return map;
4799
5103
  var _entry = _slicedToArray(entry, 2),
4800
5104
  id = _entry[0],
@@ -4804,11 +5108,11 @@ var Server = /*#__PURE__*/function () {
4804
5108
  }, {}));
4805
5109
  case 10:
4806
5110
  case "end":
4807
- return _context52.stop();
5111
+ return _context54.stop();
4808
5112
  }
4809
- }, _callee52, this);
5113
+ }, _callee54, this);
4810
5114
  }));
4811
- function buildSmallTicketProductMap(_x55) {
5115
+ function buildSmallTicketProductMap(_x58) {
4812
5116
  return _buildSmallTicketProductMap.apply(this, arguments);
4813
5117
  }
4814
5118
  return buildSmallTicketProductMap;
@@ -4866,7 +5170,7 @@ var Server = /*#__PURE__*/function () {
4866
5170
  }, {
4867
5171
  key: "resolveProductTitleValue",
4868
5172
  value: function resolveProductTitleValue(value, key, currentLocale) {
4869
- var _ref59, _ref60, _value$key;
5173
+ var _ref61, _ref62, _value$key;
4870
5174
  if (value === undefined || value === null || value === '') return null;
4871
5175
  if (_typeof(value) !== 'object') {
4872
5176
  var title = String(value);
@@ -4876,7 +5180,7 @@ var Server = /*#__PURE__*/function () {
4876
5180
  }
4877
5181
  var normalizedKey = key.replace('-', '_');
4878
5182
  var dashedKey = key.replace('_', '-');
4879
- var rawValue = (_ref59 = (_ref60 = (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : value[normalizedKey]) !== null && _ref60 !== void 0 ? _ref60 : value[dashedKey]) !== null && _ref59 !== void 0 ? _ref59 : key === 'auto' ? value.default : undefined;
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;
4880
5184
  if (rawValue === undefined || rawValue === null || rawValue === '') return null;
4881
5185
  if (_typeof(rawValue) === 'object') return this.resolveFirstProductTitleValue(rawValue);
4882
5186
  return String(rawValue);
@@ -4939,44 +5243,44 @@ var Server = /*#__PURE__*/function () {
4939
5243
  }, {
4940
5244
  key: "enrichPaymentNamesByCode",
4941
5245
  value: function () {
4942
- var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(order) {
5246
+ var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(order) {
4943
5247
  var _this15 = this;
4944
- var payments, hasMissingName, paymentModule, payMethods, nameByCode, _iterator12, _step12, method, codeKey, name, hasResolvedName, enrichedPayments;
4945
- return _regeneratorRuntime().wrap(function _callee53$(_context53) {
4946
- while (1) switch (_context53.prev = _context53.next) {
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) {
4947
5251
  case 0:
4948
5252
  payments = Array.isArray(order === null || order === void 0 ? void 0 : order.payments) ? order.payments : [];
4949
5253
  hasMissingName = payments.some(function (payment) {
4950
5254
  return _this15.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this15.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
4951
5255
  });
4952
5256
  if (hasMissingName) {
4953
- _context53.next = 4;
5257
+ _context55.next = 4;
4954
5258
  break;
4955
5259
  }
4956
- return _context53.abrupt("return", order);
5260
+ return _context55.abrupt("return", order);
4957
5261
  case 4:
4958
- _context53.prev = 4;
4959
- _context53.next = 7;
5262
+ _context55.prev = 4;
5263
+ _context55.next = 7;
4960
5264
  return this.getPaymentRouteModule();
4961
5265
  case 7:
4962
- paymentModule = _context53.sent;
4963
- _context53.next = 10;
5266
+ paymentModule = _context55.sent;
5267
+ _context55.next = 10;
4964
5268
  return paymentModule.getPayMethodListAsync();
4965
5269
  case 10:
4966
- payMethods = _context53.sent;
5270
+ payMethods = _context55.sent;
4967
5271
  nameByCode = new Map();
4968
- _iterator12 = _createForOfIteratorHelper(payMethods || []);
5272
+ _iterator13 = _createForOfIteratorHelper(payMethods || []);
4969
5273
  try {
4970
- for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
4971
- method = _step12.value;
5274
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
5275
+ method = _step13.value;
4972
5276
  codeKey = this.getPaymentCodeKey(method === null || method === void 0 ? void 0 : method.code);
4973
5277
  name = this.resolveFirstProductTitleValue(method === null || method === void 0 ? void 0 : method.name);
4974
5278
  if (codeKey && name) nameByCode.set(codeKey, name);
4975
5279
  }
4976
5280
  } catch (err) {
4977
- _iterator12.e(err);
5281
+ _iterator13.e(err);
4978
5282
  } finally {
4979
- _iterator12.f();
5283
+ _iterator13.f();
4980
5284
  }
4981
5285
  hasResolvedName = false;
4982
5286
  enrichedPayments = payments.map(function (payment) {
@@ -4990,28 +5294,28 @@ var Server = /*#__PURE__*/function () {
4990
5294
  });
4991
5295
  });
4992
5296
  if (hasResolvedName) {
4993
- _context53.next = 18;
5297
+ _context55.next = 18;
4994
5298
  break;
4995
5299
  }
4996
- return _context53.abrupt("return", order);
5300
+ return _context55.abrupt("return", order);
4997
5301
  case 18:
4998
- return _context53.abrupt("return", _objectSpread(_objectSpread({}, order), {}, {
5302
+ return _context55.abrupt("return", _objectSpread(_objectSpread({}, order), {}, {
4999
5303
  payments: enrichedPayments
5000
5304
  }));
5001
5305
  case 21:
5002
- _context53.prev = 21;
5003
- _context53.t0 = _context53["catch"](4);
5306
+ _context55.prev = 21;
5307
+ _context55.t0 = _context55["catch"](4);
5004
5308
  this.logWarning('enrichPaymentNamesByCode: 支付方式名称回填失败', {
5005
- error: _context53.t0 instanceof Error ? _context53.t0.message : String(_context53.t0)
5309
+ error: _context55.t0 instanceof Error ? _context55.t0.message : String(_context55.t0)
5006
5310
  });
5007
- return _context53.abrupt("return", order);
5311
+ return _context55.abrupt("return", order);
5008
5312
  case 25:
5009
5313
  case "end":
5010
- return _context53.stop();
5314
+ return _context55.stop();
5011
5315
  }
5012
- }, _callee53, this, [[4, 21]]);
5316
+ }, _callee55, this, [[4, 21]]);
5013
5317
  }));
5014
- function enrichPaymentNamesByCode(_x57) {
5318
+ function enrichPaymentNamesByCode(_x60) {
5015
5319
  return _enrichPaymentNamesByCode.apply(this, arguments);
5016
5320
  }
5017
5321
  return enrichPaymentNamesByCode;
@@ -5019,66 +5323,66 @@ var Server = /*#__PURE__*/function () {
5019
5323
  }, {
5020
5324
  key: "withLocalSmallTicketData",
5021
5325
  value: function () {
5022
- var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(order, options) {
5326
+ var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(order, options) {
5023
5327
  var _options$productMap, enrichedOrder, productMap, smallTicketData;
5024
- return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5025
- while (1) switch (_context54.prev = _context54.next) {
5328
+ return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5329
+ while (1) switch (_context56.prev = _context56.next) {
5026
5330
  case 0:
5027
5331
  if (this.shouldBuildSmallTicketData(order)) {
5028
- _context54.next = 2;
5332
+ _context56.next = 2;
5029
5333
  break;
5030
5334
  }
5031
- return _context54.abrupt("return", order);
5335
+ return _context56.abrupt("return", order);
5032
5336
  case 2:
5033
5337
  if (!(options !== null && options !== void 0 && options.requireFullyPaid && !this.isSalesOrderFullyPaid(order))) {
5034
- _context54.next = 4;
5338
+ _context56.next = 4;
5035
5339
  break;
5036
5340
  }
5037
- return _context54.abrupt("return", order);
5341
+ return _context56.abrupt("return", order);
5038
5342
  case 4:
5039
- _context54.prev = 4;
5040
- _context54.next = 7;
5343
+ _context56.prev = 4;
5344
+ _context56.next = 7;
5041
5345
  return this.enrichPaymentNamesByCode(order);
5042
5346
  case 7:
5043
- enrichedOrder = _context54.sent;
5347
+ enrichedOrder = _context56.sent;
5044
5348
  if (!((_options$productMap = options === null || options === void 0 ? void 0 : options.productMap) !== null && _options$productMap !== void 0)) {
5045
- _context54.next = 12;
5349
+ _context56.next = 12;
5046
5350
  break;
5047
5351
  }
5048
- _context54.t0 = _options$productMap;
5049
- _context54.next = 15;
5352
+ _context56.t0 = _options$productMap;
5353
+ _context56.next = 15;
5050
5354
  break;
5051
5355
  case 12:
5052
- _context54.next = 14;
5356
+ _context56.next = 14;
5053
5357
  return this.buildSmallTicketProductMap(enrichedOrder);
5054
5358
  case 14:
5055
- _context54.t0 = _context54.sent;
5359
+ _context56.t0 = _context56.sent;
5056
5360
  case 15:
5057
- productMap = _context54.t0;
5361
+ productMap = _context56.t0;
5058
5362
  smallTicketData = buildSmallTicketData({
5059
5363
  order: enrichedOrder,
5060
5364
  shopInfo: this.getSmallTicketShopInfo(),
5061
5365
  productMap: productMap
5062
5366
  });
5063
- return _context54.abrupt("return", _objectSpread(_objectSpread({}, enrichedOrder), {}, {
5367
+ return _context56.abrupt("return", _objectSpread(_objectSpread({}, enrichedOrder), {}, {
5064
5368
  payment_info: _objectSpread(_objectSpread({}, enrichedOrder.payment_info || {}), {}, {
5065
5369
  small_ticket_data: smallTicketData
5066
5370
  })
5067
5371
  }));
5068
5372
  case 20:
5069
- _context54.prev = 20;
5070
- _context54.t1 = _context54["catch"](4);
5373
+ _context56.prev = 20;
5374
+ _context56.t1 = _context56["catch"](4);
5071
5375
  this.logError('withLocalSmallTicketData: 生成本地小票数据失败', {
5072
- error: _context54.t1 instanceof Error ? _context54.t1.message : String(_context54.t1)
5376
+ error: _context56.t1 instanceof Error ? _context56.t1.message : String(_context56.t1)
5073
5377
  });
5074
- return _context54.abrupt("return", order);
5378
+ return _context56.abrupt("return", order);
5075
5379
  case 24:
5076
5380
  case "end":
5077
- return _context54.stop();
5381
+ return _context56.stop();
5078
5382
  }
5079
- }, _callee54, this, [[4, 20]]);
5383
+ }, _callee56, this, [[4, 20]]);
5080
5384
  }));
5081
- function withLocalSmallTicketData(_x58, _x59) {
5385
+ function withLocalSmallTicketData(_x61, _x62) {
5082
5386
  return _withLocalSmallTicketData.apply(this, arguments);
5083
5387
  }
5084
5388
  return withLocalSmallTicketData;
@@ -5140,34 +5444,34 @@ var Server = /*#__PURE__*/function () {
5140
5444
  }, {
5141
5445
  key: "handleUpdateLocalOrdersBatch",
5142
5446
  value: (function () {
5143
- var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(orderIds) {
5144
- var _this$app16;
5145
- var existedBefore, _iterator13, _step13, id, fetched, message, fetchedMap, _iterator14, _step14, order, oid, freshOrders, succeedIds, failed, _iterator15, _step15, _id, fresh, _message, overwritten, inserted;
5146
- return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5147
- while (1) switch (_context55.prev = _context55.next) {
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) {
5148
5452
  case 0:
5149
5453
  this.logInfo('handleUpdateLocalOrdersBatch: 开始处理', {
5150
5454
  count: orderIds.length,
5151
5455
  orderIds: orderIds
5152
5456
  });
5153
5457
  if (this.order) {
5154
- _context55.next = 4;
5458
+ _context57.next = 4;
5155
5459
  break;
5156
5460
  }
5157
5461
  this.logError('handleUpdateLocalOrdersBatch: Order 模块未注册');
5158
- return _context55.abrupt("return", {
5462
+ return _context57.abrupt("return", {
5159
5463
  code: 500,
5160
5464
  status: false,
5161
5465
  message: 'Order 模块未注册',
5162
5466
  data: null
5163
5467
  });
5164
5468
  case 4:
5165
- if ((_this$app16 = this.app) !== null && _this$app16 !== void 0 && _this$app16.request) {
5166
- _context55.next = 7;
5469
+ if ((_this$app17 = this.app) !== null && _this$app17 !== void 0 && _this$app17.request) {
5470
+ _context57.next = 7;
5167
5471
  break;
5168
5472
  }
5169
5473
  this.logError('handleUpdateLocalOrdersBatch: app.request 不可用');
5170
- return _context55.abrupt("return", {
5474
+ return _context57.abrupt("return", {
5171
5475
  code: 500,
5172
5476
  status: false,
5173
5477
  message: 'app.request 不可用',
@@ -5176,35 +5480,35 @@ var Server = /*#__PURE__*/function () {
5176
5480
  case 7:
5177
5481
  // 拉取前先记录"本地是否已存在",用于区分 overwritten / inserted
5178
5482
  existedBefore = new Map();
5179
- _iterator13 = _createForOfIteratorHelper(orderIds);
5483
+ _iterator14 = _createForOfIteratorHelper(orderIds);
5180
5484
  try {
5181
- for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
5182
- id = _step13.value;
5485
+ for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
5486
+ id = _step14.value;
5183
5487
  existedBefore.set(id, !!this.order.getOrderByOrderId(id));
5184
5488
  }
5185
5489
 
5186
5490
  // 走 orderDataSource 的批量 HTTP 通道,一次请求拉回多笔详情
5187
5491
  } catch (err) {
5188
- _iterator13.e(err);
5492
+ _iterator14.e(err);
5189
5493
  } finally {
5190
- _iterator13.f();
5494
+ _iterator14.f();
5191
5495
  }
5192
5496
  fetched = [];
5193
- _context55.prev = 11;
5194
- _context55.next = 14;
5497
+ _context57.prev = 11;
5498
+ _context57.next = 14;
5195
5499
  return this.order.fetchOrdersByHttp(orderIds);
5196
5500
  case 14:
5197
- fetched = _context55.sent;
5198
- _context55.next = 22;
5501
+ fetched = _context57.sent;
5502
+ _context57.next = 22;
5199
5503
  break;
5200
5504
  case 17:
5201
- _context55.prev = 17;
5202
- _context55.t0 = _context55["catch"](11);
5203
- message = _context55.t0 instanceof Error ? _context55.t0.message : String(_context55.t0);
5505
+ _context57.prev = 17;
5506
+ _context57.t0 = _context57["catch"](11);
5507
+ message = _context57.t0 instanceof Error ? _context57.t0.message : String(_context57.t0);
5204
5508
  this.logError('handleUpdateLocalOrdersBatch: 批量拉取失败', {
5205
5509
  message: message
5206
5510
  });
5207
- return _context55.abrupt("return", {
5511
+ return _context57.abrupt("return", {
5208
5512
  code: 500,
5209
5513
  status: false,
5210
5514
  message: message,
@@ -5213,45 +5517,45 @@ var Server = /*#__PURE__*/function () {
5213
5517
  case 22:
5214
5518
  // 按返回结果中的 order_id 建索引,未命中即视为单笔失败
5215
5519
  fetchedMap = new Map();
5216
- _iterator14 = _createForOfIteratorHelper(fetched);
5217
- _context55.prev = 24;
5218
- _iterator14.s();
5520
+ _iterator15 = _createForOfIteratorHelper(fetched);
5521
+ _context57.prev = 24;
5522
+ _iterator15.s();
5219
5523
  case 26:
5220
- if ((_step14 = _iterator14.n()).done) {
5221
- _context55.next = 34;
5524
+ if ((_step15 = _iterator15.n()).done) {
5525
+ _context57.next = 34;
5222
5526
  break;
5223
5527
  }
5224
- order = _step14.value;
5528
+ order = _step15.value;
5225
5529
  oid = order === null || order === void 0 ? void 0 : order.order_id;
5226
5530
  if (!(oid === undefined || oid === null)) {
5227
- _context55.next = 31;
5531
+ _context57.next = 31;
5228
5532
  break;
5229
5533
  }
5230
- return _context55.abrupt("continue", 32);
5534
+ return _context57.abrupt("continue", 32);
5231
5535
  case 31:
5232
5536
  fetchedMap.set(String(oid), order);
5233
5537
  case 32:
5234
- _context55.next = 26;
5538
+ _context57.next = 26;
5235
5539
  break;
5236
5540
  case 34:
5237
- _context55.next = 39;
5541
+ _context57.next = 39;
5238
5542
  break;
5239
5543
  case 36:
5240
- _context55.prev = 36;
5241
- _context55.t1 = _context55["catch"](24);
5242
- _iterator14.e(_context55.t1);
5544
+ _context57.prev = 36;
5545
+ _context57.t1 = _context57["catch"](24);
5546
+ _iterator15.e(_context57.t1);
5243
5547
  case 39:
5244
- _context55.prev = 39;
5245
- _iterator14.f();
5246
- return _context55.finish(39);
5548
+ _context57.prev = 39;
5549
+ _iterator15.f();
5550
+ return _context57.finish(39);
5247
5551
  case 42:
5248
5552
  freshOrders = [];
5249
5553
  succeedIds = [];
5250
5554
  failed = [];
5251
- _iterator15 = _createForOfIteratorHelper(orderIds);
5555
+ _iterator16 = _createForOfIteratorHelper(orderIds);
5252
5556
  try {
5253
- for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
5254
- _id = _step15.value;
5557
+ for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
5558
+ _id = _step16.value;
5255
5559
  fresh = fetchedMap.get(_id);
5256
5560
  if (fresh) {
5257
5561
  freshOrders.push(fresh);
@@ -5264,31 +5568,31 @@ var Server = /*#__PURE__*/function () {
5264
5568
  }
5265
5569
  }
5266
5570
  } catch (err) {
5267
- _iterator15.e(err);
5571
+ _iterator16.e(err);
5268
5572
  } finally {
5269
- _iterator15.f();
5573
+ _iterator16.f();
5270
5574
  }
5271
5575
  if (!(freshOrders.length > 0)) {
5272
- _context55.next = 58;
5576
+ _context57.next = 58;
5273
5577
  break;
5274
5578
  }
5275
- _context55.prev = 48;
5276
- _context55.next = 51;
5579
+ _context57.prev = 48;
5580
+ _context57.next = 51;
5277
5581
  return this.order.upsertOrdersFromRemote(freshOrders);
5278
5582
  case 51:
5279
- _context55.next = 58;
5583
+ _context57.next = 58;
5280
5584
  break;
5281
5585
  case 53:
5282
- _context55.prev = 53;
5283
- _context55.t2 = _context55["catch"](48);
5284
- _message = _context55.t2 instanceof Error ? _context55.t2.message : String(_context55.t2);
5586
+ _context57.prev = 53;
5587
+ _context57.t2 = _context57["catch"](48);
5588
+ _message2 = _context57.t2 instanceof Error ? _context57.t2.message : String(_context57.t2);
5285
5589
  this.logError('handleUpdateLocalOrdersBatch: 合并写入失败', {
5286
- message: _message
5590
+ message: _message2
5287
5591
  });
5288
- return _context55.abrupt("return", {
5592
+ return _context57.abrupt("return", {
5289
5593
  code: 500,
5290
5594
  status: false,
5291
- message: _message,
5595
+ message: _message2,
5292
5596
  data: null
5293
5597
  });
5294
5598
  case 58:
@@ -5304,7 +5608,7 @@ var Server = /*#__PURE__*/function () {
5304
5608
  insertedCount: inserted.length,
5305
5609
  failedCount: failed.length
5306
5610
  });
5307
- return _context55.abrupt("return", {
5611
+ return _context57.abrupt("return", {
5308
5612
  code: 200,
5309
5613
  status: true,
5310
5614
  message: '',
@@ -5316,11 +5620,11 @@ var Server = /*#__PURE__*/function () {
5316
5620
  });
5317
5621
  case 62:
5318
5622
  case "end":
5319
- return _context55.stop();
5623
+ return _context57.stop();
5320
5624
  }
5321
- }, _callee55, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
5625
+ }, _callee57, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
5322
5626
  }));
5323
- function handleUpdateLocalOrdersBatch(_x60) {
5627
+ function handleUpdateLocalOrdersBatch(_x63) {
5324
5628
  return _handleUpdateLocalOrdersBatch.apply(this, arguments);
5325
5629
  }
5326
5630
  return handleUpdateLocalOrdersBatch;
@@ -5341,11 +5645,11 @@ var Server = /*#__PURE__*/function () {
5341
5645
  var queryIndex = url.indexOf('?');
5342
5646
  if (queryIndex < 0) return null;
5343
5647
  var query = url.slice(queryIndex + 1);
5344
- var _iterator16 = _createForOfIteratorHelper(query.split('&')),
5345
- _step16;
5648
+ var _iterator17 = _createForOfIteratorHelper(query.split('&')),
5649
+ _step17;
5346
5650
  try {
5347
- for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
5348
- var pair = _step16.value;
5651
+ for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
5652
+ var pair = _step17.value;
5349
5653
  if (!pair) continue;
5350
5654
  var _pair$split = pair.split('='),
5351
5655
  _pair$split2 = _slicedToArray(_pair$split, 2),
@@ -5361,9 +5665,9 @@ var Server = /*#__PURE__*/function () {
5361
5665
  }
5362
5666
  }
5363
5667
  } catch (err) {
5364
- _iterator16.e(err);
5668
+ _iterator17.e(err);
5365
5669
  } finally {
5366
- _iterator16.f();
5670
+ _iterator17.f();
5367
5671
  }
5368
5672
  return null;
5369
5673
  }
@@ -5397,8 +5701,8 @@ var Server = /*#__PURE__*/function () {
5397
5701
  }, {
5398
5702
  key: "extractOrderDataFromCheckoutResponse",
5399
5703
  value: function extractOrderDataFromCheckoutResponse(response) {
5400
- var _response$data5, _response$data6;
5401
- var candidates = [response === null || response === void 0 || (_response$data5 = response.data) === null || _response$data5 === void 0 ? void 0 : _response$data5.order, response === null || response === void 0 || (_response$data6 = response.data) === null || _response$data6 === void 0 ? void 0 : _response$data6.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];
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];
5402
5706
  for (var _i4 = 0, _candidates = candidates; _i4 < _candidates.length; _i4++) {
5403
5707
  var candidate = _candidates[_i4];
5404
5708
  if (!candidate || _typeof(candidate) !== 'object') continue;
@@ -5684,24 +5988,24 @@ var Server = /*#__PURE__*/function () {
5684
5988
  }, {
5685
5989
  key: "recomputeAndNotifyFloorPlanQuery",
5686
5990
  value: (function () {
5687
- var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56() {
5688
- var _iterator17, _step17, _step17$value, subscriberId, sub, result, errorMessage;
5689
- return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5690
- while (1) switch (_context56.prev = _context56.next) {
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) {
5691
5995
  case 0:
5692
5996
  if (!(this.floorPlanQuerySubscribers.size === 0)) {
5693
- _context56.next = 2;
5997
+ _context58.next = 2;
5694
5998
  break;
5695
5999
  }
5696
- return _context56.abrupt("return");
6000
+ return _context58.abrupt("return");
5697
6001
  case 2:
5698
6002
  this.logInfo('recomputeAndNotifyFloorPlanQuery: 开始推送', {
5699
6003
  subscriberCount: this.floorPlanQuerySubscribers.size
5700
6004
  });
5701
- _iterator17 = _createForOfIteratorHelper(this.floorPlanQuerySubscribers.entries());
6005
+ _iterator18 = _createForOfIteratorHelper(this.floorPlanQuerySubscribers.entries());
5702
6006
  try {
5703
- for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
5704
- _step17$value = _slicedToArray(_step17.value, 2), subscriberId = _step17$value[0], sub = _step17$value[1];
6007
+ for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
6008
+ _step18$value = _slicedToArray(_step18.value, 2), subscriberId = _step18$value[0], sub = _step18$value[1];
5705
6009
  try {
5706
6010
  result = this.computeFloorPlanQueryResult(sub.context);
5707
6011
  sub.callback(result);
@@ -5717,15 +6021,15 @@ var Server = /*#__PURE__*/function () {
5717
6021
  }
5718
6022
  }
5719
6023
  } catch (err) {
5720
- _iterator17.e(err);
6024
+ _iterator18.e(err);
5721
6025
  } finally {
5722
- _iterator17.f();
6026
+ _iterator18.f();
5723
6027
  }
5724
6028
  case 5:
5725
6029
  case "end":
5726
- return _context56.stop();
6030
+ return _context58.stop();
5727
6031
  }
5728
- }, _callee56, this);
6032
+ }, _callee58, this);
5729
6033
  }));
5730
6034
  function recomputeAndNotifyFloorPlanQuery() {
5731
6035
  return _recomputeAndNotifyFloorPlanQuery.apply(this, arguments);
@@ -5755,21 +6059,21 @@ var Server = /*#__PURE__*/function () {
5755
6059
  * filter 逻辑暂为 mock,仅记录参数
5756
6060
  */
5757
6061
  function () {
5758
- var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(data) {
6062
+ var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(data) {
5759
6063
  var rawList, result;
5760
- return _regeneratorRuntime().wrap(function _callee57$(_context57) {
5761
- while (1) switch (_context57.prev = _context57.next) {
6064
+ return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6065
+ while (1) switch (_context59.prev = _context59.next) {
5762
6066
  case 0:
5763
6067
  this.logInfo('computeOrderQueryResult: 开始过滤', {
5764
6068
  data: data
5765
6069
  });
5766
6070
  console.log('[Server] computeOrderQueryResult', data);
5767
6071
  if (this.order) {
5768
- _context57.next = 5;
6072
+ _context59.next = 5;
5769
6073
  break;
5770
6074
  }
5771
6075
  this.logError('computeOrderQueryResult: Order 模块未注册');
5772
- return _context57.abrupt("return", {
6076
+ return _context59.abrupt("return", {
5773
6077
  code: 500,
5774
6078
  message: 'Order 模块未注册',
5775
6079
  data: {
@@ -5793,7 +6097,7 @@ var Server = /*#__PURE__*/function () {
5793
6097
  skip: result.skip,
5794
6098
  rejected: result.rejected
5795
6099
  });
5796
- return _context57.abrupt("return", {
6100
+ return _context59.abrupt("return", {
5797
6101
  code: 200,
5798
6102
  data: result,
5799
6103
  message: '',
@@ -5801,11 +6105,11 @@ var Server = /*#__PURE__*/function () {
5801
6105
  });
5802
6106
  case 10:
5803
6107
  case "end":
5804
- return _context57.stop();
6108
+ return _context59.stop();
5805
6109
  }
5806
- }, _callee57, this);
6110
+ }, _callee59, this);
5807
6111
  }));
5808
- function computeOrderQueryResult(_x61) {
6112
+ function computeOrderQueryResult(_x64) {
5809
6113
  return _computeOrderQueryResult.apply(this, arguments);
5810
6114
  }
5811
6115
  return computeOrderQueryResult;
@@ -5818,17 +6122,17 @@ var Server = /*#__PURE__*/function () {
5818
6122
  }, {
5819
6123
  key: "computeBookingQueryResult",
5820
6124
  value: (function () {
5821
- var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(data) {
6125
+ var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(data) {
5822
6126
  var rawOrders, result;
5823
- return _regeneratorRuntime().wrap(function _callee58$(_context58) {
5824
- while (1) switch (_context58.prev = _context58.next) {
6127
+ return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6128
+ while (1) switch (_context60.prev = _context60.next) {
5825
6129
  case 0:
5826
6130
  if (this.order) {
5827
- _context58.next = 3;
6131
+ _context60.next = 3;
5828
6132
  break;
5829
6133
  }
5830
6134
  this.logError('computeBookingQueryResult: Order 模块未注册');
5831
- return _context58.abrupt("return", {
6135
+ return _context60.abrupt("return", {
5832
6136
  code: 500,
5833
6137
  message: 'Order 模块未注册',
5834
6138
  data: {
@@ -5847,7 +6151,7 @@ var Server = /*#__PURE__*/function () {
5847
6151
  size: result.size,
5848
6152
  skip: result.skip
5849
6153
  });
5850
- return _context58.abrupt("return", {
6154
+ return _context60.abrupt("return", {
5851
6155
  code: 200,
5852
6156
  data: result,
5853
6157
  message: '',
@@ -5855,11 +6159,11 @@ var Server = /*#__PURE__*/function () {
5855
6159
  });
5856
6160
  case 8:
5857
6161
  case "end":
5858
- return _context58.stop();
6162
+ return _context60.stop();
5859
6163
  }
5860
- }, _callee58, this);
6164
+ }, _callee60, this);
5861
6165
  }));
5862
- function computeBookingQueryResult(_x62) {
6166
+ function computeBookingQueryResult(_x65) {
5863
6167
  return _computeBookingQueryResult.apply(this, arguments);
5864
6168
  }
5865
6169
  return computeBookingQueryResult;
@@ -5918,12 +6222,12 @@ var Server = /*#__PURE__*/function () {
5918
6222
  }, {
5919
6223
  key: "computeProductQueryResult",
5920
6224
  value: (function () {
5921
- var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(context, options) {
6225
+ var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(context, options) {
5922
6226
  var _menu_list_ids$length3,
5923
6227
  _this17 = this;
5924
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;
5925
- return _regeneratorRuntime().wrap(function _callee59$(_context59) {
5926
- while (1) switch (_context59.prev = _context59.next) {
6229
+ return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6230
+ while (1) switch (_context61.prev = _context61.next) {
5927
6231
  case 0:
5928
6232
  tTotal = performance.now();
5929
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;
@@ -5943,11 +6247,11 @@ var Server = /*#__PURE__*/function () {
5943
6247
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
5944
6248
  });
5945
6249
  if (this.products) {
5946
- _context59.next = 7;
6250
+ _context61.next = 7;
5947
6251
  break;
5948
6252
  }
5949
6253
  this.logError('computeProductQueryResult: Products 模块未注册');
5950
- return _context59.abrupt("return", {
6254
+ return _context61.abrupt("return", {
5951
6255
  message: 'Products 模块未注册',
5952
6256
  data: {
5953
6257
  list: [],
@@ -5956,12 +6260,12 @@ var Server = /*#__PURE__*/function () {
5956
6260
  });
5957
6261
  case 7:
5958
6262
  if (!(queryIds.length > 0)) {
5959
- _context59.next = 19;
6263
+ _context61.next = 19;
5960
6264
  break;
5961
6265
  }
5962
6266
  uniqueIds = Array.from(new Set(queryIds));
5963
6267
  _tPrice = performance.now();
5964
- _context59.next = 12;
6268
+ _context61.next = 12;
5965
6269
  return this.products.getProductsWithPrice(schedule_date, {
5966
6270
  scheduleModule: this.getSchedule(),
5967
6271
  schedule_datetime: schedule_datetime,
@@ -5971,7 +6275,7 @@ var Server = /*#__PURE__*/function () {
5971
6275
  productIds: uniqueIds
5972
6276
  });
5973
6277
  case 12:
5974
- productsWithPrice = _context59.sent;
6278
+ productsWithPrice = _context61.sent;
5975
6279
  perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
5976
6280
  count: productsWithPrice.length,
5977
6281
  ids: uniqueIds
@@ -5991,7 +6295,7 @@ var Server = /*#__PURE__*/function () {
5991
6295
  ids: uniqueIds,
5992
6296
  count: extensionFilteredProducts.length
5993
6297
  });
5994
- return _context59.abrupt("return", {
6298
+ return _context61.abrupt("return", {
5995
6299
  code: 200,
5996
6300
  data: {
5997
6301
  list: extensionFilteredProducts,
@@ -6002,19 +6306,19 @@ var Server = /*#__PURE__*/function () {
6002
6306
  });
6003
6307
  case 19:
6004
6308
  if (!(product_id != null && Number.isFinite(Number(product_id)))) {
6005
- _context59.next = 31;
6309
+ _context61.next = 31;
6006
6310
  break;
6007
6311
  }
6008
6312
  pid = Number(product_id);
6009
6313
  _tPrice2 = performance.now();
6010
- _context59.next = 24;
6314
+ _context61.next = 24;
6011
6315
  return this.products.getProductsWithPrice(schedule_date, {
6012
6316
  scheduleModule: this.getSchedule()
6013
6317
  }, {
6014
6318
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
6015
6319
  });
6016
6320
  case 24:
6017
- allProductsWithPrice = _context59.sent;
6321
+ allProductsWithPrice = _context61.sent;
6018
6322
  perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
6019
6323
  count: allProductsWithPrice.length,
6020
6324
  productId: pid
@@ -6034,7 +6338,7 @@ var Server = /*#__PURE__*/function () {
6034
6338
  productId: pid,
6035
6339
  found: !!item
6036
6340
  });
6037
- return _context59.abrupt("return", {
6341
+ return _context61.abrupt("return", {
6038
6342
  code: 200,
6039
6343
  data: item,
6040
6344
  message: item ? '' : '商品不存在或未发布',
@@ -6042,11 +6346,11 @@ var Server = /*#__PURE__*/function () {
6042
6346
  });
6043
6347
  case 31:
6044
6348
  if (!this.shouldQueryProductsByExtensionTypes(extension_type)) {
6045
- _context59.next = 51;
6349
+ _context61.next = 51;
6046
6350
  break;
6047
6351
  }
6048
6352
  _tPrice3 = performance.now();
6049
- _context59.next = 35;
6353
+ _context61.next = 35;
6050
6354
  return this.products.getProductsWithPrice(schedule_date, {
6051
6355
  scheduleModule: this.getSchedule(),
6052
6356
  schedule_datetime: schedule_datetime,
@@ -6055,7 +6359,7 @@ var Server = /*#__PURE__*/function () {
6055
6359
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
6056
6360
  });
6057
6361
  case 35:
6058
- _filteredProducts2 = _context59.sent;
6362
+ _filteredProducts2 = _context61.sent;
6059
6363
  perfMark('computeQuery.getProductsWithPrice(extensionType)', performance.now() - _tPrice3, {
6060
6364
  count: _filteredProducts2.length,
6061
6365
  extension_type: extension_type
@@ -6094,7 +6398,7 @@ var Server = /*#__PURE__*/function () {
6094
6398
  filteredCount: _filteredProducts2.length,
6095
6399
  extension_type: extension_type
6096
6400
  });
6097
- return _context59.abrupt("return", {
6401
+ return _context61.abrupt("return", {
6098
6402
  code: 200,
6099
6403
  data: {
6100
6404
  list: _filteredProducts2,
@@ -6105,11 +6409,11 @@ var Server = /*#__PURE__*/function () {
6105
6409
  });
6106
6410
  case 51:
6107
6411
  if (this.menu) {
6108
- _context59.next = 54;
6412
+ _context61.next = 54;
6109
6413
  break;
6110
6414
  }
6111
6415
  this.logError('computeProductQueryResult: Menu 模块未注册');
6112
- return _context59.abrupt("return", {
6416
+ return _context61.abrupt("return", {
6113
6417
  message: 'Menu 模块未注册',
6114
6418
  data: {
6115
6419
  list: [],
@@ -6118,11 +6422,11 @@ var Server = /*#__PURE__*/function () {
6118
6422
  });
6119
6423
  case 54:
6120
6424
  if (this.schedule) {
6121
- _context59.next = 57;
6425
+ _context61.next = 57;
6122
6426
  break;
6123
6427
  }
6124
6428
  this.logError('computeProductQueryResult: Schedule 模块未注册');
6125
- return _context59.abrupt("return", {
6429
+ return _context61.abrupt("return", {
6126
6430
  message: 'Schedule 模块未注册',
6127
6431
  data: {
6128
6432
  list: [],
@@ -6153,10 +6457,10 @@ var Server = /*#__PURE__*/function () {
6153
6457
  });
6154
6458
  tPrice = performance.now();
6155
6459
  if (!(scopedProductIds.length > 0)) {
6156
- _context59.next = 70;
6460
+ _context61.next = 70;
6157
6461
  break;
6158
6462
  }
6159
- _context59.next = 67;
6463
+ _context61.next = 67;
6160
6464
  return this.products.getProductsWithPrice(schedule_date, {
6161
6465
  scheduleModule: this.getSchedule(),
6162
6466
  schedule_datetime: schedule_datetime,
@@ -6166,13 +6470,13 @@ var Server = /*#__PURE__*/function () {
6166
6470
  productIds: productScope.isAllProducts ? undefined : scopedProductIds
6167
6471
  });
6168
6472
  case 67:
6169
- _context59.t0 = _context59.sent;
6170
- _context59.next = 71;
6473
+ _context61.t0 = _context61.sent;
6474
+ _context61.next = 71;
6171
6475
  break;
6172
6476
  case 70:
6173
- _context59.t0 = [];
6477
+ _context61.t0 = [];
6174
6478
  case 71:
6175
- filteredProducts = _context59.t0;
6479
+ filteredProducts = _context61.t0;
6176
6480
  perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
6177
6481
  count: filteredProducts.length,
6178
6482
  scopedProductCount: scopedProductIds.length
@@ -6213,7 +6517,7 @@ var Server = /*#__PURE__*/function () {
6213
6517
  filteredCount: filteredProducts.length,
6214
6518
  activeMenuCount: activeMenuList.length
6215
6519
  });
6216
- return _context59.abrupt("return", {
6520
+ return _context61.abrupt("return", {
6217
6521
  code: 200,
6218
6522
  data: {
6219
6523
  list: filteredProducts,
@@ -6224,11 +6528,11 @@ var Server = /*#__PURE__*/function () {
6224
6528
  });
6225
6529
  case 87:
6226
6530
  case "end":
6227
- return _context59.stop();
6531
+ return _context61.stop();
6228
6532
  }
6229
- }, _callee59, this);
6533
+ }, _callee61, this);
6230
6534
  }));
6231
- function computeProductQueryResult(_x63, _x64) {
6535
+ function computeProductQueryResult(_x66, _x67) {
6232
6536
  return _computeProductQueryResult.apply(this, arguments);
6233
6537
  }
6234
6538
  return computeProductQueryResult;
@@ -6243,72 +6547,72 @@ var Server = /*#__PURE__*/function () {
6243
6547
  }, {
6244
6548
  key: "recomputeAndNotifyProductQuery",
6245
6549
  value: (function () {
6246
- var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(options) {
6247
- var _iterator18, _step18, _step18$value, subscriberId, subscriber, result, errorMessage;
6248
- return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6249
- while (1) switch (_context60.prev = _context60.next) {
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) {
6250
6554
  case 0:
6251
6555
  if (!(this.productQuerySubscribers.size === 0)) {
6252
- _context60.next = 2;
6556
+ _context62.next = 2;
6253
6557
  break;
6254
6558
  }
6255
- return _context60.abrupt("return");
6559
+ return _context62.abrupt("return");
6256
6560
  case 2:
6257
6561
  this.logInfo('recomputeAndNotifyProductQuery: 开始推送', {
6258
6562
  subscriberCount: this.productQuerySubscribers.size,
6259
6563
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
6260
6564
  });
6261
- _iterator18 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
6262
- _context60.prev = 4;
6263
- _iterator18.s();
6565
+ _iterator19 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
6566
+ _context62.prev = 4;
6567
+ _iterator19.s();
6264
6568
  case 6:
6265
- if ((_step18 = _iterator18.n()).done) {
6266
- _context60.next = 22;
6569
+ if ((_step19 = _iterator19.n()).done) {
6570
+ _context62.next = 22;
6267
6571
  break;
6268
6572
  }
6269
- _step18$value = _slicedToArray(_step18.value, 2), subscriberId = _step18$value[0], subscriber = _step18$value[1];
6270
- _context60.prev = 8;
6271
- _context60.next = 11;
6573
+ _step19$value = _slicedToArray(_step19.value, 2), subscriberId = _step19$value[0], subscriber = _step19$value[1];
6574
+ _context62.prev = 8;
6575
+ _context62.next = 11;
6272
6576
  return this.computeProductQueryResult(subscriber.context, {
6273
6577
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
6274
6578
  });
6275
6579
  case 11:
6276
- result = _context60.sent;
6580
+ result = _context62.sent;
6277
6581
  subscriber.callback(result);
6278
6582
  this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
6279
6583
  subscriberId: subscriberId
6280
6584
  });
6281
- _context60.next = 20;
6585
+ _context62.next = 20;
6282
6586
  break;
6283
6587
  case 16:
6284
- _context60.prev = 16;
6285
- _context60.t0 = _context60["catch"](8);
6286
- errorMessage = _context60.t0 instanceof Error ? _context60.t0.message : String(_context60.t0);
6588
+ _context62.prev = 16;
6589
+ _context62.t0 = _context62["catch"](8);
6590
+ errorMessage = _context62.t0 instanceof Error ? _context62.t0.message : String(_context62.t0);
6287
6591
  this.logError('recomputeAndNotifyProductQuery: 推送失败', {
6288
6592
  subscriberId: subscriberId,
6289
6593
  error: errorMessage
6290
6594
  });
6291
6595
  case 20:
6292
- _context60.next = 6;
6596
+ _context62.next = 6;
6293
6597
  break;
6294
6598
  case 22:
6295
- _context60.next = 27;
6599
+ _context62.next = 27;
6296
6600
  break;
6297
6601
  case 24:
6298
- _context60.prev = 24;
6299
- _context60.t1 = _context60["catch"](4);
6300
- _iterator18.e(_context60.t1);
6602
+ _context62.prev = 24;
6603
+ _context62.t1 = _context62["catch"](4);
6604
+ _iterator19.e(_context62.t1);
6301
6605
  case 27:
6302
- _context60.prev = 27;
6303
- _iterator18.f();
6304
- return _context60.finish(27);
6606
+ _context62.prev = 27;
6607
+ _iterator19.f();
6608
+ return _context62.finish(27);
6305
6609
  case 30:
6306
6610
  case "end":
6307
- return _context60.stop();
6611
+ return _context62.stop();
6308
6612
  }
6309
- }, _callee60, this, [[4, 24, 27, 30], [8, 16]]);
6613
+ }, _callee62, this, [[4, 24, 27, 30], [8, 16]]);
6310
6614
  }));
6311
- function recomputeAndNotifyProductQuery(_x65) {
6615
+ function recomputeAndNotifyProductQuery(_x68) {
6312
6616
  return _recomputeAndNotifyProductQuery.apply(this, arguments);
6313
6617
  }
6314
6618
  return recomputeAndNotifyProductQuery;
@@ -6320,37 +6624,37 @@ var Server = /*#__PURE__*/function () {
6320
6624
  }, {
6321
6625
  key: "recomputeAndNotifyOrderQuery",
6322
6626
  value: (function () {
6323
- var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61() {
6324
- var notifyStartAt, _iterator19, _step19, _step19$value, subscriberId, subscriber, computeStartAt, result, computeEndAt, callbackStartAt, callbackEndAt, errorMessage, notifyEndAt;
6325
- return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6326
- while (1) switch (_context61.prev = _context61.next) {
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) {
6327
6631
  case 0:
6328
6632
  if (!(this.orderQuerySubscribers.size === 0)) {
6329
- _context61.next = 2;
6633
+ _context63.next = 2;
6330
6634
  break;
6331
6635
  }
6332
- return _context61.abrupt("return");
6636
+ return _context63.abrupt("return");
6333
6637
  case 2:
6334
6638
  notifyStartAt = Date.now();
6335
6639
  this.logInfo('recomputeAndNotifyOrderQuery: 开始推送', {
6336
6640
  subscriberCount: this.orderQuerySubscribers.size,
6337
6641
  notifyStartAt: new Date(notifyStartAt).toISOString()
6338
6642
  });
6339
- _iterator19 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
6340
- _context61.prev = 5;
6341
- _iterator19.s();
6643
+ _iterator20 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
6644
+ _context63.prev = 5;
6645
+ _iterator20.s();
6342
6646
  case 7:
6343
- if ((_step19 = _iterator19.n()).done) {
6344
- _context61.next = 27;
6647
+ if ((_step20 = _iterator20.n()).done) {
6648
+ _context63.next = 27;
6345
6649
  break;
6346
6650
  }
6347
- _step19$value = _slicedToArray(_step19.value, 2), subscriberId = _step19$value[0], subscriber = _step19$value[1];
6348
- _context61.prev = 9;
6651
+ _step20$value = _slicedToArray(_step20.value, 2), subscriberId = _step20$value[0], subscriber = _step20$value[1];
6652
+ _context63.prev = 9;
6349
6653
  computeStartAt = Date.now();
6350
- _context61.next = 13;
6654
+ _context63.next = 13;
6351
6655
  return this.computeOrderQueryResult(subscriber.context);
6352
6656
  case 13:
6353
- result = _context61.sent;
6657
+ result = _context63.sent;
6354
6658
  computeEndAt = Date.now();
6355
6659
  callbackStartAt = Date.now();
6356
6660
  subscriber.callback(result);
@@ -6361,30 +6665,30 @@ var Server = /*#__PURE__*/function () {
6361
6665
  callbackDurationMs: callbackEndAt - callbackStartAt,
6362
6666
  totalDurationMs: callbackEndAt - computeStartAt
6363
6667
  });
6364
- _context61.next = 25;
6668
+ _context63.next = 25;
6365
6669
  break;
6366
6670
  case 21:
6367
- _context61.prev = 21;
6368
- _context61.t0 = _context61["catch"](9);
6369
- errorMessage = _context61.t0 instanceof Error ? _context61.t0.message : String(_context61.t0);
6671
+ _context63.prev = 21;
6672
+ _context63.t0 = _context63["catch"](9);
6673
+ errorMessage = _context63.t0 instanceof Error ? _context63.t0.message : String(_context63.t0);
6370
6674
  this.logError('recomputeAndNotifyOrderQuery: 推送失败', {
6371
6675
  subscriberId: subscriberId,
6372
6676
  error: errorMessage
6373
6677
  });
6374
6678
  case 25:
6375
- _context61.next = 7;
6679
+ _context63.next = 7;
6376
6680
  break;
6377
6681
  case 27:
6378
- _context61.next = 32;
6682
+ _context63.next = 32;
6379
6683
  break;
6380
6684
  case 29:
6381
- _context61.prev = 29;
6382
- _context61.t1 = _context61["catch"](5);
6383
- _iterator19.e(_context61.t1);
6685
+ _context63.prev = 29;
6686
+ _context63.t1 = _context63["catch"](5);
6687
+ _iterator20.e(_context63.t1);
6384
6688
  case 32:
6385
- _context61.prev = 32;
6386
- _iterator19.f();
6387
- return _context61.finish(32);
6689
+ _context63.prev = 32;
6690
+ _iterator20.f();
6691
+ return _context63.finish(32);
6388
6692
  case 35:
6389
6693
  notifyEndAt = Date.now();
6390
6694
  this.logInfo('recomputeAndNotifyOrderQuery: 推送完成', {
@@ -6393,9 +6697,9 @@ var Server = /*#__PURE__*/function () {
6393
6697
  });
6394
6698
  case 37:
6395
6699
  case "end":
6396
- return _context61.stop();
6700
+ return _context63.stop();
6397
6701
  }
6398
- }, _callee61, this, [[5, 29, 32, 35], [9, 21]]);
6702
+ }, _callee63, this, [[5, 29, 32, 35], [9, 21]]);
6399
6703
  }));
6400
6704
  function recomputeAndNotifyOrderQuery() {
6401
6705
  return _recomputeAndNotifyOrderQuery.apply(this, arguments);
@@ -6422,13 +6726,13 @@ var Server = /*#__PURE__*/function () {
6422
6726
  // 如果当前开启了 checkout 弹窗,先不进行刷新,下面的代码会导致在全局搜索页调用 bookingTicket.destroy()
6423
6727
  // 导致模块被销毁 ,checkout 弹窗永远无法关闭
6424
6728
  if (window.isPaymentModalPluginOpen) return;
6425
- var _iterator20 = _createForOfIteratorHelper(this.salesSearchSubscribers.entries()),
6426
- _step20;
6729
+ var _iterator21 = _createForOfIteratorHelper(this.salesSearchSubscribers.entries()),
6730
+ _step21;
6427
6731
  try {
6428
6732
  var _loop = function _loop() {
6429
- var _step20$value = _slicedToArray(_step20.value, 2),
6430
- subscriberId = _step20$value[0],
6431
- subscriber = _step20$value[1];
6733
+ var _step21$value = _slicedToArray(_step21.value, 2),
6734
+ subscriberId = _step21$value[0],
6735
+ subscriber = _step21$value[1];
6432
6736
  try {
6433
6737
  var changedVisibleOrders = changedOrders.filter(function (order) {
6434
6738
  var orderId = _this18.getSalesSearchOrderId(order);
@@ -6451,13 +6755,13 @@ var Server = /*#__PURE__*/function () {
6451
6755
  });
6452
6756
  }
6453
6757
  };
6454
- for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
6758
+ for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
6455
6759
  if (_loop()) continue;
6456
6760
  }
6457
6761
  } catch (err) {
6458
- _iterator20.e(err);
6762
+ _iterator21.e(err);
6459
6763
  } finally {
6460
- _iterator20.f();
6764
+ _iterator21.f();
6461
6765
  }
6462
6766
  }
6463
6767
 
@@ -6536,67 +6840,67 @@ var Server = /*#__PURE__*/function () {
6536
6840
  }, {
6537
6841
  key: "recomputeAndNotifyBookingQuery",
6538
6842
  value: (function () {
6539
- var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62() {
6540
- var _iterator21, _step21, _step21$value, subscriberId, subscriber, result, errorMessage;
6541
- return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6542
- while (1) switch (_context62.prev = _context62.next) {
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) {
6543
6847
  case 0:
6544
6848
  if (!(this.bookingQuerySubscribers.size === 0)) {
6545
- _context62.next = 2;
6849
+ _context64.next = 2;
6546
6850
  break;
6547
6851
  }
6548
- return _context62.abrupt("return");
6852
+ return _context64.abrupt("return");
6549
6853
  case 2:
6550
6854
  this.logInfo('recomputeAndNotifyBookingQuery: 开始推送', {
6551
6855
  subscriberCount: this.bookingQuerySubscribers.size
6552
6856
  });
6553
- _iterator21 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
6554
- _context62.prev = 4;
6555
- _iterator21.s();
6857
+ _iterator22 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
6858
+ _context64.prev = 4;
6859
+ _iterator22.s();
6556
6860
  case 6:
6557
- if ((_step21 = _iterator21.n()).done) {
6558
- _context62.next = 22;
6861
+ if ((_step22 = _iterator22.n()).done) {
6862
+ _context64.next = 22;
6559
6863
  break;
6560
6864
  }
6561
- _step21$value = _slicedToArray(_step21.value, 2), subscriberId = _step21$value[0], subscriber = _step21$value[1];
6562
- _context62.prev = 8;
6563
- _context62.next = 11;
6865
+ _step22$value = _slicedToArray(_step22.value, 2), subscriberId = _step22$value[0], subscriber = _step22$value[1];
6866
+ _context64.prev = 8;
6867
+ _context64.next = 11;
6564
6868
  return this.computeBookingQueryResult(subscriber.context);
6565
6869
  case 11:
6566
- result = _context62.sent;
6870
+ result = _context64.sent;
6567
6871
  subscriber.callback(result);
6568
6872
  this.logInfo('recomputeAndNotifyBookingQuery: 已推送', {
6569
6873
  subscriberId: subscriberId
6570
6874
  });
6571
- _context62.next = 20;
6875
+ _context64.next = 20;
6572
6876
  break;
6573
6877
  case 16:
6574
- _context62.prev = 16;
6575
- _context62.t0 = _context62["catch"](8);
6576
- errorMessage = _context62.t0 instanceof Error ? _context62.t0.message : String(_context62.t0);
6878
+ _context64.prev = 16;
6879
+ _context64.t0 = _context64["catch"](8);
6880
+ errorMessage = _context64.t0 instanceof Error ? _context64.t0.message : String(_context64.t0);
6577
6881
  this.logError('recomputeAndNotifyBookingQuery: 推送失败', {
6578
6882
  subscriberId: subscriberId,
6579
6883
  error: errorMessage
6580
6884
  });
6581
6885
  case 20:
6582
- _context62.next = 6;
6886
+ _context64.next = 6;
6583
6887
  break;
6584
6888
  case 22:
6585
- _context62.next = 27;
6889
+ _context64.next = 27;
6586
6890
  break;
6587
6891
  case 24:
6588
- _context62.prev = 24;
6589
- _context62.t1 = _context62["catch"](4);
6590
- _iterator21.e(_context62.t1);
6892
+ _context64.prev = 24;
6893
+ _context64.t1 = _context64["catch"](4);
6894
+ _iterator22.e(_context64.t1);
6591
6895
  case 27:
6592
- _context62.prev = 27;
6593
- _iterator21.f();
6594
- return _context62.finish(27);
6896
+ _context64.prev = 27;
6897
+ _iterator22.f();
6898
+ return _context64.finish(27);
6595
6899
  case 30:
6596
6900
  case "end":
6597
- return _context62.stop();
6901
+ return _context64.stop();
6598
6902
  }
6599
- }, _callee62, this, [[4, 24, 27, 30], [8, 16]]);
6903
+ }, _callee64, this, [[4, 24, 27, 30], [8, 16]]);
6600
6904
  }));
6601
6905
  function recomputeAndNotifyBookingQuery() {
6602
6906
  return _recomputeAndNotifyBookingQuery.apply(this, arguments);
@@ -6626,11 +6930,11 @@ var Server = /*#__PURE__*/function () {
6626
6930
  var allowedProductIds = new Set();
6627
6931
  var allowedCollectionIds = new Set();
6628
6932
  var hasProductAll = false;
6629
- var _iterator22 = _createForOfIteratorHelper(activeMenuList),
6630
- _step22;
6933
+ var _iterator23 = _createForOfIteratorHelper(activeMenuList),
6934
+ _step23;
6631
6935
  try {
6632
- for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
6633
- var menu = _step22.value;
6936
+ for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) {
6937
+ var menu = _step23.value;
6634
6938
  var config = menu.partyroom_package;
6635
6939
  if (!config) {
6636
6940
  console.warn('[Server] 餐牌缺少 partyroom_package 配置:', menu);
@@ -6690,9 +6994,9 @@ var Server = /*#__PURE__*/function () {
6690
6994
 
6691
6995
  // 如果有餐牌允许所有商品,返回所有商品
6692
6996
  } catch (err) {
6693
- _iterator22.e(err);
6997
+ _iterator23.e(err);
6694
6998
  } finally {
6695
- _iterator22.f();
6999
+ _iterator23.f();
6696
7000
  }
6697
7001
  if (hasProductAll) {
6698
7002
  this.logInfo('getProductScopeByMenuConfig: 返回所有商品 scope(product_all)');