Files
huangguo_server/skd/service/versionser.go
T
rootandClaude Opus 5 8679200f41 Initial commit
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 13:57:10 +08:00

34 lines
606 B
Go

package service
import (
"91porn-server/common"
"91porn-server/common/crypt"
)
func GetTFUrl(tf string) string {
if tf != "" {
type tfStc struct {
Url string `json:"url"`
Name string `json:"name"`
}
var tfArr []tfStc
_ = crypt.JSON2Struct(tf, &tfArr)
if len(tfArr) == 0 {
return tf
}
weight := 100 / len(tfArr)
chioce := make([]common.Choice, len(tfArr))
for i := range tfArr {
chioce[i] = common.Choice{
Weight: weight,
Item: tfArr[i].Url,
}
}
ch, _ := common.WeightedChoice(chioce)
if v, ok := ch.Item.(string); ok {
return v
}
}
return tf
}