优化发布群租客清退与历史消息
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user