Archived
修复了无法使用的重大bug
This commit is contained in:
3 files changed
+5
-10
No files matched your search
@@ -37,14 +37,13 @@ def build_page(name: str, length: int, theme: str) -> list[bool or Response] or
|
|||||||
"""
|
"""
|
||||||
count = fetch_data(name)
|
count = fetch_data(name)
|
||||||
if len(str(count)) > length: # 判断在数据库内的长度是否超过了设定的(或预设的)长度
|
if len(str(count)) > length: # 判断在数据库内的长度是否超过了设定的(或预设的)长度
|
||||||
print('sdadada')
|
|
||||||
return [False, ErrorProcess().too_lang_to_count(name)]
|
return [False, ErrorProcess().too_lang_to_count(name)]
|
||||||
if 7 <= length <= 10: # 判断设定的长度是否超过阈值
|
if 7 <= length <= 10: # 判断设定的长度是否超过阈值
|
||||||
zero_count = '0' * (length - len(str(count))) + str(count)
|
zero_count = '0' * (length - len(str(count))) + str(count)
|
||||||
status, template = view_template(theme, length, name, zero_count)
|
status, template = view_template(theme, length, name, zero_count)
|
||||||
if status is True:
|
if status is True:
|
||||||
return [True, template]
|
return [True, template]
|
||||||
elif status == 'BadTheme':
|
else:
|
||||||
return [False, 'BadTheme']
|
return [False, 'BadTheme']
|
||||||
else:
|
else:
|
||||||
return [False, 'BadLength']
|
return [False, 'BadLength']
|
||||||
@@ -107,7 +106,7 @@ def main() -> Response or str:
|
|||||||
args = request.args
|
args = request.args
|
||||||
name = str(args.get('name')).replace('None', 'null')
|
name = str(args.get('name')).replace('None', 'null')
|
||||||
theme = args.get('theme')
|
theme = args.get('theme')
|
||||||
length = args.get('length')
|
length = str(args.get('length')).replace('None', '7')
|
||||||
try:
|
try:
|
||||||
length = int(length)
|
length = int(length)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|||||||
+3
-7
@@ -7,13 +7,12 @@
|
|||||||
|
|
||||||
|
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from typing import Tuple
|
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from db.sqlite import fetch_style_data
|
from db.sqlite import fetch_style_data
|
||||||
from db.sqlite import fetch_table
|
from db.sqlite import fetch_table
|
||||||
|
|
||||||
|
|
||||||
def view_template(style: str, length: int, name: str, count: str) -> str or tuple[bool, bool] or tuple[bool, str]:
|
def view_template(style: str, length: int, name: str, count: str) -> str or tuple[bool, str]:
|
||||||
"""
|
"""
|
||||||
渲染模板
|
渲染模板
|
||||||
:param count:
|
:param count:
|
||||||
@@ -23,11 +22,8 @@ def view_template(style: str, length: int, name: str, count: str) -> str or tupl
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
if style not in fetch_table():
|
if style not in fetch_table():
|
||||||
return 'BadLength'
|
return [False, 'BadLength']
|
||||||
try:
|
origin_data = fetch_style_data(style) # 获取数据库内的文件
|
||||||
origin_data = fetch_style_data(style) # 获取数据库内的文件
|
|
||||||
except sqlite3.OperationalError:
|
|
||||||
return False, False
|
|
||||||
context = []
|
context = []
|
||||||
if count != '0000000000':
|
if count != '0000000000':
|
||||||
for i in count: # 通过elif语句依次判断数字
|
for i in count: # 通过elif语句依次判断数字
|
||||||
|
|||||||
BIN
Binary file not shown.
Reference in New Issue
Block a user