蛋蛋星球-制度模式
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.0 KiB

  1. package es
  2. import (
  3. "code.fnuoos.com/EggPlanet/egg_system_rules.git/md"
  4. egg_system_rules "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils"
  5. "time"
  6. )
  7. // GetAppointIndexFromAlias 获取指定别名
  8. func GetAppointIndexFromAlias(year string, week string) string {
  9. var esIndexName string
  10. if year != "" && week != "" {
  11. esIndexName = md.EggEnergyUserEggScoreEsAlias + "_" + year + week
  12. }
  13. return esIndexName
  14. }
  15. // GetLatestEffectiveIndexFromAlias 获取最新有效别名
  16. // TODO::临时默认全是60分
  17. func GetLatestEffectiveIndexFromAlias(now time.Time) string {
  18. var esIndexName string
  19. year, week := now.ISOWeek()
  20. if now.Weekday() > time.Wednesday || (now.Weekday() > time.Wednesday && now.Hour() > 14) {
  21. // 当前已经过了周三下午两点 返回上周蛋蛋分
  22. esIndexName = egg_system_rules.IntToStr(year) + egg_system_rules.IntToStr(week-10)
  23. } else {
  24. // 没过周三下午两点 返回上上周蛋蛋分
  25. esIndexName = egg_system_rules.IntToStr(year) + egg_system_rules.IntToStr(week-20)
  26. }
  27. return esIndexName
  28. }