| | |
| | | ) |
| | | |
| | | func ConnectControl() bool { |
| | | url := config.ServUrls.ServerUrl |
| | | url := config.Options.ServerUrl |
| | | resp, err := http.Get(url) |
| | | if err != nil { |
| | | fmt.Println("连接失败", err) |
| | |
| | | } |
| | | |
| | | func GetTotal() (total int, err error) { |
| | | url := "http://" + config.ServUrls.EsUrl + "/ai_ocean/_search" |
| | | url := "http://" + config.Options.EsUrl + "/ai_ocean/_search" |
| | | queryDSL := `{ |
| | | "size": "1", |
| | | "query": { |
| | |
| | | } |
| | | |
| | | func GetData() (interface{}, error) { |
| | | //fmt.Println(config.ServUrls.EsUrl) |
| | | //fmt.Println(config.ServUrls.ServerUrl) |
| | | url := "http://" + config.ServUrls.EsUrl + "/ai_ocean/_search" |
| | | //fmt.Println(config.Options.EsUrl) |
| | | //fmt.Println(config.Options.ServerUrl) |
| | | url := "http://" + config.Options.EsUrl + "/ai_ocean/_search" |
| | | queryDSL := `{ |
| | | "size": "1", |
| | | "query": { |
| | |
| | | return nil, nil |
| | | } |
| | | picMaxImages := make([][]byte, 0) // 存储图片数据的数组 |
| | | if source[0]["picMaxUrl"].([]interface{}) != nil{ |
| | | if source[0]["picMaxUrl"].([]interface{}) != nil { |
| | | //picMaxUrls := source[0]["picMaxUrl"].([]interface{}) |
| | | if len(source[0]["picMaxUrl"].([]interface{})) > 0 { |
| | | for _, picMaxUrl := range source[0]["picMaxUrl"].([]interface{}) { |
| | |
| | | picSmImages = append(picSmImages, picSmImageData) |
| | | } |
| | | } |
| | | |
| | | // 上报机构名称 |
| | | source[0]["orgName"] = config.Options.OrgName |
| | | |
| | | model.PushDataInfo.SourceData = source[0] |
| | | model.PushDataInfo.PicMaxImages = picMaxImages |
| | | model.PushDataInfo.PicSmImages = picSmImages |
| | |
| | | } |
| | | |
| | | func DeleteData(id string) bool { |
| | | url := "http://" + config.ServUrls.EsUrl + "/ai_ocean/_delete_by_query?refresh=true" |
| | | url := "http://" + config.Options.EsUrl + "/ai_ocean/_delete_by_query?refresh=true" |
| | | deleteDSL := `{ |
| | | "query":{ |
| | | "bool":{ |
| | |
| | | } |
| | | |
| | | func MarkData(id string) bool { |
| | | url := "http://" + config.ServUrls.EsUrl + "/ai_ocean/_update_by_query?refresh=true" |
| | | url := "http://" + config.Options.EsUrl + "/ai_ocean/_update_by_query?refresh=true" |
| | | markDSL := `{ |
| | | "script": { |
| | | "source": "ctx._source.isDelete=true" |
| | |
| | | fmt.Println(err) |
| | | return false |
| | | } |
| | | total, err := util.SourceUpdated(buf) |
| | | total, err := util.SourceUpdated(buf) |
| | | if err != nil { |
| | | fmt.Println(err) |
| | | return false |