kexue-z / nonebot-plugin-dailysign

一个签到
MIT License
10 stars 3 forks source link

连接数据库后,一发送签到就报错 #4

Open xingkongamc opened 1 year ago

xingkongamc commented 1 year ago

图片 本地就不会报错,数据库提示连接成功,也存在一个叫daily_sign的数据表,更换编码也不行 图片

kexue-z commented 1 year ago

没有遇到过这种情况诶,能发一下数据表内数据和debug信息吗

xingkongamc commented 1 year ago

Microsoft Windows [版本 10.0.19045.2364] (c) Microsoft Corporation。保留所有权利。

D:\桌面\az\qqbot>nb run 01-03 14:46:44 [SUCCESS] nonebot | NoneBot is initializing... 01-03 14:46:44 [INFO] nonebot | Current Env: dev 01-03 14:46:44 [DEBUG] nonebot | Loaded Config: {'driver': '~fastapi', 'host': IPv4Address('127.0.0.1'), 'port': 8080, 'log_level': 'DEBUG', 'api_timeout': 30.0, 'superusers': set(), 'nickname': set(), 'command_start': {'/'}, 'command_sep': {'.'}, 'session_expire_timeout': datetime.timedelta(seconds=120), 'environment': 'dev', 'fastapi_reload': True, 'db_url': 'mysql://qiandao:qiandao@154.12.55.252:3306/qiandao'} 01-03 14:46:45 [DEBUG] nonebot | Succeeded to load adapter "OneBot V11" 01-03 14:46:46 [SUCCESS] nonebot | Succeeded to import "echo" 01-03 14:46:49 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_gocqhttp" 01-03 14:46:50 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_tortoise_orm" 01-03 14:46:50 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_simplemusic" 01-03 14:46:50 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_code" 01-03 14:46:50 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_manager" 01-03 14:46:50 [SUCCESS] nonebot_plugin_tortoise_orm | 数据库: 添加模型: nonebot_plugin_dailysign.models 01-03 14:46:50 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_dailysign" 01-03 14:46:50 [SUCCESS] nonebot | Running NoneBot... 01-03 14:46:50 [DEBUG] nonebot | Loaded adapters: OneBot V11 01-03 14:46:50 [INFO] uvicorn | Will watch for changes in these directories: ['D:\桌面\az\qqbot'] 01-03 14:46:50 [INFO] uvicorn | Uvicorn running on http://127.0.0.1:8080 (Press CTRL+C to quit) 01-03 14:46:50 [INFO] uvicorn | Started reloader process [25736] using WatchFiles 01-03 14:46:51 [SUCCESS] nonebot | NoneBot is initializing... 01-03 14:46:51 [INFO] nonebot | Current Env: dev 01-03 14:46:51 [DEBUG] nonebot | Loaded Config: {'driver': '~fastapi', 'host': IPv4Address('127.0.0.1'), 'port': 8080, 'log_level': 'DEBUG', 'api_timeout': 30.0, 'superusers': set(), 'nickname': set(), 'command_start': {'/'}, 'command_sep': {'.'}, 'session_expire_timeout': datetime.timedelta(seconds=120), 'db_url': 'mysql://qiandao:qiandao@154.12.55.252:3306/qiandao', 'fastapi_reload': True, 'environment': 'dev'} 01-03 14:46:52 [DEBUG] nonebot | Succeeded to load adapter "OneBot V11" 01-03 14:46:52 [SUCCESS] nonebot | Succeeded to import "echo" 01-03 14:46:52 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_code" 01-03 14:46:54 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_gocqhttp" 01-03 14:46:55 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_tortoise_orm" 01-03 14:46:55 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_simplemusic" 01-03 14:46:55 [SUCCESS] nonebot_plugin_tortoise_orm | 数据库: 添加模型: nonebot_plugin_dailysign.models 01-03 14:46:55 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_dailysign" 01-03 14:46:55 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_manager" 01-03 14:46:55 [INFO] uvicorn | Started server process [23980] 01-03 14:46:55 [INFO] uvicorn | Waiting for application startup. 01-03 14:47:00 [INFO] nonebot_plugin_gocqhttp | [1619154250] 当前版本:v1.0.0-rc3 01-03 14:47:00 [INFO] nonebot_plugin_gocqhttp | [1619154250] 将使用 device.json 内的设备信息运行Bot. 01-03 14:47:00 [INFO] nonebot_plugin_gocqhttp | [1619154250] 开始尝试登录并同步消息... 01-03 14:47:00 [INFO] nonebot_plugin_gocqhttp | [1619154250] 使用协议: iPad 01-03 14:47:00 [INFO] nonebot_plugin_gocqhttp | Startup complete, Web UI has served to http://127.0.0.1:8080/go-cqhttp/ 01-03 14:47:02 [INFO] nonebot_plugin_gocqhttp | [1619154250] Protocol -> connect to server: 116.130.229.178:8080 01-03 14:47:02 [WARNING] nonebot_plugin_gocqhttp | [1619154250] Protocol -> device lock is disable. http api may fail. 01-03 14:47:03 [INFO] nonebot_plugin_gocqhttp | [1619154250] 登录成功 欢迎使用: 星空bot01 01-03 14:47:03 [INFO] nonebot_plugin_gocqhttp | [1619154250] 开始加载好友列表... 01-03 14:47:03 [INFO] nonebot_plugin_gocqhttp | [1619154250] 共加载 5 个好友. 01-03 14:47:03 [INFO] nonebot_plugin_gocqhttp | [1619154250] 开始加载群列表... 01-03 14:47:03 [INFO] nonebot_plugin_gocqhttp | [1619154250] 共加载 2 个群. 01-03 14:47:03 [INFO] nonebot_plugin_gocqhttp | [1619154250] 资源初始化完成, 开始处理信息. 01-03 14:47:03 [INFO] nonebot_plugin_gocqhttp | go-cqhttp for 1619154250 has successfully started. 01-03 14:47:03 [INFO] nonebot_plugin_gocqhttp | [1619154250] アトリは、高性能ですから! 01-03 14:47:03 [INFO] nonebot_plugin_gocqhttp | [1619154250] 正在检查更新. 01-03 14:47:03 [INFO] nonebot_plugin_gocqhttp | [1619154250] 开始尝试连接到反向WebSocket Universal服务器: ws://127.0.0.1:8080/onebot/v11/ws 01-03 14:47:04 [INFO] nonebot_plugin_gocqhttp | [1619154250] 当前有更新的 go-cqhttp 可供更新, 请前往 https://github.com/Mrs4s/go-cqhttp/releases 下载. 01-03 14:47:04 [INFO] nonebot_plugin_gocqhttp | [1619154250] 当前版本: v1.0.0-rc3 最新版本: v1.0.0-rc4 01-03 14:47:04 [INFO] nonebot_plugin_gocqhttp | [1619154250] 开始诊断网络情况 01-03 14:47:04 [INFO] nonebot_plugin_gocqhttp | [1619154250] 收到服务器地址更新通知, 将在下一次重连时应用. 01-03 14:47:04 [SUCCESS] nonebot_plugin_tortoise_orm | 数据库: 连接成功 01-03 14:47:04 [INFO] uvicorn | Application startup complete. 01-03 14:47:04 [INFO] uvicorn | ('127.0.0.1', 63294) - "WebSocket /onebot/v11/ws" [accepted] 01-03 14:47:04 [INFO] nonebot | OneBot V11 | Bot 1619154250 connected 01-03 14:47:04 [INFO] websockets | connection open 01-03 14:47:04 [INFO] nonebot_plugin_gocqhttp | [1619154250] 已连接到反向WebSocket Universal服务器 ws://127.0.0.1:8080/onebot/v11/ws 01-03 14:47:06 [INFO] nonebot_plugin_gocqhttp | [1619154250] 网络诊断完成. 未发现问题 01-03 14:47:10 [INFO] nonebot_plugin_gocqhttp | [1619154250] 收到群 星空bot01、xingkonga(115945140) 内 xingkong(2707316959) 的消息: 签到 (-12853552) 01-03 14:47:10 [SUCCESS] nonebot | OneBot V11 1619154250 | [message.group.normal]: Message -12853552 from 2707316959@[群:115945140] "签到" 01-03 14:47:10 [DEBUG] nonebot | Checking for matchers in priority 1... 01-03 14:47:10 [DEBUG] nonebot | Checking for matchers in priority 5... 01-03 14:47:10 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_dailysign) 01-03 14:47:10 [DEBUG] nonebot | Running Matcher(type='message', module=nonebot_plugindailysign) 01-03 14:47:10 [DEBUG] nonebot | Running handler Dependent(call=) 01-03 14:47:10 [INFO] nonebot_plugin_dailysign | 群 115945140 : 用户 2707316959 签到 01-03 14:47:11 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_dailysign) running complete 01-03 14:47:11 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_dailysign) failed. Traceback (most recent call last): File "Z:\编程软件\python\lib\site-packages\tortoise\models.py", line 1059, in get_or_create await cls.select_for_update().filter(**kwargs).using_db(connection).get(), File "Z:\编程软件\python\lib\site-packages\tortoise\queryset.py", line 1018, in _execute raise DoesNotExist("Object does not exist") tortoise.exceptions.DoesNotExist: Object does not exist

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "Z:\编程软件\python\lib\site-packages\tortoise\backends\mysql\client.py", line 44, in translateexceptions return await func(self, *args) File "Z:\编程软件\python\lib\site-packages\tortoise\backends\mysql\client.py", line 172, in execute_insert await cursor.execute(query, values) File "Z:\编程软件\python\lib\site-packages\aiomysql\cursors.py", line 239, in execute await self._query(query) File "Z:\编程软件\python\lib\site-packages\aiomysql\cursors.py", line 457, in _query await conn.query(q) File "Z:\编程软件\python\lib\site-packages\aiomysql\connection.py", line 469, in query await self._read_query_result(unbuffered=unbuffered) File "Z:\编程软件\python\lib\site-packages\aiomysql\connection.py", line 672, in _read_query_result await result.read() File "Z:\编程软件\python\lib\site-packages\aiomysql\connection.py", line 1153, in read first_packet = await self.connection._read_packet() File "Z:\编程软件\python\lib\site-packages\aiomysql\connection.py", line 641, in _read_packet packet.raise_for_error() File "Z:\编程软件\python\lib\site-packages\pymysql\protocol.py", line 221, in raise_for_error err.raise_mysql_exception(self._data) File "Z:\编程软件\python\lib\site-packages\pymysql\err.py", line 143, in raise_mysql_exception raise errorclass(errno, errval) pymysql.err.DataError: (1264, "Out of range value for column 'user_id' at row 1")

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "Z:\编程软件\python\lib\multiprocessing\spawn.py", line 116, in spawn_main exitcode = _main(fd, parent_sentinel) File "Z:\编程软件\python\lib\multiprocessing\spawn.py", line 129, in _main return self._bootstrap(parent_sentinel) File "Z:\编程软件\python\lib\multiprocessing\process.py", line 315, in _bootstrap self.run() File "Z:\编程软件\python\lib\multiprocessing\process.py", line 108, in run self._target(*self._args, *self._kwargs) File "Z:\编程软件\python\lib\site-packages\uvicorn_subprocess.py", line 76, in subprocess_started target(sockets=sockets) File "Z:\编程软件\python\lib\site-packages\uvicorn\server.py", line 60, in run return asyncio.run(self.serve(sockets=sockets)) File "Z:\编程软件\python\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "Z:\编程软件\python\lib\asyncio\base_events.py", line 628, in run_until_complete self.run_forever() File "Z:\编程软件\python\lib\asyncio\base_events.py", line 595, in run_forever self._run_once() File "Z:\编程软件\python\lib\asyncio\base_events.py", line 1881, in _run_once handle._run() File "Z:\编程软件\python\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, self._args) File "Z:\编程软件\python\lib\site-packages\nonebot\message.py", line 142, in _check_matcher await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)

