def top10(request): '''显示排行前十的用户''' # 格式: rank_data = { # 1: {'id': 3, 'nickname': 'asdf', 'sex': 'male', ..., 'score': 123} # 2: {'id': 7, 'nickname': 'bob', 'sex': 'male', ..., 'score': 100} # 3: {'id': 15, 'nickname': 'lucy', 'sex': 'female', ..., 'score': 90} # } rank_data = logics.get_top_n(10) return render_json(rank_data)
def hot_users(request): """获取前10 的热门用户 {1: {id:2, nickname:zhangsan, ... score=500}, 2: {id:6, nickname:zhangsan, ... score=500}, 3: {id:9, nickname:zhangsan, ... score=500}, 4: {id:100, nickname:zhangsan, ... score=500} } """ top_dict = logics.get_top_n(config.TOP_N) return render_json(top_dict)
def hot_rank(request): """ 热度排行榜输出格式如下: rank_data = { 1: {nickname: xxx, sex: 'xx', age: 12, score: 300} 2: {nickname: xxx, sex: 'xx', age: 12, score: 200} ... } """ rank_data = logics.get_top_n(30) return render_json(rank_data)
def hot_rank(request): ''' 查看全服人气热度前 50 的用户 Return: rank_data = { '1': {'score': 81623, 'nickname': xxx, 'avatar': xxxx, 'id': xx, 'gender': xx}, '2': {'score': 73223, 'nickname': xxx, 'avatar': xxxx, 'id': xx, 'gender': xx}, '3': {'score': 63529, 'nickname': xxx, 'avatar': xxxx, 'id': xx, 'gender': xx}, } ''' rank_data = logics.get_top_n(50) return render_json(rank_data)
def hot_users(request): ''' 全服最火的 10 名用户 Return: { '1': {id: 123, nickname: abc, ..., score: 1000} '2': {...} '3': {...} ... } ''' rank_data = logics.get_top_n(10) return render_json(rank_data)
def top10(request): rank_data = logics.get_top_n(10) result = [[user.to_dict(), score] for user, score in rank_data] return render_json(result)
def top_n(request): data = logics.get_top_n() return render_json(data=data)
def hot_rank(request): '''查看人气排行榜''' rank_data = logics.get_top_n(50) return render_json(rank_data)
def hot_rank(request): logics.get_top_n(config.RANK_NUM) return render_json()
def top10(request): rank_data = logics.get_top_n(10) return render_json(rank_data)