优化发布群配置与二维码池界面

This commit is contained in:
yml
2026-06-17 20:59:24 +08:00
parent ac98841992
commit 0a42392d5e
14 changed files with 460 additions and 74 deletions
+24 -3
View File
@@ -5,6 +5,13 @@ import (
"hfb_sys/backend/internal/model"
)
const (
autoWelcomeConfigKey = "chat.auto_welcome_message"
defaultAutoWelcomeMessage = "欢迎加入订单群聊!如有任何问题,请随时沟通。"
listingGroupWelcomeConfigKey = "chat.listing_group_welcome"
defaultListingGroupWelcome = "欢迎加入账号群!请号主扫描下方二维码加入企业微信群,方便客服与您及时联系。"
)
func (r *Repository) UpdateRemark(ctx context.Context, principal Principal, conversationID uint64, remark string) error {
return r.db.WithContext(ctx).Model(&model.ChatParticipant{}).
Where("conversation_id = ? AND participant_type = ? AND participant_id = ?", conversationID, principal.Type, principal.ID).
@@ -77,13 +84,27 @@ func (r *Repository) DeleteQuickReply(ctx context.Context, adminID uint64, reply
}
func (r *Repository) GetAutoWelcomeMessage(ctx context.Context) string {
var cfg model.SystemConfig
if err := r.db.WithContext(ctx).Where("`key` = ?", "chat.auto_welcome_message").First(&cfg).Error; err != nil {
return "欢迎加入订单群聊!如有任何问题,请随时沟通。"
if err := r.db.WithContext(ctx).Where("`key` = ?", autoWelcomeConfigKey).First(&cfg).Error; err != nil {
return defaultAutoWelcomeMessage
}
return cfg.Value
}
func (r *Repository) UpdateAutoWelcomeMessage(ctx context.Context, message string) error {
return r.db.WithContext(ctx).Model(&model.SystemConfig{}).
Where("`key` = ?", "chat.auto_welcome_message").
Where("`key` = ?", autoWelcomeConfigKey).
Update("value", message).Error
}
func (r *Repository) GetListingGroupWelcomeMessage(ctx context.Context) string {
var cfg model.SystemConfig
if err := r.db.WithContext(ctx).Where("`key` = ?", listingGroupWelcomeConfigKey).First(&cfg).Error; err != nil {
return defaultListingGroupWelcome
}
return cfg.Value
}
func (r *Repository) UpdateListingGroupWelcomeMessage(ctx context.Context, message string) error {
return r.db.WithContext(ctx).Model(&model.SystemConfig{}).
Where("`key` = ?", listingGroupWelcomeConfigKey).
Update("value", message).Error
}