fix: 链接页接单打手ID与指定打手分离,手机号改为选填

This commit is contained in:
XingQue
2026-07-04 00:04:22 +08:00
parent 432387982e
commit 0afeff8227
2 changed files with 8 additions and 5 deletions

View File

@@ -76,11 +76,13 @@ def validate_pdd_order_id(raw: str) -> tuple[bool, str]:
return True, ''
def validate_cn_mobile(raw: str) -> tuple[bool, str]:
"""中国大陆手机号校验。"""
def validate_cn_mobile(raw: str, required: bool = False) -> tuple[bool, str]:
"""中国大陆手机号校验;默认选填,空值通过"""
phone = str(raw or '').strip()
if not phone:
return False, '手机号不能为空'
if required:
return False, '手机号不能为空'
return True, ''
if not re.match(r'^1[3-9]\d{9}$', phone):
return False, '请输入正确的11位中国大陆手机号'
return True, ''