@pisell/pisellos 2.1.29 → 2.1.31
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/modules/Payment/index.js +56 -46
- package/dist/modules/ProductList/index.js +3 -2
- package/dist/solution/BookingByStep/index.d.ts +17 -1
- package/dist/solution/BookingByStep/index.js +466 -21
- package/dist/solution/BookingByStep/utils/capacity.d.ts +7 -2
- package/dist/solution/BookingByStep/utils/capacity.js +24 -8
- package/dist/solution/Checkout/index.d.ts +46 -1
- package/dist/solution/Checkout/index.js +823 -503
- package/lib/modules/Payment/index.js +28 -41
- package/lib/modules/ProductList/index.js +3 -2
- package/lib/solution/BookingByStep/index.d.ts +17 -1
- package/lib/solution/BookingByStep/index.js +311 -39
- package/lib/solution/BookingByStep/utils/capacity.d.ts +7 -2
- package/lib/solution/BookingByStep/utils/capacity.js +21 -8
- package/lib/solution/Checkout/index.d.ts +46 -1
- package/lib/solution/Checkout/index.js +263 -66
- package/package.json +1 -1
|
@@ -131,6 +131,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
131
131
|
return this.ensurePaymentTables();
|
|
132
132
|
case 14:
|
|
133
133
|
this.registerNetworkHandlers();
|
|
134
|
+
|
|
135
|
+
// // 预连接数据库
|
|
136
|
+
// this.dbManager.connect()
|
|
137
|
+
|
|
134
138
|
console.log('[PaymentModule] 初始化完成');
|
|
135
139
|
this.logInfo('PaymentModule initialized successfully');
|
|
136
140
|
case 17:
|
|
@@ -657,7 +661,8 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
657
661
|
key: "createPaymentOrderAsync",
|
|
658
662
|
value: (function () {
|
|
659
663
|
var _createPaymentOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
|
|
660
|
-
var
|
|
664
|
+
var _this3 = this;
|
|
665
|
+
var newOrder, dbAddStartTime, dbAddDuration;
|
|
661
666
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
662
667
|
while (1) switch (_context7.prev = _context7.next) {
|
|
663
668
|
case 0:
|
|
@@ -666,41 +671,41 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
666
671
|
totalAmount: params.total_amount
|
|
667
672
|
});
|
|
668
673
|
_context7.prev = 1;
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
this.logInfo('createPaymentOrderAsync existingOrder', {
|
|
674
|
-
existingOrder: existingOrder
|
|
675
|
-
});
|
|
674
|
+
// 检测是否有重复的 order_id
|
|
675
|
+
// console.time('createLocalOrderAsync: getExistingOrder')
|
|
676
|
+
// const existingOrder = await this.dbManager.get('order', params.order_id);
|
|
677
|
+
// const existingOrders = await this.dbManager.getAll('order');
|
|
676
678
|
// const existingOrder = existingOrders.find(
|
|
677
679
|
// (order: PaymentOrder) => String(order.id) === String(params.order_id),
|
|
678
680
|
// );
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
//
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
//
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
//
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
//
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
681
|
+
// this.logInfo('createPaymentOrderAsync existingOrder', {
|
|
682
|
+
// existingOrder
|
|
683
|
+
// });
|
|
684
|
+
// console.timeEnd('createLocalOrderAsync: getExistingOrder')
|
|
685
|
+
// const existingOrder = existingOrders.find(
|
|
686
|
+
// (order: PaymentOrder) => String(order.id) === String(params.order_id),
|
|
687
|
+
// );
|
|
688
|
+
// if (existingOrder) {
|
|
689
|
+
// // 如果存在相同 order_id 的订单,更新该订单信息
|
|
690
|
+
// this.logInfo(
|
|
691
|
+
// `createPaymentOrderAsync found duplicate order ID: ${params.order_id}, updating existing payment order`,
|
|
692
|
+
// );
|
|
693
|
+
// // const originalOrder = { ...existingOrder };
|
|
694
|
+
// existingOrder.order_info = params.order_info;
|
|
695
|
+
// existingOrder.total_amount = params.total_amount;
|
|
696
|
+
// existingOrder.is_deposit = params.is_deposit || 0;
|
|
697
|
+
// existingOrder.deposit_amount = params.deposit_amount || '0.00';
|
|
698
|
+
// // 重新计算待付金额
|
|
699
|
+
// this.recalculateOrderAmount(existingOrder);
|
|
700
|
+
// // 更新到数据库
|
|
701
|
+
// await this.dbManager.update('order', existingOrder);
|
|
702
|
+
// // 触发更新事件
|
|
703
|
+
// this.core.effects.emit(
|
|
704
|
+
// `${this.name}:onOrderUpdated`,
|
|
705
|
+
// existingOrder,
|
|
706
|
+
// );
|
|
707
|
+
// return existingOrder;
|
|
708
|
+
// } else {
|
|
704
709
|
// 创建新的支付订单
|
|
705
710
|
newOrder = {
|
|
706
711
|
uuid: getUniqueId('pay_order_'),
|
|
@@ -715,32 +720,37 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
715
720
|
tax_fee: '0.00',
|
|
716
721
|
is_deposit: params.is_deposit || 0,
|
|
717
722
|
deposit_amount: params.deposit_amount || '0.00'
|
|
718
|
-
};
|
|
719
|
-
|
|
723
|
+
}; // 🚀 性能监控:记录数据库添加操作耗时
|
|
724
|
+
dbAddStartTime = Date.now();
|
|
725
|
+
_context7.next = 6;
|
|
720
726
|
return this.dbManager.add('order', newOrder);
|
|
721
|
-
case
|
|
722
|
-
|
|
723
|
-
this.logInfo('
|
|
727
|
+
case 6:
|
|
728
|
+
dbAddDuration = Date.now() - dbAddStartTime;
|
|
729
|
+
this.logInfo('Database add operation completed', {
|
|
730
|
+
operation: 'dbManager.add',
|
|
731
|
+
table: 'order',
|
|
724
732
|
orderUuid: newOrder.uuid,
|
|
725
|
-
orderId: newOrder.
|
|
733
|
+
orderId: newOrder.order_id,
|
|
734
|
+
duration: "".concat(dbAddDuration, "ms"),
|
|
735
|
+
performance: dbAddDuration > 100 ? 'slow' : dbAddDuration > 50 ? 'medium' : 'fast'
|
|
726
736
|
});
|
|
737
|
+
setTimeout(function () {
|
|
738
|
+
_this3.core.effects.emit("".concat(_this3.name, ":onOrderAdded"), newOrder);
|
|
739
|
+
}, 0);
|
|
727
740
|
return _context7.abrupt("return", newOrder);
|
|
728
|
-
case
|
|
729
|
-
_context7.
|
|
730
|
-
break;
|
|
731
|
-
case 28:
|
|
732
|
-
_context7.prev = 28;
|
|
741
|
+
case 12:
|
|
742
|
+
_context7.prev = 12;
|
|
733
743
|
_context7.t0 = _context7["catch"](1);
|
|
734
744
|
console.error('[PaymentModule] 创建支付订单失败', _context7.t0);
|
|
735
745
|
this.logError('createPaymentOrderAsync failed', _context7.t0, {
|
|
736
746
|
orderId: params.order_id
|
|
737
747
|
});
|
|
738
748
|
throw _context7.t0;
|
|
739
|
-
case
|
|
749
|
+
case 17:
|
|
740
750
|
case "end":
|
|
741
751
|
return _context7.stop();
|
|
742
752
|
}
|
|
743
|
-
}, _callee7, this, [[1,
|
|
753
|
+
}, _callee7, this, [[1, 12]]);
|
|
744
754
|
}));
|
|
745
755
|
function createPaymentOrderAsync(_x6) {
|
|
746
756
|
return _createPaymentOrderAsync.apply(this, arguments);
|
|
@@ -130,9 +130,10 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
130
130
|
with_count: with_count,
|
|
131
131
|
// client_schedule_ids: schedule_ids,
|
|
132
132
|
schedule_date: schedule_date,
|
|
133
|
+
application_code: (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel,
|
|
134
|
+
is_eject: 1,
|
|
133
135
|
with_schedule: with_schedule,
|
|
134
|
-
schedule_datetime: schedule_datetime
|
|
135
|
-
application_code: (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel
|
|
136
|
+
schedule_datetime: schedule_datetime
|
|
136
137
|
}, {
|
|
137
138
|
useCache: true
|
|
138
139
|
});
|
|
@@ -324,9 +324,25 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
324
324
|
success: boolean;
|
|
325
325
|
minAvailableCount: number;
|
|
326
326
|
};
|
|
327
|
+
/**
|
|
328
|
+
* 将 ProductData 转换为 CartItem,但不添加到购物车
|
|
329
|
+
* 参考 addProductToCart 方法的实现
|
|
330
|
+
*/
|
|
331
|
+
private convertProductToCartItem;
|
|
332
|
+
checkMaxDurationCapacityForDetailNums({ product, date, account, }: {
|
|
333
|
+
product: ProductData;
|
|
334
|
+
date?: {
|
|
335
|
+
startTime: string;
|
|
336
|
+
endTime: string;
|
|
337
|
+
} | null;
|
|
338
|
+
account?: Account | null;
|
|
339
|
+
}): {
|
|
340
|
+
success: boolean;
|
|
341
|
+
minAvailableCount: number;
|
|
342
|
+
};
|
|
327
343
|
setOtherData(key: string, value: any): void;
|
|
328
344
|
getOtherData(key: string): any;
|
|
329
|
-
getProductTypeById(id: number): Promise<"
|
|
345
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
330
346
|
/**
|
|
331
347
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
332
348
|
*
|