You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
734 B
41 lines
734 B
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"log"
|
|
"math/rand"
|
|
"message-demo/config"
|
|
"message-demo/global"
|
|
"message-demo/model"
|
|
"message-demo/support"
|
|
)
|
|
|
|
// 部分代码参考: https://github.com/hb0730/auto-sign
|
|
|
|
func init() {
|
|
global.GLO_CONF_CH = make(chan model.Config)
|
|
global.GLO_CONF = config.InitialConfig()
|
|
bytes, _ := json.Marshal(global.GLO_CONF)
|
|
log.Printf(string(bytes))
|
|
}
|
|
|
|
func main() {
|
|
send()
|
|
for {
|
|
select {
|
|
case global.GLO_CONF = <-global.GLO_CONF_CH:
|
|
bytes, _ := json.Marshal(global.GLO_CONF)
|
|
log.Printf(string(bytes))
|
|
send()
|
|
}
|
|
}
|
|
}
|
|
|
|
func send() {
|
|
var s support.Support
|
|
tests := []string{"test1", "test2", "test4", "test5", "test6", "test7"}
|
|
num := rand.Intn(5)
|
|
s.Name = tests[num]
|
|
s.Run()
|
|
}
|