package es import ( "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" egg_system_rules "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils" "time" ) // GetAppointIndexFromAlias 获取指定别名 func GetAppointIndexFromAlias(year string, week string) string { var esIndexName string if year != "" && week != "" { esIndexName = md.EggEnergyUserEggScoreEsAlias + "_" + year + week } return esIndexName } // GetLatestEffectiveIndexFromAlias 获取最新有效别名 func GetLatestEffectiveIndexFromAlias(now time.Time) string { var esIndexName string year, week := now.ISOWeek() if now.Weekday() > time.Wednesday || (now.Weekday() > time.Wednesday && now.Hour() > 14) { // 当前已经过了周三下午两点 返回上周蛋蛋分 esIndexName = egg_system_rules.IntToStr(year) + egg_system_rules.IntToStr(week-1) } else { // 没过周三下午两点 返回上上周蛋蛋分 esIndexName = egg_system_rules.IntToStr(year) + egg_system_rules.IntToStr(week-2) } return esIndexName }