提交2: 发布群核心功能实现
- 实现 EnsureListingConversation: 发布时建发布群,发欢迎语+二维码 - 实现 AddRenterToListingConversation: 付款后拉租客进群 - 实现 RemoveRenterFromListingConversation: 订单终态移出租客 - 实现消息可见性过滤: 租客只能看到 joined_at 之后的消息 - listing 模块注入 ListingChatCreator 接口,发布时建群 - ListingDTO 新增 listing_group_conversation_id 字段 - 付款流程改为拉租客进发布群(替代建订单群) - 订单完成和取消时自动移出租客 - 创建 chat 适配器实现接口解耦 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ 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"
|
||||
|
||||
@@ -38,6 +39,13 @@ func (r *Repository) finalizeCheckout(tx *gorm.DB, order *model.RentalOrder, che
|
||||
if err := saveFinalizedCheckout(tx, order, checkout, listing, account); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 订单完成,移出租客
|
||||
if err := chat.RemoveRenterFromListingConversation(tx, listing.ID, order.RenterID); err != nil {
|
||||
// 移出失败不阻塞订单完成,仅记录日志
|
||||
// TODO: 添加日志
|
||||
}
|
||||
|
||||
return refund, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user