优化数据字段的处理,增加限制条件

This commit is contained in:
2024-12-03 13:12:58 +08:00
parent 8ea5420520
commit be27f753ba
2 changed files with 7 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
x-env:
&template
image: fcb_photo_review:1.14.8
image: fcb_photo_review:1.14.9
restart: always
x-review:

View File

@@ -89,12 +89,16 @@ def handle_date(string):
def handle_hospital(string):
if not string:
return ""
# 只允许汉字、数字
string = re.sub(r'[^⺀-鿿0-9]', '', string)
return string[:255]
def handle_department(string):
if not string:
return ""
# 只允许汉字
string = re.sub(r'[^⺀-鿿]', '', string)
return string[:255]
@@ -153,6 +157,8 @@ def handle_original_data(string):
def handle_id(string):
if not string:
return ""
# 只允许字母和数字
string = re.sub(r'[^0-9a-zA-Z]', '', string)
# 防止过长存入数据库失败
return string[:50]