File "Z:\编程软件\python\lib\site-packages\nonebot\message.py", line 188, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "Z:\编程软件\python\lib\site-packages\nonebot\internal\matcher\matcher.py", line 727, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "Z:\编程软件\python\lib\site-packages\nonebot\internal\matcher\matcher.py", line 702, in simple_run await handler( File "Z:\编程软件\python\lib\site-packages\nonebot\dependencies__init.py", line 108, in call return await cast(Callable[..., Awaitable[R]], self.call)(**values) File "Z:\编程软件\python\lib\site-packages\nonebot_plugin_dailysign\init_.py", line 18, in msg = await get_sign_in(user_id, group_id) File "Z:\编程软件\python\lib\site-packages\nonebot_plugin_dailysign\data_source.py", line 12, in get_sign_in last_sign = await DailySign.get_last_sign(user_id, group_id) File "Z:\编程软件\python\lib\site-packages\nonebot_plugin_dailysign\models.py", line 78, in get_lastsign record, = await DailySign.get_or_create( File "Z:\编程软件\python\lib\site-packages\tortoise\models.py", line 1064, in get_or_create return await cls.create(using_db=connection, defaults, kwargs), True File "Z:\编程软件\python\lib\site-packages\tortoise\models.py", line 1135, in create await instance.save(using_db=db, force_create=True) File "Z:\编程软件\python\lib\site-packages\tortoise\models.py", line 943, in save await executor.execute_insert(self) File "Z:\编程软件\python\lib\site-packages\tortoise\backends\base\executor.py", line 226, in execute_insert insert_result = await self.db.execute_insert(self.insert_query, values) File "Z:\编程软件\python\lib\site-packages\tortoise\backends\mysql\client.py", line 52, in translateexceptions raise OperationalError(exc) tortoise.exceptions.OperationalError: (1264, "Out of range value for column 'user_id' at row 1") 01-03 14:47:11 [DEBUG] nonebot | Stop event propagation image

kexue-z commented 1 year ago

在.env里面设置 fastapi_reload=false

xingkongamc commented 1 year ago

还是那样

xingkongamc commented 1 year ago

01-03 14:56:10 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_dailysign) running complete 01-03 14:56:10 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_dailysign) failed. Traceback (most recent call last): File "Z:\编程软件\python\lib\site-packages\tortoise\models.py", line 1059, in get_or_create await cls.select_for_update().filter(**kwargs).using_db(connection).get(), File "Z:\编程软件\python\lib\site-packages\tortoise\queryset.py", line 1018, in _execute raise DoesNotExist("Object does not exist") tortoise.exceptions.DoesNotExist: Object does not exist

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "Z:\编程软件\python\lib\site-packages\tortoise\backends\mysql\client.py", line 44, in translateexceptions return await func(self, *args) File "Z:\编程软件\python\lib\site-packages\tortoise\backends\mysql\client.py", line 172, in execute_insert await cursor.execute(query, values) File "Z:\编程软件\python\lib\site-packages\aiomysql\cursors.py", line 239, in execute await self._query(query) File "Z:\编程软件\python\lib\site-packages\aiomysql\cursors.py", line 457, in _query await conn.query(q) File "Z:\编程软件\python\lib\site-packages\aiomysql\connection.py", line 469, in query await self._read_query_result(unbuffered=unbuffered) File "Z:\编程软件\python\lib\site-packages\aiomysql\connection.py", line 672, in _read_query_result await result.read() File "Z:\编程软件\python\lib\site-packages\aiomysql\connection.py", line 1153, in read first_packet = await self.connection._read_packet() File "Z:\编程软件\python\lib\site-packages\aiomysql\connection.py", line 641, in _read_packet packet.raise_for_error() File "Z:\编程软件\python\lib\site-packages\pymysql\protocol.py", line 221, in raise_for_error err.raise_mysql_exception(self._data) File "Z:\编程软件\python\lib\site-packages\pymysql\err.py", line 143, in raise_mysql_exception raise errorclass(errno, errval) pymysql.err.DataError: (1264, "Out of range value for column 'user_id' at row 1")

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "Z:\编程软件\python\lib\multiprocessing\spawn.py", line 116, in spawn_main exitcode = _main(fd, parent_sentinel) File "Z:\编程软件\python\lib\multiprocessing\spawn.py", line 129, in _main return self._bootstrap(parent_sentinel) File "Z:\编程软件\python\lib\multiprocessing\process.py", line 315, in _bootstrap self.run() File "Z:\编程软件\python\lib\multiprocessing\process.py", line 108, in run self._target(*self._args, *self._kwargs) File "Z:\编程软件\python\lib\site-packages\uvicorn_subprocess.py", line 76, in subprocess_started target(sockets=sockets) File "Z:\编程软件\python\lib\site-packages\uvicorn\server.py", line 60, in run return asyncio.run(self.serve(sockets=sockets)) File "Z:\编程软件\python\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "Z:\编程软件\python\lib\asyncio\base_events.py", line 628, in run_until_complete self.run_forever() File "Z:\编程软件\python\lib\asyncio\base_events.py", line 595, in run_forever self._run_once() File "Z:\编程软件\python\lib\asyncio\base_events.py", line 1881, in _run_once handle._run() File "Z:\编程软件\python\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, self._args) File "Z:\编程软件\python\lib\site-packages\nonebot\message.py", line 142, in _check_matcher await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)

