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.

44 lines
725 B

2 years ago
package main
import (
"log"
"sendmsg/config"
"sendmsg/global"
"sendmsg/message"
"sendmsg/model"
"sendmsg/service"
"time"
)
func init() {
global.GLO_CONF_CH = make(chan model.Config)
_conf, err := config.InitConfig()
if err != nil {
log.Fatalf("[init] Failed to initialize config: %v", err)
}
global.GLO_CONF = _conf
}
2 years ago
func main() {
//test
go func() {
var count int
for {
if count > 5 {
return
}
count++
var s = service.Service{Body: message.Body{
Title: "test title",
Content: "this is content, time is " + time.Now().Format("2006-01-02 15:04:05"),
}}
s.Run()
time.Sleep(time.Second * 2)
}
}()
2 years ago
for {
_conf := <-global.GLO_CONF_CH
global.GLO_CONF = _conf
}
2 years ago
}