优化发布群租客清退与历史消息

This commit is contained in:
yml
2026-06-18 09:39:23 +08:00
parent 233920025e
commit f4361c9804
10 changed files with 325 additions and 33 deletions
@@ -4,7 +4,6 @@ import (
"time"
"hfb_sys/backend/internal/model"
"hfb_sys/backend/internal/modules/chat"
"hfb_sys/backend/internal/modules/notification"
"hfb_sys/backend/internal/modules/wallet"
@@ -40,12 +39,6 @@ func (r *Repository) finalizeCheckout(tx *gorm.DB, order *model.RentalOrder, che
return nil, err
}
// 订单完成,移出租客
if err := chat.RemoveRenterFromListingConversation(tx, listing.ID, order.RenterID); err != nil {
// 移出失败不阻塞订单完成,仅记录日志
// TODO: 添加日志
}
return refund, nil
}
+2 -7
View File
@@ -244,8 +244,10 @@ func (r *Repository) Cancel(ctx context.Context, userID uint64, orderID uint64)
}
beforeStatus := order.Status
now := time.Now()
order.Status = orderStatusCancelled
order.HandoffStatus = handoffStatusCancelled
order.SettledAt = &now
orderID := order.ID
if beforeStatus == orderStatusPendingHandoff {
totalCent := order.RentAmountCent + order.DepositAmountCent
@@ -280,13 +282,6 @@ func (r *Repository) Cancel(ctx context.Context, userID uint64, orderID uint64)
return err
}
// 订单取消,移出租客(仅付款后取消需要移出)
if beforeStatus == orderStatusPendingHandoff {
if err := chat.RemoveRenterFromListingConversation(tx, listing.ID, order.RenterID); err != nil {
// 移出失败不阻塞订单取消
}
}
if err := tx.Save(&order).Error; err != nil {
return err
}