@pisell/pisellos 2.2.192 → 2.2.193
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
- package/dist/modules/Order/index.d.ts +12 -10
- package/dist/modules/Order/index.js +462 -571
- package/dist/modules/Order/types.d.ts +5 -5
- package/dist/modules/Order/utils.js +3 -3
- package/dist/modules/Payment/utils.js +2 -1
- package/dist/modules/SalesSummary/utils.js +1 -1
- package/dist/server/index.d.ts +8 -1
- package/dist/server/index.js +651 -464
- package/dist/server/modules/order/index.d.ts +3 -2
- package/dist/server/modules/order/index.js +68 -52
- package/dist/solution/BaseSales/index.d.ts +2 -1
- package/dist/solution/BaseSales/index.js +116 -122
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +0 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/ScanOrder/index.js +3 -1
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +3 -2
- package/lib/modules/Order/index.d.ts +12 -10
- package/lib/modules/Order/index.js +94 -118
- package/lib/modules/Order/types.d.ts +5 -5
- package/lib/modules/Order/utils.js +4 -4
- package/lib/modules/Payment/utils.js +2 -1
- package/lib/modules/SalesSummary/utils.js +1 -3
- package/lib/server/index.d.ts +8 -1
- package/lib/server/index.js +143 -24
- package/lib/server/modules/order/index.d.ts +3 -2
- package/lib/server/modules/order/index.js +25 -15
- package/lib/solution/BaseSales/index.d.ts +2 -1
- package/lib/solution/BaseSales/index.js +53 -16
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +0 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/ScanOrder/index.js +3 -1
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -682,174 +682,222 @@ var Server = /*#__PURE__*/function () {
|
|
|
682
682
|
return _ref21.apply(this, arguments);
|
|
683
683
|
};
|
|
684
684
|
}());
|
|
685
|
-
_defineProperty(this, "
|
|
685
|
+
_defineProperty(this, "handleOrderSalesCheckout", /*#__PURE__*/function () {
|
|
686
686
|
var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref23) {
|
|
687
|
-
var
|
|
688
|
-
var url, data, path, requestPath, orderId, localOrder, backendPath, _response$data2, response, fresh, savedOrder, errorMessage;
|
|
687
|
+
var data;
|
|
689
688
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
690
689
|
while (1) switch (_context9.prev = _context9.next) {
|
|
691
690
|
case 0:
|
|
692
|
-
|
|
691
|
+
data = _ref23.data;
|
|
692
|
+
return _context9.abrupt("return", _this.handleOrderCheckoutSubmit({
|
|
693
|
+
backendPath: '/shop/order/sales/checkout',
|
|
694
|
+
data: data,
|
|
695
|
+
title: 'handleOrderSalesCheckout'
|
|
696
|
+
}));
|
|
697
|
+
case 2:
|
|
698
|
+
case "end":
|
|
699
|
+
return _context9.stop();
|
|
700
|
+
}
|
|
701
|
+
}, _callee9);
|
|
702
|
+
}));
|
|
703
|
+
return function (_x9) {
|
|
704
|
+
return _ref24.apply(this, arguments);
|
|
705
|
+
};
|
|
706
|
+
}());
|
|
707
|
+
_defineProperty(this, "handleOrderCheckout", /*#__PURE__*/function () {
|
|
708
|
+
var _ref26 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref25) {
|
|
709
|
+
var data;
|
|
710
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
711
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
712
|
+
case 0:
|
|
713
|
+
data = _ref25.data;
|
|
714
|
+
return _context10.abrupt("return", _this.handleOrderCheckoutSubmit({
|
|
715
|
+
backendPath: '/order/checkout',
|
|
716
|
+
data: data,
|
|
717
|
+
title: 'handleOrderCheckout'
|
|
718
|
+
}));
|
|
719
|
+
case 2:
|
|
720
|
+
case "end":
|
|
721
|
+
return _context10.stop();
|
|
722
|
+
}
|
|
723
|
+
}, _callee10);
|
|
724
|
+
}));
|
|
725
|
+
return function (_x10) {
|
|
726
|
+
return _ref26.apply(this, arguments);
|
|
727
|
+
};
|
|
728
|
+
}());
|
|
729
|
+
_defineProperty(this, "handleOrderSalesDetail", /*#__PURE__*/function () {
|
|
730
|
+
var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref27) {
|
|
731
|
+
var _this$app2;
|
|
732
|
+
var url, data, path, requestPath, lookup, localOrder, backendPath, _response$data2, response, fresh, savedOrder, errorMessage;
|
|
733
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
734
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
735
|
+
case 0:
|
|
736
|
+
url = _ref27.url, data = _ref27.data, path = _ref27.path;
|
|
693
737
|
requestPath = _this.parseRequestPath(url, path);
|
|
694
|
-
|
|
738
|
+
lookup = _this.extractOrderSalesDetailLookup(requestPath);
|
|
695
739
|
_this.logInfo('handleOrderSalesDetail: 开始处理', {
|
|
696
740
|
url: url,
|
|
697
741
|
path: requestPath,
|
|
698
|
-
|
|
742
|
+
lookup: lookup
|
|
699
743
|
});
|
|
700
|
-
if (
|
|
701
|
-
|
|
744
|
+
if (lookup) {
|
|
745
|
+
_context11.next = 7;
|
|
702
746
|
break;
|
|
703
747
|
}
|
|
704
|
-
_this.logWarning('handleOrderSalesDetail:
|
|
748
|
+
_this.logWarning('handleOrderSalesDetail: lookup 缺失', {
|
|
705
749
|
url: url,
|
|
706
750
|
path: requestPath
|
|
707
751
|
});
|
|
708
|
-
return
|
|
752
|
+
return _context11.abrupt("return", {
|
|
709
753
|
code: 400,
|
|
710
754
|
status: false,
|
|
711
|
-
message: '
|
|
755
|
+
message: '订单 lookup 缺失',
|
|
712
756
|
data: null
|
|
713
757
|
});
|
|
714
758
|
case 7:
|
|
715
759
|
if (_this.order) {
|
|
716
|
-
|
|
760
|
+
_context11.next = 10;
|
|
717
761
|
break;
|
|
718
762
|
}
|
|
719
763
|
_this.logError('handleOrderSalesDetail: Order 模块未注册');
|
|
720
|
-
return
|
|
764
|
+
return _context11.abrupt("return", {
|
|
721
765
|
code: 500,
|
|
722
766
|
status: false,
|
|
723
767
|
message: 'Order 模块未注册',
|
|
724
768
|
data: null
|
|
725
769
|
});
|
|
726
770
|
case 10:
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
771
|
+
if (_this.shouldForceRemoteSalesDetail(data)) {
|
|
772
|
+
_context11.next = 17;
|
|
773
|
+
break;
|
|
774
|
+
}
|
|
775
|
+
_context11.next = 13;
|
|
776
|
+
return _this.order.getLocalOrderByLookup(lookup);
|
|
777
|
+
case 13:
|
|
778
|
+
localOrder = _context11.sent;
|
|
731
779
|
if (!localOrder) {
|
|
732
|
-
|
|
780
|
+
_context11.next = 17;
|
|
733
781
|
break;
|
|
734
782
|
}
|
|
735
783
|
_this.logInfo('handleOrderSalesDetail: 命中本地订单', {
|
|
736
|
-
|
|
784
|
+
lookup: lookup
|
|
737
785
|
});
|
|
738
|
-
return
|
|
786
|
+
return _context11.abrupt("return", {
|
|
739
787
|
code: 200,
|
|
740
788
|
status: true,
|
|
741
789
|
message: '',
|
|
742
790
|
data: localOrder
|
|
743
791
|
});
|
|
744
|
-
case
|
|
792
|
+
case 17:
|
|
745
793
|
if ((_this$app2 = _this.app) !== null && _this$app2 !== void 0 && _this$app2.request) {
|
|
746
|
-
|
|
794
|
+
_context11.next = 20;
|
|
747
795
|
break;
|
|
748
796
|
}
|
|
749
797
|
_this.logError('handleOrderSalesDetail: app.request 不可用');
|
|
750
|
-
return
|
|
798
|
+
return _context11.abrupt("return", {
|
|
751
799
|
code: 500,
|
|
752
800
|
status: false,
|
|
753
801
|
message: 'app.request 不可用',
|
|
754
802
|
data: null
|
|
755
803
|
});
|
|
756
|
-
case
|
|
757
|
-
backendPath = _this.buildOrderSalesDetailBackendPath(
|
|
758
|
-
|
|
759
|
-
|
|
804
|
+
case 20:
|
|
805
|
+
backendPath = _this.buildOrderSalesDetailBackendPath(lookup, data);
|
|
806
|
+
_context11.prev = 21;
|
|
807
|
+
_context11.next = 24;
|
|
760
808
|
return _this.app.request.get(backendPath, {
|
|
761
809
|
lookup_mode: 'multi'
|
|
762
810
|
}, {
|
|
763
811
|
isShopApi: true,
|
|
764
812
|
customToast: function customToast() {}
|
|
765
813
|
});
|
|
766
|
-
case
|
|
767
|
-
response =
|
|
814
|
+
case 24:
|
|
815
|
+
response = _context11.sent;
|
|
768
816
|
fresh = (_response$data2 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data2 !== void 0 ? _response$data2 : response;
|
|
769
817
|
if (!(!fresh || _typeof(fresh) !== 'object' || fresh.order_id == null)) {
|
|
770
|
-
|
|
818
|
+
_context11.next = 29;
|
|
771
819
|
break;
|
|
772
820
|
}
|
|
773
821
|
_this.logError('handleOrderSalesDetail: 后端返回订单为空', {
|
|
774
|
-
|
|
822
|
+
lookup: lookup,
|
|
775
823
|
backendPath: backendPath
|
|
776
824
|
});
|
|
777
|
-
return
|
|
825
|
+
return _context11.abrupt("return", {
|
|
778
826
|
code: 500,
|
|
779
827
|
status: false,
|
|
780
828
|
message: '后端返回订单为空',
|
|
781
829
|
data: null
|
|
782
830
|
});
|
|
783
|
-
case
|
|
784
|
-
|
|
831
|
+
case 29:
|
|
832
|
+
_context11.next = 31;
|
|
785
833
|
return _this.order.upsertOrdersFromRemote([fresh]);
|
|
786
|
-
case
|
|
787
|
-
|
|
788
|
-
return _this.order.
|
|
789
|
-
case
|
|
790
|
-
savedOrder =
|
|
834
|
+
case 31:
|
|
835
|
+
_context11.next = 33;
|
|
836
|
+
return _this.order.getLocalOrderByLookup(lookup);
|
|
837
|
+
case 33:
|
|
838
|
+
savedOrder = _context11.sent;
|
|
791
839
|
if (savedOrder) {
|
|
792
|
-
|
|
840
|
+
_context11.next = 37;
|
|
793
841
|
break;
|
|
794
842
|
}
|
|
795
843
|
_this.logError('handleOrderSalesDetail: 订单写入后回读失败', {
|
|
796
|
-
|
|
844
|
+
lookup: lookup
|
|
797
845
|
});
|
|
798
|
-
return
|
|
846
|
+
return _context11.abrupt("return", {
|
|
799
847
|
code: 500,
|
|
800
848
|
status: false,
|
|
801
849
|
message: '订单写入后回读失败',
|
|
802
850
|
data: null
|
|
803
851
|
});
|
|
804
|
-
case
|
|
852
|
+
case 37:
|
|
805
853
|
_this.logInfo('handleOrderSalesDetail: 远端订单已同步到本地', {
|
|
806
|
-
|
|
854
|
+
lookup: lookup
|
|
807
855
|
});
|
|
808
|
-
return
|
|
856
|
+
return _context11.abrupt("return", {
|
|
809
857
|
code: 200,
|
|
810
858
|
status: true,
|
|
811
859
|
message: '',
|
|
812
860
|
data: savedOrder
|
|
813
861
|
});
|
|
814
|
-
case
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
errorMessage =
|
|
862
|
+
case 41:
|
|
863
|
+
_context11.prev = 41;
|
|
864
|
+
_context11.t0 = _context11["catch"](21);
|
|
865
|
+
errorMessage = _context11.t0 instanceof Error ? _context11.t0.message : String(_context11.t0);
|
|
818
866
|
_this.logError('handleOrderSalesDetail: 请求失败', {
|
|
819
|
-
|
|
867
|
+
lookup: lookup,
|
|
820
868
|
backendPath: backendPath,
|
|
821
869
|
error: errorMessage
|
|
822
870
|
});
|
|
823
|
-
return
|
|
871
|
+
return _context11.abrupt("return", {
|
|
824
872
|
code: 500,
|
|
825
873
|
status: false,
|
|
826
874
|
message: errorMessage,
|
|
827
875
|
data: null
|
|
828
876
|
});
|
|
829
|
-
case
|
|
877
|
+
case 46:
|
|
830
878
|
case "end":
|
|
831
|
-
return
|
|
879
|
+
return _context11.stop();
|
|
832
880
|
}
|
|
833
|
-
},
|
|
881
|
+
}, _callee11, null, [[21, 41]]);
|
|
834
882
|
}));
|
|
835
|
-
return function (
|
|
836
|
-
return
|
|
883
|
+
return function (_x11) {
|
|
884
|
+
return _ref28.apply(this, arguments);
|
|
837
885
|
};
|
|
838
886
|
}());
|
|
839
887
|
/**
|
|
840
888
|
* GET /shop/schedule/floor-plan* 前缀路由:读本地 store;支持 subscriberId + callback 订阅更新
|
|
841
889
|
*/
|
|
842
890
|
_defineProperty(this, "handleFloorPlanGet", /*#__PURE__*/function () {
|
|
843
|
-
var
|
|
844
|
-
var url, data, config, routePath, base, path, _subscriberId,
|
|
845
|
-
return _regeneratorRuntime().wrap(function
|
|
846
|
-
while (1) switch (
|
|
891
|
+
var _ref30 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref29) {
|
|
892
|
+
var url, data, config, routePath, base, path, _subscriberId, _ref31, callback, subscriberId, ctx;
|
|
893
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
894
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
847
895
|
case 0:
|
|
848
|
-
url =
|
|
896
|
+
url = _ref29.url, data = _ref29.data, config = _ref29.config, routePath = _ref29.path;
|
|
849
897
|
base = '/shop/schedule/floor-plan';
|
|
850
898
|
path = _this.parseRequestPath(url, routePath);
|
|
851
899
|
if (!(path === "".concat(base, "/unsubscribe"))) {
|
|
852
|
-
|
|
900
|
+
_context12.next = 7;
|
|
853
901
|
break;
|
|
854
902
|
}
|
|
855
903
|
_subscriberId = data === null || data === void 0 ? void 0 : data.subscriberId;
|
|
@@ -860,19 +908,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
860
908
|
remaining: _this.floorPlanQuerySubscribers.size
|
|
861
909
|
});
|
|
862
910
|
}
|
|
863
|
-
return
|
|
911
|
+
return _context12.abrupt("return", {
|
|
864
912
|
code: 200,
|
|
865
913
|
message: 'ok',
|
|
866
914
|
status: true
|
|
867
915
|
});
|
|
868
916
|
case 7:
|
|
869
|
-
|
|
917
|
+
_ref31 = config || {}, callback = _ref31.callback, subscriberId = _ref31.subscriberId;
|
|
870
918
|
ctx = _this.resolveFloorPlanQueryContext(path, base);
|
|
871
919
|
if (ctx) {
|
|
872
|
-
|
|
920
|
+
_context12.next = 11;
|
|
873
921
|
break;
|
|
874
922
|
}
|
|
875
|
-
return
|
|
923
|
+
return _context12.abrupt("return", {
|
|
876
924
|
status: false,
|
|
877
925
|
code: 404,
|
|
878
926
|
message: 'Not Found',
|
|
@@ -890,28 +938,28 @@ var Server = /*#__PURE__*/function () {
|
|
|
890
938
|
total: _this.floorPlanQuerySubscribers.size
|
|
891
939
|
});
|
|
892
940
|
}
|
|
893
|
-
return
|
|
941
|
+
return _context12.abrupt("return", _this.computeFloorPlanQueryResult(ctx));
|
|
894
942
|
case 13:
|
|
895
943
|
case "end":
|
|
896
|
-
return
|
|
944
|
+
return _context12.stop();
|
|
897
945
|
}
|
|
898
|
-
},
|
|
946
|
+
}, _callee12);
|
|
899
947
|
}));
|
|
900
|
-
return function (
|
|
901
|
-
return
|
|
948
|
+
return function (_x12) {
|
|
949
|
+
return _ref30.apply(this, arguments);
|
|
902
950
|
};
|
|
903
951
|
}());
|
|
904
952
|
/**
|
|
905
953
|
* 取消预约列表查询订阅(HTTP 路由入口)
|
|
906
954
|
*/
|
|
907
955
|
_defineProperty(this, "handleUnsubscribeBookingQuery", /*#__PURE__*/function () {
|
|
908
|
-
var
|
|
909
|
-
var data,
|
|
910
|
-
return _regeneratorRuntime().wrap(function
|
|
911
|
-
while (1) switch (
|
|
956
|
+
var _ref33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_ref32) {
|
|
957
|
+
var data, _ref34, subscriberId;
|
|
958
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
959
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
912
960
|
case 0:
|
|
913
|
-
data =
|
|
914
|
-
|
|
961
|
+
data = _ref32.data;
|
|
962
|
+
_ref34 = data || {}, subscriberId = _ref34.subscriberId;
|
|
915
963
|
if (subscriberId) {
|
|
916
964
|
_this.bookingQuerySubscribers.delete(subscriberId);
|
|
917
965
|
_this.bookingRemoteQuerySubscribers.delete(subscriberId);
|
|
@@ -921,19 +969,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
921
969
|
remainingRemote: _this.bookingRemoteQuerySubscribers.size
|
|
922
970
|
});
|
|
923
971
|
}
|
|
924
|
-
return
|
|
972
|
+
return _context13.abrupt("return", {
|
|
925
973
|
code: 200,
|
|
926
974
|
message: 'ok',
|
|
927
975
|
status: true
|
|
928
976
|
});
|
|
929
977
|
case 4:
|
|
930
978
|
case "end":
|
|
931
|
-
return
|
|
979
|
+
return _context13.stop();
|
|
932
980
|
}
|
|
933
|
-
},
|
|
981
|
+
}, _callee13);
|
|
934
982
|
}));
|
|
935
|
-
return function (
|
|
936
|
-
return
|
|
983
|
+
return function (_x13) {
|
|
984
|
+
return _ref33.apply(this, arguments);
|
|
937
985
|
};
|
|
938
986
|
}());
|
|
939
987
|
/**
|
|
@@ -941,13 +989,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
941
989
|
* 通过餐牌ID列表获取所有相关日程的时间段点
|
|
942
990
|
*/
|
|
943
991
|
_defineProperty(this, "handleGetScheduleTimePoints", /*#__PURE__*/function () {
|
|
944
|
-
var
|
|
992
|
+
var _ref36 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(_ref35) {
|
|
945
993
|
var _menu_list_ids$length;
|
|
946
994
|
var url, method, data, config, menu_list_ids, _menu_list_ids$length2, menuList, scheduleIds, scheduleList, timePoints, errorMessage;
|
|
947
|
-
return _regeneratorRuntime().wrap(function
|
|
948
|
-
while (1) switch (
|
|
995
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
996
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
949
997
|
case 0:
|
|
950
|
-
url =
|
|
998
|
+
url = _ref35.url, method = _ref35.method, data = _ref35.data, config = _ref35.config;
|
|
951
999
|
console.log('[Server] handleGetScheduleTimePoints:', url, method, data, config);
|
|
952
1000
|
menu_list_ids = data.menu_list_ids;
|
|
953
1001
|
_this.logInfo('handleGetScheduleTimePoints 开始处理', {
|
|
@@ -957,12 +1005,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
957
1005
|
|
|
958
1006
|
// 检查必要的模块是否已注册
|
|
959
1007
|
if (_this.menu) {
|
|
960
|
-
|
|
1008
|
+
_context14.next = 8;
|
|
961
1009
|
break;
|
|
962
1010
|
}
|
|
963
1011
|
console.error('[Server] Menu 模块未注册');
|
|
964
1012
|
_this.logError('handleGetScheduleTimePoints: Menu 模块未注册');
|
|
965
|
-
return
|
|
1013
|
+
return _context14.abrupt("return", {
|
|
966
1014
|
code: 500,
|
|
967
1015
|
message: 'Menu 模块未注册',
|
|
968
1016
|
data: [],
|
|
@@ -970,12 +1018,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
970
1018
|
});
|
|
971
1019
|
case 8:
|
|
972
1020
|
if (_this.schedule) {
|
|
973
|
-
|
|
1021
|
+
_context14.next = 12;
|
|
974
1022
|
break;
|
|
975
1023
|
}
|
|
976
1024
|
console.error('[Server] Schedule 模块未注册');
|
|
977
1025
|
_this.logError('handleGetScheduleTimePoints: Schedule 模块未注册');
|
|
978
|
-
return
|
|
1026
|
+
return _context14.abrupt("return", {
|
|
979
1027
|
code: 500,
|
|
980
1028
|
message: 'Schedule 模块未注册',
|
|
981
1029
|
data: [],
|
|
@@ -983,7 +1031,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
983
1031
|
});
|
|
984
1032
|
case 12:
|
|
985
1033
|
if (!(!menu_list_ids || !Array.isArray(menu_list_ids) || menu_list_ids.length === 0)) {
|
|
986
|
-
|
|
1034
|
+
_context14.next = 16;
|
|
987
1035
|
break;
|
|
988
1036
|
}
|
|
989
1037
|
console.error('[Server] menu_list_ids 参数无效');
|
|
@@ -991,14 +1039,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
991
1039
|
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,
|
|
992
1040
|
menu_list_ids: menu_list_ids
|
|
993
1041
|
});
|
|
994
|
-
return
|
|
1042
|
+
return _context14.abrupt("return", {
|
|
995
1043
|
code: 400,
|
|
996
1044
|
message: 'menu_list_ids 参数无效',
|
|
997
1045
|
data: [],
|
|
998
1046
|
status: false
|
|
999
1047
|
});
|
|
1000
1048
|
case 16:
|
|
1001
|
-
|
|
1049
|
+
_context14.prev = 16;
|
|
1002
1050
|
// 1. 获取餐牌列表
|
|
1003
1051
|
menuList = _this.menu.getMenuByIds(menu_list_ids);
|
|
1004
1052
|
console.log("[Server] \u627E\u5230 ".concat(menuList.length, " \u4E2A\u9910\u724C"));
|
|
@@ -1016,13 +1064,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
1016
1064
|
scheduleCount: scheduleIds.length
|
|
1017
1065
|
});
|
|
1018
1066
|
if (!(scheduleIds.length === 0)) {
|
|
1019
|
-
|
|
1067
|
+
_context14.next = 26;
|
|
1020
1068
|
break;
|
|
1021
1069
|
}
|
|
1022
1070
|
_this.logInfo('handleGetScheduleTimePoints: 没有找到相关日程', {
|
|
1023
1071
|
menuListIdsCount: menu_list_ids.length
|
|
1024
1072
|
});
|
|
1025
|
-
return
|
|
1073
|
+
return _context14.abrupt("return", {
|
|
1026
1074
|
code: 200,
|
|
1027
1075
|
message: '没有找到相关日程',
|
|
1028
1076
|
data: [],
|
|
@@ -1046,22 +1094,22 @@ var Server = /*#__PURE__*/function () {
|
|
|
1046
1094
|
scheduleCount: scheduleList.length,
|
|
1047
1095
|
timePointCount: timePoints.length
|
|
1048
1096
|
});
|
|
1049
|
-
return
|
|
1097
|
+
return _context14.abrupt("return", {
|
|
1050
1098
|
code: 200,
|
|
1051
1099
|
message: '获取成功',
|
|
1052
1100
|
data: timePoints,
|
|
1053
1101
|
status: true
|
|
1054
1102
|
});
|
|
1055
1103
|
case 35:
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
errorMessage =
|
|
1059
|
-
console.error('[Server] 获取日程时间点失败:',
|
|
1104
|
+
_context14.prev = 35;
|
|
1105
|
+
_context14.t0 = _context14["catch"](16);
|
|
1106
|
+
errorMessage = _context14.t0 instanceof Error ? _context14.t0.message : '未知错误';
|
|
1107
|
+
console.error('[Server] 获取日程时间点失败:', _context14.t0);
|
|
1060
1108
|
_this.logError('handleGetScheduleTimePoints: 获取日程时间点失败', {
|
|
1061
1109
|
menuListIdsCount: menu_list_ids.length,
|
|
1062
1110
|
error: errorMessage
|
|
1063
1111
|
});
|
|
1064
|
-
return
|
|
1112
|
+
return _context14.abrupt("return", {
|
|
1065
1113
|
code: 500,
|
|
1066
1114
|
message: "\u83B7\u53D6\u5931\u8D25: ".concat(errorMessage),
|
|
1067
1115
|
data: [],
|
|
@@ -1069,12 +1117,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
1069
1117
|
});
|
|
1070
1118
|
case 41:
|
|
1071
1119
|
case "end":
|
|
1072
|
-
return
|
|
1120
|
+
return _context14.stop();
|
|
1073
1121
|
}
|
|
1074
|
-
},
|
|
1122
|
+
}, _callee14, null, [[16, 35]]);
|
|
1075
1123
|
}));
|
|
1076
|
-
return function (
|
|
1077
|
-
return
|
|
1124
|
+
return function (_x14) {
|
|
1125
|
+
return _ref36.apply(this, arguments);
|
|
1078
1126
|
};
|
|
1079
1127
|
}());
|
|
1080
1128
|
this.core = core;
|
|
@@ -1171,10 +1219,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1171
1219
|
}, {
|
|
1172
1220
|
key: "registerModuleWithRoutes",
|
|
1173
1221
|
value: (function () {
|
|
1174
|
-
var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1222
|
+
var _registerModuleWithRoutes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(module, options, moduleName) {
|
|
1175
1223
|
var routes;
|
|
1176
|
-
return _regeneratorRuntime().wrap(function
|
|
1177
|
-
while (1) switch (
|
|
1224
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1225
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1178
1226
|
case 0:
|
|
1179
1227
|
this.logInfo("\u5F00\u59CB\u6CE8\u518C\u6A21\u5757: ".concat(moduleName), {
|
|
1180
1228
|
moduleName: moduleName,
|
|
@@ -1182,7 +1230,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1182
1230
|
});
|
|
1183
1231
|
|
|
1184
1232
|
// 注册模块到 Core
|
|
1185
|
-
|
|
1233
|
+
_context15.next = 3;
|
|
1186
1234
|
return this.core.registerModule(module, options);
|
|
1187
1235
|
case 3:
|
|
1188
1236
|
console.log("[Server] \u2705 ".concat(moduleName, " \u6A21\u5757\u5DF2\u6CE8\u518C"));
|
|
@@ -1203,11 +1251,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1203
1251
|
}
|
|
1204
1252
|
case 6:
|
|
1205
1253
|
case "end":
|
|
1206
|
-
return
|
|
1254
|
+
return _context15.stop();
|
|
1207
1255
|
}
|
|
1208
|
-
},
|
|
1256
|
+
}, _callee15, this);
|
|
1209
1257
|
}));
|
|
1210
|
-
function registerModuleWithRoutes(
|
|
1258
|
+
function registerModuleWithRoutes(_x15, _x16, _x17) {
|
|
1211
1259
|
return _registerModuleWithRoutes.apply(this, arguments);
|
|
1212
1260
|
}
|
|
1213
1261
|
return registerModuleWithRoutes;
|
|
@@ -1220,10 +1268,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1220
1268
|
}, {
|
|
1221
1269
|
key: "registerModuleByName",
|
|
1222
1270
|
value: (function () {
|
|
1223
|
-
var _registerModuleByName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1271
|
+
var _registerModuleByName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(moduleConfig) {
|
|
1224
1272
|
var moduleName, shouldPreload, customConfig, registryConfig, ModuleClass, moduleInstance, moduleOptions;
|
|
1225
|
-
return _regeneratorRuntime().wrap(function
|
|
1226
|
-
while (1) switch (
|
|
1273
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1274
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1227
1275
|
case 0:
|
|
1228
1276
|
// 解析配置
|
|
1229
1277
|
moduleName = typeof moduleConfig === 'string' ? moduleConfig : moduleConfig.name;
|
|
@@ -1238,7 +1286,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1238
1286
|
// 查找模块配置
|
|
1239
1287
|
registryConfig = this.moduleRegistry[moduleName];
|
|
1240
1288
|
if (registryConfig) {
|
|
1241
|
-
|
|
1289
|
+
_context16.next = 8;
|
|
1242
1290
|
break;
|
|
1243
1291
|
}
|
|
1244
1292
|
this.logError("\u672A\u627E\u5230\u6A21\u5757\u914D\u7F6E: ".concat(moduleName), {
|
|
@@ -1252,7 +1300,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1252
1300
|
moduleOptions = _objectSpread({
|
|
1253
1301
|
store: _objectSpread({}, registryConfig.defaultStore)
|
|
1254
1302
|
}, customConfig); // 注册模块和路由
|
|
1255
|
-
|
|
1303
|
+
_context16.next = 13;
|
|
1256
1304
|
return this.registerModuleWithRoutes(moduleInstance, moduleOptions, moduleName.charAt(0).toUpperCase() + moduleName.slice(1));
|
|
1257
1305
|
case 13:
|
|
1258
1306
|
// 保存模块实例
|
|
@@ -1262,18 +1310,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
1262
1310
|
shouldPreload: shouldPreload,
|
|
1263
1311
|
version: registryConfig.version
|
|
1264
1312
|
});
|
|
1265
|
-
return
|
|
1313
|
+
return _context16.abrupt("return", {
|
|
1266
1314
|
module: moduleInstance,
|
|
1267
1315
|
config: registryConfig,
|
|
1268
1316
|
shouldPreload: shouldPreload
|
|
1269
1317
|
});
|
|
1270
1318
|
case 16:
|
|
1271
1319
|
case "end":
|
|
1272
|
-
return
|
|
1320
|
+
return _context16.stop();
|
|
1273
1321
|
}
|
|
1274
|
-
},
|
|
1322
|
+
}, _callee16, this);
|
|
1275
1323
|
}));
|
|
1276
|
-
function registerModuleByName(
|
|
1324
|
+
function registerModuleByName(_x18) {
|
|
1277
1325
|
return _registerModuleByName.apply(this, arguments);
|
|
1278
1326
|
}
|
|
1279
1327
|
return registerModuleByName;
|
|
@@ -1286,10 +1334,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1286
1334
|
}, {
|
|
1287
1335
|
key: "registerModules",
|
|
1288
1336
|
value: (function () {
|
|
1289
|
-
var _registerModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1337
|
+
var _registerModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(moduleConfigs) {
|
|
1290
1338
|
var configs, registeredModules, _iterator2, _step2, config, configName, result, errorMessage;
|
|
1291
|
-
return _regeneratorRuntime().wrap(function
|
|
1292
|
-
while (1) switch (
|
|
1339
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1340
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1293
1341
|
case 0:
|
|
1294
1342
|
console.log('[Server] 开始注册模块...');
|
|
1295
1343
|
|
|
@@ -1301,47 +1349,47 @@ var Server = /*#__PURE__*/function () {
|
|
|
1301
1349
|
});
|
|
1302
1350
|
registeredModules = [];
|
|
1303
1351
|
_iterator2 = _createForOfIteratorHelper(configs);
|
|
1304
|
-
|
|
1352
|
+
_context17.prev = 5;
|
|
1305
1353
|
_iterator2.s();
|
|
1306
1354
|
case 7:
|
|
1307
1355
|
if ((_step2 = _iterator2.n()).done) {
|
|
1308
|
-
|
|
1356
|
+
_context17.next = 25;
|
|
1309
1357
|
break;
|
|
1310
1358
|
}
|
|
1311
1359
|
config = _step2.value;
|
|
1312
1360
|
configName = typeof config === 'string' ? config : config.name;
|
|
1313
|
-
|
|
1314
|
-
|
|
1361
|
+
_context17.prev = 10;
|
|
1362
|
+
_context17.next = 13;
|
|
1315
1363
|
return this.registerModuleByName(config);
|
|
1316
1364
|
case 13:
|
|
1317
|
-
result =
|
|
1365
|
+
result = _context17.sent;
|
|
1318
1366
|
registeredModules.push(result);
|
|
1319
|
-
|
|
1367
|
+
_context17.next = 23;
|
|
1320
1368
|
break;
|
|
1321
1369
|
case 17:
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
errorMessage =
|
|
1370
|
+
_context17.prev = 17;
|
|
1371
|
+
_context17.t0 = _context17["catch"](10);
|
|
1372
|
+
errorMessage = _context17.t0 instanceof Error ? _context17.t0.message : String(_context17.t0);
|
|
1325
1373
|
this.logError("\u6A21\u5757\u6CE8\u518C\u5931\u8D25: ".concat(configName), {
|
|
1326
1374
|
moduleName: configName,
|
|
1327
1375
|
error: errorMessage
|
|
1328
1376
|
});
|
|
1329
|
-
console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:",
|
|
1330
|
-
throw
|
|
1377
|
+
console.error("[Server] \u6A21\u5757\u6CE8\u518C\u5931\u8D25:", _context17.t0);
|
|
1378
|
+
throw _context17.t0;
|
|
1331
1379
|
case 23:
|
|
1332
|
-
|
|
1380
|
+
_context17.next = 7;
|
|
1333
1381
|
break;
|
|
1334
1382
|
case 25:
|
|
1335
|
-
|
|
1383
|
+
_context17.next = 30;
|
|
1336
1384
|
break;
|
|
1337
1385
|
case 27:
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
_iterator2.e(
|
|
1386
|
+
_context17.prev = 27;
|
|
1387
|
+
_context17.t1 = _context17["catch"](5);
|
|
1388
|
+
_iterator2.e(_context17.t1);
|
|
1341
1389
|
case 30:
|
|
1342
|
-
|
|
1390
|
+
_context17.prev = 30;
|
|
1343
1391
|
_iterator2.f();
|
|
1344
|
-
return
|
|
1392
|
+
return _context17.finish(30);
|
|
1345
1393
|
case 33:
|
|
1346
1394
|
console.log('[Server] ✅ 所有模块注册完成');
|
|
1347
1395
|
this.logInfo('所有模块注册完成', {
|
|
@@ -1351,14 +1399,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
1351
1399
|
return m === null || m === void 0 || (_m$config = m.config) === null || _m$config === void 0 ? void 0 : _m$config.name;
|
|
1352
1400
|
})
|
|
1353
1401
|
});
|
|
1354
|
-
return
|
|
1402
|
+
return _context17.abrupt("return", registeredModules);
|
|
1355
1403
|
case 36:
|
|
1356
1404
|
case "end":
|
|
1357
|
-
return
|
|
1405
|
+
return _context17.stop();
|
|
1358
1406
|
}
|
|
1359
|
-
},
|
|
1407
|
+
}, _callee17, this, [[5, 27, 30, 33], [10, 17]]);
|
|
1360
1408
|
}));
|
|
1361
|
-
function registerModules(
|
|
1409
|
+
function registerModules(_x19) {
|
|
1362
1410
|
return _registerModules.apply(this, arguments);
|
|
1363
1411
|
}
|
|
1364
1412
|
return registerModules;
|
|
@@ -1371,10 +1419,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1371
1419
|
}, {
|
|
1372
1420
|
key: "preloadModulesData",
|
|
1373
1421
|
value: (function () {
|
|
1374
|
-
var _preloadModulesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1422
|
+
var _preloadModulesData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(registeredModules, options) {
|
|
1375
1423
|
var modulesToPreload, preloadResults, _iterator3, _step3, _step3$value, module, config, shouldPreload, startTime, _options$onModuleLoad, _options$onModuleLoad2, duration, _duration, errorMessage, successCount, failCount;
|
|
1376
|
-
return _regeneratorRuntime().wrap(function
|
|
1377
|
-
while (1) switch (
|
|
1424
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1425
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1378
1426
|
case 0:
|
|
1379
1427
|
console.log('[Server] 开始预加载模块数据...');
|
|
1380
1428
|
modulesToPreload = registeredModules.filter(function (m) {
|
|
@@ -1387,16 +1435,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
1387
1435
|
});
|
|
1388
1436
|
preloadResults = [];
|
|
1389
1437
|
_iterator3 = _createForOfIteratorHelper(registeredModules);
|
|
1390
|
-
|
|
1438
|
+
_context18.prev = 5;
|
|
1391
1439
|
_iterator3.s();
|
|
1392
1440
|
case 7:
|
|
1393
1441
|
if ((_step3 = _iterator3.n()).done) {
|
|
1394
|
-
|
|
1442
|
+
_context18.next = 40;
|
|
1395
1443
|
break;
|
|
1396
1444
|
}
|
|
1397
1445
|
_step3$value = _step3.value, module = _step3$value.module, config = _step3$value.config, shouldPreload = _step3$value.shouldPreload;
|
|
1398
1446
|
if (shouldPreload) {
|
|
1399
|
-
|
|
1447
|
+
_context18.next = 13;
|
|
1400
1448
|
break;
|
|
1401
1449
|
}
|
|
1402
1450
|
console.log("[Server] \u23ED\uFE0F \u8DF3\u8FC7 ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D"));
|
|
@@ -1404,19 +1452,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
1404
1452
|
moduleName: config.name,
|
|
1405
1453
|
reason: 'shouldPreload=false'
|
|
1406
1454
|
});
|
|
1407
|
-
return
|
|
1455
|
+
return _context18.abrupt("continue", 38);
|
|
1408
1456
|
case 13:
|
|
1409
1457
|
if (!(typeof module.preload === 'function')) {
|
|
1410
|
-
|
|
1458
|
+
_context18.next = 36;
|
|
1411
1459
|
break;
|
|
1412
1460
|
}
|
|
1413
1461
|
startTime = Date.now();
|
|
1414
|
-
|
|
1462
|
+
_context18.prev = 15;
|
|
1415
1463
|
this.logInfo("\u5F00\u59CB\u9884\u52A0\u8F7D\u6A21\u5757: ".concat(config.name), {
|
|
1416
1464
|
moduleName: config.name
|
|
1417
1465
|
});
|
|
1418
1466
|
options === null || options === void 0 || (_options$onModuleLoad = options.onModuleLoad) === null || _options$onModuleLoad === void 0 || _options$onModuleLoad.call(options, config.name);
|
|
1419
|
-
|
|
1467
|
+
_context18.next = 20;
|
|
1420
1468
|
return module.preload();
|
|
1421
1469
|
case 20:
|
|
1422
1470
|
options === null || options === void 0 || (_options$onModuleLoad2 = options.onModuleLoadComplete) === null || _options$onModuleLoad2 === void 0 || _options$onModuleLoad2.call(options, config.name);
|
|
@@ -1430,14 +1478,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
1430
1478
|
name: config.name,
|
|
1431
1479
|
success: true
|
|
1432
1480
|
});
|
|
1433
|
-
|
|
1481
|
+
_context18.next = 34;
|
|
1434
1482
|
break;
|
|
1435
1483
|
case 27:
|
|
1436
|
-
|
|
1437
|
-
|
|
1484
|
+
_context18.prev = 27;
|
|
1485
|
+
_context18.t0 = _context18["catch"](15);
|
|
1438
1486
|
_duration = Date.now() - startTime;
|
|
1439
|
-
errorMessage =
|
|
1440
|
-
console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"),
|
|
1487
|
+
errorMessage = _context18.t0 instanceof Error ? _context18.t0.message : String(_context18.t0);
|
|
1488
|
+
console.error("[Server] \u274C ".concat(config.name, " \u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25:"), _context18.t0);
|
|
1441
1489
|
this.logError("\u6A21\u5757\u9884\u52A0\u8F7D\u5931\u8D25: ".concat(config.name), {
|
|
1442
1490
|
moduleName: config.name,
|
|
1443
1491
|
duration: "".concat(_duration, "ms"),
|
|
@@ -1449,7 +1497,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1449
1497
|
error: errorMessage
|
|
1450
1498
|
});
|
|
1451
1499
|
case 34:
|
|
1452
|
-
|
|
1500
|
+
_context18.next = 38;
|
|
1453
1501
|
break;
|
|
1454
1502
|
case 36:
|
|
1455
1503
|
console.log("[Server] \u26A0\uFE0F ".concat(config.name, " \u6A21\u5757\u672A\u5B9E\u73B0 preload() \u65B9\u6CD5"));
|
|
@@ -1457,19 +1505,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
1457
1505
|
moduleName: config.name
|
|
1458
1506
|
});
|
|
1459
1507
|
case 38:
|
|
1460
|
-
|
|
1508
|
+
_context18.next = 7;
|
|
1461
1509
|
break;
|
|
1462
1510
|
case 40:
|
|
1463
|
-
|
|
1511
|
+
_context18.next = 45;
|
|
1464
1512
|
break;
|
|
1465
1513
|
case 42:
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
_iterator3.e(
|
|
1514
|
+
_context18.prev = 42;
|
|
1515
|
+
_context18.t1 = _context18["catch"](5);
|
|
1516
|
+
_iterator3.e(_context18.t1);
|
|
1469
1517
|
case 45:
|
|
1470
|
-
|
|
1518
|
+
_context18.prev = 45;
|
|
1471
1519
|
_iterator3.f();
|
|
1472
|
-
return
|
|
1520
|
+
return _context18.finish(45);
|
|
1473
1521
|
case 48:
|
|
1474
1522
|
successCount = preloadResults.filter(function (r) {
|
|
1475
1523
|
return r.success;
|
|
@@ -1484,11 +1532,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
1484
1532
|
});
|
|
1485
1533
|
case 52:
|
|
1486
1534
|
case "end":
|
|
1487
|
-
return
|
|
1535
|
+
return _context18.stop();
|
|
1488
1536
|
}
|
|
1489
|
-
},
|
|
1537
|
+
}, _callee18, this, [[5, 42, 45, 48], [15, 27]]);
|
|
1490
1538
|
}));
|
|
1491
|
-
function preloadModulesData(
|
|
1539
|
+
function preloadModulesData(_x20, _x21) {
|
|
1492
1540
|
return _preloadModulesData.apply(this, arguments);
|
|
1493
1541
|
}
|
|
1494
1542
|
return preloadModulesData;
|
|
@@ -1502,7 +1550,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1502
1550
|
}, {
|
|
1503
1551
|
key: "initialize",
|
|
1504
1552
|
value: (function () {
|
|
1505
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1553
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(moduleConfigs) {
|
|
1506
1554
|
var _moduleConfigs$length,
|
|
1507
1555
|
_this3 = this;
|
|
1508
1556
|
var autoPreload,
|
|
@@ -1510,12 +1558,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
1510
1558
|
startTime,
|
|
1511
1559
|
registeredModules,
|
|
1512
1560
|
duration,
|
|
1513
|
-
|
|
1514
|
-
return _regeneratorRuntime().wrap(function
|
|
1515
|
-
while (1) switch (
|
|
1561
|
+
_args19 = arguments;
|
|
1562
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1563
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1516
1564
|
case 0:
|
|
1517
|
-
autoPreload =
|
|
1518
|
-
options =
|
|
1565
|
+
autoPreload = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : true;
|
|
1566
|
+
options = _args19.length > 2 ? _args19[2] : undefined;
|
|
1519
1567
|
startTime = Date.now();
|
|
1520
1568
|
this.logInfo('Server 初始化开始', {
|
|
1521
1569
|
moduleConfigCount: (_moduleConfigs$length = moduleConfigs === null || moduleConfigs === void 0 ? void 0 : moduleConfigs.length) !== null && _moduleConfigs$length !== void 0 ? _moduleConfigs$length : 'all',
|
|
@@ -1527,25 +1575,25 @@ var Server = /*#__PURE__*/function () {
|
|
|
1527
1575
|
this.registerServerRoutes();
|
|
1528
1576
|
|
|
1529
1577
|
// 注册模块
|
|
1530
|
-
|
|
1578
|
+
_context19.next = 7;
|
|
1531
1579
|
return this.registerModules(moduleConfigs);
|
|
1532
1580
|
case 7:
|
|
1533
|
-
registeredModules =
|
|
1581
|
+
registeredModules = _context19.sent;
|
|
1534
1582
|
if (!autoPreload) {
|
|
1535
|
-
|
|
1583
|
+
_context19.next = 13;
|
|
1536
1584
|
break;
|
|
1537
1585
|
}
|
|
1538
|
-
|
|
1586
|
+
_context19.next = 11;
|
|
1539
1587
|
return this.preloadModulesData(registeredModules, options);
|
|
1540
1588
|
case 11:
|
|
1541
|
-
|
|
1589
|
+
_context19.next = 14;
|
|
1542
1590
|
break;
|
|
1543
1591
|
case 13:
|
|
1544
1592
|
this.logInfo('跳过自动预加载', {
|
|
1545
1593
|
autoPreload: autoPreload
|
|
1546
1594
|
});
|
|
1547
1595
|
case 14:
|
|
1548
|
-
|
|
1596
|
+
_context19.next = 16;
|
|
1549
1597
|
return this.setupProductsQuotationPriceBridge();
|
|
1550
1598
|
case 16:
|
|
1551
1599
|
// 监听 ProductsModule 同步完成事件,重新计算并推送查询结果
|
|
@@ -1571,14 +1619,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
1571
1619
|
duration: "".concat(duration, "ms"),
|
|
1572
1620
|
registeredModuleCount: registeredModules.length
|
|
1573
1621
|
});
|
|
1574
|
-
return
|
|
1622
|
+
return _context19.abrupt("return", registeredModules);
|
|
1575
1623
|
case 22:
|
|
1576
1624
|
case "end":
|
|
1577
|
-
return
|
|
1625
|
+
return _context19.stop();
|
|
1578
1626
|
}
|
|
1579
|
-
},
|
|
1627
|
+
}, _callee19, this);
|
|
1580
1628
|
}));
|
|
1581
|
-
function initialize(
|
|
1629
|
+
function initialize(_x22) {
|
|
1582
1630
|
return _initialize.apply(this, arguments);
|
|
1583
1631
|
}
|
|
1584
1632
|
return initialize;
|
|
@@ -1590,51 +1638,51 @@ var Server = /*#__PURE__*/function () {
|
|
|
1590
1638
|
}, {
|
|
1591
1639
|
key: "setupProductsQuotationPriceBridge",
|
|
1592
1640
|
value: (function () {
|
|
1593
|
-
var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1641
|
+
var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1594
1642
|
var _this$core$context, errorMessage;
|
|
1595
|
-
return _regeneratorRuntime().wrap(function
|
|
1596
|
-
while (1) switch (
|
|
1643
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1644
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1597
1645
|
case 0:
|
|
1598
1646
|
if (this.products) {
|
|
1599
|
-
|
|
1647
|
+
_context20.next = 3;
|
|
1600
1648
|
break;
|
|
1601
1649
|
}
|
|
1602
1650
|
this.logWarning('setupProductsQuotationPriceBridge: Products 模块未注册');
|
|
1603
|
-
return
|
|
1651
|
+
return _context20.abrupt("return");
|
|
1604
1652
|
case 3:
|
|
1605
1653
|
if (this.schedule) {
|
|
1606
|
-
|
|
1654
|
+
_context20.next = 6;
|
|
1607
1655
|
break;
|
|
1608
1656
|
}
|
|
1609
1657
|
this.logWarning('setupProductsQuotationPriceBridge: Schedule 模块未注册');
|
|
1610
|
-
return
|
|
1658
|
+
return _context20.abrupt("return");
|
|
1611
1659
|
case 6:
|
|
1612
|
-
|
|
1613
|
-
|
|
1660
|
+
_context20.prev = 6;
|
|
1661
|
+
_context20.next = 9;
|
|
1614
1662
|
return this.schedule.loadAllSchedule();
|
|
1615
1663
|
case 9:
|
|
1616
1664
|
this.products.clearPriceCache();
|
|
1617
|
-
|
|
1665
|
+
_context20.next = 12;
|
|
1618
1666
|
return this.products.setupQuotationPriceBridge({
|
|
1619
1667
|
scheduleModule: this.schedule,
|
|
1620
1668
|
channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel
|
|
1621
1669
|
});
|
|
1622
1670
|
case 12:
|
|
1623
1671
|
this.logInfo('Products 报价单价格桥接初始化完成');
|
|
1624
|
-
|
|
1672
|
+
_context20.next = 19;
|
|
1625
1673
|
break;
|
|
1626
1674
|
case 15:
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
errorMessage =
|
|
1675
|
+
_context20.prev = 15;
|
|
1676
|
+
_context20.t0 = _context20["catch"](6);
|
|
1677
|
+
errorMessage = _context20.t0 instanceof Error ? _context20.t0.message : String(_context20.t0);
|
|
1630
1678
|
this.logError('Products 报价单价格桥接初始化失败', {
|
|
1631
1679
|
error: errorMessage
|
|
1632
1680
|
});
|
|
1633
1681
|
case 19:
|
|
1634
1682
|
case "end":
|
|
1635
|
-
return
|
|
1683
|
+
return _context20.stop();
|
|
1636
1684
|
}
|
|
1637
|
-
},
|
|
1685
|
+
}, _callee20, this, [[6, 15]]);
|
|
1638
1686
|
}));
|
|
1639
1687
|
function setupProductsQuotationPriceBridge() {
|
|
1640
1688
|
return _setupProductsQuotationPriceBridge.apply(this, arguments);
|
|
@@ -1703,45 +1751,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
1703
1751
|
}, {
|
|
1704
1752
|
key: "refreshProductsInBackground",
|
|
1705
1753
|
value: (function () {
|
|
1706
|
-
var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1754
|
+
var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1707
1755
|
var startTime, duration, _duration2, errorMessage;
|
|
1708
|
-
return _regeneratorRuntime().wrap(function
|
|
1709
|
-
while (1) switch (
|
|
1756
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1757
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1710
1758
|
case 0:
|
|
1711
1759
|
if (this.products) {
|
|
1712
|
-
|
|
1760
|
+
_context21.next = 3;
|
|
1713
1761
|
break;
|
|
1714
1762
|
}
|
|
1715
1763
|
this.logWarning('refreshProductsInBackground: Products 模块未注册');
|
|
1716
|
-
return
|
|
1764
|
+
return _context21.abrupt("return");
|
|
1717
1765
|
case 3:
|
|
1718
1766
|
this.logInfo('refreshProductsInBackground 开始');
|
|
1719
1767
|
startTime = Date.now();
|
|
1720
|
-
|
|
1721
|
-
|
|
1768
|
+
_context21.prev = 5;
|
|
1769
|
+
_context21.next = 8;
|
|
1722
1770
|
return this.products.silentRefresh();
|
|
1723
1771
|
case 8:
|
|
1724
1772
|
duration = Date.now() - startTime;
|
|
1725
1773
|
this.logInfo('refreshProductsInBackground 完成', {
|
|
1726
1774
|
duration: "".concat(duration, "ms")
|
|
1727
1775
|
});
|
|
1728
|
-
|
|
1776
|
+
_context21.next = 18;
|
|
1729
1777
|
break;
|
|
1730
1778
|
case 12:
|
|
1731
|
-
|
|
1732
|
-
|
|
1779
|
+
_context21.prev = 12;
|
|
1780
|
+
_context21.t0 = _context21["catch"](5);
|
|
1733
1781
|
_duration2 = Date.now() - startTime;
|
|
1734
|
-
errorMessage =
|
|
1735
|
-
console.error('[Server] refreshProductsInBackground 失败:',
|
|
1782
|
+
errorMessage = _context21.t0 instanceof Error ? _context21.t0.message : String(_context21.t0);
|
|
1783
|
+
console.error('[Server] refreshProductsInBackground 失败:', _context21.t0);
|
|
1736
1784
|
this.logError('refreshProductsInBackground 失败', {
|
|
1737
1785
|
duration: "".concat(_duration2, "ms"),
|
|
1738
1786
|
error: errorMessage
|
|
1739
1787
|
});
|
|
1740
1788
|
case 18:
|
|
1741
1789
|
case "end":
|
|
1742
|
-
return
|
|
1790
|
+
return _context21.stop();
|
|
1743
1791
|
}
|
|
1744
|
-
},
|
|
1792
|
+
}, _callee21, this, [[5, 12]]);
|
|
1745
1793
|
}));
|
|
1746
1794
|
function refreshProductsInBackground() {
|
|
1747
1795
|
return _refreshProductsInBackground.apply(this, arguments);
|
|
@@ -1757,45 +1805,45 @@ var Server = /*#__PURE__*/function () {
|
|
|
1757
1805
|
}, {
|
|
1758
1806
|
key: "refreshOrdersInBackground",
|
|
1759
1807
|
value: (function () {
|
|
1760
|
-
var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1808
|
+
var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1761
1809
|
var startTime, duration, _duration3, errorMessage;
|
|
1762
|
-
return _regeneratorRuntime().wrap(function
|
|
1763
|
-
while (1) switch (
|
|
1810
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1811
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1764
1812
|
case 0:
|
|
1765
1813
|
if (this.order) {
|
|
1766
|
-
|
|
1814
|
+
_context22.next = 3;
|
|
1767
1815
|
break;
|
|
1768
1816
|
}
|
|
1769
1817
|
this.logWarning('refreshOrdersInBackground: Order 模块未注册');
|
|
1770
|
-
return
|
|
1818
|
+
return _context22.abrupt("return");
|
|
1771
1819
|
case 3:
|
|
1772
1820
|
this.logInfo('refreshOrdersInBackground 开始');
|
|
1773
1821
|
startTime = Date.now();
|
|
1774
|
-
|
|
1775
|
-
|
|
1822
|
+
_context22.prev = 5;
|
|
1823
|
+
_context22.next = 8;
|
|
1776
1824
|
return this.order.silentRefresh();
|
|
1777
1825
|
case 8:
|
|
1778
1826
|
duration = Date.now() - startTime;
|
|
1779
1827
|
this.logInfo('refreshOrdersInBackground 完成', {
|
|
1780
1828
|
duration: "".concat(duration, "ms")
|
|
1781
1829
|
});
|
|
1782
|
-
|
|
1830
|
+
_context22.next = 18;
|
|
1783
1831
|
break;
|
|
1784
1832
|
case 12:
|
|
1785
|
-
|
|
1786
|
-
|
|
1833
|
+
_context22.prev = 12;
|
|
1834
|
+
_context22.t0 = _context22["catch"](5);
|
|
1787
1835
|
_duration3 = Date.now() - startTime;
|
|
1788
|
-
errorMessage =
|
|
1789
|
-
console.error('[Server] refreshOrdersInBackground 失败:',
|
|
1836
|
+
errorMessage = _context22.t0 instanceof Error ? _context22.t0.message : String(_context22.t0);
|
|
1837
|
+
console.error('[Server] refreshOrdersInBackground 失败:', _context22.t0);
|
|
1790
1838
|
this.logError('refreshOrdersInBackground 失败', {
|
|
1791
1839
|
duration: "".concat(_duration3, "ms"),
|
|
1792
1840
|
error: errorMessage
|
|
1793
1841
|
});
|
|
1794
1842
|
case 18:
|
|
1795
1843
|
case "end":
|
|
1796
|
-
return
|
|
1844
|
+
return _context22.stop();
|
|
1797
1845
|
}
|
|
1798
|
-
},
|
|
1846
|
+
}, _callee22, this, [[5, 12]]);
|
|
1799
1847
|
}));
|
|
1800
1848
|
function refreshOrdersInBackground() {
|
|
1801
1849
|
return _refreshOrdersInBackground.apply(this, arguments);
|
|
@@ -1810,10 +1858,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1810
1858
|
}, {
|
|
1811
1859
|
key: "clearAllIndexDB",
|
|
1812
1860
|
value: (function () {
|
|
1813
|
-
var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1861
|
+
var _clearAllIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
1814
1862
|
var clearTasks, moduleNames, errorMessage;
|
|
1815
|
-
return _regeneratorRuntime().wrap(function
|
|
1816
|
-
while (1) switch (
|
|
1863
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1864
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1817
1865
|
case 0:
|
|
1818
1866
|
console.log('[Server] 开始清空所有模块的IndexedDB缓存...');
|
|
1819
1867
|
this.logInfo('开始清空所有模块的 IndexedDB 缓存');
|
|
@@ -1848,41 +1896,41 @@ var Server = /*#__PURE__*/function () {
|
|
|
1848
1896
|
moduleNames.push('FloorPlan');
|
|
1849
1897
|
}
|
|
1850
1898
|
if (!(clearTasks.length === 0)) {
|
|
1851
|
-
|
|
1899
|
+
_context23.next = 15;
|
|
1852
1900
|
break;
|
|
1853
1901
|
}
|
|
1854
1902
|
console.warn('[Server] 没有找到已注册的模块,无需清空');
|
|
1855
1903
|
this.logWarning('没有找到已注册的模块,无需清空 IndexedDB');
|
|
1856
|
-
return
|
|
1904
|
+
return _context23.abrupt("return");
|
|
1857
1905
|
case 15:
|
|
1858
1906
|
this.logInfo('准备清空模块缓存', {
|
|
1859
1907
|
moduleNames: moduleNames
|
|
1860
1908
|
});
|
|
1861
|
-
|
|
1862
|
-
|
|
1909
|
+
_context23.prev = 16;
|
|
1910
|
+
_context23.next = 19;
|
|
1863
1911
|
return Promise.all(clearTasks);
|
|
1864
1912
|
case 19:
|
|
1865
1913
|
console.log("[Server] \u2705 \u5DF2\u6210\u529F\u6E05\u7A7A\u6240\u6709\u6A21\u5757\u7684IndexedDB\u7F13\u5B58: ".concat(moduleNames.join(', ')));
|
|
1866
1914
|
this.logInfo('成功清空所有模块的 IndexedDB 缓存', {
|
|
1867
1915
|
moduleNames: moduleNames
|
|
1868
1916
|
});
|
|
1869
|
-
|
|
1917
|
+
_context23.next = 29;
|
|
1870
1918
|
break;
|
|
1871
1919
|
case 23:
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
errorMessage =
|
|
1875
|
-
console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:',
|
|
1920
|
+
_context23.prev = 23;
|
|
1921
|
+
_context23.t0 = _context23["catch"](16);
|
|
1922
|
+
errorMessage = _context23.t0 instanceof Error ? _context23.t0.message : String(_context23.t0);
|
|
1923
|
+
console.error('[Server] ❌ 清空IndexedDB缓存时发生错误:', _context23.t0);
|
|
1876
1924
|
this.logError('清空 IndexedDB 缓存时发生错误', {
|
|
1877
1925
|
moduleNames: moduleNames,
|
|
1878
1926
|
error: errorMessage
|
|
1879
1927
|
});
|
|
1880
|
-
throw
|
|
1928
|
+
throw _context23.t0;
|
|
1881
1929
|
case 29:
|
|
1882
1930
|
case "end":
|
|
1883
|
-
return
|
|
1931
|
+
return _context23.stop();
|
|
1884
1932
|
}
|
|
1885
|
-
},
|
|
1933
|
+
}, _callee23, this, [[16, 23]]);
|
|
1886
1934
|
}));
|
|
1887
1935
|
function clearAllIndexDB() {
|
|
1888
1936
|
return _clearAllIndexDB.apply(this, arguments);
|
|
@@ -1957,10 +2005,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
1957
2005
|
}, {
|
|
1958
2006
|
key: "handleRoute",
|
|
1959
2007
|
value: (function () {
|
|
1960
|
-
var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2008
|
+
var _handleRoute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(method, path, params) {
|
|
1961
2009
|
var startTime, handler, result, duration, _duration4, errorMessage;
|
|
1962
|
-
return _regeneratorRuntime().wrap(function
|
|
1963
|
-
while (1) switch (
|
|
2010
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2011
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1964
2012
|
case 0:
|
|
1965
2013
|
startTime = Date.now();
|
|
1966
2014
|
this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5F00\u59CB: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
@@ -1971,7 +2019,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1971
2019
|
});
|
|
1972
2020
|
handler = this.getRouteHandler(method, path);
|
|
1973
2021
|
if (handler) {
|
|
1974
|
-
|
|
2022
|
+
_context24.next = 6;
|
|
1975
2023
|
break;
|
|
1976
2024
|
}
|
|
1977
2025
|
this.logError("\u8DEF\u7531\u672A\u627E\u5230: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
@@ -1980,13 +2028,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
1980
2028
|
});
|
|
1981
2029
|
throw new Error("Route not found: ".concat(method.toUpperCase(), " ").concat(path));
|
|
1982
2030
|
case 6:
|
|
1983
|
-
|
|
1984
|
-
|
|
2031
|
+
_context24.prev = 6;
|
|
2032
|
+
_context24.next = 9;
|
|
1985
2033
|
return handler(_objectSpread(_objectSpread({}, params), {}, {
|
|
1986
2034
|
path: path
|
|
1987
2035
|
}));
|
|
1988
2036
|
case 9:
|
|
1989
|
-
result =
|
|
2037
|
+
result = _context24.sent;
|
|
1990
2038
|
duration = Date.now() - startTime;
|
|
1991
2039
|
this.logInfo("\u8DEF\u7531\u8BF7\u6C42\u5B8C\u6210: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
1992
2040
|
method: method.toUpperCase(),
|
|
@@ -1995,12 +2043,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
1995
2043
|
resultCode: result === null || result === void 0 ? void 0 : result.code,
|
|
1996
2044
|
resultStatus: result === null || result === void 0 ? void 0 : result.status
|
|
1997
2045
|
});
|
|
1998
|
-
return
|
|
2046
|
+
return _context24.abrupt("return", result);
|
|
1999
2047
|
case 15:
|
|
2000
|
-
|
|
2001
|
-
|
|
2048
|
+
_context24.prev = 15;
|
|
2049
|
+
_context24.t0 = _context24["catch"](6);
|
|
2002
2050
|
_duration4 = Date.now() - startTime;
|
|
2003
|
-
errorMessage =
|
|
2051
|
+
errorMessage = _context24.t0 instanceof Error ? _context24.t0.message : String(_context24.t0);
|
|
2004
2052
|
this.logError("\u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), {
|
|
2005
2053
|
method: method.toUpperCase(),
|
|
2006
2054
|
path: path,
|
|
@@ -2008,15 +2056,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
2008
2056
|
error: errorMessage,
|
|
2009
2057
|
data: params.data
|
|
2010
2058
|
});
|
|
2011
|
-
console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path),
|
|
2012
|
-
throw
|
|
2059
|
+
console.error("[Server] \u8DEF\u7531\u5904\u7406\u9519\u8BEF: ".concat(method.toUpperCase(), " ").concat(path), _context24.t0);
|
|
2060
|
+
throw _context24.t0;
|
|
2013
2061
|
case 22:
|
|
2014
2062
|
case "end":
|
|
2015
|
-
return
|
|
2063
|
+
return _context24.stop();
|
|
2016
2064
|
}
|
|
2017
|
-
},
|
|
2065
|
+
}, _callee24, this, [[6, 15]]);
|
|
2018
2066
|
}));
|
|
2019
|
-
function handleRoute(
|
|
2067
|
+
function handleRoute(_x23, _x24, _x25) {
|
|
2020
2068
|
return _handleRoute.apply(this, arguments);
|
|
2021
2069
|
}
|
|
2022
2070
|
return handleRoute;
|
|
@@ -2086,6 +2134,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
2086
2134
|
method: 'get',
|
|
2087
2135
|
path: '/update/localOrder',
|
|
2088
2136
|
handler: this.handleUpdateLocalOrder.bind(this)
|
|
2137
|
+
}, {
|
|
2138
|
+
method: 'post',
|
|
2139
|
+
path: '/shop/order/sales/checkout',
|
|
2140
|
+
handler: this.handleOrderSalesCheckout.bind(this)
|
|
2141
|
+
}, {
|
|
2142
|
+
method: 'post',
|
|
2143
|
+
path: '/shop/order/checkout',
|
|
2144
|
+
handler: this.handleOrderCheckout.bind(this)
|
|
2089
2145
|
}]);
|
|
2090
2146
|
this.registerPrefixRoutes([{
|
|
2091
2147
|
method: 'get',
|
|
@@ -2505,18 +2561,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
2505
2561
|
}, {
|
|
2506
2562
|
key: "fetchOrderListFromAPI",
|
|
2507
2563
|
value: (function () {
|
|
2508
|
-
var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2564
|
+
var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(data) {
|
|
2509
2565
|
var _this$app4;
|
|
2510
2566
|
var _response$data3, response, payload, list, count, errorMessage;
|
|
2511
|
-
return _regeneratorRuntime().wrap(function
|
|
2512
|
-
while (1) switch (
|
|
2567
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2568
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2513
2569
|
case 0:
|
|
2514
2570
|
if ((_this$app4 = this.app) !== null && _this$app4 !== void 0 && _this$app4.request) {
|
|
2515
|
-
|
|
2571
|
+
_context25.next = 3;
|
|
2516
2572
|
break;
|
|
2517
2573
|
}
|
|
2518
2574
|
this.logError('fetchOrderListFromAPI: app.request 不可用');
|
|
2519
|
-
return
|
|
2575
|
+
return _context25.abrupt("return", {
|
|
2520
2576
|
code: 500,
|
|
2521
2577
|
message: 'app.request 不可用',
|
|
2522
2578
|
data: {
|
|
@@ -2526,17 +2582,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
2526
2582
|
status: false
|
|
2527
2583
|
});
|
|
2528
2584
|
case 3:
|
|
2529
|
-
|
|
2530
|
-
|
|
2585
|
+
_context25.prev = 3;
|
|
2586
|
+
_context25.next = 6;
|
|
2531
2587
|
return this.app.request.post('/shop/order/v2/list', data, {
|
|
2532
2588
|
isShopApi: true
|
|
2533
2589
|
});
|
|
2534
2590
|
case 6:
|
|
2535
|
-
response =
|
|
2591
|
+
response = _context25.sent;
|
|
2536
2592
|
payload = (_response$data3 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data3 !== void 0 ? _response$data3 : response;
|
|
2537
2593
|
list = Array.isArray(payload === null || payload === void 0 ? void 0 : payload.list) ? payload.list : [];
|
|
2538
2594
|
count = typeof (payload === null || payload === void 0 ? void 0 : payload.count) === 'number' ? payload.count : list.length;
|
|
2539
|
-
return
|
|
2595
|
+
return _context25.abrupt("return", {
|
|
2540
2596
|
code: 200,
|
|
2541
2597
|
data: _objectSpread(_objectSpread({}, payload), {}, {
|
|
2542
2598
|
list: list,
|
|
@@ -2546,13 +2602,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
2546
2602
|
status: true
|
|
2547
2603
|
});
|
|
2548
2604
|
case 13:
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
errorMessage =
|
|
2605
|
+
_context25.prev = 13;
|
|
2606
|
+
_context25.t0 = _context25["catch"](3);
|
|
2607
|
+
errorMessage = _context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0);
|
|
2552
2608
|
this.logError('fetchOrderListFromAPI: 请求失败', {
|
|
2553
2609
|
error: errorMessage
|
|
2554
2610
|
});
|
|
2555
|
-
return
|
|
2611
|
+
return _context25.abrupt("return", {
|
|
2556
2612
|
code: 500,
|
|
2557
2613
|
message: errorMessage,
|
|
2558
2614
|
data: {
|
|
@@ -2563,11 +2619,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2563
2619
|
});
|
|
2564
2620
|
case 18:
|
|
2565
2621
|
case "end":
|
|
2566
|
-
return
|
|
2622
|
+
return _context25.stop();
|
|
2567
2623
|
}
|
|
2568
|
-
},
|
|
2624
|
+
}, _callee25, this, [[3, 13]]);
|
|
2569
2625
|
}));
|
|
2570
|
-
function fetchOrderListFromAPI(
|
|
2626
|
+
function fetchOrderListFromAPI(_x26) {
|
|
2571
2627
|
return _fetchOrderListFromAPI.apply(this, arguments);
|
|
2572
2628
|
}
|
|
2573
2629
|
return fetchOrderListFromAPI;
|
|
@@ -2579,17 +2635,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
2579
2635
|
}, {
|
|
2580
2636
|
key: "fetchBookingListFromAPI",
|
|
2581
2637
|
value: (function () {
|
|
2582
|
-
var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2638
|
+
var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(data) {
|
|
2583
2639
|
var memoryCacheEnabled, withFields, requestPayload, cacheKey, cached, rawList, bookingResult, _bookingResult$list, errorMessage;
|
|
2584
|
-
return _regeneratorRuntime().wrap(function
|
|
2585
|
-
while (1) switch (
|
|
2640
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2641
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2586
2642
|
case 0:
|
|
2587
2643
|
if (this.order) {
|
|
2588
|
-
|
|
2644
|
+
_context26.next = 3;
|
|
2589
2645
|
break;
|
|
2590
2646
|
}
|
|
2591
2647
|
this.logError('fetchBookingListFromAPI: Order 模块不可用');
|
|
2592
|
-
return
|
|
2648
|
+
return _context26.abrupt("return", {
|
|
2593
2649
|
code: 500,
|
|
2594
2650
|
message: 'Order 模块不可用',
|
|
2595
2651
|
data: {
|
|
@@ -2599,18 +2655,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
2599
2655
|
status: false
|
|
2600
2656
|
});
|
|
2601
2657
|
case 3:
|
|
2602
|
-
|
|
2658
|
+
_context26.prev = 3;
|
|
2603
2659
|
memoryCacheEnabled = this.isBookingRemoteMemoryCacheEnabled(data);
|
|
2604
2660
|
withFields = this.resolveBookingSalesWith(data);
|
|
2605
2661
|
requestPayload = this.normalizeBookingRemoteQueryPayload(data, withFields);
|
|
2606
2662
|
cacheKey = this.buildBookingRemoteCacheKey(requestPayload);
|
|
2607
2663
|
if (!memoryCacheEnabled) {
|
|
2608
|
-
|
|
2664
|
+
_context26.next = 13;
|
|
2609
2665
|
break;
|
|
2610
2666
|
}
|
|
2611
2667
|
cached = this.readBookingRemoteCache(cacheKey);
|
|
2612
2668
|
if (!cached) {
|
|
2613
|
-
|
|
2669
|
+
_context26.next = 13;
|
|
2614
2670
|
break;
|
|
2615
2671
|
}
|
|
2616
2672
|
this.logInfo('fetchBookingListFromAPI: 命中内存缓存', {
|
|
@@ -2618,14 +2674,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
2618
2674
|
listCount: cached.bookingResult.count,
|
|
2619
2675
|
withFields: cached.withFields
|
|
2620
2676
|
});
|
|
2621
|
-
return
|
|
2677
|
+
return _context26.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
|
|
2622
2678
|
cache_hit: true
|
|
2623
2679
|
}));
|
|
2624
2680
|
case 13:
|
|
2625
|
-
|
|
2681
|
+
_context26.next = 15;
|
|
2626
2682
|
return this.order.fetchOrdersBySSE(requestPayload);
|
|
2627
2683
|
case 15:
|
|
2628
|
-
rawList =
|
|
2684
|
+
rawList = _context26.sent;
|
|
2629
2685
|
bookingResult = sortBookings(filterBookingsFromOrders(rawList, data), data); // DEBUG: 挂到 window 上方便排查 SSE → 日历数据丢失问题
|
|
2630
2686
|
if (typeof globalThis !== 'undefined') {
|
|
2631
2687
|
globalThis.__SSE_BOOKING_DEBUG__ = {
|
|
@@ -2672,15 +2728,15 @@ var Server = /*#__PURE__*/function () {
|
|
|
2672
2728
|
cacheKey: cacheKey,
|
|
2673
2729
|
withFields: withFields
|
|
2674
2730
|
});
|
|
2675
|
-
return
|
|
2731
|
+
return _context26.abrupt("return", this.buildBookingResponse(bookingResult));
|
|
2676
2732
|
case 23:
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
errorMessage =
|
|
2733
|
+
_context26.prev = 23;
|
|
2734
|
+
_context26.t0 = _context26["catch"](3);
|
|
2735
|
+
errorMessage = _context26.t0 instanceof Error ? _context26.t0.message : String(_context26.t0);
|
|
2680
2736
|
this.logError('fetchBookingListFromAPI: SSE 请求失败', {
|
|
2681
2737
|
error: errorMessage
|
|
2682
2738
|
});
|
|
2683
|
-
return
|
|
2739
|
+
return _context26.abrupt("return", {
|
|
2684
2740
|
code: 500,
|
|
2685
2741
|
message: errorMessage,
|
|
2686
2742
|
data: {
|
|
@@ -2691,15 +2747,105 @@ var Server = /*#__PURE__*/function () {
|
|
|
2691
2747
|
});
|
|
2692
2748
|
case 28:
|
|
2693
2749
|
case "end":
|
|
2694
|
-
return
|
|
2750
|
+
return _context26.stop();
|
|
2695
2751
|
}
|
|
2696
|
-
},
|
|
2752
|
+
}, _callee26, this, [[3, 23]]);
|
|
2697
2753
|
}));
|
|
2698
|
-
function fetchBookingListFromAPI(
|
|
2754
|
+
function fetchBookingListFromAPI(_x27) {
|
|
2699
2755
|
return _fetchBookingListFromAPI.apply(this, arguments);
|
|
2700
2756
|
}
|
|
2701
2757
|
return fetchBookingListFromAPI;
|
|
2702
2758
|
}())
|
|
2759
|
+
}, {
|
|
2760
|
+
key: "handleOrderCheckoutSubmit",
|
|
2761
|
+
value: function () {
|
|
2762
|
+
var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
2763
|
+
var _this$app5;
|
|
2764
|
+
var backendPath, data, title, response, fresh, errorMessage, backendError;
|
|
2765
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2766
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2767
|
+
case 0:
|
|
2768
|
+
backendPath = params.backendPath, data = params.data, title = params.title;
|
|
2769
|
+
this.logInfo("".concat(title, ": \u5F00\u59CB\u5904\u7406"), {
|
|
2770
|
+
backendPath: backendPath,
|
|
2771
|
+
order_id: data === null || data === void 0 ? void 0 : data.order_id,
|
|
2772
|
+
external_sale_number: data === null || data === void 0 ? void 0 : data.external_sale_number,
|
|
2773
|
+
order_number: data === null || data === void 0 ? void 0 : data.order_number
|
|
2774
|
+
});
|
|
2775
|
+
if ((_this$app5 = this.app) !== null && _this$app5 !== void 0 && _this$app5.request) {
|
|
2776
|
+
_context27.next = 5;
|
|
2777
|
+
break;
|
|
2778
|
+
}
|
|
2779
|
+
this.logError("".concat(title, ": app.request \u4E0D\u53EF\u7528"));
|
|
2780
|
+
return _context27.abrupt("return", {
|
|
2781
|
+
code: 500,
|
|
2782
|
+
status: false,
|
|
2783
|
+
message: 'app.request 不可用',
|
|
2784
|
+
data: null
|
|
2785
|
+
});
|
|
2786
|
+
case 5:
|
|
2787
|
+
_context27.prev = 5;
|
|
2788
|
+
_context27.next = 8;
|
|
2789
|
+
return this.app.request.post(backendPath, data, {
|
|
2790
|
+
isShopApi: true,
|
|
2791
|
+
customToast: function customToast() {}
|
|
2792
|
+
});
|
|
2793
|
+
case 8:
|
|
2794
|
+
response = _context27.sent;
|
|
2795
|
+
fresh = this.extractOrderDataFromCheckoutResponse(response);
|
|
2796
|
+
if (!(fresh && this.order)) {
|
|
2797
|
+
_context27.next = 16;
|
|
2798
|
+
break;
|
|
2799
|
+
}
|
|
2800
|
+
_context27.next = 13;
|
|
2801
|
+
return this.order.upsertOrdersFromRemote([fresh]);
|
|
2802
|
+
case 13:
|
|
2803
|
+
this.logInfo("".concat(title, ": \u8BA2\u5355\u5DF2\u540C\u6B65\u5230\u672C\u5730"), {
|
|
2804
|
+
order_id: fresh.order_id,
|
|
2805
|
+
external_sale_number: fresh.external_sale_number,
|
|
2806
|
+
order_number: fresh.order_number
|
|
2807
|
+
});
|
|
2808
|
+
_context27.next = 17;
|
|
2809
|
+
break;
|
|
2810
|
+
case 16:
|
|
2811
|
+
this.logWarning("".concat(title, ": checkout \u8FD4\u56DE\u672A\u5305\u542B\u53EF\u540C\u6B65\u8BA2\u5355"), {
|
|
2812
|
+
hasOrderModule: !!this.order,
|
|
2813
|
+
backendPath: backendPath
|
|
2814
|
+
});
|
|
2815
|
+
case 17:
|
|
2816
|
+
return _context27.abrupt("return", this.normalizeCheckoutResponse(response));
|
|
2817
|
+
case 20:
|
|
2818
|
+
_context27.prev = 20;
|
|
2819
|
+
_context27.t0 = _context27["catch"](5);
|
|
2820
|
+
errorMessage = _context27.t0 instanceof Error ? _context27.t0.message : String(_context27.t0);
|
|
2821
|
+
this.logError("".concat(title, ": \u8BF7\u6C42\u5931\u8D25"), {
|
|
2822
|
+
backendPath: backendPath,
|
|
2823
|
+
error: errorMessage
|
|
2824
|
+
});
|
|
2825
|
+
backendError = this.extractBackendErrorResponse(_context27.t0);
|
|
2826
|
+
if (!backendError) {
|
|
2827
|
+
_context27.next = 27;
|
|
2828
|
+
break;
|
|
2829
|
+
}
|
|
2830
|
+
return _context27.abrupt("return", backendError);
|
|
2831
|
+
case 27:
|
|
2832
|
+
return _context27.abrupt("return", {
|
|
2833
|
+
code: 500,
|
|
2834
|
+
status: false,
|
|
2835
|
+
message: errorMessage,
|
|
2836
|
+
data: null
|
|
2837
|
+
});
|
|
2838
|
+
case 28:
|
|
2839
|
+
case "end":
|
|
2840
|
+
return _context27.stop();
|
|
2841
|
+
}
|
|
2842
|
+
}, _callee27, this, [[5, 20]]);
|
|
2843
|
+
}));
|
|
2844
|
+
function handleOrderCheckoutSubmit(_x28) {
|
|
2845
|
+
return _handleOrderCheckoutSubmit.apply(this, arguments);
|
|
2846
|
+
}
|
|
2847
|
+
return handleOrderCheckoutSubmit;
|
|
2848
|
+
}()
|
|
2703
2849
|
}, {
|
|
2704
2850
|
key: "parseOrderIdsParam",
|
|
2705
2851
|
value:
|
|
@@ -2757,34 +2903,34 @@ var Server = /*#__PURE__*/function () {
|
|
|
2757
2903
|
}, {
|
|
2758
2904
|
key: "handleUpdateLocalOrdersBatch",
|
|
2759
2905
|
value: (function () {
|
|
2760
|
-
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2761
|
-
var _this$
|
|
2906
|
+
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(orderIds) {
|
|
2907
|
+
var _this$app6;
|
|
2762
2908
|
var existedBefore, _iterator11, _step11, id, fetched, message, fetchedMap, _iterator12, _step12, order, oid, freshOrders, succeedIds, failed, _iterator13, _step13, _id, fresh, _message, overwritten, inserted;
|
|
2763
|
-
return _regeneratorRuntime().wrap(function
|
|
2764
|
-
while (1) switch (
|
|
2909
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2910
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2765
2911
|
case 0:
|
|
2766
2912
|
this.logInfo('handleUpdateLocalOrdersBatch: 开始处理', {
|
|
2767
2913
|
count: orderIds.length,
|
|
2768
2914
|
orderIds: orderIds
|
|
2769
2915
|
});
|
|
2770
2916
|
if (this.order) {
|
|
2771
|
-
|
|
2917
|
+
_context28.next = 4;
|
|
2772
2918
|
break;
|
|
2773
2919
|
}
|
|
2774
2920
|
this.logError('handleUpdateLocalOrdersBatch: Order 模块未注册');
|
|
2775
|
-
return
|
|
2921
|
+
return _context28.abrupt("return", {
|
|
2776
2922
|
code: 500,
|
|
2777
2923
|
status: false,
|
|
2778
2924
|
message: 'Order 模块未注册',
|
|
2779
2925
|
data: null
|
|
2780
2926
|
});
|
|
2781
2927
|
case 4:
|
|
2782
|
-
if ((_this$
|
|
2783
|
-
|
|
2928
|
+
if ((_this$app6 = this.app) !== null && _this$app6 !== void 0 && _this$app6.request) {
|
|
2929
|
+
_context28.next = 7;
|
|
2784
2930
|
break;
|
|
2785
2931
|
}
|
|
2786
2932
|
this.logError('handleUpdateLocalOrdersBatch: app.request 不可用');
|
|
2787
|
-
return
|
|
2933
|
+
return _context28.abrupt("return", {
|
|
2788
2934
|
code: 500,
|
|
2789
2935
|
status: false,
|
|
2790
2936
|
message: 'app.request 不可用',
|
|
@@ -2807,21 +2953,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
2807
2953
|
_iterator11.f();
|
|
2808
2954
|
}
|
|
2809
2955
|
fetched = [];
|
|
2810
|
-
|
|
2811
|
-
|
|
2956
|
+
_context28.prev = 11;
|
|
2957
|
+
_context28.next = 14;
|
|
2812
2958
|
return this.order.fetchOrdersByHttp(orderIds);
|
|
2813
2959
|
case 14:
|
|
2814
|
-
fetched =
|
|
2815
|
-
|
|
2960
|
+
fetched = _context28.sent;
|
|
2961
|
+
_context28.next = 22;
|
|
2816
2962
|
break;
|
|
2817
2963
|
case 17:
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
message =
|
|
2964
|
+
_context28.prev = 17;
|
|
2965
|
+
_context28.t0 = _context28["catch"](11);
|
|
2966
|
+
message = _context28.t0 instanceof Error ? _context28.t0.message : String(_context28.t0);
|
|
2821
2967
|
this.logError('handleUpdateLocalOrdersBatch: 批量拉取失败', {
|
|
2822
2968
|
message: message
|
|
2823
2969
|
});
|
|
2824
|
-
return
|
|
2970
|
+
return _context28.abrupt("return", {
|
|
2825
2971
|
code: 500,
|
|
2826
2972
|
status: false,
|
|
2827
2973
|
message: message,
|
|
@@ -2831,36 +2977,36 @@ var Server = /*#__PURE__*/function () {
|
|
|
2831
2977
|
// 按返回结果中的 order_id 建索引,未命中即视为单笔失败
|
|
2832
2978
|
fetchedMap = new Map();
|
|
2833
2979
|
_iterator12 = _createForOfIteratorHelper(fetched);
|
|
2834
|
-
|
|
2980
|
+
_context28.prev = 24;
|
|
2835
2981
|
_iterator12.s();
|
|
2836
2982
|
case 26:
|
|
2837
2983
|
if ((_step12 = _iterator12.n()).done) {
|
|
2838
|
-
|
|
2984
|
+
_context28.next = 34;
|
|
2839
2985
|
break;
|
|
2840
2986
|
}
|
|
2841
2987
|
order = _step12.value;
|
|
2842
2988
|
oid = order === null || order === void 0 ? void 0 : order.order_id;
|
|
2843
2989
|
if (!(oid === undefined || oid === null)) {
|
|
2844
|
-
|
|
2990
|
+
_context28.next = 31;
|
|
2845
2991
|
break;
|
|
2846
2992
|
}
|
|
2847
|
-
return
|
|
2993
|
+
return _context28.abrupt("continue", 32);
|
|
2848
2994
|
case 31:
|
|
2849
2995
|
fetchedMap.set(String(oid), order);
|
|
2850
2996
|
case 32:
|
|
2851
|
-
|
|
2997
|
+
_context28.next = 26;
|
|
2852
2998
|
break;
|
|
2853
2999
|
case 34:
|
|
2854
|
-
|
|
3000
|
+
_context28.next = 39;
|
|
2855
3001
|
break;
|
|
2856
3002
|
case 36:
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
_iterator12.e(
|
|
3003
|
+
_context28.prev = 36;
|
|
3004
|
+
_context28.t1 = _context28["catch"](24);
|
|
3005
|
+
_iterator12.e(_context28.t1);
|
|
2860
3006
|
case 39:
|
|
2861
|
-
|
|
3007
|
+
_context28.prev = 39;
|
|
2862
3008
|
_iterator12.f();
|
|
2863
|
-
return
|
|
3009
|
+
return _context28.finish(39);
|
|
2864
3010
|
case 42:
|
|
2865
3011
|
freshOrders = [];
|
|
2866
3012
|
succeedIds = [];
|
|
@@ -2886,23 +3032,23 @@ var Server = /*#__PURE__*/function () {
|
|
|
2886
3032
|
_iterator13.f();
|
|
2887
3033
|
}
|
|
2888
3034
|
if (!(freshOrders.length > 0)) {
|
|
2889
|
-
|
|
3035
|
+
_context28.next = 58;
|
|
2890
3036
|
break;
|
|
2891
3037
|
}
|
|
2892
|
-
|
|
2893
|
-
|
|
3038
|
+
_context28.prev = 48;
|
|
3039
|
+
_context28.next = 51;
|
|
2894
3040
|
return this.order.upsertOrdersFromRemote(freshOrders);
|
|
2895
3041
|
case 51:
|
|
2896
|
-
|
|
3042
|
+
_context28.next = 58;
|
|
2897
3043
|
break;
|
|
2898
3044
|
case 53:
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
_message =
|
|
3045
|
+
_context28.prev = 53;
|
|
3046
|
+
_context28.t2 = _context28["catch"](48);
|
|
3047
|
+
_message = _context28.t2 instanceof Error ? _context28.t2.message : String(_context28.t2);
|
|
2902
3048
|
this.logError('handleUpdateLocalOrdersBatch: 合并写入失败', {
|
|
2903
3049
|
message: _message
|
|
2904
3050
|
});
|
|
2905
|
-
return
|
|
3051
|
+
return _context28.abrupt("return", {
|
|
2906
3052
|
code: 500,
|
|
2907
3053
|
status: false,
|
|
2908
3054
|
message: _message,
|
|
@@ -2921,7 +3067,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2921
3067
|
insertedCount: inserted.length,
|
|
2922
3068
|
failedCount: failed.length
|
|
2923
3069
|
});
|
|
2924
|
-
return
|
|
3070
|
+
return _context28.abrupt("return", {
|
|
2925
3071
|
code: 200,
|
|
2926
3072
|
status: true,
|
|
2927
3073
|
message: '',
|
|
@@ -2933,11 +3079,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
2933
3079
|
});
|
|
2934
3080
|
case 62:
|
|
2935
3081
|
case "end":
|
|
2936
|
-
return
|
|
3082
|
+
return _context28.stop();
|
|
2937
3083
|
}
|
|
2938
|
-
},
|
|
3084
|
+
}, _callee28, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
|
|
2939
3085
|
}));
|
|
2940
|
-
function handleUpdateLocalOrdersBatch(
|
|
3086
|
+
function handleUpdateLocalOrdersBatch(_x29) {
|
|
2941
3087
|
return _handleUpdateLocalOrdersBatch.apply(this, arguments);
|
|
2942
3088
|
}
|
|
2943
3089
|
return handleUpdateLocalOrdersBatch;
|
|
@@ -2986,15 +3132,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
2986
3132
|
}
|
|
2987
3133
|
}
|
|
2988
3134
|
}, {
|
|
2989
|
-
key: "
|
|
2990
|
-
value: function
|
|
3135
|
+
key: "extractOrderSalesDetailLookup",
|
|
3136
|
+
value: function extractOrderSalesDetailLookup(url) {
|
|
2991
3137
|
var path = this.parseRequestPath(url);
|
|
2992
3138
|
var match = path.match(/^\/shop\/order\/sales\/([^/?#]+)$/);
|
|
2993
3139
|
return match !== null && match !== void 0 && match[1] ? decodeURIComponent(match[1]) : null;
|
|
2994
3140
|
}
|
|
3141
|
+
}, {
|
|
3142
|
+
key: "shouldForceRemoteSalesDetail",
|
|
3143
|
+
value: function shouldForceRemoteSalesDetail(data) {
|
|
3144
|
+
return (data === null || data === void 0 ? void 0 : data.forceRemote) === true || (data === null || data === void 0 ? void 0 : data.force_remote) === true;
|
|
3145
|
+
}
|
|
2995
3146
|
}, {
|
|
2996
3147
|
key: "buildOrderSalesDetailBackendPath",
|
|
2997
|
-
value: function buildOrderSalesDetailBackendPath(
|
|
3148
|
+
value: function buildOrderSalesDetailBackendPath(lookup, data) {
|
|
2998
3149
|
var rawWith = data && _typeof(data) === 'object' ? data.with : undefined;
|
|
2999
3150
|
var withFields = Array.isArray(rawWith) && rawWith.length > 0 ? rawWith : ['products', 'scheduleEvents'];
|
|
3000
3151
|
var searchParams = new URLSearchParams();
|
|
@@ -3004,7 +3155,43 @@ var Server = /*#__PURE__*/function () {
|
|
|
3004
3155
|
});
|
|
3005
3156
|
searchParams.append('lookup_mode', 'multi');
|
|
3006
3157
|
var query = searchParams.toString();
|
|
3007
|
-
return "/shop/order/sales/".concat(encodeURIComponent(
|
|
3158
|
+
return "/shop/order/sales/".concat(encodeURIComponent(lookup)).concat(query ? "?".concat(query) : '');
|
|
3159
|
+
}
|
|
3160
|
+
}, {
|
|
3161
|
+
key: "extractOrderDataFromCheckoutResponse",
|
|
3162
|
+
value: function extractOrderDataFromCheckoutResponse(response) {
|
|
3163
|
+
var _response$data4, _response$data5;
|
|
3164
|
+
var candidates = [response === null || response === void 0 || (_response$data4 = response.data) === null || _response$data4 === void 0 ? void 0 : _response$data4.order, response === null || response === void 0 || (_response$data5 = response.data) === null || _response$data5 === void 0 ? void 0 : _response$data5.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];
|
|
3165
|
+
for (var _i2 = 0, _candidates = candidates; _i2 < _candidates.length; _i2++) {
|
|
3166
|
+
var candidate = _candidates[_i2];
|
|
3167
|
+
if (!candidate || _typeof(candidate) !== 'object') continue;
|
|
3168
|
+
if (candidate.order_id !== undefined && candidate.order_id !== null) {
|
|
3169
|
+
return candidate;
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
return null;
|
|
3173
|
+
}
|
|
3174
|
+
}, {
|
|
3175
|
+
key: "normalizeCheckoutResponse",
|
|
3176
|
+
value: function normalizeCheckoutResponse(response) {
|
|
3177
|
+
if (response && _typeof(response) === 'object' && (response.code !== undefined || response.status !== undefined)) {
|
|
3178
|
+
return response;
|
|
3179
|
+
}
|
|
3180
|
+
return {
|
|
3181
|
+
code: 200,
|
|
3182
|
+
status: true,
|
|
3183
|
+
message: '',
|
|
3184
|
+
data: response
|
|
3185
|
+
};
|
|
3186
|
+
}
|
|
3187
|
+
}, {
|
|
3188
|
+
key: "extractBackendErrorResponse",
|
|
3189
|
+
value: function extractBackendErrorResponse(error) {
|
|
3190
|
+
var _error$response, _error$response2;
|
|
3191
|
+
var candidates = [error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data, error === null || error === void 0 ? void 0 : error.data, error === null || error === void 0 || (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.body, error === null || error === void 0 ? void 0 : error.body];
|
|
3192
|
+
return candidates.find(function (candidate) {
|
|
3193
|
+
return candidate && _typeof(candidate) === 'object';
|
|
3194
|
+
}) || null;
|
|
3008
3195
|
}
|
|
3009
3196
|
|
|
3010
3197
|
/**
|
|
@@ -3116,16 +3303,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
3116
3303
|
}, {
|
|
3117
3304
|
key: "recomputeAndNotifyFloorPlanQuery",
|
|
3118
3305
|
value: (function () {
|
|
3119
|
-
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3306
|
+
var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
3120
3307
|
var _iterator15, _step15, _step15$value, subscriberId, sub, result, errorMessage;
|
|
3121
|
-
return _regeneratorRuntime().wrap(function
|
|
3122
|
-
while (1) switch (
|
|
3308
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3309
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3123
3310
|
case 0:
|
|
3124
3311
|
if (!(this.floorPlanQuerySubscribers.size === 0)) {
|
|
3125
|
-
|
|
3312
|
+
_context29.next = 2;
|
|
3126
3313
|
break;
|
|
3127
3314
|
}
|
|
3128
|
-
return
|
|
3315
|
+
return _context29.abrupt("return");
|
|
3129
3316
|
case 2:
|
|
3130
3317
|
this.logInfo('recomputeAndNotifyFloorPlanQuery: 开始推送', {
|
|
3131
3318
|
subscriberCount: this.floorPlanQuerySubscribers.size
|
|
@@ -3155,9 +3342,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3155
3342
|
}
|
|
3156
3343
|
case 5:
|
|
3157
3344
|
case "end":
|
|
3158
|
-
return
|
|
3345
|
+
return _context29.stop();
|
|
3159
3346
|
}
|
|
3160
|
-
},
|
|
3347
|
+
}, _callee29, this);
|
|
3161
3348
|
}));
|
|
3162
3349
|
function recomputeAndNotifyFloorPlanQuery() {
|
|
3163
3350
|
return _recomputeAndNotifyFloorPlanQuery.apply(this, arguments);
|
|
@@ -3187,21 +3374,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
3187
3374
|
* filter 逻辑暂为 mock,仅记录参数
|
|
3188
3375
|
*/
|
|
3189
3376
|
function () {
|
|
3190
|
-
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3377
|
+
var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(data) {
|
|
3191
3378
|
var rawList, result;
|
|
3192
|
-
return _regeneratorRuntime().wrap(function
|
|
3193
|
-
while (1) switch (
|
|
3379
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3380
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3194
3381
|
case 0:
|
|
3195
3382
|
this.logInfo('computeOrderQueryResult: 开始过滤', {
|
|
3196
3383
|
data: data
|
|
3197
3384
|
});
|
|
3198
3385
|
console.log('[Server] computeOrderQueryResult', data);
|
|
3199
3386
|
if (this.order) {
|
|
3200
|
-
|
|
3387
|
+
_context30.next = 5;
|
|
3201
3388
|
break;
|
|
3202
3389
|
}
|
|
3203
3390
|
this.logError('computeOrderQueryResult: Order 模块未注册');
|
|
3204
|
-
return
|
|
3391
|
+
return _context30.abrupt("return", {
|
|
3205
3392
|
code: 500,
|
|
3206
3393
|
message: 'Order 模块未注册',
|
|
3207
3394
|
data: {
|
|
@@ -3225,7 +3412,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3225
3412
|
skip: result.skip,
|
|
3226
3413
|
rejected: result.rejected
|
|
3227
3414
|
});
|
|
3228
|
-
return
|
|
3415
|
+
return _context30.abrupt("return", {
|
|
3229
3416
|
code: 200,
|
|
3230
3417
|
data: result,
|
|
3231
3418
|
message: '',
|
|
@@ -3233,11 +3420,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3233
3420
|
});
|
|
3234
3421
|
case 10:
|
|
3235
3422
|
case "end":
|
|
3236
|
-
return
|
|
3423
|
+
return _context30.stop();
|
|
3237
3424
|
}
|
|
3238
|
-
},
|
|
3425
|
+
}, _callee30, this);
|
|
3239
3426
|
}));
|
|
3240
|
-
function computeOrderQueryResult(
|
|
3427
|
+
function computeOrderQueryResult(_x30) {
|
|
3241
3428
|
return _computeOrderQueryResult.apply(this, arguments);
|
|
3242
3429
|
}
|
|
3243
3430
|
return computeOrderQueryResult;
|
|
@@ -3250,17 +3437,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
3250
3437
|
}, {
|
|
3251
3438
|
key: "computeBookingQueryResult",
|
|
3252
3439
|
value: (function () {
|
|
3253
|
-
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3440
|
+
var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(data) {
|
|
3254
3441
|
var rawOrders, result;
|
|
3255
|
-
return _regeneratorRuntime().wrap(function
|
|
3256
|
-
while (1) switch (
|
|
3442
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3443
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3257
3444
|
case 0:
|
|
3258
3445
|
if (this.order) {
|
|
3259
|
-
|
|
3446
|
+
_context31.next = 3;
|
|
3260
3447
|
break;
|
|
3261
3448
|
}
|
|
3262
3449
|
this.logError('computeBookingQueryResult: Order 模块未注册');
|
|
3263
|
-
return
|
|
3450
|
+
return _context31.abrupt("return", {
|
|
3264
3451
|
code: 500,
|
|
3265
3452
|
message: 'Order 模块未注册',
|
|
3266
3453
|
data: {
|
|
@@ -3279,7 +3466,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3279
3466
|
size: result.size,
|
|
3280
3467
|
skip: result.skip
|
|
3281
3468
|
});
|
|
3282
|
-
return
|
|
3469
|
+
return _context31.abrupt("return", {
|
|
3283
3470
|
code: 200,
|
|
3284
3471
|
data: result,
|
|
3285
3472
|
message: '',
|
|
@@ -3287,11 +3474,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3287
3474
|
});
|
|
3288
3475
|
case 8:
|
|
3289
3476
|
case "end":
|
|
3290
|
-
return
|
|
3477
|
+
return _context31.stop();
|
|
3291
3478
|
}
|
|
3292
|
-
},
|
|
3479
|
+
}, _callee31, this);
|
|
3293
3480
|
}));
|
|
3294
|
-
function computeBookingQueryResult(
|
|
3481
|
+
function computeBookingQueryResult(_x31) {
|
|
3295
3482
|
return _computeBookingQueryResult.apply(this, arguments);
|
|
3296
3483
|
}
|
|
3297
3484
|
return computeBookingQueryResult;
|
|
@@ -3307,12 +3494,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
3307
3494
|
}, {
|
|
3308
3495
|
key: "computeProductQueryResult",
|
|
3309
3496
|
value: (function () {
|
|
3310
|
-
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3497
|
+
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(context, options) {
|
|
3311
3498
|
var _menu_list_ids$length3,
|
|
3312
3499
|
_this6 = this;
|
|
3313
3500
|
var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, product_id, queryIds, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, activeMenuList, tMenu, menuList, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tSort;
|
|
3314
|
-
return _regeneratorRuntime().wrap(function
|
|
3315
|
-
while (1) switch (
|
|
3501
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3502
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3316
3503
|
case 0:
|
|
3317
3504
|
tTotal = performance.now();
|
|
3318
3505
|
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, product_id = context.product_id;
|
|
@@ -3331,11 +3518,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3331
3518
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3332
3519
|
});
|
|
3333
3520
|
if (this.products) {
|
|
3334
|
-
|
|
3521
|
+
_context32.next = 7;
|
|
3335
3522
|
break;
|
|
3336
3523
|
}
|
|
3337
3524
|
this.logError('computeProductQueryResult: Products 模块未注册');
|
|
3338
|
-
return
|
|
3525
|
+
return _context32.abrupt("return", {
|
|
3339
3526
|
message: 'Products 模块未注册',
|
|
3340
3527
|
data: {
|
|
3341
3528
|
list: [],
|
|
@@ -3344,12 +3531,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
3344
3531
|
});
|
|
3345
3532
|
case 7:
|
|
3346
3533
|
if (!(queryIds.length > 0)) {
|
|
3347
|
-
|
|
3534
|
+
_context32.next = 18;
|
|
3348
3535
|
break;
|
|
3349
3536
|
}
|
|
3350
3537
|
uniqueIds = Array.from(new Set(queryIds));
|
|
3351
3538
|
_tPrice = performance.now();
|
|
3352
|
-
|
|
3539
|
+
_context32.next = 12;
|
|
3353
3540
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
3354
3541
|
scheduleModule: this.getSchedule(),
|
|
3355
3542
|
schedule_datetime: schedule_datetime,
|
|
@@ -3359,7 +3546,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3359
3546
|
productIds: uniqueIds
|
|
3360
3547
|
});
|
|
3361
3548
|
case 12:
|
|
3362
|
-
productsWithPrice =
|
|
3549
|
+
productsWithPrice = _context32.sent;
|
|
3363
3550
|
perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
|
|
3364
3551
|
count: productsWithPrice.length,
|
|
3365
3552
|
ids: uniqueIds
|
|
@@ -3378,7 +3565,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3378
3565
|
ids: uniqueIds,
|
|
3379
3566
|
count: _filteredProducts.length
|
|
3380
3567
|
});
|
|
3381
|
-
return
|
|
3568
|
+
return _context32.abrupt("return", {
|
|
3382
3569
|
code: 200,
|
|
3383
3570
|
data: {
|
|
3384
3571
|
list: _filteredProducts,
|
|
@@ -3389,19 +3576,19 @@ var Server = /*#__PURE__*/function () {
|
|
|
3389
3576
|
});
|
|
3390
3577
|
case 18:
|
|
3391
3578
|
if (!(product_id != null && Number.isFinite(Number(product_id)))) {
|
|
3392
|
-
|
|
3579
|
+
_context32.next = 30;
|
|
3393
3580
|
break;
|
|
3394
3581
|
}
|
|
3395
3582
|
pid = Number(product_id);
|
|
3396
3583
|
_tPrice2 = performance.now();
|
|
3397
|
-
|
|
3584
|
+
_context32.next = 23;
|
|
3398
3585
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
3399
3586
|
scheduleModule: this.getSchedule()
|
|
3400
3587
|
}, {
|
|
3401
3588
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3402
3589
|
});
|
|
3403
3590
|
case 23:
|
|
3404
|
-
allProductsWithPrice =
|
|
3591
|
+
allProductsWithPrice = _context32.sent;
|
|
3405
3592
|
perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
|
|
3406
3593
|
count: allProductsWithPrice.length,
|
|
3407
3594
|
productId: pid
|
|
@@ -3421,7 +3608,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3421
3608
|
productId: pid,
|
|
3422
3609
|
found: !!item
|
|
3423
3610
|
});
|
|
3424
|
-
return
|
|
3611
|
+
return _context32.abrupt("return", {
|
|
3425
3612
|
code: 200,
|
|
3426
3613
|
data: item,
|
|
3427
3614
|
message: item ? '' : '商品不存在或未发布',
|
|
@@ -3429,11 +3616,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3429
3616
|
});
|
|
3430
3617
|
case 30:
|
|
3431
3618
|
if (this.menu) {
|
|
3432
|
-
|
|
3619
|
+
_context32.next = 33;
|
|
3433
3620
|
break;
|
|
3434
3621
|
}
|
|
3435
3622
|
this.logError('computeProductQueryResult: Menu 模块未注册');
|
|
3436
|
-
return
|
|
3623
|
+
return _context32.abrupt("return", {
|
|
3437
3624
|
message: 'Menu 模块未注册',
|
|
3438
3625
|
data: {
|
|
3439
3626
|
list: [],
|
|
@@ -3442,11 +3629,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3442
3629
|
});
|
|
3443
3630
|
case 33:
|
|
3444
3631
|
if (this.schedule) {
|
|
3445
|
-
|
|
3632
|
+
_context32.next = 36;
|
|
3446
3633
|
break;
|
|
3447
3634
|
}
|
|
3448
3635
|
this.logError('computeProductQueryResult: Schedule 模块未注册');
|
|
3449
|
-
return
|
|
3636
|
+
return _context32.abrupt("return", {
|
|
3450
3637
|
message: 'Schedule 模块未注册',
|
|
3451
3638
|
data: {
|
|
3452
3639
|
list: [],
|
|
@@ -3477,10 +3664,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3477
3664
|
});
|
|
3478
3665
|
tPrice = performance.now();
|
|
3479
3666
|
if (!(scopedProductIds.length > 0)) {
|
|
3480
|
-
|
|
3667
|
+
_context32.next = 49;
|
|
3481
3668
|
break;
|
|
3482
3669
|
}
|
|
3483
|
-
|
|
3670
|
+
_context32.next = 46;
|
|
3484
3671
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
3485
3672
|
scheduleModule: this.getSchedule(),
|
|
3486
3673
|
schedule_datetime: schedule_datetime,
|
|
@@ -3490,13 +3677,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
3490
3677
|
productIds: productScope.isAllProducts ? undefined : scopedProductIds
|
|
3491
3678
|
});
|
|
3492
3679
|
case 46:
|
|
3493
|
-
|
|
3494
|
-
|
|
3680
|
+
_context32.t0 = _context32.sent;
|
|
3681
|
+
_context32.next = 50;
|
|
3495
3682
|
break;
|
|
3496
3683
|
case 49:
|
|
3497
|
-
|
|
3684
|
+
_context32.t0 = [];
|
|
3498
3685
|
case 50:
|
|
3499
|
-
filteredProducts =
|
|
3686
|
+
filteredProducts = _context32.t0;
|
|
3500
3687
|
perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
|
|
3501
3688
|
count: filteredProducts.length,
|
|
3502
3689
|
scopedProductCount: scopedProductIds.length
|
|
@@ -3529,7 +3716,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3529
3716
|
filteredCount: filteredProducts.length,
|
|
3530
3717
|
activeMenuCount: activeMenuList.length
|
|
3531
3718
|
});
|
|
3532
|
-
return
|
|
3719
|
+
return _context32.abrupt("return", {
|
|
3533
3720
|
code: 200,
|
|
3534
3721
|
data: {
|
|
3535
3722
|
list: filteredProducts,
|
|
@@ -3540,11 +3727,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3540
3727
|
});
|
|
3541
3728
|
case 62:
|
|
3542
3729
|
case "end":
|
|
3543
|
-
return
|
|
3730
|
+
return _context32.stop();
|
|
3544
3731
|
}
|
|
3545
|
-
},
|
|
3732
|
+
}, _callee32, this);
|
|
3546
3733
|
}));
|
|
3547
|
-
function computeProductQueryResult(
|
|
3734
|
+
function computeProductQueryResult(_x32, _x33) {
|
|
3548
3735
|
return _computeProductQueryResult.apply(this, arguments);
|
|
3549
3736
|
}
|
|
3550
3737
|
return computeProductQueryResult;
|
|
@@ -3559,72 +3746,72 @@ var Server = /*#__PURE__*/function () {
|
|
|
3559
3746
|
}, {
|
|
3560
3747
|
key: "recomputeAndNotifyProductQuery",
|
|
3561
3748
|
value: (function () {
|
|
3562
|
-
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3749
|
+
var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(options) {
|
|
3563
3750
|
var _iterator16, _step16, _step16$value, subscriberId, subscriber, result, errorMessage;
|
|
3564
|
-
return _regeneratorRuntime().wrap(function
|
|
3565
|
-
while (1) switch (
|
|
3751
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3752
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3566
3753
|
case 0:
|
|
3567
3754
|
if (!(this.productQuerySubscribers.size === 0)) {
|
|
3568
|
-
|
|
3755
|
+
_context33.next = 2;
|
|
3569
3756
|
break;
|
|
3570
3757
|
}
|
|
3571
|
-
return
|
|
3758
|
+
return _context33.abrupt("return");
|
|
3572
3759
|
case 2:
|
|
3573
3760
|
this.logInfo('recomputeAndNotifyProductQuery: 开始推送', {
|
|
3574
3761
|
subscriberCount: this.productQuerySubscribers.size,
|
|
3575
3762
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3576
3763
|
});
|
|
3577
3764
|
_iterator16 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
|
|
3578
|
-
|
|
3765
|
+
_context33.prev = 4;
|
|
3579
3766
|
_iterator16.s();
|
|
3580
3767
|
case 6:
|
|
3581
3768
|
if ((_step16 = _iterator16.n()).done) {
|
|
3582
|
-
|
|
3769
|
+
_context33.next = 22;
|
|
3583
3770
|
break;
|
|
3584
3771
|
}
|
|
3585
3772
|
_step16$value = _slicedToArray(_step16.value, 2), subscriberId = _step16$value[0], subscriber = _step16$value[1];
|
|
3586
|
-
|
|
3587
|
-
|
|
3773
|
+
_context33.prev = 8;
|
|
3774
|
+
_context33.next = 11;
|
|
3588
3775
|
return this.computeProductQueryResult(subscriber.context, {
|
|
3589
3776
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3590
3777
|
});
|
|
3591
3778
|
case 11:
|
|
3592
|
-
result =
|
|
3779
|
+
result = _context33.sent;
|
|
3593
3780
|
subscriber.callback(result);
|
|
3594
3781
|
this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
|
|
3595
3782
|
subscriberId: subscriberId
|
|
3596
3783
|
});
|
|
3597
|
-
|
|
3784
|
+
_context33.next = 20;
|
|
3598
3785
|
break;
|
|
3599
3786
|
case 16:
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
errorMessage =
|
|
3787
|
+
_context33.prev = 16;
|
|
3788
|
+
_context33.t0 = _context33["catch"](8);
|
|
3789
|
+
errorMessage = _context33.t0 instanceof Error ? _context33.t0.message : String(_context33.t0);
|
|
3603
3790
|
this.logError('recomputeAndNotifyProductQuery: 推送失败', {
|
|
3604
3791
|
subscriberId: subscriberId,
|
|
3605
3792
|
error: errorMessage
|
|
3606
3793
|
});
|
|
3607
3794
|
case 20:
|
|
3608
|
-
|
|
3795
|
+
_context33.next = 6;
|
|
3609
3796
|
break;
|
|
3610
3797
|
case 22:
|
|
3611
|
-
|
|
3798
|
+
_context33.next = 27;
|
|
3612
3799
|
break;
|
|
3613
3800
|
case 24:
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
_iterator16.e(
|
|
3801
|
+
_context33.prev = 24;
|
|
3802
|
+
_context33.t1 = _context33["catch"](4);
|
|
3803
|
+
_iterator16.e(_context33.t1);
|
|
3617
3804
|
case 27:
|
|
3618
|
-
|
|
3805
|
+
_context33.prev = 27;
|
|
3619
3806
|
_iterator16.f();
|
|
3620
|
-
return
|
|
3807
|
+
return _context33.finish(27);
|
|
3621
3808
|
case 30:
|
|
3622
3809
|
case "end":
|
|
3623
|
-
return
|
|
3810
|
+
return _context33.stop();
|
|
3624
3811
|
}
|
|
3625
|
-
},
|
|
3812
|
+
}, _callee33, this, [[4, 24, 27, 30], [8, 16]]);
|
|
3626
3813
|
}));
|
|
3627
|
-
function recomputeAndNotifyProductQuery(
|
|
3814
|
+
function recomputeAndNotifyProductQuery(_x34) {
|
|
3628
3815
|
return _recomputeAndNotifyProductQuery.apply(this, arguments);
|
|
3629
3816
|
}
|
|
3630
3817
|
return recomputeAndNotifyProductQuery;
|
|
@@ -3636,16 +3823,16 @@ var Server = /*#__PURE__*/function () {
|
|
|
3636
3823
|
}, {
|
|
3637
3824
|
key: "recomputeAndNotifyOrderQuery",
|
|
3638
3825
|
value: (function () {
|
|
3639
|
-
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3826
|
+
var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
3640
3827
|
var notifyStartAt, _iterator17, _step17, _step17$value, subscriberId, subscriber, computeStartAt, result, computeEndAt, callbackStartAt, callbackEndAt, errorMessage, notifyEndAt;
|
|
3641
|
-
return _regeneratorRuntime().wrap(function
|
|
3642
|
-
while (1) switch (
|
|
3828
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3829
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3643
3830
|
case 0:
|
|
3644
3831
|
if (!(this.orderQuerySubscribers.size === 0)) {
|
|
3645
|
-
|
|
3832
|
+
_context34.next = 2;
|
|
3646
3833
|
break;
|
|
3647
3834
|
}
|
|
3648
|
-
return
|
|
3835
|
+
return _context34.abrupt("return");
|
|
3649
3836
|
case 2:
|
|
3650
3837
|
notifyStartAt = Date.now();
|
|
3651
3838
|
this.logInfo('recomputeAndNotifyOrderQuery: 开始推送', {
|
|
@@ -3653,20 +3840,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
3653
3840
|
notifyStartAt: new Date(notifyStartAt).toISOString()
|
|
3654
3841
|
});
|
|
3655
3842
|
_iterator17 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
|
|
3656
|
-
|
|
3843
|
+
_context34.prev = 5;
|
|
3657
3844
|
_iterator17.s();
|
|
3658
3845
|
case 7:
|
|
3659
3846
|
if ((_step17 = _iterator17.n()).done) {
|
|
3660
|
-
|
|
3847
|
+
_context34.next = 27;
|
|
3661
3848
|
break;
|
|
3662
3849
|
}
|
|
3663
3850
|
_step17$value = _slicedToArray(_step17.value, 2), subscriberId = _step17$value[0], subscriber = _step17$value[1];
|
|
3664
|
-
|
|
3851
|
+
_context34.prev = 9;
|
|
3665
3852
|
computeStartAt = Date.now();
|
|
3666
|
-
|
|
3853
|
+
_context34.next = 13;
|
|
3667
3854
|
return this.computeOrderQueryResult(subscriber.context);
|
|
3668
3855
|
case 13:
|
|
3669
|
-
result =
|
|
3856
|
+
result = _context34.sent;
|
|
3670
3857
|
computeEndAt = Date.now();
|
|
3671
3858
|
callbackStartAt = Date.now();
|
|
3672
3859
|
subscriber.callback(result);
|
|
@@ -3677,30 +3864,30 @@ var Server = /*#__PURE__*/function () {
|
|
|
3677
3864
|
callbackDurationMs: callbackEndAt - callbackStartAt,
|
|
3678
3865
|
totalDurationMs: callbackEndAt - computeStartAt
|
|
3679
3866
|
});
|
|
3680
|
-
|
|
3867
|
+
_context34.next = 25;
|
|
3681
3868
|
break;
|
|
3682
3869
|
case 21:
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
errorMessage =
|
|
3870
|
+
_context34.prev = 21;
|
|
3871
|
+
_context34.t0 = _context34["catch"](9);
|
|
3872
|
+
errorMessage = _context34.t0 instanceof Error ? _context34.t0.message : String(_context34.t0);
|
|
3686
3873
|
this.logError('recomputeAndNotifyOrderQuery: 推送失败', {
|
|
3687
3874
|
subscriberId: subscriberId,
|
|
3688
3875
|
error: errorMessage
|
|
3689
3876
|
});
|
|
3690
3877
|
case 25:
|
|
3691
|
-
|
|
3878
|
+
_context34.next = 7;
|
|
3692
3879
|
break;
|
|
3693
3880
|
case 27:
|
|
3694
|
-
|
|
3881
|
+
_context34.next = 32;
|
|
3695
3882
|
break;
|
|
3696
3883
|
case 29:
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
_iterator17.e(
|
|
3884
|
+
_context34.prev = 29;
|
|
3885
|
+
_context34.t1 = _context34["catch"](5);
|
|
3886
|
+
_iterator17.e(_context34.t1);
|
|
3700
3887
|
case 32:
|
|
3701
|
-
|
|
3888
|
+
_context34.prev = 32;
|
|
3702
3889
|
_iterator17.f();
|
|
3703
|
-
return
|
|
3890
|
+
return _context34.finish(32);
|
|
3704
3891
|
case 35:
|
|
3705
3892
|
notifyEndAt = Date.now();
|
|
3706
3893
|
this.logInfo('recomputeAndNotifyOrderQuery: 推送完成', {
|
|
@@ -3709,9 +3896,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3709
3896
|
});
|
|
3710
3897
|
case 37:
|
|
3711
3898
|
case "end":
|
|
3712
|
-
return
|
|
3899
|
+
return _context34.stop();
|
|
3713
3900
|
}
|
|
3714
|
-
},
|
|
3901
|
+
}, _callee34, this, [[5, 29, 32, 35], [9, 21]]);
|
|
3715
3902
|
}));
|
|
3716
3903
|
function recomputeAndNotifyOrderQuery() {
|
|
3717
3904
|
return _recomputeAndNotifyOrderQuery.apply(this, arguments);
|
|
@@ -3725,67 +3912,67 @@ var Server = /*#__PURE__*/function () {
|
|
|
3725
3912
|
}, {
|
|
3726
3913
|
key: "recomputeAndNotifyBookingQuery",
|
|
3727
3914
|
value: (function () {
|
|
3728
|
-
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3915
|
+
var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
3729
3916
|
var _iterator18, _step18, _step18$value, subscriberId, subscriber, result, errorMessage;
|
|
3730
|
-
return _regeneratorRuntime().wrap(function
|
|
3731
|
-
while (1) switch (
|
|
3917
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3918
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3732
3919
|
case 0:
|
|
3733
3920
|
if (!(this.bookingQuerySubscribers.size === 0)) {
|
|
3734
|
-
|
|
3921
|
+
_context35.next = 2;
|
|
3735
3922
|
break;
|
|
3736
3923
|
}
|
|
3737
|
-
return
|
|
3924
|
+
return _context35.abrupt("return");
|
|
3738
3925
|
case 2:
|
|
3739
3926
|
this.logInfo('recomputeAndNotifyBookingQuery: 开始推送', {
|
|
3740
3927
|
subscriberCount: this.bookingQuerySubscribers.size
|
|
3741
3928
|
});
|
|
3742
3929
|
_iterator18 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
|
|
3743
|
-
|
|
3930
|
+
_context35.prev = 4;
|
|
3744
3931
|
_iterator18.s();
|
|
3745
3932
|
case 6:
|
|
3746
3933
|
if ((_step18 = _iterator18.n()).done) {
|
|
3747
|
-
|
|
3934
|
+
_context35.next = 22;
|
|
3748
3935
|
break;
|
|
3749
3936
|
}
|
|
3750
3937
|
_step18$value = _slicedToArray(_step18.value, 2), subscriberId = _step18$value[0], subscriber = _step18$value[1];
|
|
3751
|
-
|
|
3752
|
-
|
|
3938
|
+
_context35.prev = 8;
|
|
3939
|
+
_context35.next = 11;
|
|
3753
3940
|
return this.computeBookingQueryResult(subscriber.context);
|
|
3754
3941
|
case 11:
|
|
3755
|
-
result =
|
|
3942
|
+
result = _context35.sent;
|
|
3756
3943
|
subscriber.callback(result);
|
|
3757
3944
|
this.logInfo('recomputeAndNotifyBookingQuery: 已推送', {
|
|
3758
3945
|
subscriberId: subscriberId
|
|
3759
3946
|
});
|
|
3760
|
-
|
|
3947
|
+
_context35.next = 20;
|
|
3761
3948
|
break;
|
|
3762
3949
|
case 16:
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
errorMessage =
|
|
3950
|
+
_context35.prev = 16;
|
|
3951
|
+
_context35.t0 = _context35["catch"](8);
|
|
3952
|
+
errorMessage = _context35.t0 instanceof Error ? _context35.t0.message : String(_context35.t0);
|
|
3766
3953
|
this.logError('recomputeAndNotifyBookingQuery: 推送失败', {
|
|
3767
3954
|
subscriberId: subscriberId,
|
|
3768
3955
|
error: errorMessage
|
|
3769
3956
|
});
|
|
3770
3957
|
case 20:
|
|
3771
|
-
|
|
3958
|
+
_context35.next = 6;
|
|
3772
3959
|
break;
|
|
3773
3960
|
case 22:
|
|
3774
|
-
|
|
3961
|
+
_context35.next = 27;
|
|
3775
3962
|
break;
|
|
3776
3963
|
case 24:
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
_iterator18.e(
|
|
3964
|
+
_context35.prev = 24;
|
|
3965
|
+
_context35.t1 = _context35["catch"](4);
|
|
3966
|
+
_iterator18.e(_context35.t1);
|
|
3780
3967
|
case 27:
|
|
3781
|
-
|
|
3968
|
+
_context35.prev = 27;
|
|
3782
3969
|
_iterator18.f();
|
|
3783
|
-
return
|
|
3970
|
+
return _context35.finish(27);
|
|
3784
3971
|
case 30:
|
|
3785
3972
|
case "end":
|
|
3786
|
-
return
|
|
3973
|
+
return _context35.stop();
|
|
3787
3974
|
}
|
|
3788
|
-
},
|
|
3975
|
+
}, _callee35, this, [[4, 24, 27, 30], [8, 16]]);
|
|
3789
3976
|
}));
|
|
3790
3977
|
function recomputeAndNotifyBookingQuery() {
|
|
3791
3978
|
return _recomputeAndNotifyBookingQuery.apply(this, arguments);
|