mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
🔧 移除帮助图片清理功能.
This commit is contained in:
parent
8d8cbf20c3
commit
394ef36424
@ -16,7 +16,7 @@ from zhenxun.utils.platform import PlatformUtils
|
|||||||
|
|
||||||
from ....base_model import Result
|
from ....base_model import Result
|
||||||
from ....config import QueryDateType
|
from ....config import QueryDateType
|
||||||
from ....utils import authentication, clear_help_image, get_system_status
|
from ....utils import authentication, get_system_status
|
||||||
from .data_source import ApiDataSource
|
from .data_source import ApiDataSource
|
||||||
from .model import (
|
from .model import (
|
||||||
ActiveGroup,
|
ActiveGroup,
|
||||||
@ -234,7 +234,6 @@ async def _(param: BotManageUpdateParam):
|
|||||||
bot_data.block_plugins = CommonUtils.convert_module_format(param.block_plugins)
|
bot_data.block_plugins = CommonUtils.convert_module_format(param.block_plugins)
|
||||||
bot_data.block_tasks = CommonUtils.convert_module_format(param.block_tasks)
|
bot_data.block_tasks = CommonUtils.convert_module_format(param.block_tasks)
|
||||||
await bot_data.save(update_fields=["block_plugins", "block_tasks"])
|
await bot_data.save(update_fields=["block_plugins", "block_tasks"])
|
||||||
clear_help_image()
|
|
||||||
return Result.ok()
|
return Result.ok()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"{router.prefix}/update_bot_manage 调用错误", "WebUi", e=e)
|
logger.error(f"{router.prefix}/update_bot_manage 调用错误", "WebUi", e=e)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ from zhenxun.utils.enum import BlockType, PluginType
|
|||||||
from zhenxun.utils.manager.virtual_env_package_manager import VirtualEnvPackageManager
|
from zhenxun.utils.manager.virtual_env_package_manager import VirtualEnvPackageManager
|
||||||
|
|
||||||
from ....base_model import Result
|
from ....base_model import Result
|
||||||
from ....utils import authentication, clear_help_image
|
from ....utils import authentication
|
||||||
from .data_source import ApiDataSource
|
from .data_source import ApiDataSource
|
||||||
from .model import (
|
from .model import (
|
||||||
BatchUpdatePlugins,
|
BatchUpdatePlugins,
|
||||||
@ -82,7 +82,6 @@ async def _() -> Result[PluginCount]:
|
|||||||
async def _(param: UpdatePlugin) -> Result:
|
async def _(param: UpdatePlugin) -> Result:
|
||||||
try:
|
try:
|
||||||
await ApiDataSource.update_plugin(param)
|
await ApiDataSource.update_plugin(param)
|
||||||
clear_help_image()
|
|
||||||
return Result.ok(info="已经帮你写好啦!")
|
return Result.ok(info="已经帮你写好啦!")
|
||||||
except (ValueError, KeyError):
|
except (ValueError, KeyError):
|
||||||
return Result.fail("插件数据不存在...")
|
return Result.fail("插件数据不存在...")
|
||||||
@ -110,7 +109,6 @@ async def _(param: PluginSwitch) -> Result:
|
|||||||
db_plugin.block_type = None
|
db_plugin.block_type = None
|
||||||
db_plugin.status = True
|
db_plugin.status = True
|
||||||
await db_plugin.save()
|
await db_plugin.save()
|
||||||
clear_help_image()
|
|
||||||
return Result.ok(info="成功改变了开关状态!")
|
return Result.ok(info="成功改变了开关状态!")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"{router.prefix}/change_switch 调用错误", "WebUi", e=e)
|
logger.error(f"{router.prefix}/change_switch 调用错误", "WebUi", e=e)
|
||||||
@ -177,7 +175,6 @@ async def _(
|
|||||||
updated_count=result_dict["updated_count"],
|
updated_count=result_dict["updated_count"],
|
||||||
errors=result_dict["errors"],
|
errors=result_dict["errors"],
|
||||||
)
|
)
|
||||||
clear_help_image()
|
|
||||||
return Result.ok(result_model, "插件配置更新完成")
|
return Result.ok(result_model, "插件配置更新完成")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"{router.prefix}/plugins/batch_update 调用错误", "WebUi", e=e)
|
logger.error(f"{router.prefix}/plugins/batch_update 调用错误", "WebUi", e=e)
|
||||||
@ -197,7 +194,6 @@ async def _(payload: RenameMenuTypePayload) -> Result[str]:
|
|||||||
old_name=payload.old_name, new_name=payload.new_name
|
old_name=payload.old_name, new_name=payload.new_name
|
||||||
)
|
)
|
||||||
if result.get("success"):
|
if result.get("success"):
|
||||||
clear_help_image()
|
|
||||||
return Result.ok(
|
return Result.ok(
|
||||||
info=result.get(
|
info=result.get(
|
||||||
"info",
|
"info",
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import psutil
|
|||||||
import ujson as json
|
import ujson as json
|
||||||
|
|
||||||
from zhenxun.configs.config import Config
|
from zhenxun.configs.config import Config
|
||||||
from zhenxun.configs.path_config import DATA_PATH, IMAGE_PATH
|
from zhenxun.configs.path_config import DATA_PATH
|
||||||
|
|
||||||
from .base_model import SystemFolderSize, SystemStatus, User
|
from .base_model import SystemFolderSize, SystemStatus, User
|
||||||
|
|
||||||
@ -68,22 +68,6 @@ def validate_path(path_str: str | None) -> tuple[Path | None, str | None]:
|
|||||||
return None, f"路径验证失败: {e!s}"
|
return None, f"路径验证失败: {e!s}"
|
||||||
|
|
||||||
|
|
||||||
GROUP_HELP_PATH = DATA_PATH / "group_help"
|
|
||||||
SIMPLE_HELP_IMAGE = IMAGE_PATH / "SIMPLE_HELP.png"
|
|
||||||
SIMPLE_DETAIL_HELP_IMAGE = IMAGE_PATH / "SIMPLE_DETAIL_HELP.png"
|
|
||||||
|
|
||||||
|
|
||||||
def clear_help_image():
|
|
||||||
"""清理帮助图片"""
|
|
||||||
if SIMPLE_HELP_IMAGE.exists():
|
|
||||||
SIMPLE_HELP_IMAGE.unlink()
|
|
||||||
if SIMPLE_DETAIL_HELP_IMAGE.exists():
|
|
||||||
SIMPLE_DETAIL_HELP_IMAGE.unlink()
|
|
||||||
for file in GROUP_HELP_PATH.iterdir():
|
|
||||||
if file.is_file():
|
|
||||||
file.unlink()
|
|
||||||
|
|
||||||
|
|
||||||
def get_user(uname: str) -> User | None:
|
def get_user(uname: str) -> User | None:
|
||||||
"""获取账号密码
|
"""获取账号密码
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user