kinit/kinit-api/core/validator.py
ktianc 7fbdcb3b0f 版本升级
1. 新增:微信小程序端新增微信手机号登录功能(必须为企业认证小程序)
2. 新增:加入动态更新常见问题
3. 新增:新增小程序分享功能
4. 新增:小程序新增第一次登录需要修改密码
5. 新增:新增接口权限控制
6. 新增:用户新增is_staff用来判断是否为工作人员
7. 新增:软删除新增is_delete字段来判断,delete_datetime当前主要来记录时间
8. 更新:部分接口删除功能已更新,需要试用软删除的才会试用软删除
9. 更新:更新系统配置缓存功能
10. 更新:接口认证依赖项更新
11. 更新:获取系统基础配置信息与用户协议与隐私协议更新
12. 优化:优化接口与数据库操作
2023-02-27 17:28:27 +08:00

35 lines
773 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/python
# -*- coding: utf-8 -*-
# @version : 1.0
# @Creaet Time : 2021/10/18 22:19
# @File : validator.py
# @IDE : PyCharm
# @desc : pydantic 模型重用验证器
"""
官方文档https://pydantic-docs.helpmanual.io/usage/validators/#reuse-validators
"""
import re
def vali_telephone(value: str) -> str:
"""
手机号验证器
:param value: 手机号
:return: 手机号
"""
if not value or len(value) != 11 or not value.isdigit():
raise ValueError("请输入正确手机号")
REGEX_TELEPHONE = r'^1(3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8[0-9]|9[0-9])\d{8}$'
if not re.match(REGEX_TELEPHONE, value):
raise ValueError("请输入正确手机号")
return value