Compare commits
No commits in common. "b57221598d877d417fdcdeebe16b0060a16fb25e" and "9212efc176fb1fd015543366646de85f880b7468" have entirely different histories.
b57221598d
...
9212efc176
@ -81,10 +81,7 @@ func (l *ActivateOrderLogic) ProcessTask(ctx context.Context, task *asynq.Task)
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := l.finalizeCouponAndOrder(ctx, orderInfo); err != nil {
|
||||
logger.WithContext(ctx).Error("[ActivateOrderLogic] Finalize order failed", logger.Field("error", err.Error()))
|
||||
return err
|
||||
}
|
||||
l.finalizeCouponAndOrder(ctx, orderInfo)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -143,7 +140,7 @@ func (l *ActivateOrderLogic) processOrderByType(ctx context.Context, orderInfo *
|
||||
|
||||
// finalizeCouponAndOrder handles post-processing tasks including coupon updates
|
||||
// and order status finalization
|
||||
func (l *ActivateOrderLogic) finalizeCouponAndOrder(ctx context.Context, orderInfo *order.Order) error {
|
||||
func (l *ActivateOrderLogic) finalizeCouponAndOrder(ctx context.Context, orderInfo *order.Order) {
|
||||
// Update coupon if exists
|
||||
if orderInfo.Coupon != "" {
|
||||
if err := l.svc.CouponModel.UpdateCount(ctx, orderInfo.Coupon); err != nil {
|
||||
@ -161,9 +158,7 @@ func (l *ActivateOrderLogic) finalizeCouponAndOrder(ctx context.Context, orderIn
|
||||
logger.Field("error", err.Error()),
|
||||
logger.Field("order_no", orderInfo.OrderNo),
|
||||
)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewPurchase handles new subscription purchase including user creation,
|
||||
|
||||
14
说明文档.md
14
说明文档.md
@ -1,14 +0,0 @@
|
||||
# 项目说明文档
|
||||
|
||||
## 1. 项目规划
|
||||
- [ ] 核心业务逻辑维护与Bug修复
|
||||
- [ ] 确保支付与订单流程闭环
|
||||
|
||||
## 2. 实施方案
|
||||
- **订单状态修复**:针对支付后订单状态未更新问题,完善异步任务的错误处理机制。
|
||||
|
||||
## 3. 进度记录
|
||||
- **2026-01-15 [已完成] 修复订单状态更新 Bug**
|
||||
- **问题描述**:用户支付成功后,订单状态停留在“已支付”,未流转到“已完成”,导致订阅未下发。
|
||||
- **原因分析**:`finalizeCouponAndOrder` 函数在更新数据库失败时仅打印日志未返回错误,导致 Asynq 消息队列误判任务成功,未触发重试机制。
|
||||
- **解决方案**:重构该函数及其调用方 `ProcessTask`,确保数据库更新错误能向上抛出,触发 Asynq 的自动重试策略。
|
||||
Loading…
x
Reference in New Issue
Block a user