🐛 修复读写缓存时没有转换数据类型的错误

This commit is contained in:
洛水居室 2022-08-31 15:27:14 +08:00
parent 623acf8012
commit 781dd99ab6
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -23,7 +23,9 @@ class WikiCache:
async def get(self, key: str) -> dict:
qname = f"{self.qname}:{key}"
result = json.loads(await self.client.get(qname))
data = await self.client.get(qname)
json_data = str(data, encoding="utf-8")
result = json.loads(json_data)
if isinstance(result, list) and len(result) > 0:
for num, item in enumerate(result):
result[num] = json.loads(item)