You've already forked FrameTour-RenderWorker
							
							自动更新模板
This commit is contained in:
		@@ -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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user