初始化项目

This commit is contained in:
2026-04-27 10:54:32 +08:00
parent 28976d3e7d
commit ba360bc89b
20 changed files with 589 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
package account
import "github.com/gogf/gf/v2/util/gconv"
var (
PlatformXHS = newPlatform(gconv.PtrString("xiaohongshu"), "小红书")
PlatformDY = newPlatform(gconv.PtrString("douyin"), "抖音")
PlatformKS = newPlatform(gconv.PtrString("kuaishou"), "快手")
)
type Platform *string
type platform struct {
code Platform
desc string
}
func (s platform) Code() Platform {
return s.code
}
func (s platform) Desc() string {
return s.desc
}
func newPlatform(code Platform, desc string) platform {
return platform{code: code, desc: desc}
}
func GetDescByCode(code Platform) string {
switch *code {
case *PlatformXHS.Code():
return PlatformXHS.Desc()
case *PlatformDY.Code():
return PlatformDY.Desc()
case *PlatformKS.Code():
return PlatformKS.Desc()
}
return "未知平台"
}

View File

@@ -0,0 +1,26 @@
package account
import "github.com/gogf/gf/v2/util/gconv"
var (
StatusDisable = newStatus(gconv.PtrInt8(0), "disable")
StatusEnable = newStatus(gconv.PtrInt8(1), "enable")
)
type Status *int8
type status struct {
code Status
desc string
}
func (s status) Code() Status {
return s.code
}
func (s status) Desc() string {
return s.desc
}
func newStatus(code Status, desc string) status {
return status{code: code, desc: desc}
}

View File

@@ -0,0 +1,5 @@
package consts
const ReClick = "操作过于频繁,请稍后再试。"
const NoRow = "未找到可用数据。"
const GenerateQrCodeFail = "生成二维码失败。"

View File

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

View File

@@ -0,0 +1,18 @@
package public
// 欢迎语
const (
GreetingBegin = "您好,很高兴为您服务!请问有什么可以帮您?"
GreetingBetween = "💗回复数字就好~"
GreetingEnd = "🌟也可直接点击下方咨询专业老师~"
)
// 追问
const (
SceneOpeningRemark = "宝子,刚才给您发的信息您有看到吗?有任何问题都能直接问我,加微信也能更方便沟通~"
SceneDialog = "看您暂时没回复,是不是还有什么疑问?加微信我详细给您说明~"
SceneCardSend = "宝子,加上没~要及时加哦,不然卡片容易失效哒✨"
)
// 对话超时时间
const DialogTimeout = 10

View File

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

View File

@@ -0,0 +1,4 @@
package consts
const QrCodeCount = "qrCodeCount:order:%s"
const QrCode = "qrCode:order:%s"

View File

@@ -0,0 +1,39 @@
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), "卡片发送后无回应")
)
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 {
switch *code {
case *SceneTypeOpeningRemark.Code():
return SceneTypeOpeningRemark.Desc()
case *SceneTypeDialog.Code():
return SceneTypeDialog.Desc()
case *SceneTypeCardSend.Code():
return SceneTypeCardSend.Desc()
}
return "未知场景类型"
}