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