Files
hfb_sys/backend/internal/modules/chat/export.go
T
yml2213 6d61027318 新增摸大红业务并修复后台链接按钮白字
支持分类筛选、搜索、下单支付建群与固定二维码;合并迁移种子数据;后台表格编辑/详情链接恢复主题色可见。
2026-07-16 18:08:18 +08:00

37 lines
1.0 KiB
Go

package chat
import (
"hfb_sys/backend/internal/model"
"gorm.io/gorm"
)
// DefaultSupportAdminID 导出默认客服选择逻辑,供其他业务模块建群时复用。
func DefaultSupportAdminID(tx *gorm.DB) uint64 {
return defaultSupportAdminID(tx)
}
// SendSystemMessageForTx 在事务内发送系统文本消息。
func SendSystemMessageForTx(tx *gorm.DB, conversationID uint64, content string) error {
return sendSystemMessage(tx, conversationID, content)
}
// SendImageMessageForTx 在事务内发送系统图片消息。
func SendImageMessageForTx(tx *gorm.DB, conversationID uint64, content, imageURL string) error {
if content == "" {
content = "👇 请扫码联系客服"
}
message := model.ChatMessage{
ConversationID: conversationID,
SenderType: "system",
SenderRole: "system",
ContentType: "image",
Content: content,
AttachmentURLS: encodeStringList([]string{imageURL}),
}
if err := tx.Create(&message).Error; err != nil {
return err
}
return updateConversationLastMessage(tx, conversationID, &message)
}