cutego/main.go

47 lines
1.2 KiB
Go
Raw Permalink Normal View History

2022-03-01 13:49:12 +08:00
package main
// init函数执行顺序自上而下, 最后执行main包里面的init函数
import (
"cutego/pkg/config"
_ "cutego/pkg/cronjob"
2023-01-18 17:09:49 +08:00
_ "cutego/pkg/gin"
2023-01-18 17:46:25 +08:00
"cutego/pkg/logging"
"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-02-03 10:27:04 +08:00
starter()
//user := dataobject.SysUser{}
//user.UserId = 1
//user.UserName = "test"
//user.Password = "123456"
//user.LoginDate = time.Now()
//jsonString := util.ToJSONString(user)
//fmt.Println(jsonString)
//fmt.Println(util.FormatDateTime(user.LoginDate))
//fmt.Println(util.FormatDate(user.LoginDate))
//fmt.Println(util.FormatTime(user.LoginDate))
//
//sysUser := dataobject.SysUser{}
//util.ParseJSONStruct(jsonString, &sysUser)
//fmt.Println(sysUser)
2023-02-02 17:59:03 +08:00
}
func starter() {
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 {
2023-01-18 17:46:25 +08:00
logging.FatalfLog("Start server: %+v", err)
2022-03-01 13:49:12 +08:00
}
}
2023-01-18 14:53:01 +08:00
//func testChangeJob() {
// time.Sleep(time.Millisecond * 5000)
// fmt.Println("改变任务调度间隔")
// cronjob.AppendCronFunc("*/5 * * * *", "test1", "1")
//}