@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.
@@ -323,48 +323,35 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
323
323
  totalAmount: params.total_amount
324
324
  });
325
325
  try {
326
- const existingOrder = await this.dbManager.get("order", params.order_id);
327
- this.logInfo("createPaymentOrderAsync existingOrder", {
328
- existingOrder
326
+ const newOrder = {
327
+ uuid: (0, import_utils.getUniqueId)("pay_order_"),
328
+ id: params.order_id,
329
+ order_id: params.order_id,
330
+ order_info: params.order_info,
331
+ payment_status: import_types.PaymentStatus.Processing,
332
+ payment: [],
333
+ adjust_offline_payments: [],
334
+ total_amount: params.total_amount,
335
+ expect_amount: params.total_amount,
336
+ tax_fee: "0.00",
337
+ is_deposit: params.is_deposit || 0,
338
+ deposit_amount: params.deposit_amount || "0.00"
339
+ };
340
+ const dbAddStartTime = Date.now();
341
+ await this.dbManager.add("order", newOrder);
342
+ const dbAddDuration = Date.now() - dbAddStartTime;
343
+ this.logInfo("Database add operation completed", {
344
+ operation: "dbManager.add",
345
+ table: "order",
346
+ orderUuid: newOrder.uuid,
347
+ orderId: newOrder.order_id,
348
+ duration: `${dbAddDuration}ms`,
349
+ performance: dbAddDuration > 100 ? "slow" : dbAddDuration > 50 ? "medium" : "fast"
329
350
  });
330
- if (existingOrder) {
331
- this.logInfo(
332
- `createPaymentOrderAsync found duplicate order ID: ${params.order_id}, updating existing payment order`
333
- );
334
- existingOrder.order_info = params.order_info;
335
- existingOrder.total_amount = params.total_amount;
336
- existingOrder.is_deposit = params.is_deposit || 0;
337
- existingOrder.deposit_amount = params.deposit_amount || "0.00";
338
- this.recalculateOrderAmount(existingOrder);
339
- await this.dbManager.update("order", existingOrder);
340
- await this.core.effects.emit(
341
- import_types.PaymentHooks.OnOrderUpdated,
342
- existingOrder
343
- );
344
- return existingOrder;
345
- } else {
346
- const newOrder = {
347
- uuid: (0, import_utils.getUniqueId)("pay_order_"),
348
- id: params.order_id,
349
- order_id: params.order_id,
350
- order_info: params.order_info,
351
- payment_status: import_types.PaymentStatus.Processing,
352
- payment: [],
353
- adjust_offline_payments: [],
354
- total_amount: params.total_amount,
355
- expect_amount: params.total_amount,
356
- tax_fee: "0.00",
357
- is_deposit: params.is_deposit || 0,
358
- deposit_amount: params.deposit_amount || "0.00"
359
- };
360
- await this.dbManager.add("order", newOrder);
361
- this.core.effects.emit(import_types.PaymentHooks.OnOrderAdded, newOrder);
362
- this.logInfo("createPaymentOrderAsync completed - new payment order created", {
363
- orderUuid: newOrder.uuid,
364
- orderId: newOrder.id
365
- });
366
- return newOrder;
367
- }
351
+ setTimeout(() => {
352
+ this.core.effects.emit(`${this.name}:onOrderAdded`, newOrder);
353
+ }, 0);
354
+ return newOrder;
368
355
  } catch (error) {
369
356
  console.error("[PaymentModule] 创建支付订单失败", error);
370
357
  this.logError("createPaymentOrderAsync failed", error, {
@@ -96,9 +96,10 @@ var ProductList = class extends import_BaseModule.BaseModule {
96
96
  with_count,
97
97
  // client_schedule_ids: schedule_ids,
98
98
  schedule_date,
99
+ application_code: (_b = this.otherParams) == null ? void 0 : _b.channel,
100
+ is_eject: 1,
99
101
  with_schedule,
100
- schedule_datetime,
101
- application_code: (_b = this.otherParams) == null ? void 0 : _b.channel
102
+ schedule_datetime
102
103
  },
103
104
  { useCache: true }
104
105
  );
@@ -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<"normal" | "duration" | "session">;
345
+ getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
330
346
  /**
331
347
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
332
348
  *