package main import ( _ "Cold_Monitor/Nats" "Cold_Monitor/conf" _ "Cold_Monitor/routers" "github.com/beego/beego/v2/adapter/orm" beego "github.com/beego/beego/v2/server/web" _ "github.com/go-sql-driver/mysql" "strconv" ) func init() { orm.RegisterDriver("mysql", orm.DRMySQL) orm.RegisterDataBase("default", "mysql", conf.MysqlServer_Username+":"+conf.MysqlServer_Password+"@tcp("+conf.MysqlServer_UrlPort+")/"+conf.MysqlServer_Database+"?charset=utf8mb4&loc=Local&parseTime=True", conf.MysqlServer_MaxIdleConnections, conf.MysqlServer_MaxOpenConnections) orm.RunSyncdb("default", false, true) // 创建数据库 //logs.Println("MysqlServer:" + conf.MysqlServer_Username + ":" + conf.MysqlServer_Password + "@tcp(" + conf.MysqlServer_UrlPort + ")/" + conf.MysqlServer_Database + "?charset=utf8mb4&loc=Local&parseTime=True") } func main() { beego.BConfig.AppName = conf.AppName + "_" + strconv.Itoa(conf.HTTPPort) // 项目名 beego.BConfig.ServerName = conf.AppName + "_" + strconv.Itoa(conf.HTTPPort) //server 名称 beego.BConfig.RunMode = "dev" // 应用的运行模式 beego.BConfig.Listen.HTTPPort = conf.HTTPPort //监听端口 本地:8518 线上:8528 println(conf.HTTPPort) //go TimeTask.Init() // 时间任务 beego.Run() } /* 冷链 动环监控 https://gogs.baozhida.cn/bzdadmin/Cold_Monitor.git */