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