2026-04-03 17:52:09 +08:00
|
|
|
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"), "快手")
|
2026-04-11 18:22:52 +08:00
|
|
|
platformMap = map[Platform]platform{
|
|
|
|
|
gconv.PtrString("xiaohongshu"): PlatformXHS,
|
|
|
|
|
gconv.PtrString("douyin"): PlatformDY,
|
|
|
|
|
gconv.PtrString("kuaishou"): PlatformKS,
|
|
|
|
|
}
|
2026-04-03 17:52:09 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
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}
|
|
|
|
|
}
|
2026-04-11 18:22:52 +08:00
|
|
|
|
|
|
|
|
func GetDescByCode(code Platform) string {
|
|
|
|
|
if p, ok := platformMap[code]; ok {
|
|
|
|
|
return p.Desc()
|
|
|
|
|
}
|
|
|
|
|
return "未知平台"
|
|
|
|
|
}
|