@pisell/pisellos 2.3.11 → 2.3.13

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