refactor: remove ExternalSource and ExternalID from Conversation model and related services, update references to use ChannelID instead

This commit is contained in:
mlogclub
2026-04-27 19:04:10 +08:00
parent 24105781d9
commit b3ef55b04e
21 changed files with 183 additions and 136 deletions
@@ -56,7 +56,7 @@ func buildConversationAssignedNotifyBody(conversation *models.Conversation, assi
lines := []string{
fmt.Sprintf("会话ID: #%d", conversation.ID),
fmt.Sprintf("会话主题: %s", strs.DefaultIfBlank(conversation.Subject, "-")),
fmt.Sprintf("接入渠道: %s", enums.GetExternalSourceLabel(conversation.ExternalSource)),
fmt.Sprintf("接入渠道: %s", resolveConversationChannelLabel(conversation)),
fmt.Sprintf("当前状态: %s", enums.GetIMConversationStatusLabel(conversation.Status)),
fmt.Sprintf("处理人: %s", resolveNotifyUserLabel(assigneeID)),
}
@@ -67,6 +67,16 @@ func buildConversationAssignedNotifyBody(conversation *models.Conversation, assi
return strings.Join(lines, "\n")
}
func resolveConversationChannelLabel(conversation *models.Conversation) string {
if conversation == nil || conversation.ChannelID <= 0 {
return "-"
}
if channel := services.ChannelService.Get(conversation.ChannelID); channel != nil {
return strs.DefaultIfBlank(channel.Name, channel.ChannelType)
}
return "-"
}
func resolveNotifyUserLabel(userID int64) string {
if userID <= 0 {
return "-"