[Fix]Close #638
This commit is contained in:
parent
38338ddbc0
commit
1307d637ec
@ -8,18 +8,18 @@ import os
|
||||
import decimal
|
||||
import json
|
||||
from datetime import datetime
|
||||
from math import isnan
|
||||
|
||||
|
||||
MAX_NUMBER = 10000000000000
|
||||
MAX_DECIMAL = 4
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def safeUnicode(value):
|
||||
"""检查接口数据潜在的错误,保证转化为的字符串正确"""
|
||||
# 检查是数字接近0时会出现的浮点数上限
|
||||
if type(value) is int or type(value) is float:
|
||||
if value > MAX_NUMBER:
|
||||
if value > MAX_NUMBER or isnan(value):
|
||||
value = 0
|
||||
|
||||
# 检查防止小数点位过多
|
||||
|
Loading…
Reference in New Issue
Block a user