mirror of https://github.com/mindoc-org/mindoc.git
添加版本号标识
parent
5f591305d9
commit
9cb4b6aa25
|
@ -52,19 +52,9 @@ func RegisterModel() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//初始化数据
|
||||||
func Initialization() {
|
func Initialization() {
|
||||||
|
|
||||||
//o := orm.NewOrm()
|
|
||||||
//o.Raw("alter table "+models.NewMember().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
|
||||||
//o.Raw("alter table "+models.NewBook().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
|
||||||
//o.Raw("alter table "+models.NewRelationship().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
|
||||||
//o.Raw("alter table "+models.NewComment().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
|
||||||
//o.Raw("alter table " +models.NewOption().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
|
||||||
//o.Raw("alter table "+models.NewDocument().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
|
||||||
//o.Raw("alter table "+models.NewAttachment().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
|
||||||
//o.Raw("alter table "+models.NewLogger().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
|
||||||
//o.Raw("alter table "+models.NewCommentVote().TableNameWithPrefix()+" convert to character set utf8mb4_general_ci;").Exec()
|
|
||||||
|
|
||||||
options := []models.Option {
|
options := []models.Option {
|
||||||
{ OptionName: "ENABLED_CAPTCHA", OptionValue: "false", OptionTitle:"是否启用验证码"},
|
{ OptionName: "ENABLED_CAPTCHA", OptionValue: "false", OptionTitle:"是否启用验证码"},
|
||||||
{ OptionName: "ENABLED_REGISTER",OptionValue:"false",OptionTitle:"是否启用注册"},
|
{ OptionName: "ENABLED_REGISTER",OptionValue:"false",OptionTitle:"是否启用注册"},
|
||||||
|
@ -122,6 +112,8 @@ func RegisterLogger() {
|
||||||
logs.Async()
|
logs.Async()
|
||||||
|
|
||||||
if _,err := os.Stat("logs/log.log"); os.IsNotExist(err) {
|
if _,err := os.Stat("logs/log.log"); os.IsNotExist(err) {
|
||||||
|
os.MkdirAll("./logs",0777)
|
||||||
|
|
||||||
if f,err := os.Create("logs/log.log");err == nil {
|
if f,err := os.Create("logs/log.log");err == nil {
|
||||||
f.Close()
|
f.Close()
|
||||||
beego.SetLogger("file",`{"filename":"logs/log.log"}`)
|
beego.SetLogger("file",`{"filename":"logs/log.log"}`)
|
||||||
|
|
10
main.go
10
main.go
|
@ -13,8 +13,16 @@ import (
|
||||||
"github.com/lifei6671/godoc/controllers"
|
"github.com/lifei6671/godoc/controllers"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
VERSION string
|
||||||
|
BUILD_TIME string
|
||||||
|
GO_VERSION string
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
|
fmt.Printf("MinDoc version%s\n%s\n%s\nstart directory%s\n", VERSION, BUILD_TIME, GO_VERSION,os.Args[0])
|
||||||
|
|
||||||
commands.RegisterDataBase()
|
commands.RegisterDataBase()
|
||||||
commands.RegisterModel()
|
commands.RegisterModel()
|
||||||
commands.RegisterLogger()
|
commands.RegisterLogger()
|
||||||
|
@ -23,7 +31,7 @@ func main() {
|
||||||
|
|
||||||
beego.SetStaticPath("uploads","uploads")
|
beego.SetStaticPath("uploads","uploads")
|
||||||
|
|
||||||
fmt.Println(os.Args[0])
|
|
||||||
|
|
||||||
beego.ErrorController(&controllers.ErrorController{})
|
beego.ErrorController(&controllers.ErrorController{})
|
||||||
beego.Run()
|
beego.Run()
|
||||||
|
|
|
@ -89,6 +89,7 @@ func (m *Book) Insert() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
o.Commit()
|
o.Commit()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
o.Rollback()
|
o.Rollback()
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue