|
@@ -99,7 +99,7 @@ func (this *AheadManager) UpdateUserGroupJob() {
|
|
|
return
|
|
|
}
|
|
|
log.Printf("[MANAGER-INFO]AheadManager UserGroup Change Start\n")
|
|
|
- this.BatchFlag = getWeekBatchName(time.Now())
|
|
|
+ this.BatchFlag = public.GetWeekBatchName(time.Now())
|
|
|
|
|
|
newMap := map[string]int{}
|
|
|
//新圈用户
|
|
@@ -207,25 +207,3 @@ func (this *AheadManager) sortUserByBatchAndGetFinal(userIds []string) (rData []
|
|
|
log.Printf("[MANAGER-INFO]AheadManager sortUserByBatchAndGetFinal Finished\n")
|
|
|
return userIds[:total]
|
|
|
}
|
|
|
-
|
|
|
-//getWeekBatchName 返回周批次标识
|
|
|
-//return Example 2022Y73W
|
|
|
-func getWeekBatchName(t time.Time) string {
|
|
|
- yearDay := t.YearDay()
|
|
|
- yearFirstDay := t.AddDate(0, 0, -yearDay+1)
|
|
|
- firstDayInWeek := int(yearFirstDay.Weekday())
|
|
|
-
|
|
|
- //今年第一周有几天
|
|
|
- firstWeekDays := 1
|
|
|
- if firstDayInWeek != 0 {
|
|
|
- firstWeekDays = 7 - firstDayInWeek + 1
|
|
|
- }
|
|
|
- var week int
|
|
|
- if yearDay <= firstWeekDays {
|
|
|
- week = 1
|
|
|
- } else {
|
|
|
- week = (yearDay-firstWeekDays)/7 + 2
|
|
|
- }
|
|
|
-
|
|
|
- return fmt.Sprintf("%dY%02dW", t.Year(), week)
|
|
|
-}
|