panlei
2019-07-05 e29fa980a6ec4bb1e21d87b897eece0764d5f3c0
ruleserver/timeTicker.go
@@ -2,7 +2,7 @@
import (
   "fmt"
   "os"
   "ruleprocess/logger"
   "time"
)
@@ -39,12 +39,13 @@
            for _, timeEle := range TimeEleList {
               if timeEle.N > 0 {
                  timeEle.N = timeEle.N - 1
                  logger.Info("-------------------------------------打印定时器元素当前值-----------------------------------------:",timeEle.N)
               }
            }
         case stop := <-stopChan:
            if stop {
               fmt.Println("定时器结束")
               os.Exit(0)
               //os.Exit(0)
            }
         }
      }
@@ -91,3 +92,11 @@
func (p SubList) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }
func (p SubList) Len() int           { return len(p) }
func (p SubList) Less(i, j int) bool { return p[i].Sort < p[j].Sort }
// 结构体根据某字段排序
type resultList []*LittleRuleResult
func (p resultList) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }
func (p resultList) Len() int           { return len(p) }
func (p resultList) Less(i, j int) bool { return p[i].Sort < p[j].Sort }