From 14b902f429f3e3765b2e6f76ba0e2261f1f27cc3 Mon Sep 17 00:00:00 2001 From: "DESKTOP-4RNDQIC\\29019" <290198252@qq.com> Date: Wed, 21 Jul 2021 00:14:05 +0800 Subject: [PATCH] no message --- controller/plan.go | 6 +++--- model/port.go | 3 +-- test/portData_test.go | 18 +++++++++--------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/controller/plan.go b/controller/plan.go index ec5a784..5124391 100644 --- a/controller/plan.go +++ b/controller/plan.go @@ -191,9 +191,9 @@ func (this *PlanController) FinishUndo(c *gin.Context) { id := c.Param("id") log.Print("finish undo id",id) - e := db.GetOrm().Exec(fmt.Sprintf("update background.`undo` set done = 1,finish_time='%s' where id = %d", - time.Now().Format("2006-01-02 15:04:05"),1)).Error - log.Print(fmt.Sprintf("update undo set done = 1,finish_time='%s' where id = %d",time.Now().Format("2006-01-02 15:04:05"),1)) + e := db.GetOrm().Exec(fmt.Sprintf("update background.`undo` set done = 1,finish_time='%s' where id = %s", + time.Now().Format("2006-01-02 15:04:05"),id)).Error + log.Print(fmt.Sprintf("update background.`undo` set done = 1,finish_time='%s' where id = %s",time.Now().Format("2006-01-02 15:04:05"),id)) if nil != e { logs.Error(e.Error()) return diff --git a/model/port.go b/model/port.go index aa98c6f..dca2687 100644 --- a/model/port.go +++ b/model/port.go @@ -98,7 +98,7 @@ func InsertDocToElaticSearch(doc Doc) error { func CreateIndexFromMysqlTable(tblname string) error { columns := []Field{} - e := db.GetMysqlClient().Query2("describe "+tblname, &columns) + e := db.GetMysqlClient().Query2("describe " + tblname, &columns) if nil != e { logger.Debug(e.Error()) return e @@ -163,7 +163,6 @@ func PortDocumentToElasticsearch(tblname string) error { if nil != e { log.Print(e.Error()) } - log.Print("index not existed , create " + tblname) } } else { props := map[string]interface{}{} diff --git a/test/portData_test.go b/test/portData_test.go index 725dc0e..999c609 100644 --- a/test/portData_test.go +++ b/test/portData_test.go @@ -80,15 +80,15 @@ func TestReflect(t *testing.T) { } // 测试新建索引,查看mapping是否生效 -// test create new index,and check the mapping works -func TestCreateIndex(t *testing.T) { - InitConfig() - InitLogs() - InitRedisConfig() - InitMysql() - db.InitELK() - InitElasticSearch() -} +// // test create new index,and check the mapping works +// func TestCreateIndex(t *testing.T) { +// InitConfig() +// InitLogs() +// InitRedisConfig() +// InitMysql() +// db.InitELK() +// InitElasticSearch() +// } // 测试query doc // test doc query works