Skip to content

Commit e6a515e

Browse files
committed
更新函数reStructuredText风格文档
1 parent 854a4d8 commit e6a515e

File tree

8 files changed

+19
-2
lines changed

8 files changed

+19
-2
lines changed

backend/app/api/jwt_security.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,19 @@
2424

2525

2626
def get_hash_password(password: str) -> str:
27-
"""使用hash算法加密密码 """
27+
"""
28+
使用hash算法加密密码
29+
30+
:param password:
31+
:return:
32+
"""
2833
return pwd_context.hash(password)
2934

3035

3136
def verity_password(plain_password: str, hashed_password: str) -> bool:
3237
"""
3338
密码校验
39+
3440
:param plain_password: 要验证的密码
3541
:param hashed_password: 要比较的hash密码
3642
:return: 比较密码之后的结果
@@ -41,6 +47,7 @@ def verity_password(plain_password: str, hashed_password: str) -> bool:
4147
def create_access_token(data: Union[int, Any], expires_delta: Union[timedelta, None] = None) -> str:
4248
"""
4349
生成加密 token
50+
4451
:param data: 传进来的值
4552
:param expires_delta: 增加的到期时间
4653
:return: 加密token
@@ -57,6 +64,7 @@ def create_access_token(data: Union[int, Any], expires_delta: Union[timedelta, N
5764
async def get_current_user(db: AsyncSession = Depends(get_db), token: str = Depends(oauth2_schema)) -> User:
5865
"""
5966
通过token获取当前用户
67+
6068
:param db:
6169
:param token:
6270
:return:
@@ -76,6 +84,7 @@ async def get_current_user(db: AsyncSession = Depends(get_db), token: str = Depe
7684
async def get_current_is_superuser(user: User = Depends(get_current_user)) -> User:
7785
"""
7886
通过token验证当前用户权限
87+
7988
:param user:
8089
:return:
8190
"""

backend/app/common/sys_redis.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def __init__(self):
2323
async def init_redis_connect(self):
2424
"""
2525
触发初始化连接
26+
2627
:return:
2728
"""
2829
try:

backend/app/datebase/base_class.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def __tablename__(cls) -> str:
2121
def use_uuid() -> str:
2222
"""
2323
使用uuid
24+
2425
:return:
2526
"""
2627
return uuid.uuid4().hex

backend/app/middleware/access_middle.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class AccessMiddleware(BaseHTTPMiddleware):
1212
"""
1313
记录请求日志
1414
"""
15+
1516
async def dispatch(self, request: Request, call_next) -> Response:
1617
start_time = datetime.now()
1718
response = await call_next(request)

backend/app/utils/encoding_tree.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
def list_to_tree(data_list, parent_id=0) -> list:
77
"""
88
递归获取树形结构数据
9+
910
:param data_list: 数据列表
1011
:param parent_id: 父级id
1112
:return:
@@ -21,6 +22,7 @@ def list_to_tree(data_list, parent_id=0) -> list:
2122
def ram_list_to_tree(data_list: list) -> list:
2223
"""
2324
利用对象内存共享生成树
25+
2426
:param data_list: 数据列表
2527
:return:
2628
"""

backend/app/utils/generate_string.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
def get_uuid() -> str:
77
"""
88
生成uuid
9+
910
:return: str(uuid)
1011
"""
1112
return str(uuid.uuid4())

backend/app/utils/processing_string.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def check_string(pattern, text) -> bool:
1414
def is_mobile(text: str) -> bool:
1515
"""
1616
检查手机号码
17+
1718
:param text:
1819
:return:
1920
"""
@@ -23,6 +24,7 @@ def is_mobile(text: str) -> bool:
2324
def is_wechat(text: str) -> bool:
2425
"""
2526
检查微信号
27+
2628
:param text:
2729
:return:
2830
"""
@@ -32,6 +34,7 @@ def is_wechat(text: str) -> bool:
3234
def is_QQ(text: str) -> bool:
3335
"""
3436
检查QQ号
37+
3538
:param text:
3639
:return:
3740
"""

backend/app/utils/send_email.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def send_email_verification_code(send_to, code, text=SEND_RESET_PASSWORD_TEXT):
3636
smtp = smtplib.SMTP_SSL(host=settings.EMAIL_HOST, port=settings.EMAIL_PORT)
3737
else:
3838
smtp = smtplib.SMTP(host=settings.EMAIL_HOST, port=settings.EMAIL_PORT)
39-
smtp.connect(settings.EMAIL_SERVER)
4039
smtp.login(settings.EMAIL_USER, settings.EMAIL_PASSWORD)
4140
smtp.sendmail(message['from'], send_to, message.as_string())
4241
smtp.quit()

0 commit comments

Comments
 (0)