| | |
| | | "fmt" |
| | | "io/ioutil" |
| | | "net/http" |
| | | "time" |
| | | "strconv" |
| | | "time" |
| | | |
| | | "basic.com/pubsub/protomsg.git" |
| | | ) |
| | |
| | | func Parsesources(sources []map[string]interface{}) (esinfos []*protomsg.Esinfo) { |
| | | var ok bool |
| | | for _, source := range sources { |
| | | tmpinfo := protomsg.Esinfo{} |
| | | var tmpinfo protomsg.Esinfo |
| | | tmpinfo.FaceFeature, ok = source["faceFeature"].(string) |
| | | if !ok { |
| | | continue |
| | |
| | | func Videopersonsbyid(sources []map[string]interface{}) (tmpinfos []protomsg.Videopersons) { |
| | | var ok bool |
| | | |
| | | //var tmpinfo protomsg.Videopersons |
| | | var tmpinfo protomsg.Videopersons |
| | | for _, source := range sources{ |
| | | tmpinfo := protomsg.Videopersons{} |
| | | tmpinfo.Id, ok = source["id"].(string) |
| | | if !ok { |
| | | continue |
| | |
| | | tmpinfo.BeautyLevel,ok = source["beautyLevel"].(string) |
| | | Isnil("beautyLevel",ok) |
| | | if source["picSmUrl"] != nil { |
| | | //fmt.Println(source["picSmUrl"]) |
| | | for _,v := range source["picSmUrl"].([]interface{}) { |
| | | tmpinfo.PicSmUrl = append(tmpinfo.PicSmUrl, v.(string)) |
| | | } |
| | | fmt.Println(tmpinfo.PicSmUrl) |
| | | } |
| | | tmpinfo.VideoUrl,ok = source["videoUrl"].(string) |
| | | Isnil("videoUrl",ok) |
| | |
| | | Isnil("analyServerIp",ok) |
| | | tmpinfo.ClusterId,ok = source["clusterId"].(string) |
| | | Isnil("clusterId",ok) |
| | | tmpinfo.IsAlarm,ok = source["isAlarm"].(string) |
| | | |
| | | isAlarm,ok := source["isAlarm"].(float64) |
| | | fmt.Println(ok) |
| | | if ok { |
| | | tmpinfo.IsAlarm= strconv.FormatFloat(isAlarm, 'E', -1, 64)//float64 |
| | | } |
| | | Isnil("isAlarm",ok) |
| | | tmpinfo.IsAckAlarm,ok = source["isAckAlarm"].(string) |
| | | Isnil("isAckAlarm",ok) |
| | | |
| | | isAckAlarm,ok := source["isAckAlarm"].(float64) |
| | | fmt.Println(ok) |
| | | if ok { |
| | | tmpinfo.IsAckAlarm= strconv.FormatFloat(isAckAlarm, 'E', -1, 64)//float64 |
| | | } |
| | | Isnil("isAckAlarm",ok) |
| | | |
| | | isCollect,ok := source["isCollect"].(float64) |
| | | if ok { |
| | | tmpinfo.IsDelete= int32(isCollect) |
| | | } |
| | | Isnil("isDelete", ok) |
| | | Isnil("isCollect", ok) |
| | | |
| | | isDelete,ok := source["isDelete"].(float64) |
| | | if ok { |
| | | tmpinfo.IsDelete= int32(isDelete) |
| | | } |
| | | Isnil("isDelete", ok) |
| | | |
| | | if source["alarmRules"] != nil { |
| | | fmt.Println(source["alarmRules"]) |
| | | for _,v := range source["alarmRules"].([]interface{}) { |
| | |
| | | |
| | | tmpinfo.BaseInfo = append(tmpinfo.BaseInfo, &bi) |
| | | } |
| | | |
| | | } |
| | | |
| | | //根据 tableid 获取 tablename |
| | | //name, _:= Dbtablename(tmpinfo.TableId) |
| | | //tmpinfo.TableName= name |
| | | fmt.Println(tmpinfos) |
| | | tmpinfos = append(tmpinfos, tmpinfo) |
| | | } |
| | | |
| | |
| | | func Dbpersonbyid(sources []map[string]interface{}) (tmpinfos []protomsg.Dbperson) { |
| | | var ok bool |
| | | |
| | | //var tmpinfo protomsg.Dbperson |
| | | var tmpinfo protomsg.Dbperson |
| | | for _, source := range sources{ |
| | | tmpinfo := protomsg.Dbperson{} |
| | | tmpinfo.FaceFeature, ok = source["faceFeature"].(string) |
| | | if !ok { |
| | | continue |
| | |
| | | func Dbtablebyid(sources []map[string]interface{}) (tmpinfos []protomsg.Dbtable) { |
| | | var ok bool |
| | | |
| | | //var tmpinfo protomsg.Dbtable |
| | | var tmpinfo protomsg.Dbtable |
| | | for _, source := range sources{ |
| | | tmpinfo := protomsg.Dbtable{} |
| | | |
| | | tmpinfo.Id, ok = source["id"].(string) |
| | | if !ok { |
| | | continue |
| | |
| | | } |
| | | return sources,nil |
| | | } |
| | | //slice scroll 解析工具函数 |
| | | |
| | | func Sourcelistforscroll(buf []byte)(datasource map[string]interface{}, err error){ |
| | | var data = make(map[string]interface{}) |
| | | var info interface{} |
| | |
| | | } |
| | | |
| | | func EsReq(method string, url string, parama []byte) (buf []byte, err error) { |
| | | defer elapsed("page")() |
| | | //defer elapsed("page")() |
| | | timeout := time.Duration(10 * time.Second) |
| | | client := http.Client{ |
| | | Timeout: timeout, |