@pisell/pisellos 0.0.195 → 0.0.199

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.
@@ -181,9 +181,47 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
181
181
  * 注意:只清理完全支付的订单,部分支付的订单保留以便继续支付
182
182
  */
183
183
  cleanupFinishedOrders(): Promise<void>;
184
+ /**
185
+ * 检测未同步的订单并重新加入任务队列
186
+ *
187
+ * 此方法专门用于处理因网络问题导致任务队列执行失败但队列被清空的情况。
188
+ * 它会检查本地 IndexDB 中所有未同步的订单(isSynced: false),
189
+ * 并将这些订单重新添加到任务队列中。
190
+ *
191
+ * 使用场景:
192
+ * - 网络恢复后重新检查未同步的订单
193
+ * - 应用启动时检查并重新排队未完成的支付
194
+ * - 用户手动重试前的预检查
195
+ *
196
+ * @returns Promise<number> 返回重新加入队列的订单数量
197
+ */
198
+ recheckAndRequeueUnsyncedOrders(): Promise<number>;
184
199
  /**
185
200
  * 手动执行支付同步队列
186
201
  * 外部可以调用此方法来触发支付同步任务的执行
202
+ *
203
+ * 注意:此方法只执行现有队列中的任务,不会检查未同步的订单。
204
+ * 如果需要检查未同步订单,请先调用 recheckAndRequeueUnsyncedOrders()
205
+ *
206
+ * 使用示例:
207
+ * ```typescript
208
+ * // 1. 先检查并重新排队未同步订单,然后执行队列
209
+ * const requeuedCount = await paymentModule.recheckAndRequeueUnsyncedOrders();
210
+ * if (requeuedCount > 0) {
211
+ * await paymentModule.runPaymentSyncQueue();
212
+ * }
213
+ *
214
+ * // 2. 或者直接执行现有队列(不检查未同步订单)
215
+ * await paymentModule.runPaymentSyncQueue();
216
+ * ```
187
217
  */
188
218
  runPaymentSyncQueue(): Promise<void>;
219
+ /**
220
+ * 重新将订单添加到同步队列
221
+ * 用于处理因网络问题导致任务队列清空但订单未同步的情况
222
+ *
223
+ * @param order 要重新添加的订单
224
+ * @returns Promise<boolean> 是否成功添加到队列
225
+ */
226
+ private reAddOrderToSyncQueue;
189
227
  }