tcp server 用于给andriod 客户端定时发送消息
liuxiaolong
2019-05-29 c2e4179bd62a53807720f738a086d697bcf0f2f6
esutil/EsClient.go
@@ -99,15 +99,15 @@
         if exist {
            source["race"] = prace
         }
         fmt.Println("race: ", source["race"])
         source["ageDescription"] = getAgeDesc(source["Age"])
         source["videoNum"] = getVideoUrl(source)
         timeFormat := "2019-05-28 15:04:05"
         picDateStr, err := time.Parse(timeFormat, source["picDate"].(string))
         fmt.Println("picDate: ", picDateStr)
         picDateStr, err := time.Parse("2006-01-02 15:04:05", source["picDate"].(string))
         fmt.Println("picDate: ", picDateStr.Format("2006-01-02 15:04:05"))
         if err == nil {
            source["picDate"] = picDateStr
            source["picDate"] = picDateStr.Format("2006-01-02 15:04:05")
         }
         baseInfo := getSourceBaseInfo(source)
@@ -123,8 +123,9 @@
}
func getAgeDesc(age interface{})(ageDesc string) {
   fmt.Println("ageInterface: ", age)
   if age !=nil {
      ageInt := age.(int32)
      ageInt := age.(int)
      if ageInt >0 && ageInt<7 {
         ageDesc = "童年"
      } else if ageInt >=7 && ageInt<18 {
@@ -318,7 +319,7 @@
   seccond := strconv.Itoa(sec)
   prama := "{\"query\":{\"bool\":{\"filter\":[{\"range\":{\"picDate\":{\"gte\":\"now+8h-" + seccond + "s\",\"lt\":\"now+8h\"}}}]}},\"size\":\"1000\",\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," +
      "\"_source\":[\"baseInfo\",\"Gender\",\"personId\",\"personPicUrl\",\"indeviceName\",\"imgKey\",\"sdkType\",\"ageDescription\",\"indeviceid\",\"content\",\"Id\",\"picAddress\",\"picMaxUrl\",\"picDate\",\"Race\",\"videoNum\",\"picSmUrl\",\"taskName\",\"personIsHub\",\"idcard\",\"videoIp\",\"videoReqNum\"]" +
      "\"_source\":[\"baseInfo\",\"Gender\",\"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)