This commit is contained in:
parent
1b61b35c03
commit
e5af152d14
|
@ -107,7 +107,7 @@ def fetch_all_menu() -> Generator[tuple[str, str, str], None, None]:
|
|||
db.close()
|
||||
|
||||
|
||||
def fetch_roll_result() -> str|None:
|
||||
def fetch_roll_result() -> str | None:
|
||||
"""
|
||||
获取N天前的抽签结果
|
||||
:return: 抽签结果
|
||||
|
@ -118,7 +118,7 @@ def fetch_roll_result() -> str|None:
|
|||
cursor = db.cursor()
|
||||
try:
|
||||
cursor.execute("select value from roll_result where datestr=?",
|
||||
(datestr, ))
|
||||
(datestr,))
|
||||
row = cursor.fetchone()
|
||||
if row is not None:
|
||||
return row[0]
|
||||
|
|
|
@ -55,6 +55,7 @@ def vote_reduce(summary: dict[str, float], limit: int = 2) -> tuple[dict[str, fl
|
|||
"""
|
||||
按规则对投票结果进行修饰
|
||||
:param summary: 投票汇总结果
|
||||
:param limit: 降低最近N次点餐结果概率
|
||||
:return: 投票汇总结果
|
||||
"""
|
||||
last_results = list(fetch_roll_result_list(-1, limit))
|
||||
|
|
|
@ -3,10 +3,10 @@ from configparser import ConfigParser
|
|||
|
||||
from flask import request
|
||||
|
||||
|
||||
config = ConfigParser()
|
||||
config.read('./config.ini')
|
||||
|
||||
|
||||
def is_mobile_request(user_agent: str) -> bool:
|
||||
"""
|
||||
判断是否是移动端
|
||||
|
@ -16,6 +16,7 @@ def is_mobile_request(user_agent: str) -> bool:
|
|||
ua_expression = config.get('Settings', 'UA_EXPRESSION')
|
||||
return bool(eval(ua_expression, {"user_agent": user_agent, "re": re}))
|
||||
|
||||
|
||||
def get_user() -> str:
|
||||
"""
|
||||
根据访问IP决定用户ID
|
||||
|
|
Loading…
Reference in New Issue