| | |
| | | if len(temp) > 0 { |
| | | if ruleList[i].SetType == "linkTask" { |
| | | // groupId中含有link则为联动任务 |
| | | //LinkTask(args, ruleList[i], taskId) |
| | | LinkTask(args, ruleList[i], taskId) |
| | | } else { |
| | | // 独立任务的处理 |
| | | RunRule(args, ruleList[i], taskId) |
| | |
| | | for _, va := range resultSplice { |
| | | completeFormula = completeFormula + va.Result |
| | | } |
| | | if strings.HasPrefix(completeFormula,"&&") || strings.HasPrefix(completeFormula,"||") || strings.HasPrefix(completeFormula,">=") || strings.HasPrefix(completeFormula,"<=") || strings.HasPrefix(completeFormula,"==") || strings.HasPrefix(completeFormula,"!=") ||strings.HasPrefix(completeFormula,">") || strings.HasPrefix(completeFormula,"<") { |
| | | // 以这些开头的基本是联动任务 |
| | | if strings.HasPrefix(completeFormula,"&&") || strings.HasPrefix(completeFormula,"||") || strings.HasPrefix(completeFormula,">=") || strings.HasPrefix(completeFormula,"<=") || strings.HasPrefix(completeFormula,"==") || strings.HasPrefix(completeFormula,"!=") { |
| | | completeFormula = completeFormula[2:len(completeFormula)-1] |
| | | } |
| | | if strings.HasPrefix(completeFormula,">") || strings.HasPrefix(completeFormula,"<") { |
| | | completeFormula = completeFormula[1:len(completeFormula)-1] |
| | | } |
| | | expression, _ := govaluate.NewEvaluableExpression(completeFormula) |
| | | if strings.HasPrefix(completeFormula, "&&") || strings.HasPrefix(completeFormula, "||") { |
| | | panic("规则有误,得到的数学公式不可解析") |
| | | } |
| | | result, _ := expression.Evaluate(nil) // 得到数学公式的结果 |
| | | return result.(bool) |
| | | } |
| | | if completeFormula != "" { |
| | | log.Println("结果公式-----------:", completeFormula) |
| | | expression, _ := govaluate.NewEvaluableExpression(completeFormula) |
| | |
| | | timeEle.N = timeEle.InitN // 重置定时器 |
| | | } |
| | | } |
| | | log.Println("--------------------走这里了吗---------------") |
| | | return false |
| | | } else { |
| | | // 最后成功报警才把符合条件的人脸数据塞进结果标签里 |