fix(order): 修复超时与异常过渡态下的状态机流转及权限断层

This commit is contained in:
yml2213
2026-09-09 16:15:21 +08:00
parent 17d4f7be9e
commit 8b7a0c8059
9 changed files with 267 additions and 43 deletions
+2 -1
View File
@@ -32,7 +32,8 @@ func (r *Repository) Create(ctx context.Context, userID uint64, orderID uint64,
if order.Status == "completed" || order.Status == "cancelled" || order.Status == "closed" {
return ErrInvalidDispute
}
isCheckoutDispute := order.Status == "pending_checkout_confirm" || order.Status == "pending_checkout_accept"
isCheckoutDispute := order.Status == "pending_checkout_confirm" || order.Status == "pending_checkout_accept" ||
(order.Status == "abnormal" && (order.HandoffStatus == "owner_checkout_confirm_timeout" || order.HandoffStatus == "owner_return_confirm_timeout" || order.HandoffStatus == "pending_owner_checkout"))
var count int64
if err := tx.Model(&model.Dispute{}).
Where("order_id = ? AND status IN ?", order.ID, []string{"open", "processing"}).