tcp server 用于给andriod 客户端定时发送消息
liuxiaolong
2020-07-28 12e91e9556865a80f17061041bdefe98f6f42374
controllers/EsController.go
@@ -3,6 +3,7 @@
import (
   "andriodServer/esutil"
   "encoding/json"
   "fmt"
   "github.com/gin-gonic/gin"
   "io"
   "strings"
@@ -23,6 +24,9 @@
      return
   }
   videoUrl := getVideoUrlById(id)
   if videoUrl != "" {
      videoUrl = "http://"+videoUrl
   }
   c.JSON(200, map[string]interface{}{
      "success": true,
@@ -33,8 +37,8 @@
   })
}
var EsUrl string
func getVideoUrlById(_id string) string {
   url := ""
   jsonDSL:= `{
       "query": {
           "bool": {
@@ -51,8 +55,9 @@
           "videoUrl"
       ]
   }`
   body, err := esutil.EsReq("POST", url, []byte(jsonDSL))
   body, err := esutil.EsReq("POST", EsUrl+"ai_ocean/_search", []byte(jsonDSL))
   if err != nil {
      fmt.Println("err:", err)
      return ""
   }
   jsonStr := string(body)