()
| 7 | } |
| 8 | |
| 9 | func (this *RankController) Index() { |
| 10 | limit, _ := this.GetInt("limit", 50) |
| 11 | if limit > 200 { |
| 12 | limit = 200 |
| 13 | } |
| 14 | |
| 15 | tab := this.GetString("tab", "all") |
| 16 | switch tab { |
| 17 | case "reading": |
| 18 | rt := models.NewReadingTime() |
| 19 | this.Data["SeoTitle"] = "阅读时长榜" |
| 20 | this.Data["TodayReading"] = rt.Sort(models.PeriodDay, limit, true) |
| 21 | this.Data["WeekReading"] = rt.Sort(models.PeriodWeek, limit, true) |
| 22 | this.Data["MonthReading"] = rt.Sort(models.PeriodMonth, limit, true) |
| 23 | this.Data["LastWeekReading"] = rt.Sort(models.PeriodLastWeek, limit, true) |
| 24 | this.Data["LastMonthReading"] = rt.Sort(models.PeriodLastMoth, limit, true) |
| 25 | this.Data["AllReading"] = rt.Sort(models.PeriodAll, limit, true) |
| 26 | case "sign": |
| 27 | this.Data["SeoTitle"] = "用户签到榜" |
| 28 | sign := models.NewSign() |
| 29 | this.Data["ContinuousSignUsers"] = sign.Sorted(limit, "total_continuous_sign", true) |
| 30 | this.Data["TotalSignUsers"] = sign.Sorted(limit, "total_sign", true) |
| 31 | this.Data["HistoryContinuousSignUsers"] = sign.Sorted(limit, "history_total_continuous_sign", true) |
| 32 | this.Data["ThisMonthSign"] = sign.SortedByPeriod(limit, models.PeriodMonth, true) |
| 33 | this.Data["LastMonthSign"] = sign.SortedByPeriod(limit, models.PeriodLastMoth, true) |
| 34 | case "popular": |
| 35 | this.Data["SeoTitle"] = "文档人气榜" |
| 36 | bookCounter := models.NewBookCounter() |
| 37 | //this.Data["Today"] = bookCounter.PageViewSort(models.PeriodDay, limit, true) |
| 38 | this.Data["Week"] = bookCounter.PageViewSort(models.PeriodWeek, limit, true) |
| 39 | this.Data["Month"] = bookCounter.PageViewSort(models.PeriodMonth, limit, true) |
| 40 | //this.Data["LastWeek"] = bookCounter.PageViewSort(models.PeriodLastWeek, limit, true) |
| 41 | //this.Data["LastMonth"] = bookCounter.PageViewSort(models.PeriodLastMoth, limit, true) |
| 42 | this.Data["All"] = bookCounter.PageViewSort(models.PeriodAll, limit, true) |
| 43 | case "star": |
| 44 | this.Data["SeoTitle"] = "热门收藏榜" |
| 45 | bookCounter := models.NewBookCounter() |
| 46 | //this.Data["Today"] = bookCounter.StarSort(models.PeriodDay, limit, true) |
| 47 | this.Data["Week"] = bookCounter.StarSort(models.PeriodWeek, limit, true) |
| 48 | this.Data["Month"] = bookCounter.StarSort(models.PeriodMonth, limit, true) |
| 49 | //this.Data["LastWeek"] = bookCounter.StarSort(models.PeriodLastWeek, limit, true) |
| 50 | //this.Data["LastMonth"] = bookCounter.StarSort(models.PeriodLastMoth, limit, true) |
| 51 | this.Data["All"] = bookCounter.StarSort(models.PeriodAll, limit, true) |
| 52 | default: |
| 53 | tab = "all" |
| 54 | this.Data["SeoTitle"] = "总榜" |
| 55 | limit = 10 |
| 56 | sign := models.NewSign() |
| 57 | book := models.NewBook() |
| 58 | this.Data["ContinuousSignUsers"] = sign.Sorted(limit, "total_continuous_sign", true) |
| 59 | this.Data["ThisMonthSign"] = sign.SortedByPeriod(limit, models.PeriodMonth, true) |
| 60 | this.Data["TotalReadingUsers"] = sign.Sorted(limit, "total_reading_time", true) |
| 61 | this.Data["StarBooks"] = book.Sorted(limit, "star") |
| 62 | this.Data["VcntBooks"] = book.Sorted(limit, "vcnt") |
| 63 | this.Data["CommentBooks"] = book.Sorted(limit, "cnt_comment") |
| 64 | } |
| 65 | this.Data["Tab"] = tab |
| 66 | this.Data["IsRank"] = true |
nothing calls this directly
no test coverage detected