调整代码

This commit is contained in:
liuwei
2025-04-27 10:10:31 +08:00
parent 126f58e315
commit 08c505bfd3
2 changed files with 10 additions and 2 deletions

View File

@@ -44,4 +44,5 @@ pywin32==306
gewechat-client==0.1.5
fastapi~=0.115.12
uvicorn~=0.34.2
uvicorn~=0.34.2
dacite~=1.9.2

View File

@@ -3,6 +3,8 @@ import logging
import re
import time
import dacite
from base.func_epic import is_friday, get_free
from base.func_news import News
@@ -65,7 +67,12 @@ class Robot(Job):
self.contact_manager.set_contacts(self.allContacts)
# 获取个人信息
profile: Profile = self.client.get_profile(self.app_id)
profile_dict = self.client.get_profile(self.app_id)
try:
profile: Profile = dacite.from_dict(Profile, profile_dict)
except Exception as e:
self.LOG.info(f"Profile dict 转换失败: {e}")
return
if profile.data.wxid is None:
self.LOG.info(f"获取个人信息失败,退出程序!")
return