| | |
| | | } |
| | | |
| | | //根据抓拍人员id更新(videourl)摄像机地址 |
| | | func UpdateVideourlById(id string, videoUrl string, indexName string, serverIp string, serverPort string, command int) (statu int) { |
| | | func UpdateVideourlById(id string, videoUrl string, indexName string, serverIp string, serverPort string, command int) (statu int,err error) { |
| | | |
| | | var info interface{} |
| | | url := "http://" + serverIp + ":" + serverPort + "/" + indexName + "/_update_by_query?refresh=true" |
| | |
| | | if err != nil { |
| | | fmt.Println("http request videoUrlInfo info is err!") |
| | | statu = 500 |
| | | return |
| | | return statu,err |
| | | } |
| | | json.Unmarshal(buf, &info) |
| | | //fmt.Println(info) |
| | |
| | | if !ok { |
| | | fmt.Println("http response interface can not change map[string]interface{}") |
| | | statu = 500 |
| | | return |
| | | 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!") |
| | | statu = 500 |
| | | return |
| | | return statu,errors.New("first updated change error!") |
| | | } |
| | | if middle == 1 { |
| | | statu = 200 |
| | | return |
| | | return statu,nil |
| | | } |
| | | if middle == 0 { |
| | | statu = 201 |
| | | return |
| | | return statu,errors.New("已经修改") |
| | | } |
| | | return statu |
| | | return statu,nil |
| | | } |
| | | |
| | | //获取当前节点抓拍库所有人员ID*缓存* |