本文整理匯總了Golang中github.com/ginuerzh/sports/models.RedisLogger.CoinsCount方法的典型用法代碼示例。如果您正苦於以下問題:Golang RedisLogger.CoinsCount方法的具體用法?Golang RedisLogger.CoinsCount怎麽用?Golang RedisLogger.CoinsCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/ginuerzh/sports/models.RedisLogger
的用法示例。
在下文中一共展示了RedisLogger.CoinsCount方法的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)
}