-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
37 lines (31 loc) · 863 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"enian_blog/lib/cmn"
"enian_blog/lib/initialize"
"enian_blog/models"
_ "enian_blog/routers"
"github.com/beego/beego/v2/server/web"
)
func init() {
// beego.BConfig.WebConfig.Session.SessionOn = true
// beego.BConfig.WebConfig.Session.SessionProvider = "file"
// beego.BConfig.WebConfig.Session.SessionProviderConfig = "./tmp"
}
func main() {
initialize.ConfigCreate()
initialize.PrintlnLogoAndVersion()
// 创建表
db, dbErr := models.GetDb()
if dbErr != nil {
cmn.FatalError("数据库错误," + dbErr.Error())
}
mUser := models.User{}
err := db.First(&mUser).Error
if err != nil {
initialize.CreateData()
}
web.AddFuncMap("TimeToRelativeTime", cmn.TimeToRelativeTime)
web.AddFuncMap("TimeStrToRelativeTime", cmn.TimeStrToRelativeTime)
web.AddFuncMap("GetUrlEditArticle", cmn.GetUrlEditArticle)
web.Run()
}