修复完成订单自动回显

This commit is contained in:
yml
2026-06-03 22:12:09 +08:00
parent c80d3f960e
commit 13e3a41d63
3 changed files with 38 additions and 4 deletions
+9 -3
View File
@@ -973,9 +973,7 @@ func (r *Repository) finalizeCheckout(tx *gorm.DB, order *model.RentalOrder, che
order.SettlementStatus = "settled"
order.SettledAt = &now
order.OwnerSettledAt = &now
listing.Status = "published"
listing.InTransaction = false
account.Status = "published"
archiveListingAfterCheckout(&listing, &account)
orderID := order.ID
settlement := buildCheckoutSettlement(*order, checkout)
@@ -1062,6 +1060,14 @@ func (r *Repository) finalizeCheckout(tx *gorm.DB, order *model.RentalOrder, che
return refund, nil
}
// 完成后的账号先下架,避免已完成订单对应的账号重新出现在公开首页。
func archiveListingAfterCheckout(listing *model.RentalListing, account *model.GameAccount) {
listing.Status = "offline"
listing.InTransaction = false
listing.PublishedAt = nil
account.Status = "offline"
}
func (r *Repository) prepareRefund(order *model.RentalOrder, amountCent int64, bizType string, remark string) (*refundAction, error) {
if amountCent <= 0 {
return nil, nil