添加版本号标识

pull/25/merge
Minho 2017-05-04 10:35:56 +08:00
parent 5f591305d9
commit 9cb4b6aa25
3 changed files with 13 additions and 12 deletions

View File

@ -52,19 +52,9 @@ func RegisterModel() {
}
//初始化数据
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 {
{ OptionName: "ENABLED_CAPTCHA", OptionValue: "false", OptionTitle:"是否启用验证码"},
{ OptionName: "ENABLED_REGISTER",OptionValue:"false",OptionTitle:"是否启用注册"},
@ -122,6 +112,8 @@ func RegisterLogger() {
logs.Async()
if _,err := os.Stat("logs/log.log"); os.IsNotExist(err) {
os.MkdirAll("./logs",0777)
if f,err := os.Create("logs/log.log");err == nil {
f.Close()
beego.SetLogger("file",`{"filename":"logs/log.log"}`)

10
main.go
View File

@ -13,8 +13,16 @@ import (
"github.com/lifei6671/godoc/controllers"
)
var (
VERSION string
BUILD_TIME string
GO_VERSION string
)
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.RegisterModel()
commands.RegisterLogger()
@ -23,7 +31,7 @@ func main() {
beego.SetStaticPath("uploads","uploads")
fmt.Println(os.Args[0])
beego.ErrorController(&controllers.ErrorController{})
beego.Run()

View File

@ -89,6 +89,7 @@ func (m *Book) Insert() error {
return err
}
o.Commit()
return nil
}
o.Rollback()
return err