panlei
2019-11-16 90f568cf48fcc3131b45a2081dea40015eae5c5b
ruleserver/readyDataForRule.go
@@ -93,35 +93,6 @@
   //logger.Info("初步保留两位成str::::",value2)
   return value2
}
// 取出某个时间规则的第几天的规则段集合
func GetTimeById(id string, index int) []structure.TimeRange {
   _, cameraTimeRule := cache.GetTimeRuleById(id)
   var timeRangeList []structure.Day
   err := json.Unmarshal([]byte(cameraTimeRule.TimeRule), &timeRangeList)
   if err != nil {
      logger.Error("取时间规则时反序列化错误!")
   }
   for _, timerange := range timeRangeList {
      if timerange.Day == index {
         //logger.Println("取到的时间规则:", timerange.TimeRange)
         return timerange.TimeRange
      }
   }
   return nil
}
// 根据传入的字符串得到其在一周内的索引 周一到周日分别对应1到7
func getIndexOfWeek(weekday string) int {
   var weekdays = [7]string{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}
   for k, value := range weekdays {
      if value == weekday {
         return k + 1 // 因为数据库中存的是1-7代表的周一到周日
      }
   }
   return 0
}
// 将字符串格式的坐标序列化为Point格式
func Json2points(areaPoints string) []structure.Point {
@@ -275,7 +246,7 @@
         // 这步要备齐表达式里所需要的所有参数
         a.TargetNum++
         uuid := uuid.NewV4().String()
         arg1 := structure.Arg{obj.Id,uuid,obj.Score, PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale), float64(obj.Rects.Width * obj.Rects.Height), a.AreaJson,obj.IsYolo, obj.Rects, obj.Feature, obj.ThftRes, []*structure.BaseInfo{},"",structure.ResultMsg{}}
         arg1 := structure.Arg{obj.Id,uuid,obj.Score, PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale), float64(obj.Rects.Width * obj.Rects.Height), a.AreaJson,obj.IsYolo, obj.Rects, obj.Car,obj.Feature, obj.ThftRes, []*structure.BaseInfo{},"",structure.ResultMsg{}}
         //logger.Println("放进去的arg:-------", arg1)
         a.Args = append(a.Args, &arg1)
         a.FilterData = append(a.FilterData, &arg1)