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.
58 lines
1.1 KiB
58 lines
1.1 KiB
package main
|
|
|
|
import (
|
|
"GoClouds/core/comm"
|
|
"GoClouds/models"
|
|
"GoClouds/webs/sys/app"
|
|
"GoClouds/webs/sys/controller"
|
|
"github.com/mgr9525/go-cloud"
|
|
"html/template"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
/*ymlpath:=""
|
|
if len(os.Args)>1 {
|
|
ymlpath=os.Args[1]
|
|
}*/
|
|
|
|
gocloud.RunApp("", constomRoute, customFun)
|
|
}
|
|
|
|
func customFun() []template.FuncMap {
|
|
println("constomFun")
|
|
err := comm.InitDb()
|
|
if err != nil {
|
|
println("db err:" + err.Error())
|
|
os.Exit(1)
|
|
}
|
|
err = SyncTable()
|
|
if err != nil {
|
|
println("db Sync2 err:" + err.Error())
|
|
os.Exit(2)
|
|
}
|
|
gocloud.GetCustomConf("", app.Conf)
|
|
return []template.FuncMap{map[string]interface{}{
|
|
"AppName": func() string {
|
|
return "GoCloud"
|
|
},
|
|
"AppVer": func() string {
|
|
return "1.0.0"
|
|
},
|
|
}}
|
|
}
|
|
func constomRoute() {
|
|
gocloud.RegController(new(controller.CommController))
|
|
gocloud.RegController(new(controller.UserController))
|
|
}
|
|
|
|
func SyncTable() error {
|
|
if comm.DbSys == nil {
|
|
return nil
|
|
}
|
|
isext, err := comm.DbSys.IsTableExist(models.SysUser{})
|
|
if err == nil && !isext {
|
|
comm.DbSys.ImportFile("my.sql")
|
|
}
|
|
return nil
|
|
}
|