蛋蛋星球-制度模式
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

31 rinda
1004 B

  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. func GetLatestEffectiveIndexFromAlias(now time.Time) string {
  17. var esIndexName string
  18. year, week := now.ISOWeek()
  19. if now.Weekday() > time.Wednesday || (now.Weekday() > time.Wednesday && now.Hour() > 14) {
  20. // 当前已经过了周三下午两点 返回当周蛋蛋分
  21. esIndexName = egg_system_rules.IntToStr(year) + egg_system_rules.IntToStr(week)
  22. } else {
  23. // 没过周三下午两点 返回上周蛋蛋分
  24. esIndexName = egg_system_rules.IntToStr(year) + egg_system_rules.IntToStr(week-1)
  25. }
  26. return esIndexName
  27. }