diff --git a/controller/blog.go b/controller/blog.go index 78aa762..acc1f7e 100644 --- a/controller/blog.go +++ b/controller/blog.go @@ -245,7 +245,6 @@ func SearchArticleESHightLight(c *gin.Context) { x := []RetHighlight{} _, e = db.GetElastic(). QueryHighlight("doc", query, &x,highlight, 10, 0) - log.Print(x) if nil != e { log.Print(e.Error()) return diff --git a/db/elasticEngine.go b/db/elasticEngine.go index bf0f402..f6be2ac 100644 --- a/db/elasticEngine.go +++ b/db/elasticEngine.go @@ -86,7 +86,6 @@ func (p *ElkEngine) QueryHighlight(index string, query elastic.Query, v interfac } id := []string{} for _, vs := range res.Hits.Hits { - log.Print(vs.Highlight) id = append(id, vs.Id) data, e := vs.Source.MarshalJSON() if nil != e { @@ -113,7 +112,6 @@ func (p *ElkEngine) QueryHighlight(index string, query elastic.Query, v interfac } id := []string{} for _, vs := range res.Hits.Hits { - log.Print(vs.Highlight) id = append(id, vs.Id) data, e := vs.Source.MarshalJSON() // log.Print(string(data)) diff --git a/main.go b/main.go index d0f1b3d..47b921b 100644 --- a/main.go +++ b/main.go @@ -38,7 +38,7 @@ func CORSMiddleware(c *gin.Context) { if config.ApiConfig().RunMode == "release" { c.Writer.Header().Set("Access-Control-Allow-Origin", "https://testingcloud.club") } else { - c.Writer.Header().Set("Access-Control-Allow-Origin", "http://127.0.0.1") + c.Writer.Header().Set("Access-Control-Allow-Origin", "http://127.0.0.1:8080") } c.Writer.Header().Set("Access-Control-Max-Age", "86400") c.Writer.Header().Set("Access-Control-Allow-Headers", @@ -50,6 +50,8 @@ func CORSMiddleware(c *gin.Context) { c.Writer.Header().Set("Access-Control-Expose-Headers", "Content-Length") c.Writer.Header().Set("Access-Control-Allow-Credentials", "true") + log.Print("remote addr is ",c.Request.RemoteAddr) + if c.Request.Method == "OPTIONS" { log.Println("OPTIONS") c.AbortWithStatus(200)