fix to_dict

This commit is contained in:
yubanmeiqin9048
2023-08-07 21:01:47 +08:00
parent ceeb20ed2d
commit f7b96daa50
2 changed files with 10 additions and 1 deletions

View File

@ -30,7 +30,6 @@ class DownloadingTorrent(BaseModel):
dlspeed: Optional[str] = None
media: Optional[dict] = {}
class TransferInfo(BaseModel):
"""
文件转移结果信息
@ -51,3 +50,12 @@ class TransferInfo(BaseModel):
fail_list: Optional[list] = []
# 错误信息
message: Optional[str] = None
def to_dict(self):
"""
返回字典
"""
dicts = vars(self).copy() # 创建一个字典的副本以避免修改原始数据
dicts["path"] = str(self.path) if self.path else None
dicts["target_path"] = str(self.target_path) if self.target_path else None
return dicts