From 1029221fde3bfceb1b39b1b681b5297fe95210b7 Mon Sep 17 00:00:00 2001 From: lookerzz <1031516901@qq.com> Date: Tue, 22 Sep 2026 15:10:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0statistics=20tag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 +- environment.yml | Bin 7994 -> 8042 bytes magic_llm/llm_func.py | 62 +++++++ magic_llm/prom.txt | 371 ++++++++++++++++++++++++++++++++++++++++++ main.py | 5 +- requirements.txt | 2 + 6 files changed, 443 insertions(+), 2 deletions(-) create mode 100644 magic_llm/llm_func.py create mode 100644 magic_llm/prom.txt diff --git a/.gitignore b/.gitignore index b220eb5..3f43128 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ __pycache__/ .venv/ venv/ env/ +.env +.env.local +.local-data-backups/ # IDE .idea/ @@ -20,4 +23,4 @@ Thumbs.db .idea/ .idea.backup/ -.run/ \ No newline at end of file +.run/ diff --git a/environment.yml b/environment.yml index f427ba657a2881b01f37ac19c2e2007c960d1e3d..ed613a4f60479bb7bb35603c86dfa2613d41e018 100644 GIT binary patch delta 38 ucmdmG_sVWVknChFUOrA+1|tSN24e<;$%- students.id + , nullable=False # 不允许为null + ,comment="关联学生id") + employment_status = Column(String(50) + , default="not_started" + ,comment="就业状态:not_started/job_hunting/offered/employed") + employment_open_date = Column(Date + ,comment="就业开放时间") + offer_date = Column(Date + ,comment="offer下发时间") + company_name = Column(String(100) + , comment="就业公司名称") + salary = Column(DECIMAL(10, 2) # 高精度浮点数薪资,最多 10 位数字,小数占 2 位 + , comment="就业薪资") + remark = Column(String(255) + ,default=None + , comment="备注信息") + created_at = Column(DateTime + , default=datetime.now + , comment="创建时间") + updated_at = Column(DateTime + , default=datetime.now + , onupdate=datetime.now + ,comment="更新时间") + is_deleted = Column(SmallInteger + ,default=0 + ,comment="逻辑删除:0正常,1删除") + +class Score(Base): + __tablename__ = "score_info_detail" + id = Column(Integer + , primary_key=True + ,autoincrement=True + ,comment="成绩表序号,自增主键" + ) + student_id = Column(Integer + ,ForeignKey("student_info_detail.id") + ,nullable=False + ,comment="学生学号" + ) + score = Column(DECIMAL(4,1) + ,CheckConstraint("score between 0 and 100") + ) + exam_seq= Column(Integer + , nullable=False + ,comment="考试序次") + __table_args__ = ( + UniqueConstraint("student_id" + , "exam_seq" + , name="uk_student_exam_seq"), + )#学生id和学生姓名应为联合唯一,即一个学生一次考试只能有一个分数 + exam_date=Column(Date + ,default=date.today + ,comment="考试日期" + ) + created_at=Column(DateTime + ,default=datetime.now + ,comment="创建时间" + ) + updated_at=Column(DateTime + ,default=datetime.now + ,onupdate=datetime.now + ,comment="更新时间" + ) + remark=Column(String(225) + ,comment="备注说明" + ) + is_deleted=Column(Integer + ,default=0 + ,comment="逻辑删除标记:未删除0,已删除1" + ) + +class Student(Base): + __tablename__ = 'student_info_detail' + id = Column(Integer + , primary_key=True + , autoincrement=True + , comment = '学生编号,自增主键' + ) + student_no = Column(VARCHAR(50) + ,nullable = True + ,unique = True) + student_name = Column(VARCHAR(50)) + class_id = Column(Integer + ,ForeignKey('class_info_detail.id') + )#外键约束 班级表的主键id,存在这个班级,学生表才可以输入 + consultant_id = Column(Integer + , ForeignKey('consultant_info_detail.id') + ,nullable = True + )#外键约束 顾问表的主键id,存在这个顾问,才可以写入,允许为空 + native_place = Column(VARCHAR(100) + ,nullable = True) + graduation_school = Column(VARCHAR(100) + ,nullable = True) + major = Column(VARCHAR(100) + ,nullable = True) + enrollment_date = Column(Date + ,nullable = False)#入学时间必填 + graduation_date = Column(Date, + nullable = True)#毕业时间可以为空 + education = Column(VARCHAR(50) + ,nullable = True)#学历可以为空 + age = Column(Integer + ,nullable = False) + gender = Column(VARCHAR(10) + ,nullable = False) + create_at = Column(DATETIME + ,default = datetime.now) + update_at = Column(DATETIME + ,default = datetime.now + ,onupdate = datetime.now) + is_deleted = Column(Integer + ,default = 0)#逻辑删除,默认为0,为1则表示已删除 + +class Teacher(Base): + __tablename__ = 'teacher_info_detail' + id = Column( + Integer + , primary_key=True + ,autoincrement=True + ,comment='老师主键') + teacher_no = Column( + VARCHAR(50) + ,nullable=False + ,unique=True + ,comment='老师编号' + ) + teacher_name = Column( + VARCHAR(50) + ,nullable=False + ,comment='老师名字' + ) + phone = Column( + VARCHAR(20) + ,nullable=True + ,comment='老师电话' + ) + email = Column( + VARCHAR(100) + ,nullable=True + ,comment='邮箱' + ) + remark = Column( + VARCHAR(2550) + ,nullable=True + ,comment='备注' + ) + created_at = Column( + DateTime + ,nullable=False + ,default=datetime.now + ,comment='创建时间' + ) + updated_at = Column( + DateTime + ,nullable=False + ,default=datetime.now + ,comment='更新时间' + ) + is_deleted = Column( + TINYINT + ,nullable=False + ,default=0 + ,comment='逻辑删除' + )''' \ No newline at end of file diff --git a/main.py b/main.py index 700b8d4..be226d3 100644 --- a/main.py +++ b/main.py @@ -5,9 +5,11 @@ from api.statistics import statistics_router import uvicorn from api.student import student_router from api.teacher import router as teacher_router,class_teacher_router +from api.magic import magic_router app = FastAPI() app.middleware("http")(log_middleware) +app.include_router(magic_router) #-------------朱婷婷-------------- from api.class_api import classes_router @@ -23,6 +25,7 @@ from api import consultant app.include_router(consultant.router) #-------------张昕浩--------------- app.include_router(example_router) +app.include_router(magic_router) app.include_router(statistics_router, prefix="/statistics") #-------------曾凯--------------- @@ -34,4 +37,4 @@ app.include_router(employment_router, prefix="/employment") #-----------主程序---------------- if __name__ == "__main__": - uvicorn.run(app, host="0.0.0.0", port=23333) \ No newline at end of file + uvicorn.run(app, host="0.0.0.0", port=23333) diff --git a/requirements.txt b/requirements.txt index 0b1a59e..e01d68c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,5 @@ uvicorn==0.40.0 SQLAlchemy==2.0.49 PyMySQL==1.1.2 pydantic==2.13.3 +openai==2.30.0 +python-dotenv==1.2.2