Archived
update: 将代码中的单引号更换为双引号
This commit is contained in:
8 files changed
+67
-67
No files matched your search
+12
-12
@@ -9,7 +9,7 @@
|
||||
from src.db import Database
|
||||
|
||||
|
||||
async def resp(_id: str, length: int = 7, theme: str = 'lewd') -> dict:
|
||||
async def resp(_id: str, length: int = 7, theme: str = "lewd") -> dict:
|
||||
"""
|
||||
generate dict response
|
||||
include all information
|
||||
@@ -22,27 +22,27 @@ async def resp(_id: str, length: int = 7, theme: str = 'lewd') -> dict:
|
||||
times = result[1]
|
||||
str_number = str(times) # 将整形转换为字符串
|
||||
len_number = len(str_number) # 再获取字符串长度
|
||||
g_length = length * '0' # 根据输入的位数来生成0的数量
|
||||
g_length = length * "0" # 根据输入的位数来生成0的数量
|
||||
show_number = str(g_length[:-len_number] + str_number)
|
||||
context = []
|
||||
headers = {'cache-control': 'max-age=0, no-cache, no-store, must-revalidate',
|
||||
'Content-Type': 'image/svg+xml; charset=utf-8'}
|
||||
headers = {"cache-control": "max-age=0, no-cache, no-store, must-revalidate",
|
||||
"Content-Type": "image/svg+xml; charset=utf-8"}
|
||||
data = await Database().query_image(theme)
|
||||
height = data[0][-1]
|
||||
width = data[0][-2]
|
||||
counter = 0
|
||||
for i, n in zip(data, show_number):
|
||||
context.append({
|
||||
'position': i[-2] * counter,
|
||||
'width': i[-2],
|
||||
'height': i[-1],
|
||||
'base64': data[int(n)][1]
|
||||
"position": i[-2] * counter,
|
||||
"width": i[-2],
|
||||
"height": i[-1],
|
||||
"base64": data[int(n)][1]
|
||||
})
|
||||
counter += 1
|
||||
|
||||
return {
|
||||
'context': context,
|
||||
'g_width': length * width,
|
||||
'g_height': height,
|
||||
'headers': headers
|
||||
"context": context,
|
||||
"g_width": length * width,
|
||||
"g_height": height,
|
||||
"headers": headers
|
||||
}
|
||||
Reference in New Issue
Block a user