@pisell/pisellos 2.2.257 → 2.2.259

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