优化号主交接超时卡死问题
- 号主交接超时(owner_timeout)后允许补提交交接说明,避免临时延误导致订单卡死 - 后台新增"重置交接"动作,可将超时订单恢复为待号主交接并刷新计时 - 交接超时改以进入待交接时刻为基准计算,新增 handoff_started_at 字段 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
ae11dd7b8d
commit
8192344027
@@ -20,9 +20,12 @@ func (r *Repository) SubmitHandoff(ctx context.Context, userID uint64, orderID u
|
||||
if order.OwnerID != userID {
|
||||
return ErrPermissionDenied
|
||||
}
|
||||
if order.Status != orderStatusPendingHandoff || order.HandoffStatus != handoffStatusPendingOwner {
|
||||
// 号主交接超时(owner_timeout)后仍允许补提交,避免临时延误导致订单卡死。
|
||||
if order.Status != orderStatusPendingHandoff ||
|
||||
(order.HandoffStatus != handoffStatusPendingOwner && order.HandoffStatus != handoffStatusOwnerTimeout) {
|
||||
return ErrOrderCannotHandoff
|
||||
}
|
||||
lateSubmit := order.HandoffStatus == handoffStatusOwnerTimeout
|
||||
record := model.HandoffRecord{
|
||||
OrderID: order.ID,
|
||||
FromUserID: order.OwnerID,
|
||||
@@ -35,11 +38,15 @@ func (r *Repository) SubmitHandoff(ctx context.Context, userID uint64, orderID u
|
||||
}
|
||||
order.HandoffStatus = handoffStatusPendingRenterConfirm
|
||||
orderID := order.ID
|
||||
renterContent := "请查看交接记录,确认账号可正常登录后点击确认收号。"
|
||||
if lateSubmit {
|
||||
renterContent = "号主已补交交接说明,请查看交接记录,确认账号可正常登录后点击确认收号。"
|
||||
}
|
||||
if err := notification.Append(tx, notification.Entry{
|
||||
UserID: order.RenterID,
|
||||
Type: "handoff",
|
||||
Title: "号主已提交交接说明",
|
||||
Content: "请查看交接记录,确认账号可正常登录后点击确认收号。",
|
||||
Content: renterContent,
|
||||
BizType: "order",
|
||||
BizID: &orderID,
|
||||
}); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user