🐛 不允许空UID传入

This commit is contained in:
KimigaiiWuyi 2023-08-11 01:26:26 +08:00
parent f93017ff12
commit 5d51424785
3 changed files with 20 additions and 18 deletions

View File

@ -229,7 +229,7 @@ class Bind(BaseModel):
''' '''
为数据库增加绑定UID 为数据库增加绑定UID
如果有传`lenth_limit`, 当uid位数不等的时候, 返回`-1` 如果有传`lenth_limit`, 当uid位数不等或uid位数为0的时候, 返回`-1`
如果该UID已绑定, 则返回`-2` 如果该UID已绑定, 则返回`-2`
@ -246,6 +246,8 @@ class Bind(BaseModel):
if is_digit is not None: if is_digit is not None:
if not uid.isdigit(): if not uid.isdigit():
return -3 return -3
if not uid:
return -1
if result is None and not await cls.bind_exists(user_id, bot_id): if result is None and not await cls.bind_exists(user_id, bot_id):
return await cls.insert_data( return await cls.insert_data(

28
poetry.lock generated
View File

@ -2,13 +2,13 @@
[[package]] [[package]]
name = "aiofiles" name = "aiofiles"
version = "23.1.0" version = "23.2.1"
description = "File support for asyncio." description = "File support for asyncio."
optional = false optional = false
python-versions = ">=3.7,<4.0" python-versions = ">=3.7"
files = [ files = [
{file = "aiofiles-23.1.0-py3-none-any.whl", hash = "sha256:9312414ae06472eb6f1d163f555e466a23aed1c8f60c30cccf7121dba2e53eb2"}, {file = "aiofiles-23.2.1-py3-none-any.whl", hash = "sha256:19297512c647d4b27a2cf7c34caa7e405c0d60b5560618a29a9fe027b18b0107"},
{file = "aiofiles-23.1.0.tar.gz", hash = "sha256:edd247df9a19e0db16534d4baaf536d6609a43e1de5401d7a4c1c148753a1635"}, {file = "aiofiles-23.2.1.tar.gz", hash = "sha256:84ec2218d8419404abcb9f0c02df3f34c6e0a68ed41072acfb1cef5cbc29051a"},
] ]
[package.source] [package.source]
@ -230,13 +230,13 @@ reference = "mirrors"
[[package]] [[package]]
name = "async-timeout" name = "async-timeout"
version = "4.0.2" version = "4.0.3"
description = "Timeout context manager for asyncio programs" description = "Timeout context manager for asyncio programs"
optional = false optional = false
python-versions = ">=3.6" python-versions = ">=3.7"
files = [ files = [
{file = "async-timeout-4.0.2.tar.gz", hash = "sha256:2163e1640ddb52b7a8c80d0a67a08587e5d245cc9c553a74a847056bc2976b15"}, {file = "async-timeout-4.0.3.tar.gz", hash = "sha256:4640d96be84d82d02ed59ea2b7105a0f7b33abe8703703cd0ab0bf87c427522f"},
{file = "async_timeout-4.0.2-py3-none-any.whl", hash = "sha256:8ca1e4fcf50d07413d66d1a5e416e42cfdf5851c981d679a09851a6853383b3c"}, {file = "async_timeout-4.0.3-py3-none-any.whl", hash = "sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028"},
] ]
[package.source] [package.source]
@ -657,13 +657,13 @@ reference = "mirrors"
[[package]] [[package]]
name = "dnspython" name = "dnspython"
version = "2.4.1" version = "2.4.2"
description = "DNS toolkit" description = "DNS toolkit"
optional = false optional = false
python-versions = ">=3.8,<4.0" python-versions = ">=3.8,<4.0"
files = [ files = [
{file = "dnspython-2.4.1-py3-none-any.whl", hash = "sha256:5b7488477388b8c0b70a8ce93b227c5603bc7b77f1565afe8e729c36c51447d7"}, {file = "dnspython-2.4.2-py3-none-any.whl", hash = "sha256:57c6fbaaeaaf39c891292012060beb141791735dbb4004798328fc2c467402d8"},
{file = "dnspython-2.4.1.tar.gz", hash = "sha256:c33971c79af5be968bb897e95c2448e11a645ee84d93b265ce0b7aabe5dfdca8"}, {file = "dnspython-2.4.2.tar.gz", hash = "sha256:8dcfae8c7460a2f84b4072e26f1c9f4101ca20c071649cb7c34e8b6a93d58984"},
] ]
[package.extras] [package.extras]
@ -1735,13 +1735,13 @@ reference = "mirrors"
[[package]] [[package]]
name = "pycln" name = "pycln"
version = "2.2.1" version = "2.2.2"
description = "A formatter for finding and removing unused import statements." description = "A formatter for finding and removing unused import statements."
optional = false optional = false
python-versions = ">=3.6.2,<4" python-versions = ">=3.6.2,<4"
files = [ files = [
{file = "pycln-2.2.1-py3-none-any.whl", hash = "sha256:686f55b511d11d7f114dcbe0c7d1512443441e1dd00a74ee9ba6b6c1b775c9e2"}, {file = "pycln-2.2.2-py3-none-any.whl", hash = "sha256:73ed5e997dac02cb6dc84bf87c1d834191d026cfabade94e913973610abd65f7"},
{file = "pycln-2.2.1.tar.gz", hash = "sha256:560ed5dec5e44d3250ed1cd6b080080c4022c24dfd2840902113b42d31775bd0"}, {file = "pycln-2.2.2.tar.gz", hash = "sha256:a8a1bd0ac0f5d2fb5fcfb409e027667c2a5ac5341bb7fa23d4a7bd1c1cfc3fec"},
] ]
[package.dependencies] [package.dependencies]

View File

@ -1,12 +1,12 @@
--index-url https://mirrors.bfsu.edu.cn/pypi/web/simple --index-url https://mirrors.bfsu.edu.cn/pypi/web/simple
aiofiles==23.1.0 ; python_full_version >= "3.8.1" and python_version < "4.0" aiofiles==23.2.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
aiohttp==3.8.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" aiohttp==3.8.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
aiosignal==1.3.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" aiosignal==1.3.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
aiosqlite==0.19.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" aiosqlite==0.19.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
anyio==3.7.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" anyio==3.7.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
apscheduler==3.10.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" apscheduler==3.10.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
async-timeout==4.0.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" async-timeout==4.0.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
attrs==23.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" attrs==23.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
backports-zoneinfo==0.2.1 ; python_full_version >= "3.8.1" and python_version < "3.9" backports-zoneinfo==0.2.1 ; python_full_version >= "3.8.1" and python_version < "3.9"
bcrypt==4.0.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" bcrypt==4.0.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
@ -16,7 +16,7 @@ cffi==1.15.1 ; os_name == "nt" and implementation_name != "pypy" and python_full
charset-normalizer==3.2.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" charset-normalizer==3.2.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
click==8.1.6 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" click==8.1.6 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
colorama==0.4.6 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" and (platform_system == "Windows" or sys_platform == "win32") colorama==0.4.6 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" and (platform_system == "Windows" or sys_platform == "win32")
dnspython==2.4.1 ; python_full_version >= "3.8.1" and python_version < "4.0" dnspython==2.4.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
email-validator==2.0.0.post2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" email-validator==2.0.0.post2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
exceptiongroup==1.1.2 ; python_full_version >= "3.8.1" and python_version < "3.11" exceptiongroup==1.1.2 ; python_full_version >= "3.8.1" and python_version < "3.11"
fastapi-amis-admin==0.5.8 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" fastapi-amis-admin==0.5.8 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"