From 4c05846986ed3e718f429a47aebfbd3536eae69c Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Sun, 19 Jan 2025 14:55:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=9B=B4=E6=96=B0=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/api.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/util/api.py b/util/api.py index 5c81907..46c698e 100644 --- a/util/api.py +++ b/util/api.py @@ -20,7 +20,7 @@ def sync_center(): :return: 任务列表 """ try: - from template import TEMPLATES + from template import TEMPLATES, download_template response = session.post(os.getenv('API_ENDPOINT') + "/sync", json={ 'accessKey': os.getenv('ACCESS_KEY'), @@ -34,10 +34,17 @@ def sync_center(): data = response.json() logger.debug("获取任务结果:【%s】", data) if data.get('code', 0) == 200: + templates = data.get('data', {}).get('templates', []) tasks = data.get('data', {}).get('tasks', []) else: tasks = [] + templates = [] logger.warning("获取任务失败") + for template in templates: + template_id = template.get('id', '') + if template_id: + logger.info("更新模板:【%s】", template_id) + download_template(template_id) return tasks