| | |
| | | if !exist { |
| | | return errors.New("picSmUrl is not string"), nil |
| | | } |
| | | //fmt.Println("picSmUrl: ",psm) |
| | | |
| | | if !strings.HasPrefix(psm, "http") { |
| | | source["picSmUrl"] = picurl + psm |
| | | } |
| | | //videoUrl := getVideoUrl(source) |
| | | |
| | | source["videoNum"] = getVideoUrl(source) |
| | | timeFormat := "2019-05-28 15:04:05" |
| | | picDateStr, err := time.Parse(timeFormat, source["picDate"].(string)) |
| | | if err == nil { |
| | | source["picDate"] = picDateStr |
| | | } |
| | | |
| | | baseInfo := getSourceBaseInfo(source) |
| | | source["baseInfo"] = baseInfo |
| | | |
| | | sources = append(sources, source) |
| | | } |
| | |
| | | } else { |
| | | return nil, dat |
| | | } |
| | | } |
| | | |
| | | type BaseInfo struct { |
| | | TaskId string `json:"taskId"` |
| | | TaskName string `json:"taskName"` |
| | | LikePer string `json:"likePer"` |
| | | TableId string `json:"tableId"` |
| | | TableName string `json:"tableName"` |
| | | PersonId string `json:"personId"` |
| | | PersonPicUrl string `json:"personPicUrl"` |
| | | PersonName string `json:"personName"` |
| | | Gender string `json:"gender"` |
| | | PhoneNum string `json:"phoneNum"` |
| | | IDCard string `json:"IDCard"` |
| | | MonitorLevel string `json:"monitorLevel"` |
| | | Content string `json:"content"` |
| | | } |
| | | |
| | | func getSourceBaseInfo(source map[string]interface{}) (baseInfoJson string) { |
| | | sdkType := source["sdkType"].(string) |
| | | if sdkType == "人脸" { |
| | | var baseInfo = BaseInfo{ |
| | | TaskId:"",//2.0新字段 |
| | | TaskName:"",//2.0新字段 |
| | | LikePer:source["likePer"].(string), |
| | | TableId:"",//2.0新字段 |
| | | TableName:source["BaseName"].(string), |
| | | PersonId:source["personId"].(string), |
| | | PersonName:source["idcard"].(string),//人员姓名,从管理平台获取 |
| | | PersonPicUrl:source["personPicUrl"].(string), |
| | | Gender:source["Gender"].(string), |
| | | PhoneNum:"",//手机号,从管理平台获取 |
| | | IDCard:source["idcard"].(string), |
| | | MonitorLevel:"",//2.0新字段 |
| | | Content:source["content"].(string), |
| | | } |
| | | bytes, err := json.Marshal(baseInfo) |
| | | if err !=nil { |
| | | return "" |
| | | } |
| | | return string(bytes) |
| | | } |
| | | return "" |
| | | } |
| | | |
| | | func getVideoUrl(source map[string]interface{}) (videoUrl string){ |
| | |
| | | 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\",\"imgKey\",\"sdkType\",\"ageDescription\",\"indeviceid\",\"content\",\"ID\",\"picAddress\",\"picMaxUrl\",\"picDate\",\"race\",\"videoNum\",\"picSmUrl\",\"taskName\",\"personIsHub\",\"IDCard\",\"videoIp\",\"videoReqNum\"]" + |
| | | "\"_source\":[\"baseInfo\",\"Gender\",\"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) |
| | | |