| | |
| | | import ( |
| | | "errors" |
| | | "fmt" |
| | | "strconv" |
| | | "strings" |
| | | "time" |
| | | |
| | |
| | | DisappearTime int // 消失时间, 单位小时 |
| | | AlarmInterval int // 报警时间间隔, 单位天 |
| | | LastDirection string // 最后一次抓拍 |
| | | MaxAge string // 年龄 |
| | | MinAge string // 年龄 |
| | | MaxAge int // 年龄 |
| | | MinAge int // 年龄 |
| | | Task *db.ModelTask |
| | | } |
| | | |
| | |
| | | if v.Alias == "age" { |
| | | if val, ok := v.Value.(string); ok { |
| | | ages := strings.Split(val, ",") |
| | | m.MinAge = ages[0] |
| | | m.MaxAge = ages[1] |
| | | m.MinAge, _ = strconv.Atoi(ages[0]) |
| | | m.MaxAge, _ = strconv.Atoi(ages[1]) |
| | | } |
| | | } |
| | | |
| | |
| | | results := make([]*db.ModelTaskResults, 0) |
| | | var ageFilter, labelFilter, keyFilter, lastFilter []PersonInfo |
| | | |
| | | if m.MinAge != "" { |
| | | if m.MinAge > 0 { |
| | | err := db.GetDB().Raw(` |
| | | SELECT |
| | | s.document_number, |
| | |
| | | } |
| | | |
| | | // 合并一下条件 |
| | | if m.MinAge != "" && m.PersonLabel != "" { |
| | | if m.MinAge > 0 && m.PersonLabel != "" { |
| | | lastFilter = intersectPersonInfo(ageFilter, labelFilter) |
| | | } else if m.MinAge != "" { |
| | | } else if m.MinAge > 0 { |
| | | lastFilter = ageFilter |
| | | } else if m.PersonLabel != "" { |
| | | lastFilter = labelFilter |