自动更新模板
This commit is contained in:
parent
8e558396c5
commit
4c05846986
@ -20,7 +20,7 @@ def sync_center():
|
|||||||
:return: 任务列表
|
:return: 任务列表
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
from template import TEMPLATES
|
from template import TEMPLATES, download_template
|
||||||
|
|
||||||
response = session.post(os.getenv('API_ENDPOINT') + "/sync", json={
|
response = session.post(os.getenv('API_ENDPOINT') + "/sync", json={
|
||||||
'accessKey': os.getenv('ACCESS_KEY'),
|
'accessKey': os.getenv('ACCESS_KEY'),
|
||||||
@ -34,10 +34,17 @@ def sync_center():
|
|||||||
data = response.json()
|
data = response.json()
|
||||||
logger.debug("获取任务结果:【%s】", data)
|
logger.debug("获取任务结果:【%s】", data)
|
||||||
if data.get('code', 0) == 200:
|
if data.get('code', 0) == 200:
|
||||||
|
templates = data.get('data', {}).get('templates', [])
|
||||||
tasks = data.get('data', {}).get('tasks', [])
|
tasks = data.get('data', {}).get('tasks', [])
|
||||||
else:
|
else:
|
||||||
tasks = []
|
tasks = []
|
||||||
|
templates = []
|
||||||
logger.warning("获取任务失败")
|
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
|
return tasks
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user