From be245a9d32928d47e1f1125880f60b2de36de68b Mon Sep 17 00:00:00 2001 From: 3136352472 <3136352472> Date: Tue, 9 Jun 2020 17:57:09 +0800 Subject: [PATCH] fix --- core.go | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/core.go b/core.go index f56a22b..e36e085 100644 --- a/core.go +++ b/core.go @@ -165,6 +165,45 @@ func isInExpandTags(ta TimeArrow, expandTag string) bool { 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) { ta, err := GetData(group) if err != nil {