🐛 修复绑定uid可以为空的BUG (KimigaiiWuyi/GenshinUID#579)

This commit is contained in:
KimigaiiWuyi 2023-09-03 15:46:46 +08:00
parent dc8ea76856
commit dcca449235
4 changed files with 21 additions and 17 deletions

View File

@ -67,10 +67,11 @@ async def get_help(
is_icon: bool = True,
ICON_PATH: Optional[Path] = None,
extra_message: Optional[List[str]] = None,
enable_cache: bool = True,
) -> bytes:
help_path = get_res_path('help') / f'{name}.jpg'
if help_path.exists() and name in cache and cache[name]:
if help_path.exists() and name in cache and cache[name] and enable_cache:
return await convert_img(Image.open(help_path))
if sub_color is None and is_dark:
@ -194,12 +195,13 @@ async def get_help(
img = img.convert('RGB')
help_path = get_res_path('help') / f'{name}.jpg'
img.save(
help_path,
'JPEG',
quality=89,
subsampling=0,
)
cache[name] = 1
if enable_cache:
img.save(
help_path,
'JPEG',
quality=89,
subsampling=0,
)
cache[name] = 1
return await convert_img(img)

View File

@ -61,6 +61,8 @@ class SQLA:
new_uid = new_uid.strip()
new_sr_uid: str = data['sr_uid'] if 'sr_uid' in data else ''
new_sr_uid = new_sr_uid.strip()
if not new_sr_uid and not new_uid:
return -3
if new_uid:
retcode = await GsBind.insert_uid(
user_id, self.bot_id, new_uid, group_id, 9, True

14
poetry.lock generated
View File

@ -941,13 +941,13 @@ reference = "mirrors"
[[package]]
name = "gitpython"
version = "3.1.32"
version = "3.1.34"
description = "GitPython is a Python library used to interact with Git repositories"
optional = false
python-versions = ">=3.7"
files = [
{file = "GitPython-3.1.32-py3-none-any.whl", hash = "sha256:e3d59b1c2c6ebb9dfa7a184daf3b6dd4914237e7488a1730a6d8f6f5d0b4187f"},
{file = "GitPython-3.1.32.tar.gz", hash = "sha256:8d9b8cb1e80b9735e8717c9362079d3ce4c6e5ddeebedd0361b228c3a67a62f6"},
{file = "GitPython-3.1.34-py3-none-any.whl", hash = "sha256:5d3802b98a3bae1c2b8ae0e1ff2e4aa16bcdf02c145da34d092324f599f01395"},
{file = "GitPython-3.1.34.tar.gz", hash = "sha256:85f7d365d1f6bf677ae51039c1ef67ca59091c7ebd5a3509aa399d4eda02d6dd"},
]
[package.dependencies]
@ -2098,13 +2098,13 @@ reference = "mirrors"
[[package]]
name = "soupsieve"
version = "2.4.1"
version = "2.5"
description = "A modern CSS selector implementation for Beautiful Soup."
optional = false
python-versions = ">=3.7"
python-versions = ">=3.8"
files = [
{file = "soupsieve-2.4.1-py3-none-any.whl", hash = "sha256:1c1bfee6819544a3447586c889157365a27e10d88cde3ad3da0cf0ddf646feb8"},
{file = "soupsieve-2.4.1.tar.gz", hash = "sha256:89d12b2d5dfcd2c9e8c22326da9d9aa9cb3dfab0a83a024f05704076ee8d35ea"},
{file = "soupsieve-2.5-py3-none-any.whl", hash = "sha256:eaa337ff55a1579b6549dc679565eac1e3d000563bcb1c8ab0d0fefbc0c2cdc7"},
{file = "soupsieve-2.5.tar.gz", hash = "sha256:5663d5a7b3bfaeee0bc4372e7fc48f9cff4940b3eec54a6451cc5299f1097690"},
]
[package.source]

View File

@ -24,7 +24,7 @@ fastapi-user-auth==0.5.0 ; python_full_version >= "3.8.1" and python_full_versio
fastapi==0.97.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
frozenlist==1.4.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
gitdb==4.0.10 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
gitpython==3.1.32 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
gitpython==3.1.34 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
greenlet==2.0.2 ; python_full_version >= "3.8.1" and (platform_machine == "win32" or platform_machine == "WIN32" or platform_machine == "AMD64" or platform_machine == "amd64" or platform_machine == "x86_64" or platform_machine == "ppc64le" or platform_machine == "aarch64") and python_full_version < "4.0.0"
h11==0.14.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
httpcore==0.17.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
@ -48,7 +48,7 @@ six==1.16.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
smmap==5.0.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sniffio==1.3.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sortedcontainers==2.4.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
soupsieve==2.4.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
soupsieve==2.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sqlalchemy-database==0.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sqlalchemy2-stubs==0.0.2a35 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sqlalchemy==1.4.41 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"