File "Z:\编程软件\python\lib\site-packages\nonebot\message.py", line 188, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "Z:\编程软件\python\lib\site-packages\nonebot\internal\matcher\matcher.py", line 727, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "Z:\编程软件\python\lib\site-packages\nonebot\internal\matcher\matcher.py", line 702, in simple_run await handler( File "Z:\编程软件\python\lib\site-packages\nonebot\dependencies__init.py", line 108, in call return await cast(Callable[..., Awaitable[R]], self.call)(**values) File "Z:\编程软件\python\lib\site-packages\nonebot_plugin_dailysign\init_.py", line 18, in msg = await get_sign_in(user_id, group_id) File "Z:\编程软件\python\lib\site-packages\nonebot_plugin_dailysign\data_source.py", line 12, in get_sign_in last_sign = await DailySign.get_last_sign(user_id, group_id) File "Z:\编程软件\python\lib\site-packages\nonebot_plugin_dailysign\models.py", line 78, in get_lastsign record, = await DailySign.get_or_create( File "Z:\编程软件\python\lib\site-packages\tortoise\models.py", line 1064, in get_or_create return await cls.create(using_db=connection, defaults, kwargs), True File "Z:\编程软件\python\lib\site-packages\tortoise\models.py", line 1135, in create await instance.save(using_db=db, force_create=True) File "Z:\编程软件\python\lib\site-packages\tortoise\models.py", line 943, in save await executor.execute_insert(self) File "Z:\编程软件\python\lib\site-packages\tortoise\backends\base\executor.py", line 226, in execute_insert insert_result = await self.db.execute_insert(self.insert_query, values) File "Z:\编程软件\python\lib\site-packages\tortoise\backends\mysql\client.py", line 52, in translateexceptions raise OperationalError(exc) tortoise.exceptions.OperationalError: (1264, "Out of range value for column 'user_id' at row 1") 01-03 14:56:11 [DEBUG] nonebot | Stop event propagation