业务更名为撞车并切换crash路由
用户可见文案与页面/API路径改为撞车与crash,保留mohong表与权限码兼容;移动端入口去掉租/撞图标。
This commit is contained in:
@@ -169,6 +169,22 @@ func (r *Repository) EnsureSupportConversation(ctx context.Context, userID uint6
|
||||
_ = tx.Model(&existing).Update("support_scene", SupportSceneGeneral).Error
|
||||
}
|
||||
}
|
||||
// 兼容旧摸大红场景码 mohong → crash
|
||||
if existing.ID == 0 && scene == SupportSceneCrash {
|
||||
err = tx.Table("chat_conversations AS c").
|
||||
Select("c.*").
|
||||
Joins("JOIN chat_participants AS cp ON cp.conversation_id = c.id").
|
||||
Where(
|
||||
"c.type = ? AND c.support_scene = ? AND cp.participant_type = ? AND cp.participant_id = ?",
|
||||
ConversationTypeGeneralSupport, SupportSceneMohong, "user", userID,
|
||||
).
|
||||
Order("c.id ASC").
|
||||
Limit(1).
|
||||
Find(&existing).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if existing.ID > 0 {
|
||||
conversationID = existing.ID
|
||||
return nil
|
||||
|
||||
@@ -35,7 +35,7 @@ type ConversationDTO struct {
|
||||
|
||||
// EnsureSupportRequest 创建/复用客服会话。
|
||||
type EnsureSupportRequest struct {
|
||||
// Scene 业务场景:general(默认)/ mohong(摸大红)
|
||||
// Scene 业务场景:general(默认)/ crash(撞车,兼容旧值 mohong)
|
||||
Scene string `json:"scene"`
|
||||
}
|
||||
|
||||
|
||||
@@ -11,18 +11,20 @@ import (
|
||||
// 客服入口业务场景(与前端 POST /chats/support 的 scene 对齐)。
|
||||
const (
|
||||
SupportSceneGeneral = "general"
|
||||
SupportSceneMohong = "mohong"
|
||||
SupportSceneCrash = "crash"
|
||||
// SupportSceneMohong 兼容旧 scene 值,与 crash 同一客服分组。
|
||||
SupportSceneMohong = "mohong"
|
||||
)
|
||||
|
||||
// resolveSupportScene 规范化场景并返回标题、客服分组 code、欢迎语。
|
||||
// groupCode 为空时表示不走分组,使用默认客服选取逻辑。
|
||||
func resolveSupportScene(raw string) (scene, title, groupCode, welcome string) {
|
||||
switch strings.ToLower(strings.TrimSpace(raw)) {
|
||||
case SupportSceneMohong:
|
||||
return SupportSceneMohong,
|
||||
"摸大红客服",
|
||||
supportgroup.GroupCodeMohong,
|
||||
"您好,这里是摸大红客服。请直接描述问题,可将订单信息复制后发送。"
|
||||
case SupportSceneCrash, SupportSceneMohong:
|
||||
return SupportSceneCrash,
|
||||
"撞车客服",
|
||||
supportgroup.GroupCodeMohong, // 分组 code 仍为 mohong,后台可改显示名
|
||||
"您好,这里是撞车客服。请直接描述问题,可将订单信息复制后发送。"
|
||||
default:
|
||||
// 未知场景回落平台客服,避免随意 scene 绕开分配策略
|
||||
return SupportSceneGeneral,
|
||||
|
||||
Reference in New Issue
Block a user