本文整理匯總了Golang中github.com/ginuerzh/sports/models.RedisLogger.LBDisCard方法的典型用法代碼示例。如果您正苦於以下問題:Golang RedisLogger.LBDisCard方法的具體用法?Golang RedisLogger.LBDisCard怎麽用?Golang RedisLogger.LBDisCard使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/ginuerzh/sports/models.RedisLogger
的用法示例。
在下文中一共展示了RedisLogger.LBDisCard方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: userRecStatHandler
func userRecStatHandler(request *http.Request, resp http.ResponseWriter, redis *models.RedisLogger, form userRecStatForm) {
user := &models.Account{}
stats := &statResp{}
if find, err := user.FindByUserid(form.Userid); !find {
e := errors.NewError(errors.NotExistsError, "user not found")
if err != nil {
e = errors.NewError(errors.DbError, err.Error())
}
writeResponse(request.RequestURI, resp, nil, e)
return
}
stats.RecCount, _ = models.TotalRecords(form.Userid)
stats.TotalDistance, stats.TotalDuration = redis.RecStats(form.Userid)
maxDisRec, _ := models.MaxDistanceRecord(form.Userid)
maxSpeedRec, _ := models.MaxSpeedRecord(form.Userid)
stats.MaxDistance = &record{}
if maxDisRec.Sport != nil {
stats.MaxDistance.Type = maxDisRec.Type
stats.MaxDistance.Source = maxDisRec.Sport.Source
stats.MaxDistance.BeginTime = maxDisRec.StartTime.Unix()
stats.MaxDistance.EndTime = maxDisRec.EndTime.Unix()
stats.MaxDistance.Duration = maxDisRec.Sport.Duration
stats.MaxDistance.Distance = maxDisRec.Sport.Distance
}
stats.MaxSpeed = &record{}
if maxSpeedRec.Sport != nil {
stats.MaxDistance.Type = maxDisRec.Type
stats.MaxDistance.Source = maxDisRec.Sport.Source
stats.MaxDistance.BeginTime = maxDisRec.StartTime.Unix()
stats.MaxDistance.EndTime = maxDisRec.EndTime.Unix()
stats.MaxSpeed.Duration = maxSpeedRec.Sport.Duration
stats.MaxSpeed.Distance = maxSpeedRec.Sport.Distance
}
stats.Score = user.Props.Score
stats.Actor = userActor(user.Actor)
stats.Level = user.Level()
//stats.Rank = userRank(stats.Level)
stats.Index = redis.LBDisRank(form.Userid) + 1
stats.LBCount = redis.LBDisCard()
writeResponse(request.RequestURI, resp, stats, nil)
}