|
@ -165,6 +165,45 @@ func isInExpandTags(ta TimeArrow, expandTag string) bool { |
|
|
return false |
|
|
return false |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//CreateDayOfWeekTypePlan 创建一个每周计划
|
|
|
|
|
|
func CreateDayOfWeekTypePlan(group string, dayOfWeek []int, timesOnDay []string, expandValue interface{}, expandTags []string, weights float64) TimeArrow { |
|
|
|
|
|
return TimeArrow{ |
|
|
|
|
|
Type: TimeArrowTypeDayOfWeek, |
|
|
|
|
|
Group: group, |
|
|
|
|
|
DayOfWeek: dayOfWeek, |
|
|
|
|
|
TimesOnDay: timesOnDay, |
|
|
|
|
|
ExpandValue: expandValue, |
|
|
|
|
|
ExpandTags: expandTags, |
|
|
|
|
|
Weights: weights, |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//CreateDayOfMonthTypePlan 创建一个每月计划
|
|
|
|
|
|
func CreateDayOfMonthTypePlan(group string, dayOfMonth []int, timesOnDay []string, expandValue interface{}, expandTags []string, weights float64) TimeArrow { |
|
|
|
|
|
return TimeArrow{ |
|
|
|
|
|
Type: TimeArrowTypeDayOfMonth, |
|
|
|
|
|
Group: group, |
|
|
|
|
|
DayOfMonth: dayOfMonth, |
|
|
|
|
|
TimesOnDay: timesOnDay, |
|
|
|
|
|
ExpandValue: expandValue, |
|
|
|
|
|
ExpandTags: expandTags, |
|
|
|
|
|
Weights: weights, |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//CreateDateSliceTypePlan 创建一个时间段计划
|
|
|
|
|
|
func CreateDateSliceTypePlan(group string, dateSlice []DateSlice, timesOnDay []string, expandValue interface{}, expandTags []string, weights float64) TimeArrow { |
|
|
|
|
|
return TimeArrow{ |
|
|
|
|
|
Type: TimeArrowTypeDateSlice, |
|
|
|
|
|
Group: group, |
|
|
|
|
|
DateSlice: dateSlice, |
|
|
|
|
|
TimesOnDay: timesOnDay, |
|
|
|
|
|
ExpandValue: expandValue, |
|
|
|
|
|
ExpandTags: expandTags, |
|
|
|
|
|
Weights: weights, |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func GetHitTimeArrow(t time.Time, group string, expandTags ...string) (*TimeArrow, error) { |
|
|
func GetHitTimeArrow(t time.Time, group string, expandTags ...string) (*TimeArrow, error) { |
|
|
ta, err := GetData(group) |
|
|
ta, err := GetData(group) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|