feat: 新增账号编码和HTTP连接功能

This commit is contained in:
2026-04-11 18:22:52 +08:00
parent 2f5c4f7e54
commit f8927afa9c
94 changed files with 1213 additions and 10230 deletions

View File

@@ -6,6 +6,11 @@ var (
PlatformXHS = newPlatform(gconv.PtrString("xiaohongshu"), "小红书")
PlatformDY = newPlatform(gconv.PtrString("douyin"), "抖音")
PlatformKS = newPlatform(gconv.PtrString("kuaishou"), "快手")
platformMap = map[Platform]platform{
gconv.PtrString("xiaohongshu"): PlatformXHS,
gconv.PtrString("douyin"): PlatformDY,
gconv.PtrString("kuaishou"): PlatformKS,
}
)
type Platform *string
@@ -25,3 +30,10 @@ func (s platform) Desc() string {
func newPlatform(code Platform, desc string) platform {
return platform{code: code, desc: desc}
}
func GetDescByCode(code Platform) string {
if p, ok := platformMap[code]; ok {
return p.Desc()
}
return "未知平台"
}

12
consts/public/msg_key.go Normal file
View File

@@ -0,0 +1,12 @@
package public
const GmqMsgPluginsName = "gmq_msg"
const AccountDialogKeyUserId = "account:dialog:%s"
const (
AccountFollowupTopic = "account:followup:stream" // 请求 Stream 键名与发消息的key一致
AccountFollowupConsumer = "account-followup-consumer" // 消费者名称(唯一标识)
AccountFollowupCount = 1 // 批处理大小每次读取1条
AccountFollowupAck = false // ACK是否自动确认true自动确认false不确认
)

View File

@@ -2,6 +2,7 @@ package public
// sql 数据库表名
const (
TableNameAccount = "account"
TableNameScriptedSpeech = "scripted_speech"
TableNameAccount = "account"
TableNameAccountUserDialog = "account_user_dialog"
TableNameScriptedSpeech = "scripted_speech"
)

View File

@@ -0,0 +1,40 @@
package scriptedSpeech
import "github.com/gogf/gf/v2/util/gconv"
var (
SceneTypeOpeningRemark = newSceneType(gconv.PtrInt8(1), "开场白无回应")
SceneTypeDialog = newSceneType(gconv.PtrInt8(2), "对话中途无回应")
SceneTypeCardSend = newSceneType(gconv.PtrInt8(3), "卡片发送后无回应")
sceneTypeMap = map[SceneType]sceneType{
gconv.PtrInt8(1): SceneTypeOpeningRemark,
gconv.PtrInt8(2): SceneTypeDialog,
gconv.PtrInt8(3): SceneTypeCardSend,
}
)
type SceneType *int8
type sceneType struct {
code SceneType
desc string
}
func (s sceneType) Code() SceneType {
return s.code
}
func (s sceneType) Desc() string {
return s.desc
}
func newSceneType(code SceneType, desc string) sceneType {
return sceneType{code: code, desc: desc}
}
func GetDescByCode(code SceneType) string {
if p, ok := sceneTypeMap[code]; ok {
return p.Desc()
}
return "未知场景类型"
}