迁移脚本的一些问题修复
This commit is contained in:
@@ -99,7 +99,10 @@ def prefix_19(iccid: str) -> str:
|
||||
|
||||
|
||||
def validate_iccid_19(iccid_19: str) -> Optional[ValidationError]:
|
||||
"""iccid_19 必须 19 位纯数字。"""
|
||||
"""iccid_19 必须是 19 位。
|
||||
|
||||
奇成历史数据里存在带字母的 ICCID,迁移脚本只校验长度,不强制纯数字。
|
||||
"""
|
||||
if not iccid_19:
|
||||
return ValidationError(code="iccid_19_required", message="iccid_19 不能为空")
|
||||
if len(iccid_19) != 19:
|
||||
@@ -107,13 +110,11 @@ def validate_iccid_19(iccid_19: str) -> Optional[ValidationError]:
|
||||
code="iccid_19_length",
|
||||
message=f"iccid_19 必须是 19 位,当前 {len(iccid_19)} 位",
|
||||
)
|
||||
if not iccid_19.isdigit():
|
||||
return ValidationError(code="iccid_19_format", message="iccid_19 必须是纯数字")
|
||||
return None
|
||||
|
||||
|
||||
def validate_iccid_20(iccid_20: str, iccid_19: str) -> Optional[ValidationError]:
|
||||
"""iccid_20 可空(CTCC 卡);非空时必须 20 位纯数字且前 19 位 == iccid_19。"""
|
||||
"""iccid_20 可空(CTCC 卡);非空时必须 20 位且前 19 位 == iccid_19。"""
|
||||
if not iccid_20:
|
||||
return None
|
||||
if len(iccid_20) != 20:
|
||||
@@ -121,8 +122,6 @@ def validate_iccid_20(iccid_20: str, iccid_19: str) -> Optional[ValidationError]
|
||||
code="iccid_20_length",
|
||||
message=f"iccid_20 必须是 20 位,当前 {len(iccid_20)} 位",
|
||||
)
|
||||
if not iccid_20.isdigit():
|
||||
return ValidationError(code="iccid_20_format", message="iccid_20 必须是纯数字")
|
||||
if iccid_20[:19] != iccid_19:
|
||||
return ValidationError(
|
||||
code="iccid_20_prefix_mismatch",
|
||||
|
||||
Reference in New Issue
Block a user