| | |
| | | "basic.com/dbapi.git" |
| | | "basic.com/pubsub/protomsg.git" |
| | | "github.com/knetic/govaluate" |
| | | "os" |
| | | "ruleprocess/logger" |
| | | "ruleprocess/ruleserver" |
| | | "strconv" |
| | |
| | | logger.Info("通过规则,表达式为:", result) |
| | | // 推送服务器 |
| | | pushData(ruleGroup.Urls, msg) |
| | | os.Exit(1) |
| | | //os.Exit(1) |
| | | } else { |
| | | logger.Info("没通过规则,表达式为:", result) |
| | | os.Exit(1) |
| | | //os.Exit(1) |
| | | } |
| | | } |
| | | } |
| | |
| | | // 是否符合时间规则 |
| | | func timeJudge(label *Label, groupRule protomsg.EventPush) string { |
| | | timeNow := time.Now().Format("2006-01-02 15:04:05") |
| | | logger.Info("标签过滤器起始时间为:",groupRule.TimeStart,groupRule.TimeEnd) |
| | | flag1 := isBefore(groupRule.TimeStart, timeNow) |
| | | flag2 := isBefore(timeNow, groupRule.TimeEnd) |
| | | if flag1 && flag2 { |
| | |
| | | func pushData(urls []*protomsg.PushUrl, data ruleserver.ResultMsg) { |
| | | for _, url := range urls { |
| | | logger.Debug("看看推送地址:",url.Url) |
| | | Push("tcp://"+url.Url, data) |
| | | Push("tcp://192.168.1.123:40012", data) |
| | | } |
| | | } |
| | | |