feat: 新增账号编码和HTTP连接功能
This commit is contained in:
40
consts/scriptedSpeech/scene_type.go
Normal file
40
consts/scriptedSpeech/scene_type.go
Normal 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 "未知场景类型"
|
||||
}
|
||||
Reference in New Issue
Block a user