✨ feat(plugins): Enhance PluginExtraData with ignore_statistics and limits features (#2098)

- Added ignore_statistics field to PluginExtraData to control call statistics.
- Introduced limits parameter in PluginExtraData for rate limiting plugin usage.
- Updated relevant plugins to utilize the new features for better control over plugin statistics and usage limits.
This commit is contained in:
HibiKier
2026-02-06 16:46:01 +08:00
committed by GitHub
parent 5c067bcf04
commit bc8e1659ae
8 changed files with 85 additions and 8 deletions
@@ -7,6 +7,7 @@ from tortoise.exceptions import DoesNotExist
from zhenxun.configs.config import Config
from zhenxun.configs.utils import ConfigGroup
from zhenxun.models.plugin_info import PluginInfo as DbPluginInfo
from zhenxun.services.cache.runtime_cache import PluginInfoMemoryCache
from zhenxun.utils.enum import BlockType, PluginType
from .model import (
@@ -159,6 +160,8 @@ class ApiDataSource:
plugins_to_update_other_fields, list(other_update_fields)
)
bulk_updated_count = len(plugins_to_update_other_fields)
for plugin in plugins_to_update_other_fields:
await PluginInfoMemoryCache.upsert_from_model(plugin)
except Exception as e_bulk:
errors.append(
{
@@ -243,6 +246,8 @@ class ApiDataSource:
updated_count = await DbPluginInfo.filter(menu_type=old_name).update(
menu_type=new_name
)
if updated_count:
await PluginInfoMemoryCache.refresh()
return {"success": True, "updated_count": updated_count}
except Exception as e:
# 可以添加更详细的日志记录