From d02aad28b9761b7904943af021377dcf259e2505 Mon Sep 17 00:00:00 2001 From: Minho Date: Wed, 3 May 2017 16:03:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/command.go | 12 ++++++------ controllers/search.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/commands/command.go b/commands/command.go index 54112361..2ef7b8b4 100644 --- a/commands/command.go +++ b/commands/command.go @@ -86,8 +86,8 @@ func Initialization() { member.Email = "admin@iminho.me" if err := member.Add();err != nil { - fmt.Println(err) - os.Exit(1) + panic(err) + os.Exit(0) } book := models.NewBook() @@ -108,8 +108,8 @@ func Initialization() { book.Theme = "default" if err := book.Insert(); err != nil { - beego.Error(err) - os.Exit(1) + panic(err) + os.Exit(0) } } @@ -142,8 +142,8 @@ func RegisterCommand() { f, _ := os.Create("install.lock") defer f.Close() }else{ - logs.Info("初始化数据库失败 =>",err) - os.Exit(2) + panic(err.Error()) + os.Exit(0) } } diff --git a/controllers/search.go b/controllers/search.go index 97f72f3e..5b5ac7e8 100644 --- a/controllers/search.go +++ b/controllers/search.go @@ -70,7 +70,7 @@ func (c *SearchController) Index() { src = re.ReplaceAllString(src, "\n") r := []rune(src) - beego.Info(r) + if len(r) > 100 { src = string(r[:100]) }else{