⚒️ 重大重构 LoveACE V2
引入了 mongodb 对数据库进行了一定程度的数据加密 性能改善 代码简化 统一错误模型和响应 使用 apifox 作为文档
This commit is contained in:
22
loveace/router/endpoint/aac/model/base.py
Normal file
22
loveace/router/endpoint/aac/model/base.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from pathlib import Path
|
||||
|
||||
from loveace.config.manager import config_manager
|
||||
|
||||
settings = config_manager.get_settings()
|
||||
|
||||
|
||||
class AACConfig:
|
||||
"""AAC 模块配置常量"""
|
||||
|
||||
BASE_URL = "http://api-dekt-ac-acxk-net.vpn2.aufe.edu.cn:8118"
|
||||
WEB_URL = "http://dekt-ac-acxk-net.vpn2.aufe.edu.cn:8118"
|
||||
LOGIN_SERVICE_URL = "http://uaap-aufe-edu-cn.vpn2.aufe.edu.cn:8118/cas/login?service=http%3a%2f%2fapi.dekt.ac.acxk.net%2fUser%2fIndex%2fCoreLoginCallback%3fisCASGateway%3dtrue"
|
||||
RSA_PRIVATE_KEY_PATH = str(
|
||||
Path(settings.app.rsa_protect_key_path).joinpath("aac_private_key.pem")
|
||||
)
|
||||
|
||||
def to_full_url(self, path: str) -> str:
|
||||
"""将路径转换为完整URL"""
|
||||
if path.startswith("http://") or path.startswith("https://"):
|
||||
return path
|
||||
return self.BASE_URL.rstrip("/") + "/" + path.lstrip("/")
|
||||
40
loveace/router/endpoint/aac/model/credit.py
Normal file
40
loveace/router/endpoint/aac/model/credit.py
Normal file
@@ -0,0 +1,40 @@
|
||||
from typing import List
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class LoveACCreditInfo(BaseModel):
|
||||
"""爱安财总分信息"""
|
||||
|
||||
total_score: float = Field(
|
||||
0.0, alias="TotalScore", description="总分,爱安财服务端已四舍五入"
|
||||
)
|
||||
is_type_adopt: bool = Field(
|
||||
False, alias="IsTypeAdopt", description="是否达到毕业要求"
|
||||
)
|
||||
type_adopt_result: str = Field(
|
||||
"", alias="TypeAdoptResult", description="未达到毕业要求的原因"
|
||||
)
|
||||
|
||||
|
||||
class LoveACCreditItem(BaseModel):
|
||||
"""爱安财分数明细条目"""
|
||||
|
||||
id: str = Field("", alias="ID", description="条目ID")
|
||||
title: str = Field("", alias="Title", description="条目标题")
|
||||
type_name: str = Field("", alias="TypeName", description="条目类别名称")
|
||||
user_no: str = Field("", alias="UserNo", description="用户编号,即学号")
|
||||
score: float = Field(0.0, alias="Score", description="分数")
|
||||
add_time: str = Field("", alias="AddTime", description="添加时间")
|
||||
|
||||
|
||||
class LoveACCreditCategory(BaseModel):
|
||||
"""爱安财分数类别"""
|
||||
|
||||
id: str = Field("", alias="ID", description="类别ID")
|
||||
show_num: int = Field(0, alias="ShowNum", description="显示序号")
|
||||
type_name: str = Field("", alias="TypeName", description="类别名称")
|
||||
total_score: float = Field(0.0, alias="TotalScore", description="类别总分")
|
||||
children: List[LoveACCreditItem] = Field(
|
||||
[], alias="children", description="该类别下的分数明细列表"
|
||||
)
|
||||
Reference in New Issue
Block a user