本文整理汇总了Golang中github.com/ginuerzh/sports/models.RedisLogger.RegisterCount方法的典型用法代码示例。如果您正苦于以下问题:Golang RedisLogger.RegisterCount方法的具体用法?Golang RedisLogger.RegisterCount怎么用?Golang RedisLogger.RegisterCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/ginuerzh/sports/models.RedisLogger
的用法示例。
在下文中一共展示了RedisLogger.RegisterCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: summaryHandler
func summaryHandler(w http.ResponseWriter, redis *models.RedisLogger, form summaryForm) {
if ok, err := checkToken(redis, form.Token); !ok {
writeResponse(w, err)
return
}
var stats struct {
RegPhone []int64 `json:"reg_phone"`
RegEmail []int64 `json:"reg_email"`
RegWeibo []int64 `json:"reg_weibo"`
Registers []int64 `json:"registers"`
Logins []int64 `json:"logins"`
CoachLogins []int64 `json:"coach_logins"`
Actives []int64 `json:"actives"`
PostUsers []int64 `json:"post_users"`
Posts []int64 `json:"posts"`
Gamers []int64 `json:"gamers"`
GameTime []int64 `json:"game_time"`
RecordUsers []int64 `json:"record_users"`
AuthCoaches []int64 `json:"auth_coaches"`
Coins []int64 `json:"coins"`
Users int `json:"users"`
Onlines int `json:"onlines"`
OnlineCoaches int `json:"online_coaches"`
}
days := form.Days
if days <= 0 {
days = 3
}
//var start, end time.Time
//start, end = now.BeginningOfDay(), now.EndOfDay()
stats.RegPhone = redis.RegisterCount(days, models.AccountPhone)
stats.RegEmail = redis.RegisterCount(days, models.AccountEmail)
stats.RegWeibo = redis.RegisterCount(days, models.AccountWeibo)
stats.Registers = redis.RegisterCount(days, "")
stats.Logins = redis.LoginCount(days)
stats.CoachLogins = redis.CoachLoginCount(days)
actives := make([]int64, days)
for i := 0; i < days; i++ {
actives[i] = stats.Logins[i] - stats.Registers[i]
}
stats.Actives = actives
stats.PostUsers = redis.PostUserCount(days)
stats.Posts = redis.PostsCount(days)
stats.Gamers = redis.GamersCount(days)
stats.GameTime = redis.GameTime(days)
stats.RecordUsers = redis.RecordUsersCount(days)
stats.AuthCoaches = redis.AuthCoachesCount(days)
stats.Coins = redis.CoinsCount(days)
stats.Users = models.UserCount()
stats.Onlines = redis.Onlines()
writeResponse(w, stats)
}