2022-03-01 13:49:12 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
// init函数执行顺序自上而下, 最后执行main包里面的init函数
|
|
|
|
import (
|
|
|
|
"cutego/pkg/common"
|
|
|
|
"cutego/pkg/config"
|
|
|
|
_ "cutego/pkg/cronjob"
|
2023-01-18 17:09:49 +08:00
|
|
|
_ "cutego/pkg/gin"
|
2023-01-17 17:00:34 +08:00
|
|
|
"cutego/pkg/util"
|
2023-01-18 17:09:49 +08:00
|
|
|
"cutego/refs"
|
2022-03-01 13:49:12 +08:00
|
|
|
"fmt"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2023-01-18 14:53:01 +08:00
|
|
|
//go testChangeJob()
|
2023-01-17 17:00:34 +08:00
|
|
|
gin.SetMode(util.IF(config.AppEnvConfig.Server.RunMode == "", "debug", config.AppEnvConfig.Server.RunMode).(string))
|
2023-01-18 17:09:49 +08:00
|
|
|
err := refs.CoolGin.Run(fmt.Sprintf(":%d", config.AppEnvConfig.Server.Port))
|
2022-03-01 13:49:12 +08:00
|
|
|
if err != nil {
|
|
|
|
common.FatalfLog("Start server: %+v", err)
|
|
|
|
}
|
|
|
|
}
|
2023-01-18 14:53:01 +08:00
|
|
|
|
|
|
|
//func testChangeJob() {
|
|
|
|
// time.Sleep(time.Millisecond * 5000)
|
|
|
|
// fmt.Println("改变任务调度间隔")
|
|
|
|
// cronjob.AppendCronFunc("*/5 * * * *", "test1", "1")
|
|
|
|
//}
|