feat: Add hget function to redis util

This commit is contained in:
LWR 2023-03-19 22:06:26 +08:00
parent d897580e0e
commit 479bea2fe0
3 changed files with 10 additions and 3 deletions

View File

@ -220,7 +220,7 @@ class DynamicUpdate(BaseModel):
def default(cls):
"""
获取功能全部开启的默认 DynamicUpdate 实例
默认配置启用动态推送推送内容模板为 "{uname} {action}\n{url}"
默认配置启用动态推送推送内容模板为 "{uname} {action}\n{url}{next}{picture}"
"""
return DynamicUpdate(enabled=True, message=DynamicUpdate.DEFAULT_MESSAGE)

View File

@ -285,13 +285,13 @@ class LiveReportGenerator:
)
pic.draw_img_alpha(pic.auto_size_img_by_limit(guard_list_img, logo_limit))
# 盲盒盈亏线图
# 盲盒盈亏线图
if model.box_profit_diagram:
profits = param.get("box_profit_diagram", [])
if profits:
profits.insert(0, 0.0)
pic.draw_section("盲盒盈亏线图")
pic.draw_section("盲盒盈亏线图")
diagram = cls.__get_box_profit_diagram(profits, pic.width - (margin * 2))
pic.draw_img_alpha(pic.auto_size_img_by_limit(diagram, logo_limit))

View File

@ -85,6 +85,13 @@ async def hexists(key: str, hkey: Union[str, int]) -> bool:
return await __redis.hexists(key, hkey)
async def hget(key: str, hkey: Union[str, int]) -> str:
result = await __redis.hget(key, hkey)
if result is None:
return ""
return result.decode()
async def hgeti(key: str, hkey: Union[str, int]) -> int:
result = await __redis.hget(key, hkey)
if result is None: