返回 map
This commit is contained in:
		@@ -17,5 +17,6 @@ pool = PooledDB(
 | 
				
			|||||||
    user=MYSQL_USER,
 | 
					    user=MYSQL_USER,
 | 
				
			||||||
    password=MYSQL_PASS,
 | 
					    password=MYSQL_PASS,
 | 
				
			||||||
    database=MYSQL_NAME,
 | 
					    database=MYSQL_NAME,
 | 
				
			||||||
    charset='utf8mb4'
 | 
					    charset='utf8mb4',
 | 
				
			||||||
 | 
					    cursorclass=pymysql.cursors.DictCursor,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -97,12 +97,12 @@ def get_image_type(type:str, id:str, version:str, ext:str):
 | 
				
			|||||||
            if os.path.exists(img_path):
 | 
					            if os.path.exists(img_path):
 | 
				
			||||||
                return Response(content=open(img_path, 'rb').read(), media_type=f"image/{ext}")
 | 
					                return Response(content=open(img_path, 'rb').read(), media_type=f"image/{ext}")
 | 
				
			||||||
            if type == 'ad' or type == 'article' or type == 'article_attribute':
 | 
					            if type == 'ad' or type == 'article' or type == 'article_attribute':
 | 
				
			||||||
                count = cursor.execute(f"SELECT * FROM `web_{type}` WHERE `id`={id}")
 | 
					                count = cursor.execute(f"SELECT image FROM `web_{type}` WHERE `id`={id}")
 | 
				
			||||||
                img = cursor.fetchone()
 | 
					                img = cursor.fetchone()
 | 
				
			||||||
                if img is None:
 | 
					                if img is None:
 | 
				
			||||||
                    print('图片不存在:', count)
 | 
					                    print('图片不存在:', count)
 | 
				
			||||||
                    return Response('图片不存在', status_code=404)
 | 
					                    return Response('图片不存在', status_code=404)
 | 
				
			||||||
                url = img['image']
 | 
					                url = img[0]
 | 
				
			||||||
            elif type == 'url':
 | 
					            elif type == 'url':
 | 
				
			||||||
                id = unquote(id, 'utf-8')
 | 
					                id = unquote(id, 'utf-8')
 | 
				
			||||||
                id = id.replace(' ','+')
 | 
					                id = id.replace(' ','+')
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user