| | |
| | | "basic.com/pubsub/protomsg.git" |
| | | ) |
| | | |
| | | var logPrint = func(i ...interface{}) { |
| | | fmt.Println(i) |
| | | } |
| | | |
| | | func InitLog(fn func(i ...interface{})) { |
| | | if fn != nil { |
| | | logPrint = fn |
| | | } |
| | | } |
| | | |
| | | // 根据抓拍人员id查询抓拍人员信息 |
| | | func AIOceaninfosbyid(id []string, indexName string, serverIp string, serverPort string) ([]protomsg.AIOcean, error) { |
| | | var aIOceanInfo []protomsg.AIOcean |
| | |
| | | } |
| | | } |
| | | }` |
| | | fmt.Println(jsonDSL) |
| | | logPrint(jsonDSL) |
| | | buf, err := EsReq("POST", url, []byte(jsonDSL)) |
| | | if err != nil { |
| | | return "", err |
| | | } |
| | | json.Unmarshal(buf, &info) |
| | | out, ok := info.(map[string]interface{}) |
| | | fmt.Println(out) |
| | | logPrint(out) |
| | | if !ok { |
| | | return "", errors.New("http response interface can not change map[string]interface{}") |
| | | } |
| | |
| | | } |
| | | } |
| | | ` |
| | | //fmt.Println("url: ", url, videoUrlInfo) |
| | | //logPrint("url: ", url, videoUrlInfo) |
| | | buf, err := EsReq("POST", url, []byte(videoUrlInfo)) |
| | | if err != nil { |
| | | fmt.Println("http request videoUrlInfo info is err!") |
| | | logPrint("http request videoUrlInfo info is err!") |
| | | statu = 500 |
| | | return statu, err |
| | | } |
| | | json.Unmarshal(buf, &info) |
| | | //fmt.Println(info) |
| | | //logPrint(info) |
| | | out, ok := info.(map[string]interface{}) |
| | | if !ok { |
| | | fmt.Println("http response interface can not change map[string]interface{}") |
| | | logPrint("http response interface can not change map[string]interface{}") |
| | | statu = 500 |
| | | return statu, errors.New("http response interface can not change map[string]interface{}") |
| | | } |
| | | middle, ok := out["updated"].(float64) |
| | | if !ok { |
| | | fmt.Println("first updated change error!") |
| | | logPrint("first updated change error!") |
| | | statu = 500 |
| | | return statu, errors.New("first updated change error!") |
| | | } |
| | |
| | | go func(reqParam string) { |
| | | defer wg.Done() |
| | | |
| | | //fmt.Println(url) |
| | | //fmt.Println(prama) |
| | | //logPrint(url) |
| | | //logPrint(prama) |
| | | buf, err := EsReq("POST", url, []byte(reqParam)) |
| | | |
| | | if err != nil { |
| | | fmt.Println("http request videoUrlInfo info is err!") |
| | | fmt.Println(len(capturetable)) |
| | | logPrint("http request videoUrlInfo info is err!") |
| | | logPrint(len(capturetable)) |
| | | return |
| | | } |
| | | |
| | | sources, err := Sourcelistforscroll(buf) |
| | | |
| | | if err != nil { |
| | | fmt.Println(len(capturetable)) |
| | | logPrint(len(capturetable)) |
| | | return |
| | | } |
| | | for _, source := range sources["sourcelist"].([]map[string]interface{}) { |
| | |
| | | "scroll": "1m", |
| | | "scroll_id" : "` + scroll_id + `" |
| | | }` |
| | | //fmt.Println(scroll_url) |
| | | //fmt.Println(jsonDSL) |
| | | //logPrint(scroll_url) |
| | | //logPrint(jsonDSL) |
| | | buf, err := EsReq("POST", scroll_url, []byte(jsonDSL)) |
| | | |
| | | if err != nil { |
| | | fmt.Println("lenth1: ", len(capturetable)) |
| | | logPrint("lenth1: ", len(capturetable)) |
| | | return |
| | | } |
| | | nextSources, err := Sourcelistforscroll(buf) |
| | |
| | | } |
| | | |
| | | nextM := nextSources["sourcelist"].([]map[string]interface{}) |
| | | //fmt.Println("id",nextSources) |
| | | //logPrint("id",nextSources) |
| | | if nextM == nil || len(nextM) == 0 { |
| | | //fmt.Println("lenth: ", len(capturetable)) |
| | | //logPrint("lenth: ", len(capturetable)) |
| | | return |
| | | } |
| | | //fmt.Println("id") |
| | | //logPrint("id") |
| | | for _, source := range nextM { |
| | | tmpList = append(tmpList, source["id"].(string)) |
| | | } |
| | | //fmt.Println("tmpList: ", len(tmpList)) |
| | | //logPrint("tmpList: ", len(tmpList)) |
| | | lock.Lock() |
| | | capturetable = append(capturetable, tmpList...) |
| | | lock.Unlock() |
| | |
| | | } |
| | | wg.Wait() |
| | | |
| | | fmt.Println("lenth_all: ", len(capturetable)) |
| | | fmt.Println("耗时:", time.Since(ts)) |
| | | logPrint("lenth_all: ", len(capturetable)) |
| | | logPrint("耗时:", time.Since(ts)) |
| | | return capturetable |
| | | } |
| | | |
| | |
| | | "sort":[{"picDate":{"order":"desc"}}], |
| | | "_source": {"includes":[],"excludes":["*.feature"]} |
| | | }` |
| | | fmt.Println(DSLJson) |
| | | logPrint(DSLJson) |
| | | buf, err := EsReq("POST", url, []byte(DSLJson)) |
| | | if err != nil { |
| | | return aIOceanInfo, err |
| | |
| | | } |
| | | |
| | | aIOcean := AIOceanAnalysis(sources) |
| | | //fmt.Println(len(videoperson)) |
| | | //logPrint(len(videoperson)) |
| | | return aIOcean, nil |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | aIOcean := AIOceanAnalysis(sources) |
| | | fmt.Println(len(aIOcean)) |
| | | logPrint(len(aIOcean)) |
| | | return aIOcean, nil |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | }` |
| | | //fmt.Println(DSLJson) |
| | | //logPrint(DSLJson) |
| | | buf, err := EsReq("POST", url, []byte(DSLJson)) |
| | | if err != nil { |
| | | return total, err |
| | |
| | | return total, errors.New("first hits change error!") |
| | | } |
| | | total = int(middle["total"].(float64)) |
| | | //fmt.Println(total) |
| | | //logPrint(total) |
| | | return total, nil |
| | | } |
| | | |
| | |
| | | var source = make(map[string]interface{}, 0) |
| | | tmpbuf, ok := in.(map[string]interface{}) |
| | | if !ok { |
| | | fmt.Println("change to source error!") |
| | | logPrint("change to source error!") |
| | | continue |
| | | } |
| | | sdkName := tmpbuf["key"].(string) |
| | |
| | | source["value"] = count |
| | | sources = append(sources, source) |
| | | } |
| | | //fmt.Println("tmpSource",sources) |
| | | //logPrint("tmpSource",sources) |
| | | return sources, nil |
| | | } |
| | | |
| | |
| | | var source = make(map[string]interface{}, 0) |
| | | tmpbuf, ok := in.(map[string]interface{}) |
| | | if !ok { |
| | | fmt.Println("change to source error!") |
| | | logPrint("change to source error!") |
| | | continue |
| | | } |
| | | task := tmpbuf["key"].(map[string]interface{}) |
| | |
| | | source["count"] = count |
| | | sources = append(sources, source) |
| | | } |
| | | //fmt.Println("tmpSource",sources) |
| | | //logPrint("tmpSource",sources) |
| | | return sources, nil |
| | | |
| | | } |
| | |
| | | ` |
| | | //logger.Debug(url) |
| | | //logger.Debug(JsonDSL) |
| | | //fmt.Println(JsonDSL) |
| | | //logPrint(JsonDSL) |
| | | buf, err := EsReq("POST", url, []byte(JsonDSL)) |
| | | if err != nil { |
| | | return capdbinfo, errors.New("http request dbtablename info is err!") |
| | |
| | | if err != nil { |
| | | return capdbinfo, err |
| | | } |
| | | //fmt.Println(sources) |
| | | //logPrint(sources) |
| | | // 返回所有查询的数据 |
| | | capdbinfos := Parsesources(sources) |
| | | return capdbinfos, nil |
| | |
| | | "_source": ["` + strings.Replace(strings.Trim(fmt.Sprint(source), "[]"), " ", "\",\"", -1) + `"] |
| | | }` |
| | | |
| | | fmt.Println("url: ",url) |
| | | fmt.Println("url: ",JsonDSL) |
| | | logPrint("url: ",url) |
| | | logPrint("url: ",JsonDSL) |
| | | buf, err := EsReq("POST", url, []byte(JsonDSL)) |
| | | if err != nil { |
| | | return dbinfos, err |