| | |
| | | return value[i-1] |
| | | } |
| | | |
| | | func PostAction(sec int, Eurl string, picurl string) []byte { |
| | | func PostAction(sec int, Eurl string, picurl string, ishub string) []byte { |
| | | index := "videopersons,personaction" |
| | | url := fmt.Sprintf("%s%s%s", Eurl, index, "/_search") |
| | | |
| | |
| | | if sec > 60 { |
| | | preSec = "-60s" |
| | | } |
| | | prama := "{\"query\":{\"bool\":{\"filter\":[{\"range\":{\"picDate\":{\"gte\":\"now+8h-" + seccond + "s\",\"lt\":\"now+8h"+preSec+"\"}}}]}},\"size\":\"1000\",\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," + |
| | | var ishubReq ="" |
| | | if ishub == "hub" { |
| | | ishubReq = "{\"term\":{\"personIsHub\":\"1\"}}," |
| | | } |
| | | prama := "{\"query\":{\"bool\":{\"filter\":["+ishubReq+"{\"range\":{\"picDate\":{\"gte\":\"now+8h-" + seccond + "s\",\"lt\":\"now+8h"+preSec+"\"}}}]}},\"size\":\"1000\",\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," + |
| | | "\"_source\":[\"baseInfo\",\"Gender\",\"BaseName\",\"Age\",\"personId\",\"personPicUrl\",\"indeviceName\",\"imgKey\",\"sdkType\",\"ageDescription\",\"indeviceid\",\"content\",\"Id\",\"picAddress\",\"picMaxUrl\",\"picDate\",\"Race\",\"videoNum\",\"picSmUrl\",\"taskName\",\"personIsHub\",\"idcard\",\"videoIp\",\"videoReqNum\"]" + |
| | | "}" |
| | | err, tokenRes := GetEsDataReq(url, prama, picurl, true) |
| | |
| | | var sec = flag.Int("sec", 10, "the second for query data. ") |
| | | |
| | | var Level = flag.String("level","ErrorLevel","log level") |
| | | var IsHub = flag.String("hub", "hub", "hub is personIsHub=1") |
| | | |
| | | func main() { |
| | | flag.Parse() |
| | |
| | | } |
| | | |
| | | func handleMessage(conn net.Conn, connArr []net.Conn) bool { |
| | | jsonstring := esutil.PostAction(*sec, *Eurl, *Picurl) |
| | | jsonstring := esutil.PostAction(*sec, *Eurl, *Picurl, *IsHub) |
| | | if jsonstring == nil { |
| | | log.Log.Infoln("the data is nil,remoteArr:",conn.RemoteAddr()) |
| | | conn.Write([]byte("\000")) |