优化客服会话筛选

This commit is contained in:
yml
2026-06-18 01:08:54 +08:00
parent 272b2cb71e
commit 7dc7368367
8 changed files with 567 additions and 98 deletions
+43 -27
View File
@@ -12,19 +12,27 @@ import (
)
type conversationRow struct {
ID uint64
OrderID *uint64
ListingID *uint64
Type string
Title string
Status string
Role string
LastMessageID *uint64
LastMessagePreview string
LastMessageAt *time.Time
UnreadCount int64
CreatedAt time.Time
UpdatedAt time.Time
ID uint64
OrderID *uint64
ListingID *uint64
LatestOrderID *uint64
LatestOrderNo string
LatestOrderStatus string
LatestHandoffStatus string
LatestRefundStatus string
Type string
Title string
Status string
Role string
LastMessageID *uint64
LastMessagePreview string
LastMessageAt *time.Time
LastSenderType string
LastSenderID uint64
LastSenderRole string
UnreadCount int64
CreatedAt time.Time
UpdatedAt time.Time
}
func (r *Repository) conversationQuery(ctx context.Context, principal Principal) *gorm.DB {
@@ -281,20 +289,28 @@ func (r *Repository) adminNames(ctx context.Context, ids []uint64) (map[uint64]s
}
func (row conversationRow) toDTO(participants []ParticipantDTO) ConversationDTO {
return ConversationDTO{
ID: row.ID,
OrderID: row.OrderID,
ListingID: row.ListingID,
Type: row.Type,
Title: row.Title,
Status: row.Status,
Role: row.Role,
Participants: participants,
LastMessageID: row.LastMessageID,
LastMessagePreview: row.LastMessagePreview,
LastMessageAt: row.LastMessageAt,
UnreadCount: row.UnreadCount,
CreatedAt: row.CreatedAt,
UpdatedAt: row.UpdatedAt,
ID: row.ID,
OrderID: row.OrderID,
ListingID: row.ListingID,
LatestOrderID: row.LatestOrderID,
LatestOrderNo: row.LatestOrderNo,
LatestOrderStatus: row.LatestOrderStatus,
LatestHandoffStatus: row.LatestHandoffStatus,
LatestRefundStatus: row.LatestRefundStatus,
Type: row.Type,
Title: row.Title,
Status: row.Status,
Role: row.Role,
Participants: participants,
LastMessageID: row.LastMessageID,
LastMessagePreview: row.LastMessagePreview,
LastMessageAt: row.LastMessageAt,
LastSenderType: row.LastSenderType,
LastSenderID: row.LastSenderID,
LastSenderRole: row.LastSenderRole,
UnreadCount: row.UnreadCount,
CreatedAt: row.CreatedAt,
UpdatedAt: row.UpdatedAt,
}
}
func defaultSupportAdminID(tx *gorm.DB) uint64 {