From c13f8a67497f59d1d6e96d59ceaca5a8abe1dc33 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Wed, 29 May 2024 22:11:07 +0800 Subject: [PATCH] fix --- package.json | 2 +- plugins/dailyword/__init__.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index e4d2d5c..a8370c7 100644 --- a/package.json +++ b/package.json @@ -770,7 +770,7 @@ "name": "每日一言", "description": "在仪表板中显示每日一言卡片。", "labels": "仪表板", - "version": "1.0", + "version": "1.1", "icon": "Calibre_B.png", "author": "jxxghp", "level": 1 diff --git a/plugins/dailyword/__init__.py b/plugins/dailyword/__init__.py index e0c9af8..a64bc4e 100644 --- a/plugins/dailyword/__init__.py +++ b/plugins/dailyword/__init__.py @@ -1,7 +1,7 @@ +from datetime import datetime +from functools import lru_cache from typing import List, Tuple, Dict, Any, Optional -from cachetools import TTLCache, cached - from app.plugins import _PluginBase from app.utils.http import RequestUtils @@ -14,7 +14,7 @@ class DailyWord(_PluginBase): # 插件图标 plugin_icon = "Calibre_B.png" # 插件版本 - plugin_version = "1.0" + plugin_version = "1.1" # 插件作者 plugin_author = "jxxghp" # 作者主页 @@ -120,8 +120,8 @@ class DailyWord(_PluginBase): "name": "每日一言" }] - @cached(cache=TTLCache(maxsize=1, ttl=43200)) - def __get_youngam(self) -> Optional[dict]: + @lru_cache(maxsize=1) + def __get_youngam(self, **kwargs) -> Optional[dict]: """ 获取每日一言,缓存12小时 """ @@ -174,7 +174,7 @@ class DailyWord(_PluginBase): "border": False } # 获取流行越势数据 - data = self.__get_youngam() + data = self.__get_youngam(today=datetime.now().strftime("%Y-%m-%d")) if not data: elements = [ {