Beispiel #1
0
func userRanksHandler(r *http.Request, w http.ResponseWriter,
	user *models.Account) {
	var ranks struct {
		Userid         string `json:"userid"`
		ScoreRank      int    `json:"score_rank"`
		PhysiqueRank   int    `json:"physique_rank"`
		LiteratureRank int    `json:"literature_rank"`
		MagicRank      int    `json:"magic_rank"`
	}

	//log.Println(user.Props)
	ranks.Userid = user.Id
	ranks.ScoreRank, _ = user.PropIndex("score", user.Props.Score)
	ranks.PhysiqueRank, _ = user.PropIndex("physique", user.Props.Physical)
	ranks.LiteratureRank, _ = user.PropIndex("literature", user.Props.Literal)
	ranks.MagicRank, _ = user.PropIndex("magic", user.Props.Mental)

	writeResponse(r.RequestURI, w, ranks, nil)
}