111
This commit is contained in:
parent
17ef776cff
commit
c08d244708
@ -72,15 +72,22 @@ async def check_data(game, data_in: schemas.CheckData):
|
||||
fail_list.append('<p style="color:yellow;font-size:17px;">警告:记录数大于一条</p>')
|
||||
|
||||
for k, t in check_type.items():
|
||||
if isinstance(df[k][0], str) and t == 'json':
|
||||
try:
|
||||
json.loads(df[k][0])
|
||||
pass_list.append(f'<p style="color:green;font-size:17px;">通过:字段{k} 是期望的类型</p>')
|
||||
continue
|
||||
except:
|
||||
if t == 'json':
|
||||
|
||||
if isinstance(df[k][0], str):
|
||||
try:
|
||||
json.loads(df[k][0])
|
||||
pass_list.append(f'<p style="color:green;font-size:17px;">通过:字段{k} 是期望的类型</p>')
|
||||
continue
|
||||
except:
|
||||
fail_list.append(
|
||||
f"""<p style="color:red;font-size:17px;">错误:字段{k} 期望{t}类型,不是json格式</p>""")
|
||||
continue
|
||||
else:
|
||||
fail_list.append(
|
||||
f"""<p style="color:red;font-size:17px;">错误:字段{k} 期望{t}类型,不是json格式</p>""")
|
||||
f"""<p style="color:red;font-size:17px;">错误:字段{k} 期望{t}类型,得到{re.findall("'(.*)'>", str(type(df[k][0])))[0]}</p>""")
|
||||
continue
|
||||
|
||||
if not isinstance(df[k][0], getattr(type_map, t)):
|
||||
fail_list.append(
|
||||
f"""<p style="color:red;font-size:17px;">错误:字段{k} 期望{t}类型,得到->{re.findall("'(.*)'>", str(type(df[k][0])))[0]}</p>""")
|
||||
|
Loading…
Reference in New Issue
Block a user