| | |
| | | log "github.com/long/test/log" |
| | | ) |
| | | |
| | | func GetEsDataReq(url string, parama string, isSource bool) (error, map[string]interface{}) { |
| | | func GetEsDataReq(url string, parama string, picurl string, isSource bool) (error, map[string]interface{}) { |
| | | //log.Log.Infoln("es 查询请求路径" + url) // 配置信息 获取 |
| | | req, err := http.NewRequest("POST", url, strings.NewReader(parama)) |
| | | |
| | |
| | | } |
| | | |
| | | source["id"] = value.(map[string]interface{})["_id"] |
| | | |
| | | sdkType := source["sdkType"] |
| | | if sdkType != nil { |
| | | sdk, err := strconv.Atoi(sdkType.(string)) |
| | |
| | | |
| | | source["sdkType"] = sdkTypeToValue(sdk) |
| | | } |
| | | |
| | | pmax, exist := source["picMaxUrl"].(string) |
| | | if !exist { |
| | | return errors.New("picMaxurl is not string"), nil |
| | | } |
| | | |
| | | if !strings.HasPrefix(pmax, "http") { |
| | | source["picMaxUrl"] = picurl + pmax |
| | | |
| | | } |
| | | |
| | | psm, exist := source["picSmUrl"].(string) |
| | | if !exist { |
| | | return errors.New("picSmUrl is not string"), nil |
| | | } |
| | | |
| | | if !strings.HasPrefix(psm, "http") { |
| | | source["picSmUrl"] = picurl + psm |
| | | } |
| | | |
| | | sources = append(sources, source) |
| | | } |
| | | data["datalist"] = sources |
| | |
| | | return value[i-1] |
| | | } |
| | | |
| | | func PostAction(sec int, Eurl string) []byte { |
| | | func PostAction(sec int, Eurl string, picurl string) []byte { |
| | | index := "videopersons,personaction" |
| | | url := fmt.Sprintf("%s%s%s", Eurl, index, "/_search") |
| | | |
| | | seccond := strconv.Itoa(sec) |
| | | |
| | | prama := "{\"query\":{\"bool\":{\"filter\":[{\"term\":{\"personIsHub\":\"1\"}},{\"range\":{\"picDate\":{\"gte\":\"now+8h-" + seccond + "s\",\"lt\":\"now+8h\"}}}]}},\"size\":\"1000\",\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," + |
| | | "\"_source\":[\"baseInfo\",\"gender\",\"indeviceName\",\"sdkType\",\"ageDescription\",\"content\",\"ID\",\"picAddress\",\"picMaxUrl\",\"picDate\",\"race\",\"videoNum\",\"picSmUrl\",\"taskName\",\"personIsHub\",\"IDCard\",\"videoIp\",\"videoReqNum\"]" + |
| | | "\"_source\":[\"baseInfo\",\"gender\",\"indeviceName\",\"imageKey\",\"sdkType\",\"ageDescription\",\"indeviceid\",\"content\",\"ID\",\"picAddress\",\"picMaxUrl\",\"picDate\",\"race\",\"videoNum\",\"picSmUrl\",\"taskName\",\"personIsHub\",\"IDCard\",\"videoIp\",\"videoReqNum\"]" + |
| | | "}" |
| | | err, tokenRes := GetEsDataReq(url, prama, true) |
| | | err, tokenRes := GetEsDataReq(url, prama, picurl, true) |
| | | if err != nil { |
| | | log.Log.Errorln(err) |
| | | return nil |