**客服在线状态:** - 后端:添加 admin_users.support_status 字段(online/offline/busy) - 接口:PUT /admin/me/support-status 更新状态 - 前端:管理员顶部导航显示状态切换器(仅客服权限可见) - 转接对话框显示客服在线状态和智能排序(在线优先) **聊天粘贴图片:** - 用户端、移动端、管理端聊天输入框支持 Ctrl+V/Cmd+V 直接粘贴图片 - 自动调用图片压缩和上传逻辑,与文件选择上传保持一致 - 最多支持粘贴9张图片 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
102 lines
3.2 KiB
Go
102 lines
3.2 KiB
Go
package chat
|
|
|
|
import "time"
|
|
|
|
type Principal struct {
|
|
Type string
|
|
ID uint64
|
|
}
|
|
|
|
type ConversationDTO struct {
|
|
ID uint64 `json:"id"`
|
|
OrderID *uint64 `json:"order_id"`
|
|
Type string `json:"type"`
|
|
Title string `json:"title"`
|
|
Status string `json:"status"`
|
|
Role string `json:"role"`
|
|
Participants []ParticipantDTO `json:"participants,omitempty"`
|
|
LastMessageID *uint64 `json:"last_message_id"`
|
|
LastMessagePreview string `json:"last_message_preview"`
|
|
LastMessageAt *time.Time `json:"last_message_at"`
|
|
UnreadCount int64 `json:"unread_count"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type ParticipantDTO struct {
|
|
ID uint64 `json:"id"`
|
|
ConversationID uint64 `json:"conversation_id"`
|
|
ParticipantType string `json:"participant_type"`
|
|
ParticipantID uint64 `json:"participant_id"`
|
|
Role string `json:"role"`
|
|
Remark string `json:"remark"`
|
|
DisplayName string `json:"display_name"`
|
|
AvatarURL string `json:"avatar_url"`
|
|
LastReadAt *time.Time `json:"last_read_at"`
|
|
JoinedAt time.Time `json:"joined_at"`
|
|
}
|
|
|
|
type MessageDTO struct {
|
|
ID uint64 `json:"id"`
|
|
ConversationID uint64 `json:"conversation_id"`
|
|
SenderType string `json:"sender_type"`
|
|
SenderID uint64 `json:"sender_id"`
|
|
SenderRole string `json:"sender_role"`
|
|
SenderName string `json:"sender_name"`
|
|
SenderAvatar string `json:"sender_avatar"`
|
|
IsSelf bool `json:"is_self"`
|
|
ContentType string `json:"content_type"`
|
|
Content string `json:"content"`
|
|
AttachmentURLS []string `json:"attachment_urls"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type SendMessageRequest struct {
|
|
Content string `json:"content"`
|
|
AttachmentURLS []string `json:"attachment_urls"`
|
|
}
|
|
|
|
type TransferRequest struct {
|
|
ToAdminID uint64 `json:"to_admin_id" binding:"required"`
|
|
}
|
|
|
|
type UpdateRemarkRequest struct {
|
|
Remark string `json:"remark"`
|
|
}
|
|
|
|
type SupportAdminDTO struct {
|
|
ID uint64 `json:"id"`
|
|
Nickname string `json:"nickname"`
|
|
SupportStatus string `json:"support_status"`
|
|
ChatCount int64 `json:"chat_count"`
|
|
}
|
|
|
|
type QuickReplyDTO struct {
|
|
ID uint64 `json:"id"`
|
|
AdminUserID uint64 `json:"admin_user_id"`
|
|
Title string `json:"title"`
|
|
Content string `json:"content"`
|
|
SortOrder int `json:"sort_order"`
|
|
IsGlobal bool `json:"is_global"`
|
|
}
|
|
|
|
type CreateQuickReplyRequest struct {
|
|
Title string `json:"title" binding:"required"`
|
|
Content string `json:"content" binding:"required"`
|
|
SortOrder int `json:"sort_order"`
|
|
IsGlobal bool `json:"is_global"`
|
|
}
|
|
|
|
type UpdateQuickReplyRequest struct {
|
|
Title string `json:"title"`
|
|
Content string `json:"content"`
|
|
SortOrder *int `json:"sort_order"`
|
|
}
|
|
|
|
type PaginatedResult struct {
|
|
Items interface{} `json:"items"`
|
|
Total int64 `json:"total"`
|
|
Page int `json:"page"`
|
|
PageSize int `json:"page_size"`
|
|
}
|