From a4a31f14745176cd4007ec90bcd5527f73fdb88a Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Tue, 5 Aug 2025 17:33:42 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(update):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=9B=B4=E6=96=B0=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=9B=B4=E6=96=B0=E8=B7=AF=E5=BE=84=E5=92=8C?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zhenxun/builtin_plugins/__init__.py | 2 +- zhenxun/builtin_plugins/auto_update/__init__.py | 1 - zhenxun/utils/manager/zhenxun_repo_manager.py | 17 ++++++++--------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/zhenxun/builtin_plugins/__init__.py b/zhenxun/builtin_plugins/__init__.py index 825e23b1..4c993c2b 100644 --- a/zhenxun/builtin_plugins/__init__.py +++ b/zhenxun/builtin_plugins/__init__.py @@ -86,7 +86,7 @@ from bag_users t1 @PriorityLifecycle.on_startup(priority=5) async def _(): if not ZhenxunRepoManager.check_resources_exists(): - await ZhenxunRepoManager.resources_update(branch="test") + await ZhenxunRepoManager.resources_update() """签到与用户的数据迁移""" if goods_list := await GoodsInfo.filter(uuid__isnull=True).all(): for goods in goods_list: diff --git a/zhenxun/builtin_plugins/auto_update/__init__.py b/zhenxun/builtin_plugins/auto_update/__init__.py index 0595066c..32040400 100644 --- a/zhenxun/builtin_plugins/auto_update/__init__.py +++ b/zhenxun/builtin_plugins/auto_update/__init__.py @@ -100,7 +100,6 @@ async def _( source_str, # type: ignore zip.result, ) - await MessageUtils.build_message(result).finish(reply_to=True) except Exception as e: logger.error("版本更新失败...", "检查更新", session=session, e=e) await MessageUtils.build_message(f"更新版本失败...e: {e}").finish() diff --git a/zhenxun/utils/manager/zhenxun_repo_manager.py b/zhenxun/utils/manager/zhenxun_repo_manager.py index 046c0200..ecae4669 100644 --- a/zhenxun/utils/manager/zhenxun_repo_manager.py +++ b/zhenxun/utils/manager/zhenxun_repo_manager.py @@ -45,11 +45,11 @@ class ZhenxunRepoConfig: ZHENXUN_BOT_BACKUP_PATH = Path() / "backup" # 需要替换的文件夹 ZHENXUN_BOT_UPDATE_FOLDERS: ClassVar[list[str]] = [ - "builtin_plugins", - "services", - "utils", - "models", - "configs", + "zhenxun/builtin_plugins", + "zhenxun/services", + "zhenxun/utils", + "zhenxun/models", + "zhenxun/configs", ] ZHENXUN_BOT_VERSION_FILE_STRING = "__version__" ZHENXUN_BOT_VERSION_FILE = Path() / ZHENXUN_BOT_VERSION_FILE_STRING @@ -262,11 +262,10 @@ class ZhenxunRepoManagerClass: self.config.ZHENXUN_BOT_UNZIP_PATH / filename, Path() / filename, ) + logger.debug("备份真寻更新文件完成!", LOG_COMMAND) + unzip_dir = next(self.config.ZHENXUN_BOT_UNZIP_PATH.iterdir()) for folder in self.config.ZHENXUN_BOT_UPDATE_FOLDERS: - self.__copy_files( - self.config.ZHENXUN_BOT_UNZIP_PATH / folder, - self.config.ZHENXUN_BOT_CODE_PATH / folder, - ) + self.__copy_files(unzip_dir / folder, Path() / folder) logger.debug("移动真寻更新文件完成!", LOG_COMMAND) if self.config.ZHENXUN_BOT_UNZIP_PATH.exists(): shutil.rmtree(self.config.ZHENXUN_BOT_UNZIP_PATH)