优化数据字段的处理,增加限制条件
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
x-env:
|
x-env:
|
||||||
&template
|
&template
|
||||||
image: fcb_photo_review:1.14.8
|
image: fcb_photo_review:1.14.9
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
x-review:
|
x-review:
|
||||||
|
|||||||
@@ -89,12 +89,16 @@ def handle_date(string):
|
|||||||
def handle_hospital(string):
|
def handle_hospital(string):
|
||||||
if not string:
|
if not string:
|
||||||
return ""
|
return ""
|
||||||
|
# 只允许汉字、数字
|
||||||
|
string = re.sub(r'[^⺀-鿿0-9]', '', string)
|
||||||
return string[:255]
|
return string[:255]
|
||||||
|
|
||||||
|
|
||||||
def handle_department(string):
|
def handle_department(string):
|
||||||
if not string:
|
if not string:
|
||||||
return ""
|
return ""
|
||||||
|
# 只允许汉字
|
||||||
|
string = re.sub(r'[^⺀-鿿]', '', string)
|
||||||
return string[:255]
|
return string[:255]
|
||||||
|
|
||||||
|
|
||||||
@@ -153,6 +157,8 @@ def handle_original_data(string):
|
|||||||
def handle_id(string):
|
def handle_id(string):
|
||||||
if not string:
|
if not string:
|
||||||
return ""
|
return ""
|
||||||
|
# 只允许字母和数字
|
||||||
|
string = re.sub(r'[^0-9a-zA-Z]', '', string)
|
||||||
# 防止过长存入数据库失败
|
# 防止过长存入数据库失败
|
||||||
return string[:50]
|
return string[:50]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user