本文整理汇总了Python中users.Users.get_user方法的典型用法代码示例。如果您正苦于以下问题:Python Users.get_user方法的具体用法?Python Users.get_user怎么用?Python Users.get_user使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类users.Users
的用法示例。
在下文中一共展示了Users.get_user方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_all_username_and_score
# 需要导入模块: from users import Users [as 别名]
# 或者: from users.Users import get_user [as 别名]
def get_all_username_and_score(start_datetime, end_datetime, count=20):
result = list()
usernames = Games.get_all_username(start_datetime, end_datetime)
for username in usernames:
temp = dict()
temp["username"] = username["username"][:3] + "****" + username["username"][7:]
u = Users.get_user(username["username"])
if u is not None:
temp["user_id"] = u.id
else:
temp["user_id"] = 0
temp["score"] = Games.get_max_score(username["username"], start_datetime, end_datetime)
result.append(temp)
result = Operations.sort_list_with_dict(result, "score", True)
# before = 0
ranking = 1
index = 1
for r in result:
if index > count:
break
# if r["score"] == before:
# r["ranking"] = ranking
# reward_node_info = GameDayRewards.get_some_node_info(ranking)
# if reward_node_info:
# r["reward"] = reward_node_info.get("text")
# else:
# r["reward"] = 0
# index += 1
# continue
# else:
# before = r["score"]
ranking = index
r["ranking"] = ranking
reward_node_info = GameDayRewards.get_some_node_info(ranking)
if reward_node_info:
r["reward"] = reward_node_info.get("text")
else:
r["reward"] = 0
index += 1
return result
示例2: view_user
# 需要导入模块: from users import Users [as 别名]
# 或者: from users.Users import get_user [as 别名]
def view_user(id=None):
u = Users()
name, last_name, user_login = list(u.get_user(id))[0]
return render_template("index.html", name=name, last_name=last_name,
user_login=user_login)