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