From 3ed18a297ea56a076021b9c6ddc2fe3ff283b452 Mon Sep 17 00:00:00 2001 From: jieyuu <645634619@qq.com> Date: Mon, 6 Jan 2025 00:30:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(models):=20=E6=B7=BB=E5=8A=A0schemas?= =?UTF-8?q?=EF=BC=8Cmodels=E5=B9=B6=E7=94=9F=E6=88=90=E9=83=A8=E5=88=86=20?= =?UTF-8?q?CRUD=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 mooc/models/__init__.py 中添加了 part3中数据库表的导入 - 新增了 mooc/crud/crud_goouc_fullexam.py 文件,实现了 goouc_fullexam 相关表的 CRUD 接口 - 添加了 Advert、Banji、Banner 等多个模型类的 CRUD 操作方法 --- mooc/crud/crud_goouc_fullexam.py | 207 ++++ mooc/models/__init__.py | 50 +- mooc/models/goouc_fullexam.py | 635 +++++++++++++ mooc/models/goouc_fullexam_user.py | 531 +++++++++++ mooc/schemas/goouc_fullexam.py | 1359 +++++++++++++++++++++++++++ mooc/schemas/goouc_fullexam_user.py | 940 ++++++++++++++++++ 6 files changed, 3721 insertions(+), 1 deletion(-) create mode 100644 mooc/crud/crud_goouc_fullexam.py create mode 100644 mooc/models/goouc_fullexam.py create mode 100644 mooc/models/goouc_fullexam_user.py create mode 100644 mooc/schemas/goouc_fullexam.py create mode 100644 mooc/schemas/goouc_fullexam_user.py diff --git a/mooc/crud/crud_goouc_fullexam.py b/mooc/crud/crud_goouc_fullexam.py new file mode 100644 index 0000000..31d5a0e --- /dev/null +++ b/mooc/crud/crud_goouc_fullexam.py @@ -0,0 +1,207 @@ +from typing import Optional +from sqlalchemy.orm import Session +from mooc.crud.crud_base import CRUDBase + +from mooc.models.goouc_fullexam import (Advert, Banji, Banner, Category, Cdkey, CdkeyCate, Cdkeys, Exercise, Feedback, + Gift, IndexBtn, Knowledge, KnowledgeCate, Notice, Order, Paper, PaperTest, + Phonecode, QYear, School, Setting, ShareRecord, SonSimple, Test, TestType, + TypeCate, + ) +from mooc.schemas.goouc_fullexam import (AdvertUpdate, AdvertCreate, BanjiUpdate, BanjiCreate, BannerCreate, + BannerUpdate, CategoryCreate, CategoryUpdate, CdkeyCreate, CdkeyUpdate, + CdkeyCateCreate, CdkeyCateUpdate, IndexBtnCreate, IndexBtnUpdate, GiftCreate, + GiftUpdate, CdkeysCreate, CdkeysUpdate, ExerciseCreate, ExerciseUpdate, + FeedbackCreate, FeedbackUpdate, TypeCateCreate, TypeCateUpdate, + KnowledgeCreate, KnowledgeUpdate, KnowledgeCateCreate, KnowledgeCateUpdate, + NoticeCreate, NoticeUpdate, OrderCreate, OrderUpdate, PaperCreate, PaperUpdate, + PaperTestCreate, PaperTestUpdate, PhoneCodeUpdate, PhoneCodeCreate, + QYearCreate, QYearUpdate, SchoolCreate, SchoolUpdate, SettingCreate, + SettingUpdate, ShareRecordCreate, ShareRecordUpdate, SonSimpleCreate, + SonSimpleUpdate, TestCreate, TestUpdate, TestTypeCreate, TestTypeUpdate, + ) + + +class CRUDAdvert(CRUDBase[Advert, AdvertCreate, AdvertUpdate]): + + def get_advert(self, db: Session, admin_id: int) -> Optional[Advert]: + return self.get_by_field(db, "id", admin_id) + + +class CRUDBanji(CRUDBase[Banji, BanjiCreate, BanjiUpdate]): + + def get_banji(self, db: Session, banji_id: int) -> Optional[Banji]: + return self.get_by_field(db, "banji_id", banji_id) + + +class CRUDBanner(CRUDBase[Banner, BannerCreate, BannerUpdate]): + + def get_banner(self, db: Session, banner_id: int): + return self.get_by_field(db, "banner_id", banner_id) + + +class CRUDCategory(CRUDBase[Category, CategoryCreate, CategoryUpdate]): + + def get_category(self, db: Session, category_id: int): + return self.get_by_field(db, "category_id", category_id) + + +class CRUDCdkey(CRUDBase[Cdkey, CdkeyCreate, CdkeyUpdate]): + + def get_cdkey(self, db: Session, cdkey_id: int): + return self.get_by_field(db, "cdkey_id", cdkey_id) + + +class CRUDCdkeyCate(CRUDBase[CdkeyCate, CdkeyCateCreate, CdkeyCateUpdate]): + + def get_cdkey_cate(self, db: Session, cdkey_cate_id: int): + return self.get_by_field(db, "cdkey_cate_id", cdkey_cate_id) + + +class CRUDCdkeys(CRUDBase[Cdkeys, CdkeysCreate, CdkeysUpdate]): + + def get_cdkeys(self, db: Session, cdkeys_id: int): + return self.get_by_field(db, "cdkeys_id", cdkeys_id) + + +class CRUDExercise(CRUDBase[Exercise, ExerciseCreate, ExerciseUpdate]): + + def get_exercise(self, db: Session, exercise_id: int): + return self.get_by_field(db, "exercise_id", exercise_id) + + +class CRUDFeedback(CRUDBase[Feedback, FeedbackCreate, FeedbackUpdate]): + + def get_feedback(self, db: Session, feedback_id: int): + return self.get_by_field(db, "feedback_id", feedback_id) + + +class CRUDGift(CRUDBase[Gift, GiftCreate, GiftUpdate]): + + def get_gift(self, db: Session, gift_id: int): + return self.get_by_field(db, "gift_id", gift_id) + + +class CRUDIndexBtn(CRUDBase[IndexBtn, IndexBtnCreate, IndexBtnUpdate]): + + def get_index_btn(self, db: Session, index_btn_id: int): + return self.get_by_field(db, "index_btn_id", index_btn_id) + + +class CRUDKnowledge(CRUDBase[Knowledge, KnowledgeCreate, KnowledgeUpdate]): + + def get_knowledge(self, db: Session, knowledge_id: int): + return self.get_by_field(db, "knowledge_id", knowledge_id) + + +class CRUDKnowledgeCate( + CRUDBase[KnowledgeCate, KnowledgeCateCreate, KnowledgeCateUpdate] +): + + def get_knowledge_cate(self, db: Session, knowledge_cate_id: int): + return self.get_by_field(db, "knowledge_cate_id", knowledge_cate_id) + + +class CRUDNotice(CRUDBase[Notice, NoticeCreate, NoticeUpdate]): + + def get_notice(self, db: Session, notice_id: int): + return self.get_by_field(db, "notice_id", notice_id) + + +class CRUDOrder(CRUDBase[Order, OrderCreate, OrderUpdate]): + + def get_order(self, db: Session, order_id: int): + return self.get_by_field(db, "order_id", order_id) + + +class CRUDPaper(CRUDBase[Paper, PaperCreate, PaperUpdate]): + + def get_paper(self, db: Session, paper_id: int): + return self.get_by_field(db, "paper_id", paper_id) + + +class CRUDPaperTest(CRUDBase[PaperTest, PaperTestCreate, PaperTestUpdate]): + + def get_paper_test(self, db: Session, paper_test_id: int): + return self.get_by_field(db, "paper_test_id", paper_test_id) + + +class CRUDPhonecode(CRUDBase[Phonecode, PhoneCodeCreate, PhoneCodeUpdate]): + + def get_phonecode(self, db: Session, phonecode_id: int): + return self.get_by_field(db, "phonecode_id", phonecode_id) + + +class CRUDQYear(CRUDBase[QYear, QYearCreate, QYearUpdate]): + + def get_qyear(self, db: Session, qyear_id: int): + return self.get_by_field(db, "qyear_id", qyear_id) + + +class CRUDSchool(CRUDBase[School, SchoolCreate, SchoolUpdate]): + + def get_school(self, db: Session, school_id: int): + return self.get_by_field(db, "school_id", school_id) + + +class CRUDSetting(CRUDBase[Setting, SettingCreate, SettingUpdate]): + + def get_setting(self, db: Session, setting_id: int): + return self.get_by_field(db, "setting_id", setting_id) + + +class CRUDShareRecord(CRUDBase[ShareRecord, ShareRecordCreate, ShareRecordUpdate]): + + def get_share_record(self, db: Session, share_record_id: int): + return self.get_by_field(db, "share_record_id", share_record_id) + + +class CRUDsonSimple(CRUDBase[SonSimple, SonSimpleCreate, SonSimpleUpdate]): + + def get_son_simple(self, db: Session, son_simple_id: int): + return self.get_by_field(db, "son_simple_id", son_simple_id) + + +class CRUDTest(CRUDBase[Test, TestCreate, TestUpdate]): + + def get_test(self, db: Session, test_id: int): + return self.get_by_field(db, "test_id", test_id) + + +class CRUDTestType(CRUDBase[TestType, TestTypeCreate, TestTypeUpdate]): + + def get_test_type(self, db: Session, test_type_id: int): + return self.get_by_field(db, "test_type_id", test_type_id) + + +class CRUDTypeCate(CRUDBase[TypeCate, TypeCateCreate, TypeCateUpdate]): + + def get_type_cate(self, db: Session, type_cate_id: int): + return self.get + + +advert = CRUDAdvert(Advert) +banji = CRUDBase(Banji) +banner = CRUDBanner(Banner) +category = CRUDCategory(Category) +cdkey = CRUDCdkey(Cdkey) +cdkeyCate = CRUDCdkeyCate(CdkeyCate) +cdkeys = CRUDCdkeys(Cdkeys) +exercise = CRUDExercise(Exercise) +feedback = CRUDFeedback(Feedback) +gift = CRUDGift(Gift) +indexBtn = CRUDIndexBtn(IndexBtn) +knowledge = CRUDKnowledge(Knowledge) +knowledgeCate = CRUDKnowledgeCate(KnowledgeCate) +notice = CRUDNotice(Notice) +order = CRUDOrder(Order) +paper = CRUDPaper(Paper) +paperTest = CRUDPaperTest(PaperTest) +phonecode = CRUDPhonecode(Phonecode) +qYear = CRUDSchool(School) +school = CRUDSchool(School) +setting = CRUDSetting(Setting) +shareRecord = CRUDShareRecord(ShareRecord) +sonSimple = CRUDsonSimple(SonSimple) +test = CRUDTest(Test) +testType = CRUDTestType(TestType) +typeCate = CRUDTypeCate(TypeCate) diff --git a/mooc/models/__init__.py b/mooc/models/__init__.py index c0b21b2..edfe19e 100644 --- a/mooc/models/__init__.py +++ b/mooc/models/__init__.py @@ -155,7 +155,55 @@ def verify_all_models(): "ims_users_founder_own_create_groups", "ims_users_founder_own_uni_groups", "ims_users_founder_own_users", - "ims_users_founder_own_users_groups" + "ims_users_founder_own_users_groups", + # part 3 + "ims_goouc_fullexam_advert", + "ims_goouc_fullexam_banji", + "ims_goouc_fullexam_banner", + "ims_goouc_fullexam_category", + "ims_goouc_fullexam_cdkey", + "ims_goouc_fullexam_cdkeys", + "ims_goouc_fullexam_cdkey_cate", + "ims_goouc_fullexam_exercise", + "ims_goouc_fullexam_feedback", + "ims_goouc_fullexam_gift", + "ims_goouc_fullexam_index_btn", + "ims_goouc_fullexam_knowledge", + "ims_goouc_fullexam_knowledge_cate", + "ims_goouc_fullexam_notice", + "ims_goouc_fullexam_order", + "ims_goouc_fullexam_paper", + "ims_goouc_fullexam_paper_test", + "ims_goouc_fullexam_phonecode", + "ims_goouc_fullexam_q_year", + "ims_goouc_fullexam_school", + "ims_goouc_fullexam_setting", + "ims_goouc_fullexam_share_record", + "ims_goouc_fullexam_son_simple", + "ims_goouc_fullexam_test", + "ims_goouc_fullexam_test_type", + "ims_goouc_fullexam_type_cate", + "ims_goouc_fullexam_watermark", + "ims_goouc_fullexam_wxtpl", + "ims_goouc_fullexam_xuesheng", + "ims_goouc_fullexam_user", + "ims_goouc_fullexam_user_collection_praction", + "ims_goouc_fullexam_user_doexam", + "ims_goouc_fullexam_user_doother_exam", + "ims_goouc_fullexam_user_doother_exam_answer", + "ims_goouc_fullexam_user_exam_answer", + "ims_goouc_fullexam_user_formid", + "ims_goouc_fullexam_user_gift", + "ims_goouc_fullexam_user_knowledge_cate", + "ims_goouc_fullexam_user_member", + "ims_goouc_fullexam_user_pool", + "ims_goouc_fullexam_user_qhigh", + "ims_goouc_fullexam_user_qintensive", + "ims_goouc_fullexam_user_qtype", + "ims_goouc_fullexam_user_read", + "ims_goouc_fullexam_user_special", + "ims_goouc_fullexam_user_spequence", + "ims_goouc_fullexam_user_wrong_praction", } actual_tables = set(Base.metadata.tables.keys()) diff --git a/mooc/models/goouc_fullexam.py b/mooc/models/goouc_fullexam.py new file mode 100644 index 0000000..b089528 --- /dev/null +++ b/mooc/models/goouc_fullexam.py @@ -0,0 +1,635 @@ +from sqlalchemy import Date, DateTime, Index, String, Text, text, Column, Integer +from sqlalchemy.dialects.mysql import DECIMAL + +from mooc.db.database import Base + + +class Advert(Base): + __tablename__ = 'ims_goouc_fullexam_advert' + __table_args__ = ( + Index('idx_weid', 'weid'), + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False, server_default=text("'0'")) + homeId = Column(String(255), nullable=True, comment='首页广告id') + secondId = Column(String(255), nullable=True, comment='解析页广告id') + createtime = Column(Integer, nullable=True, comment='创建时间') + + class Config: + orm_mode = True + + +class Banji(Base): + __tablename__ = 'ims_goouc_fullexam_banji' + + banji_id = Column(Integer, primary_key=True, index=True) + uidht = Column(Integer, nullable=False) + school_id = Column(Integer, nullable=False) + nianfen_id = Column(Integer, nullable=False) + xdgl_id = Column(Integer, nullable=False) + nid = Column(Integer, nullable=False) + name = Column(String(50), nullable=False) + bname = Column(String(50), nullable=False) + parentid = Column(Integer, nullable=False) + displayorder = Column(Integer, nullable=False) + enabled = Column(Integer, nullable=False) + icon = Column(String(100), nullable=False) + banjikouhao = Column(String(100), nullable=False) + banxun = Column(String(100), nullable=False) + banjimubiao = Column(String(100), nullable=False) + bzrjy = Column(String(200), nullable=False) + description = Column(String(200), nullable=False) + styleid = Column(Integer, nullable=False) + linkurl = Column(String(500), nullable=False) + ishomepage = Column(Integer, nullable=False) + icontype = Column(Integer, nullable=False) + css = Column(String(500), nullable=False) + weid = Column(Integer, nullable=True) + status = Column(Integer, nullable=False, server_default=text("'0'")) + + class Config: + orm_mode = True + + +class Banner(Base): + __tablename__ = 'ims_goouc_fullexam_banner' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '轮播图表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + title = Column(String(255), nullable=False) + image = Column(String(255), nullable=False, comment='图片路径') + createtime = Column(Integer, nullable=False, comment='创建时间') + type = Column(Integer, nullable=False, server_default=text("'1'"), comment='图片跳转方式 1本程序跳转 2外部链接') + link = Column(Text, nullable=True, comment='链接') + status = Column(Integer, nullable=False, server_default=text("'2'"), comment='图片状态 1 显示 2 不显示') + istatus = Column(Integer, nullable=False, server_default=text("'1'"), comment='是否删除的标识') + + class Config: + orm_mode = True + + +class Category(Base): + __tablename__ = 'ims_goouc_fullexam_category' + __table_args__ = ( + Index('idx_name', 'name'), + Index('idx_weid', 'weid'), + {'comment': '分类表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + name = Column(String(255), nullable=False, comment='分类名称') + createtime = Column(Integer, nullable=False, comment='创建时间') + pid = Column(String(255), nullable=False, server_default=text("'0'"), comment='分类父级 默认为顶级分类') + order = Column(Integer, nullable=False, server_default=text("'0'"), comment='分类序号 默认为0') + status = Column(Integer, nullable=False, server_default=text("'1'"), comment='分类核状态 1 显示 2不显示') + istatus = Column(Integer, nullable=False, server_default=text("'1'"), comment='是否删除的标识') + + class Config: + orm_mode = True + + +class Cdkey(Base): + __tablename__ = 'ims_goouc_fullexam_cdkey' + __table_args__ = ( + Index('idx_cid', 'cid'), + Index('idx_weid', 'weid'), + {'comment': '兑换码'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False, server_default=text("'0'")) + cid = Column(Integer, nullable=False, server_default=text("'0'")) + uid = Column(Integer, nullable=False, server_default=text("'0'"), comment='用户id 0未领取') + display = Column(Integer, nullable=False, server_default=text("'1'"), comment='1启用 2作废') + code = Column(String(255), nullable=True, comment='题库') + createtime = Column(Integer, nullable=True, comment='时间') + usetime = Column(Integer, nullable=True, comment='时间') + status = Column(Integer, nullable=True, server_default=text("'1'"), comment='状态 1未使用 2已使用') + kpool = Column(String(2000), nullable=True, comment='到期时间') + day_num = Column(Integer, nullable=True, comment='激活天数') + endtime = Column(Integer, nullable=True) + + class Config: + orm_mode = True + + +class CdkeyCate(Base): + __tablename__ = 'ims_goouc_fullexam_cdkey_cate' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '兑换码'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False, server_default=text("'0'")) + title = Column(String(255), nullable=False) + papers = Column(String(2000), nullable=False, comment='试卷ids') + createtime = Column(Integer, nullable=True, comment='时间') + qpool = Column(String(2000), nullable=True, comment='题库') + kpool = Column(String(2000), nullable=True, comment='知识库') + msg = Column(String(255), nullable=True, comment='提示信息') + status = Column(Integer, nullable=False, server_default=text("'1'"), comment='状态 1启用 2禁用') + is_delete = Column(Integer, nullable=False, server_default=text("'1'"), comment='状态 1正常 2删除') + + class Config: + orm_mode = True + + +class Cdkeys(Base): + __tablename__ = 'ims_goouc_fullexam_cdkeys' + __table_args__ = ( + Index('idx_code_id', 'code_id'), + Index('idx_kpool_id', 'kpool_id'), + Index('idx_weid', 'weid'), + {'comment': '兑换码-题库表'} + ) + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False, server_default=text("'0'")) + code_id = Column(Integer, nullable=False, server_default=text("'0'")) + kpool_id = Column(Integer, nullable=False, server_default=text("'0'"), comment='绑定') + type = Column(Integer, nullable=False, server_default=text("'0'"), comment='绑定类型 1 试卷 2题库') + + class Config: + orm_mode = True + + +class Exercise(Base): + __tablename__ = 'ims_goouc_fullexam_exercise' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '记录练习做的每道题'} + ) + + id = Column(Integer, primary_key=True, index=True) + uid = Column(Integer, nullable=False) + testid = Column(Integer, nullable=False) + isright = Column(Integer, nullable=False) + weid = Column(Integer, nullable=True, server_default=text("'0'")) + test_type = Column(Integer, nullable=True) + uanswer = Column(String(255), nullable=True) + istatus = Column(Integer, nullable=False, server_default=text("'1'")) + createtime = Column(Integer, nullable=True, comment='创建时间') + + class Config: + orm_mode = True + + +class Feedback(Base): + __tablename__ = 'ims_goouc_fullexam_feedback' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '反馈表'} + ) + + id = Column(Integer, primary_key=True, index=True) + uid = Column(Integer, nullable=False) + weid = Column(Integer, nullable=True, server_default=text("'0'")) + testid = Column(Integer, nullable=True) + relation = Column(String(255), nullable=True) + content = Column(Text, nullable=True) + istatus = Column(Integer, nullable=False, server_default=text("'1'")) + createtime = Column(Integer, nullable=True, comment='时间') + + class Config: + orm_mode = True + + +class Gift(Base): + __tablename__ = 'ims_goouc_fullexam_gift' + __table_args__ = ( + Index('idx_weid', 'weid'), + ) + + id = Column(Integer, primary_key=True, index=True, comment='礼品id') + weid = Column(Integer, nullable=False, server_default=text("'0'")) + name = Column(String(100), nullable=False, comment='礼品名称') + price = Column(Integer, nullable=False, server_default=text("'100'"), comment='礼品市场价格') + coins = Column(Integer, nullable=False, server_default=text("'500'"), comment='礼品所需金币') + image = Column(String(255), nullable=False, comment='礼品图片') + about = Column(Text, nullable=False) + + class Config: + orm_mode = True + + +class IndexBtn(Base): + __tablename__ = 'ims_goouc_fullexam_index_btn' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '菜单按钮表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False, server_default=text("'0'")) + doid = Column(Integer, nullable=False, server_default=text("'0'")) + title = Column(String(255), nullable=False) + types = Column(Integer, nullable=False, server_default=text("'1'"), comment='1模块功能 2题库') + library_id = Column(Integer, nullable=False) + icon = Column(String(255), nullable=True, comment='图片路径') + status = Column(Integer, nullable=False, server_default=text("'1'"), comment='图片状态 1 显示 2 不显示') + sort = Column(Integer, nullable=False, server_default=text("'0'"), comment='排序') + + class Config: + orm_mode = True + + +class Knowledge(Base): + __tablename__ = 'ims_goouc_fullexam_knowledge' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '知识点'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + title = Column(String(255), nullable=False) + content = Column(Text, nullable=False, comment='公告内容') + createtime = Column(Integer, nullable=False, comment='创建时间') + one = Column(Integer, nullable=True, server_default=text("'0'"), comment='分类1') + two = Column(Integer, nullable=True, server_default=text("'0'"), comment='分类2') + three = Column(Integer, nullable=True, server_default=text("'0'"), comment='分类3') + status = Column(Integer, nullable=False, server_default=text("'2'"), comment='状态 1显示 2不显示') + istatus = Column(Integer, nullable=False, server_default=text("'1'"), comment='是否删除的标识') + + class Config: + orm_mode = True + + +class KnowledgeCate(Base): + __tablename__ = 'ims_goouc_fullexam_knowledge_cate' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '知识点分类表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + name = Column(String(255), nullable=False, comment='知识点名称') + create_time = Column(Integer, nullable=False, comment='创建时间') + type = Column(Integer, nullable=True, server_default=text("'1'"), comment='分类 1刷知识点 2考前必备') + pid = Column(Integer, nullable=True, server_default=text("'0'"), comment='默认0为顶级分类') + istatus = Column(Integer, nullable=False, server_default=text("'1'"), comment='是否删除的标识') + status = Column(Integer, nullable=False, server_default=text("'1'"), comment='显示隐藏') + price = Column(DECIMAL(10, 2), nullable=True, server_default=text("'0.00'")) + + class Config: + orm_mode = True + + +class Notice(Base): + __tablename__ = 'ims_goouc_fullexam_notice' + __table_args__ = ( + Index('idx_type', 'type'), + Index('idx_weid', 'weid'), + {'comment': '公告表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + type = Column(Integer, nullable=False, comment='公告类型') + title = Column(String(255), nullable=False, comment='公告标题') + content = Column(Text, nullable=False, comment='公告内容') + createtime = Column(Integer, nullable=False, comment='创建时间') + image = Column(String(255), nullable=True, comment='活动公告的图片') + readnum = Column(Integer, nullable=True, server_default=text("'0'"), comment='阅读量') + status = Column(Integer, nullable=False, server_default=text("'2'"), comment='公告状态 1 显示 2 不显示') + istatus = Column(Integer, nullable=False, server_default=text("'1'"), comment='是否删除的标识') + video_audio_id = Column(String(255), nullable=True, comment='音/视频ID') + pcate = Column(Integer, nullable=True, comment='文章所属分类') + ccate = Column(Integer, nullable=True, comment='文章所属子分类') + article_type = Column(Integer, nullable=True, comment='文章的类型1文章2视频') + + class Config: + orm_mode = True + + +class Order(Base): + __tablename__ = 'ims_goouc_fullexam_order' + __table_args__ = ( + Index('idx_dataid', 'dataid'), + Index('idx_out_trade_no', 'out_trade_no'), + Index('idx_transaction_sn', 'transaction_sn'), + Index('idx_weid', 'weid') + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + type = Column(Integer, nullable=False, comment='购买类型 1购买考试 2VIP购买') + out_trade_no = Column(String(255), nullable=False) + userid = Column(Integer, nullable=False) + order_status = Column(Integer, nullable=False, comment='订单状态 0未支付1已支付') + all_money = Column(DECIMAL(10, 2), nullable=False, server_default=text("'0.00'"), comment='总金额') + true_money = Column(DECIMAL(10, 2), nullable=False, comment='实付款') + createtime = Column(Integer, nullable=False) + openid = Column(String(255), nullable=True, comment='购买者的openid') + paytime = Column(Integer, nullable=True) + msg = Column(String(255), nullable=True) + dataid = Column(Integer, nullable=True) + transaction_sn = Column(String(255), nullable=True, comment='第三方流水号') + istatus = Column(Integer, nullable=False, server_default=text("'1'"), comment='订单删除标识') + + class Config: + orm_mode = True + + +class Paper(Base): + __tablename__ = 'ims_goouc_fullexam_paper' + __table_args__ = ( + Index('idx_status', 'status'), + Index('idx_type', 'type'), + Index('idx_weid', 'weid'), + {'comment': '试卷表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + title = Column(String(255), nullable=False, comment='试卷标题') + franction = Column(Text, nullable=False, comment='每个题型有多少 每个题多少分') + createtime = Column(Integer, nullable=False, comment='创建时间') + price = Column(DECIMAL(10, 2), nullable=False, server_default=text("'0.00'"), comment='试卷价格默认0') + times = Column(Integer, nullable=False, comment='试卷时间单位分') + is_repeat = Column(Integer, nullable=False, server_default=text("'2'"), comment='重复答题 1可以 2否') + type = Column(Integer, nullable=True, server_default=text("'1'"), comment='试卷类型') + total_franction = Column(Integer, nullable=True, server_default=text("'0'"), comment='试卷总分值') + status = Column(Integer, nullable=True, server_default=text("'2'"), + comment='试卷状态 默认为2 待完善试卷 1 已完善试卷') + istatus = Column(Integer, nullable=False, server_default=text("'1'"), comment='是否删除的标识') + dnum = Column(Integer, nullable=True, server_default=text("'0'"), comment='做题人数') + displayorder = Column(Integer, nullable=True, server_default=text("'0'"), comment='显示顺序') + + class Config: + orm_mode = True + + +class PaperTest(Base): + __tablename__ = 'ims_goouc_fullexam_paper_test' + __table_args__ = ( + Index('idx_paperid', 'paperid'), + Index('idx_weid', 'weid'), + {'comment': '试卷试题表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + paperid = Column(String(255), nullable=False, comment='试卷标题') + testid = Column(Integer, nullable=False, comment='试题ID') + test_type = Column(Integer, nullable=False, comment='题型类型') + createtime = Column(Integer, nullable=False, comment='创建时间') + istatus = Column(Integer, nullable=False, server_default=text("'1'"), comment='是否删除的标识') + + class Config: + orm_mode = True + + +class Phonecode(Base): + __tablename__ = 'ims_goouc_fullexam_phonecode' + __table_args__ = ( + Index('idx_phone', 'phone'), + {'comment': '手机发送验证码'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + phone = Column(String(11), nullable=False) + code = Column(Integer, nullable=False, comment='手机验证码') + createtime = Column(Integer, nullable=False) + + class Config: + orm_mode = True + + +class QYear(Base): + __tablename__ = 'ims_goouc_fullexam_q_year' + __table_args__ = ( + Index('idx_name', 'name'), + Index('idx_weid', 'weid'), + {'comment': '试题年份表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + name = Column(String(255), nullable=False, comment='年份名称') + createtime = Column(Integer, nullable=False, comment='创建时间') + status = Column(Integer, nullable=True, server_default=text("'1'"), comment='状态 1 显示 2不显示') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='是否删除的标识') + + class Config: + orm_mode = True + + +class School(Base): + __tablename__ = 'ims_goouc_fullexam_school' + + school_id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=True) + school_name = Column(String(200), nullable=True) + school_logo = Column(String(200), nullable=True) + school_info_intro = Column(Text, nullable=True, comment='学校描述') + addtime = Column(Integer, nullable=True) + mu_str = Column(String(30), nullable=True) + status = Column(Integer, nullable=True, server_default=text("'1'")) + line_status = Column(Integer, nullable=True, server_default=text("'1'")) + cookbook_status = Column(Integer, nullable=True, server_default=text("'1'")) + class_notice_status = Column(Integer, nullable=True, server_default=text("'1'"), + comment='班级公告是否需要审核;1=》不需要;2=》需要') + school_type = Column(Integer, nullable=True, server_default=text("'0'")) + host_url = Column(Text, nullable=True, comment='官网地址') + on_school = Column(Integer, nullable=True, server_default=text("'0'"), comment='在校天数') + begin_day = Column(Integer, nullable=True, server_default=text("'0'"), comment='开始上课周数') + am_much = Column(Integer, nullable=True, server_default=text("'0'"), comment='上午课数') + pm_much = Column(Integer, nullable=True, server_default=text("'0'"), comment='下午课数') + ye_much = Column(Integer, nullable=True, server_default=text("'0'"), comment='晚上课数') + line_type = Column(Text, nullable=True, comment='班级圈类别') + appointment = Column(Text, nullable=True, comment='预约类别') + parents = Column(Integer, nullable=True, server_default=text("'3'"), comment='学生可绑定家长数') + add_time = Column(Integer, nullable=True, server_default=text("'0'")) + + class Config: + orm_mode = True + + +class Setting(Base): + __tablename__ = 'ims_goouc_fullexam_setting' + __table_args__ = {'comment': '基础设置表'} + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + info_status = Column(Integer, nullable=False, server_default=text("'1'"), comment='是否必须完善信息1是') + app_id = Column(String(50), nullable=False, comment='微信公众公众号Appid') + app_secret = Column(String(50), nullable=False, comment='微信公众SERECT') + IOS = Column(Integer, nullable=False, server_default=text("'2'"), comment='1开启 2关闭') + customer_service = Column(String(255), nullable=False, comment='客服二维码') + mchid = Column(String(50), nullable=True, comment='微信支付商户ID') + pay_secret = Column(String(50), nullable=True, comment='支付密匙') + pay_open = Column(Integer, nullable=True, server_default=text("'0'"), comment='支付开启 1开启') + signcertpath = Column(String(255), nullable=True, comment='商户CERT证书路径') + signkeypath = Column(String(255), nullable=True, comment='商户KEY证书路径') + AccessKeyId = Column(String(255), nullable=True, comment='阿里云账号') + AccessKeySecret = Column(String(255), nullable=True, comment='阿里云秘钥') + SignName = Column(String(255), nullable=True, comment='阿里云短信签名') + TemplateCode = Column(String(255), nullable=True, comment='阿里云验证码模板id') + RegionId = Column(String(255), nullable=True, comment='阿里云视频点播区域名') + banner_height = Column(Integer, nullable=True, server_default=text("'232'"), comment='轮播图高') + shareupper = Column(Integer, nullable=True, server_default=text("'0'"), comment='每日分享获得积分上限') + share_title = Column(String(255), nullable=True, comment='分享标题') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='是否删除的标识') + is_display = Column(Integer, nullable=True, server_default=text("'1'"), comment='公告是否显示') + display_num = Column(Integer, nullable=True, server_default=text("'5'"), comment='公告显示条数') + use_integral_num = Column(Integer, nullable=True, comment='高频题消耗积分个数') + franction = Column(Text, nullable=True, comment='每个题型有多少每题多少分') + paper_time = Column(Integer, nullable=True, comment='考试时长单位(分)') + reward_integral = Column(Integer, nullable=True, comment='答对一题奖励积分数量') + medal = Column(Text, nullable=True, comment='勋章设置') + share_integral = Column(Integer, nullable=True, comment='每次分享可得积分') + sms_accessKeyId = Column(String(255), nullable=True, comment='短信accesskeyid') + sms_accessKeySecret = Column(String(255), nullable=True, comment='短信accesskeysecret') + about = Column(Text, nullable=True, comment='关于我们') + wechat_number = Column(String(255), nullable=True, comment='商家微信号') + standard = Column(Integer, nullable=True, server_default=text("'5'"), comment='每日答题达标数量') + pass_ = Column('pass', String(255), nullable=True) + good = Column(String(255), nullable=True) + excellent = Column(String(255), nullable=True) + randoms = Column(String(255), nullable=True) + randoms_icon = Column(String(255), nullable=True) + randoms_rule = Column(String(255), nullable=True) + notdone = Column(String(255), nullable=True) + notdone_icon = Column(String(255), nullable=True) + notdone_rule = Column(String(255), nullable=True) + qhig = Column(String(255), nullable=True) + qhig_icon = Column(String(255), nullable=True) + qhig_rule = Column(String(255), nullable=True) + qint = Column(String(255), nullable=True) + qint_icon = Column(String(255), nullable=True) + qint_rule = Column(String(255), nullable=True) + qhot = Column(String(255), nullable=True) + qhot_icon = Column(String(255), nullable=True) + qhot_rule = Column(String(255), nullable=True) + qdiff = Column(String(255), nullable=True) + qdiff_icon = Column(String(255), nullable=True) + qdiff_rule = Column(String(255), nullable=True) + countdown = Column(String(255), nullable=True, comment='事件名称') + countdowntime = Column(DateTime, nullable=True, comment='时间点') + time_display = Column(Integer, nullable=True, server_default=text("'1'"), comment='倒计时显示') + student_open = Column(Integer, nullable=True, server_default=text("'1'"), comment='学生开启 1开启') + freepoolnum = Column(Integer, nullable=True, server_default=text("'0'"), comment='题库体验题数') + freeknowledgenum = Column(Integer, nullable=True, server_default=text("'0'"), comment='知识点体验章数') + + class Config: + orm_mode = True + + +class ShareRecord(Base): + __tablename__ = 'ims_goouc_fullexam_share_record' + __table_args__ = ( + Index('idx_weid', 'weid'), + ) + + id = Column(Integer, primary_key=True, index=True) + uid = Column(Integer, nullable=False) + weid = Column(Integer, nullable=True, server_default=text("'0'")) + num = Column(Integer, nullable=True) + istatus = Column(Integer, nullable=True, server_default=text("'1'")) + day = Column(Date, nullable=True, comment='记录哪一天') + createtime = Column(Integer, nullable=True, comment='创建时间') + + class Config: + orm_mode = True + + +class SonSimple(Base): + __tablename__ = 'ims_goouc_fullexam_son_simple' + + id = Column(Integer, primary_key=True, index=True) + weid = Column(String(150), nullable=False) + son_title = Column(String(255), nullable=False) + + class Config: + orm_mode = True + + +class Test(Base): + __tablename__ = 'ims_goouc_fullexam_test' + __table_args__ = ( + Index('idx_type', 'type'), + Index('idx_weid', 'weid'), + {'comment': '试题表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + type = Column(Integer, nullable=False, comment='试题类型') + title = Column(String(255), nullable=False, comment='试题题目 仅在列表显示 试卷内不显示') + question = Column(Text, nullable=False, comment='题目') + rightkey = Column(Text, nullable=False, comment='正确答案') + analysis = Column(Text, nullable=False, comment='答案解析') + createtime = Column(Integer, nullable=False, comment='创建时间') + son_simple = Column(Integer, nullable=False, server_default=text("'0'")) + libraryid = Column(Integer, nullable=True, server_default=text("'0'"), comment='题库id') + qimage = Column(Text, nullable=True, comment='试题图片') + qaudio = Column(Text, nullable=True, comment='问题音频') + a_type = Column(Integer, nullable=True, server_default=text("'0'"), comment='选项类型') + option = Column(Text, nullable=True, comment='选项') + aimage = Column(Text, nullable=True, comment='解析图片') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='是否删除的标识') + anum = Column(Integer, nullable=True, server_default=text("'0'"), comment='本题答题次数 仅考试') + rnum = Column(Integer, nullable=True, server_default=text("'0'"), comment='正确回答次数 仅考试') + level = Column(Integer, nullable=True, server_default=text("'1'"), comment='难度等级') + qvideo = Column(Text, nullable=True, comment='问题视频') + analysis_audio = Column(Text, nullable=True, comment='音频解析') + knowledge = Column(Text, nullable=True, comment='所属知识点类别') + type_classification = Column(Text, nullable=True, comment='类型分类') + q_year = Column(Text, nullable=True, comment='年份') + pid = Column(Integer, nullable=True, server_default=text("'0'"), comment='问题父id') + son_status = Column(Integer, nullable=True, comment='语音题是否加了小题') + display = Column(Integer, nullable=True, server_default=text("'1'"), comment='1-显示2-不显示') + + class Config: + orm_mode = True + + +class TestType(Base): + __tablename__ = 'ims_goouc_fullexam_test_type' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '试题库表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + name = Column(String(255), nullable=False, comment='试题库名称') + createtime = Column(Integer, nullable=False, comment='创建时间') + display_order = Column(Integer, nullable=False, server_default=text("'0'")) + pid = Column(Integer, nullable=True, server_default=text("'0'"), comment='默认0为顶级分类') + gpid = Column(Integer, nullable=True, server_default=text("'0'"), comment='默认0') + price = Column(DECIMAL(10, 2), nullable=True, server_default=text("'0.00'")) + status = Column(Integer, nullable=True, server_default=text("'1'"), comment='题库状态') + is_student = Column(Integer, nullable=True, server_default=text("'0'"), comment='学员专享 1是') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='是否删除的标识') + + class Config: + orm_mode = True + + +class TypeCate(Base): + __tablename__ = 'ims_goouc_fullexam_type_cate' + __table_args__ = ( + Index('idx_name', 'name'), + Index('idx_weid', 'weid'), + {'comment': '类型分类表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + name = Column(String(255), nullable=False, comment='分类名称') + createtime = Column(Integer, nullable=False, comment='创建时间') + status = Column(Integer, nullable=True, server_default=text("'1'"), comment='状态 1 显示 2不显示') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='是否删除的标识') + + class Config: + orm_mode = True diff --git a/mooc/models/goouc_fullexam_user.py b/mooc/models/goouc_fullexam_user.py new file mode 100644 index 0000000..fec5236 --- /dev/null +++ b/mooc/models/goouc_fullexam_user.py @@ -0,0 +1,531 @@ +from sqlalchemy import CHAR, Float, Index, String, Text, text, Integer, Column +from sqlalchemy.dialects.mysql import DECIMAL + +from mooc.db.database import Base + + +class User(Base): + __tablename__ = 'ims_goouc_fullexam_user' + __table_args__ = ( + Index('idx_openid', 'openid'), + Index('idx_unionid', 'unionid'), + Index('idx_weid', 'weid'), + {'comment': '用户信息表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + openid = Column(String(255), nullable=False, comment='用户标识') + last_login_time = Column(Integer, nullable=False, comment='最近一次登录时间') + createtime = Column(Integer, nullable=False, comment='创建时间') + is_band = Column(Integer, nullable=False, server_default=text("'0'"), comment='是否绑定微信 1是0否') + h5_openid = Column(String(255), nullable=False) + unionid = Column(String(255), nullable=True) + nickname = Column(String(255), nullable=True, comment='用户昵称 可保存特殊符号') + headimg = Column(String(255), nullable=True, comment='用户头像') + name = Column(String(50), nullable=True, comment='用户姓名') + phone = Column(String(11), nullable=True, comment='手机号') + gradeid = Column(Integer, nullable=True, comment='个人信息完善页面 选择年级ID') + classid = Column(Integer, nullable=True, comment='班级考试 参加班级的ID') + groupid = Column(Integer, nullable=True, comment='固定人群组考试 群组ID') + nativeplace = Column(String(255), nullable=True, comment='籍贯') + province = Column(String(255), nullable=True, comment='省') + city = Column(String(255), nullable=True, comment='市') + county = Column(String(255), nullable=True, comment='县') + ismember = Column(Integer, nullable=True, server_default=text("'2'"), comment='是否是会员 1 是会员 2不是') + password = Column(String(255), nullable=True, comment='用户登录密码') + member_endtime = Column(String(255), nullable=True, comment='会员到期时间 ') + status = Column(Integer, nullable=True, server_default=text("'1'"), comment='是否拉黑 ') + integral = Column(Integer, nullable=True, server_default=text("'0'"), comment='用户积分数') + balance = Column(DECIMAL(8, 2), nullable=True, server_default=text("'0.00'"), comment='用户余额') + qrcode = Column(String(255), nullable=True, comment='用户二维码路径') + pid = Column(Integer, nullable=True, server_default=text("'0'"), + comment='用户自己注册 为0 扫描其他人二维码 为二维码人的ID') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='是否删除的标识') + id_card = Column(String(255), nullable=True, comment='身份证号') + student_id = Column(String(200), nullable=True, comment='学号') + school = Column(String(255), nullable=True, comment='学校') + level = Column(Integer, nullable=True, server_default=text("'0'"), comment='用户等级') + grade = Column(String(255), nullable=True, comment='年级') + count_day = Column(Integer, nullable=True, server_default=text("'0'"), comment='累计天数') + + class Config: + orm_mode = True + + +class UserCollectionPraction(Base): + __tablename__ = 'ims_goouc_fullexam_user_collection_praction' + __table_args__ = ( + Index('idx_test_type', 'test_type'), + Index('idx_testid', 'testid'), + Index('idx_uid', 'uid'), + Index('idx_weid', 'weid'), + {'comment': '收藏'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + uid = Column(Integer, nullable=False, comment='用户ID') + testid = Column(Integer, nullable=False, comment='试题ID') + test_type = Column(Integer, nullable=False, comment='试题类型') + createtime = Column(Integer, nullable=False, comment='创建时间') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='删除状态') + iscollect = Column(Integer, nullable=True, server_default=text("'2'")) + + class Config: + orm_mode = True + + +class UserDoexam(Base): + __tablename__ = 'ims_goouc_fullexam_user_doexam' + __table_args__ = ( + Index('idx_examid', 'examid'), + Index('idx_uid', 'uid'), + Index('idx_weid', 'weid'), + {'comment': '用户参加全真考试表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + uid = Column(Integer, nullable=False, comment='用户ID') + examid = Column(Integer, nullable=False, comment='已发布的试卷 考试 或练习的ID') + createtime = Column(Integer, nullable=False, comment='交卷时间') + recordid = Column(Integer, nullable=False, comment='考试记录id') + evaluation = Column(Integer, nullable=False, server_default=text("'2'"), comment='1已评2未评默认2 3批改中') + franction = Column(Integer, nullable=True, server_default=text("'0'"), comment='得分情况') + usetime = Column(String(20), nullable=True, server_default=text("'0'"), comment='考试用时') + level = Column(String(255), nullable=True) + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='删除状态') + + class Config: + orm_mode = True + + +class UserDootherExam(Base): + __tablename__ = 'ims_goouc_fullexam_user_doother_exam' + __table_args__ = ( + Index('idx_uid', 'uid'), + Index('idx_weid', 'weid'), + {'comment': '用户参加其他考试表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + uid = Column(Integer, nullable=False, comment='用户ID') + recordid = Column(Integer, nullable=False, comment='区分是哪一次考试') + createtime = Column(Integer, nullable=False, comment='交卷时间') + franction = Column(Integer, nullable=True, server_default=text("'0'"), comment='得分情况') + usetime = Column(String(20), nullable=True, server_default=text("'0'"), comment='考试用时') + level = Column(String(255), nullable=True) + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='删除状态') + type = Column(Integer, nullable=True, comment='类型2-优先未做3-智能考试') + + class Config: + orm_mode = True + + +class UserDootherExamAnswer(Base): + __tablename__ = 'ims_goouc_fullexam_user_doother_exam_answer' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '用户其他考试答题记录表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + uid = Column(Integer, nullable=False, comment='用户ID') + recordid = Column(Integer, nullable=False, comment='区分是哪一次考试') + testid = Column(Integer, nullable=False, comment='试题id') + test_type = Column(Integer, nullable=False, comment='试题类型') + isright = Column(Integer, nullable=False, comment='是否正确') + createtime = Column(Integer, nullable=False, comment='创建时间') + uanswer = Column(Text, nullable=True, comment='用户答案') + franction = Column(Integer, nullable=True, server_default=text("'0'"), comment='得分情况') + ischeck = Column(Integer, nullable=True, server_default=text("'1'"), comment='是否批改 默认为已批该') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='删除状态') + type = Column(Integer, nullable=True, comment='类型2-优先未做3-智能考试') + + class Config: + orm_mode = True + + +class UserExamAnswer(Base): + __tablename__ = 'ims_goouc_fullexam_user_exam_answer' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '用户参加全真考试表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + uid = Column(Integer, nullable=False, comment='用户ID') + examid = Column(Integer, nullable=False, comment='已发布的试卷 考试 或练习的ID') + testid = Column(Integer, nullable=False, comment='试题id') + test_type = Column(Integer, nullable=False, comment='试题类型') + isright = Column(Integer, nullable=False, comment='是否正确') + createtime = Column(Integer, nullable=False, comment='创建时间') + comments = Column(Text, nullable=False, comment='简答题评语') + simple_evaluation = Column(Integer, nullable=True, server_default=text("'2'"), comment='1已批改默认2未3批改中') + uanswer = Column(Text, nullable=True, comment='用户答案') + franction = Column(Integer, nullable=True, server_default=text("'0'"), comment='得分情况') + ischeck = Column(Integer, nullable=True, server_default=text("'1'"), comment='是否批改 默认为已批该') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='删除状态') + recordid = Column(Integer, nullable=True, comment='考试记录id') + type = Column(Integer, nullable=True, comment='类型只有1-全真') + simple_score = Column(Integer, nullable=True, comment='简答题评分') + + class Config: + orm_mode = True + + +class UserFormid(Base): + __tablename__ = 'ims_goouc_fullexam_user_formid' + __table_args__ = ( + Index('idx_uid', 'uid'), + Index('idx_weid', 'weid'), + {'comment': 'formid表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + uid = Column(Integer, nullable=False, comment='用户ID') + formid = Column(String(255), nullable=False) + createtime = Column(Integer, nullable=False, comment='创建时间') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='删除状态') + + class Config: + orm_mode = True + + +class UserGift(Base): + __tablename__ = 'ims_goouc_fullexam_user_gift' + __table_args__ = ( + Index('idx_uid', 'uid'), + Index('idx_weid', 'weid') + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + uid = Column(Integer, nullable=False) + giftid = Column(Integer, nullable=False) + createtime = Column(Integer, nullable=False) + status = Column(Integer, nullable=True, server_default=text("'0'")) + updatetime = Column(Integer, nullable=True) + consignee_name = Column(String(255), nullable=True, comment='收货人姓名') + consignee_phone = Column(String(255), nullable=True, comment='收货人电话') + consignee_address = Column(String(255), nullable=True, comment='收货人地址') + + class Config: + orm_mode = True + + +class UserKnowledgeCate(Base): + __tablename__ = 'ims_goouc_fullexam_user_knowledge_cate' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '用户知识点库'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + uid = Column(Integer, nullable=False, server_default=text("'0'"), comment='用户id') + createtime = Column(Integer, nullable=False, comment='创建时间') + cate = Column(Integer, nullable=True, server_default=text("'0'"), comment='知识点id') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='是否删除的标识') + + class Config: + orm_mode = True + + +class UserMember(Base): + __tablename__ = 'ims_goouc_fullexam_user_member' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '会员设置表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + createtime = Column(Integer, nullable=False, comment='创建时间') + status = Column(Integer, nullable=True, server_default=text("'2'"), comment='是否开启购买会员') + scale = Column(DECIMAL(8, 2), nullable=True, server_default=text("'1.00'"), comment='折扣比例') + info = Column(Text, nullable=True, comment='详细信息') + price = Column(DECIMAL(8, 2), nullable=True, server_default=text("'0.00'"), comment='VIP单月价格') + istui = Column(Integer, nullable=True, server_default=text("'0'"), comment='推荐购买的') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='删除状态') + + class Config: + orm_mode = True + + +class UserPool(Base): + __tablename__ = 'ims_goouc_fullexam_user_pool' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '用户题库'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + uid = Column(Integer, nullable=False, server_default=text("'0'"), comment='用户id') + createtime = Column(Integer, nullable=False, comment='创建时间') + paperid = Column(Integer, nullable=False, server_default=text("'0'"), comment='试卷id') + poolid = Column(Integer, nullable=True, server_default=text("'0'"), comment='题库id') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='是否删除的标识') + + class Config: + orm_mode = True + + +class UserQhigh(Base): + __tablename__ = 'ims_goouc_fullexam_user_qhigh' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '记录高频上次退出的题id'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + user_id = Column(Integer, nullable=False, comment='用户ID') + question_id = Column(Integer, nullable=False, comment='试题ID') + create_time = Column(Integer, nullable=False, comment='创建时间') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='删除状态') + + class Config: + orm_mode = True + + +class UserQintensive(Base): + __tablename__ = 'ims_goouc_fullexam_user_qintensive' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '记录精编上次退出的题id'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + user_id = Column(Integer, nullable=False, comment='用户ID') + question_id = Column(Integer, nullable=False, comment='试题ID') + create_time = Column(Integer, nullable=False, comment='创建时间') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='删除状态') + + class Config: + orm_mode = True + + +class UserQtype(Base): + __tablename__ = 'ims_goouc_fullexam_user_qtype' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '记录题型退出时题下标'} + ) + + id = Column(Integer, primary_key=True, index=True) + uid = Column(Integer, nullable=False) + type_id = Column(Integer, nullable=False) + weid = Column(Integer, nullable=True, server_default=text("'0'")) + last_id = Column(Integer, nullable=True) + istatus = Column(Integer, nullable=True, server_default=text("'1'")) + createtime = Column(Integer, nullable=True, comment='时间') + + class Config: + orm_mode = True + + +class UserRead(Base): + __tablename__ = 'ims_goouc_fullexam_user_read' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '用户阅读公告 文章 活动表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + uid = Column(Integer, nullable=False, comment='用户ID') + noticeid = Column(Integer, nullable=False, comment='公告 活动 文章 ID') + createtime = Column(Integer, nullable=False, comment='创建时间') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='删除状态') + + class Config: + orm_mode = True + + +class UserSpecial(Base): + __tablename__ = 'ims_goouc_fullexam_user_special' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '记录知识点退出时题下标'} + ) + + id = Column(Integer, primary_key=True, index=True) + uid = Column(Integer, nullable=False) + special_id = Column(Integer, nullable=False) + weid = Column(Integer, nullable=True, server_default=text("'0'")) + last_id = Column(Integer, nullable=True) + istatus = Column(Integer, nullable=True, server_default=text("'1'")) + createtime = Column(Integer, nullable=True, comment='时间') + + class Config: + orm_mode = True + + +class UserSpequence(Base): + __tablename__ = 'ims_goouc_fullexam_user_spequence' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '记录顺序上次退出的下标id'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + user_id = Column(Integer, nullable=False, comment='用户ID') + question_id = Column(Integer, nullable=False, comment='下标ID,这儿是顺序id') + create_time = Column(Integer, nullable=False, comment='创建时间') + lib_id = Column(Integer, nullable=True, comment='题库id') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='删除状态') + + class Config: + orm_mode = True + + +class UserWrongPraction(Base): + __tablename__ = 'ims_goouc_fullexam_user_wrong_praction' + __table_args__ = ( + Index('idx_test_type', 'test_type'), + Index('idx_testid', 'testid'), + Index('idx_uid', 'uid'), + Index('idx_weid', 'weid'), + {'comment': '错题集,错题收藏'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + uid = Column(Integer, nullable=False, comment='用户ID') + testid = Column(Integer, nullable=False, comment='试题ID') + test_type = Column(Integer, nullable=False, comment='试题类型') + createtime = Column(Integer, nullable=False, comment='创建时间') + uanswer = Column(Text, nullable=True, comment='用户答案') + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='删除状态') + iscollect = Column(Integer, nullable=True, server_default=text("'2'")) + + class Config: + orm_mode = True + + +class Watermark(Base): + __tablename__ = 'ims_goouc_fullexam_watermark' + __table_args__ = {'comment': '水印配置表'} + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + type = Column(Integer, nullable=False, comment='1个人信息 2为自定义') + open = Column(Integer, nullable=False, server_default=text("'2'"), comment='1打开水印 2关闭水印') + content = Column(String(1024), nullable=False, comment='水印内容') + size = Column(Integer, nullable=False, comment='字体大小') + rotate = Column(Integer, nullable=False, comment='旋转度数') + transparent = Column(Integer, nullable=False, comment='透明度') + local_type = Column(Integer, nullable=False, comment='1预设 2为自定义 生效位置类型') + presupposition = Column(Integer, nullable=False, comment='预设类型') + horizontal = Column(Integer, nullable=False, comment='水平距离') + vertical = Column(Integer, nullable=False, comment='垂直距离') + + class Config: + orm_mode = True + + +class Wxtpl(Base): + __tablename__ = 'ims_goouc_fullexam_wxtpl' + __table_args__ = ( + Index('idx_weid', 'weid'), + {'comment': '模板消息表'} + ) + + id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + type = Column(Integer, nullable=False) + tplid = Column(String(255), nullable=False) + createtime = Column(Integer, nullable=False, comment='创建时间') + keyword1 = Column(String(255), nullable=True) + keyword2 = Column(String(255), nullable=True) + keyword3 = Column(String(255), nullable=True) + istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='删除状态') + + class Config: + orm_mode = True + + +class Xuesheng(Base): + __tablename__ = 'ims_goouc_fullexam_xuesheng' + + xuesheng_id = Column(Integer, primary_key=True, index=True) + weid = Column(Integer, nullable=False) + uidht = Column(Integer, nullable=False) + school_id = Column(Integer, nullable=False) + nianfen_id = Column(Integer, nullable=False) + banji_id = Column(Integer, nullable=False) + banjixs_id = Column(Integer, nullable=False) + xiaozu_id = Column(Integer, nullable=False) + xiaozuxs_id = Column(Integer, nullable=False) + sflx = Column(Integer, nullable=False) + bjcsjf = Column(Float, nullable=False, server_default=text("'0.00'")) + bjzf = Column(Float, nullable=False, server_default=text("'0.00'")) + displayorder = Column(Integer, nullable=False) + pic = Column(Text, nullable=False) + sex = Column(Text, nullable=False) + jiguan = Column(Text, nullable=False) + minzu = Column(Text, nullable=False) + sfzhm = Column(Text, nullable=False) + qq = Column(String(255), nullable=False) + phone = Column(String(255), nullable=False) + yzm = Column(String(225), nullable=False) + updatetime = Column(Integer, nullable=False) + beizhu = Column(Text, nullable=False) + addtime = Column(Integer, nullable=False) + openid = Column(String(255), nullable=False) + openid1 = Column(String(255), nullable=False) + openid2 = Column(String(255), nullable=False) + openid3 = Column(String(255), nullable=False) + openid4 = Column(String(255), nullable=False) + openid5 = Column(String(255), nullable=False) + openid6 = Column(String(255), nullable=False) + openid7 = Column(String(255), nullable=False) + openid8 = Column(String(255), nullable=False) + sflx1 = Column(Integer, nullable=False) + sflx2 = Column(Integer, nullable=False) + sflx3 = Column(Integer, nullable=False) + sflx4 = Column(Integer, nullable=False) + sflx5 = Column(Integer, nullable=False) + sflx6 = Column(Integer, nullable=False) + sflx7 = Column(Integer, nullable=False) + sflx8 = Column(Integer, nullable=False) + nid = Column(Integer, nullable=False) + name = Column(String(50), nullable=False) + parentid = Column(Integer, nullable=False) + enabled = Column(Integer, nullable=False) + icon = Column(String(100), nullable=False) + description = Column(String(100), nullable=False) + styleid = Column(Integer, nullable=False) + linkurl = Column(String(500), nullable=False) + ishomepage = Column(Integer, nullable=False) + icontype = Column(Integer, nullable=False) + css = Column(String(500), nullable=False) + student_name = Column(CHAR(20), nullable=True) + gxuehao = Column(CHAR(25), nullable=True) + xxuehao = Column(CHAR(25), nullable=True) + zxxuehao = Column(CHAR(25), nullable=True) + student_img = Column(CHAR(60), nullable=True) + parent_name = Column(CHAR(20), nullable=True) + parent_phone = Column(CHAR(20), nullable=True) + address = Column(String(255), nullable=True) + uid = Column(Integer, nullable=True, server_default=text("'0'")) + uid1 = Column(Integer, nullable=True, server_default=text("'0'")) + uid2 = Column(Integer, nullable=True, server_default=text("'0'")) + uid3 = Column(Integer, nullable=True, server_default=text("'0'")) + uid4 = Column(Integer, nullable=True, server_default=text("'0'")) + uid5 = Column(Integer, nullable=True, server_default=text("'0'")) + uid6 = Column(Integer, nullable=True, server_default=text("'0'")) + uid7 = Column(Integer, nullable=True, server_default=text("'0'")) + uid8 = Column(Integer, nullable=True, server_default=text("'0'")) + + class Config: + orm_mode = True diff --git a/mooc/schemas/goouc_fullexam.py b/mooc/schemas/goouc_fullexam.py new file mode 100644 index 0000000..1967675 --- /dev/null +++ b/mooc/schemas/goouc_fullexam.py @@ -0,0 +1,1359 @@ +from pydantic import BaseModel, Field +from datetime import datetime +from typing import Optional, List +from decimal import Decimal +from datetime import date + + +# 广告 +class AdvertBase(BaseModel): + weid: Optional[int] = Field(0, ge=0, description="站点 ID") + homeId: Optional[str] = Field(None, max_length=255, description="首页广告id") + secondId: Optional[str] = Field(None, max_length=255, description="解析页广告id") + createtime: Optional[int] = Field(None, description="创建时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class AdvertCreate(AdvertBase): + pass + + +class AdvertUpdate(AdvertBase): + weid: Optional[int] = None + homeId: Optional[str] = None + secondId: Optional[str] = None + createtime: Optional[int] = None + + +class AdvertInDB(AdvertBase): + id: int + createtime: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int) and obj.createtime is not None: + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + +class AdvertResponse(AdvertInDB): + pass + + +class AdvertListResponse(BaseModel): + data: List[AdvertResponse] + + +# 班级 +class BanjiBase(BaseModel): + weid: Optional[int] = None + uidht: int + school_id: int + nianfen_id: int + xdgl_id: int + nid: int + name: str + bname: str + parentid: int + displayorder: int + enabled: bool + icon: str + banjikouhao: str + banxun: str + banjimubiao: str + bzrjy: str + description: str + styleid: int + linkurl: str + ishomepage: bool + status: Optional[int] = 0 + icontype: bool + css: str + + class Config: + orm_mode = True + + +class BanjiCreate(BanjiBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class BanjiUpdate(BanjiBase): + # 允许部分更新,所以所有字段都是可选的 + weid: Optional[int] = None + uidht: Optional[int] = None + school_id: Optional[int] = None + nianfen_id: Optional[int] = None + xdgl_id: Optional[int] = None + nid: Optional[int] = None + name: Optional[str] = None + bname: Optional[str] = None + parentid: Optional[int] = None + displayorder: Optional[int] = None + enabled: Optional[bool] = None + icon: Optional[str] = None + banjikouhao: Optional[str] = None + banxun: Optional[str] = None + banjimubiao: Optional[str] = None + bzrjy: Optional[str] = None + description: Optional[str] = None + styleid: Optional[int] = None + linkurl: Optional[str] = None + ishomepage: Optional[bool] = None + status: Optional[int] = None + icontype: Optional[bool] = None + css: Optional[str] = None + + +class BanjiInDB(BanjiBase): + banji_id: int + + class Config: + orm_mode = True + + +# 轮播图 +class BannerBase(BaseModel): + weid: int + title: str = Field(..., max_length=255) + image: str = Field(..., max_length=255, description="图片路径") + type: Optional[int] = Field(1, ge=1, le=2, description="图片跳转方式 1本程序跳转 2外部链接") + link: Optional[str] = None + status: Optional[int] = Field(2, ge=1, le=2, description="图片状态 1 显示 2 不显示") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + istatus: Optional[int] = Field(1, ge=1, le=2, description="是否删除的标识") + + class Config: + orm_mode = True + + +class BannerCreate(BannerBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class BannerUpdate(BannerBase): + weid: Optional[int] = None + title: Optional[str] = None + image: Optional[str] = None + type: Optional[int] = None + link: Optional[str] = None + status: Optional[int] = None + createtime: Optional[int] = None + istatus: Optional[int] = None + + +class BannerInDB(BannerBase): + id: int + + class Config: + orm_mode = True + + +class BannerResponse(BannerInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class BannerListResponse(BaseModel): + data: List[BannerResponse] + + +class CategoryBase(BaseModel): + weid: int + name: str = Field(..., max_length=255, description="分类名称") + pid: Optional[str] = Field("0", max_length=255, description="分类父级,默认为顶级分类") + order: Optional[int] = Field(0, ge=0, le=99999, description="分类序号,默认为0") + status: Optional[int] = Field(1, ge=1, le=2, description="分类状态 1 显示 2 不显示") + istatus: Optional[int] = Field(1, ge=1, le=2, description="是否删除的标识") + + class Config: + orm_mode = True + + +class CategoryCreate(CategoryBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class CategoryUpdate(CategoryBase): + weid: Optional[int] = None + name: Optional[str] = None + pid: Optional[str] = None + order: Optional[int] = None + status: Optional[int] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + + class Config: + orm_mode = True + + +class CategoryInDB(CategoryBase): + id: int + + createtime: int = Field(..., description="创建时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class CategoryResponse(CategoryInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class CategoryListResponse(BaseModel): + data: List[CategoryResponse] + + +# 兑换码 +class CdkeyBase(BaseModel): + weid: int = Field(..., description="站点 ID") + cid: int = Field(..., description="分类 ID") + code: Optional[str] = Field(None, max_length=255, description="题库代码") + uid: int = Field(0, ge=0, description="用户 ID,默认为0表示未领取") + createtime: Optional[int] = Field(None, description="创建时间,Unix 时间戳") + usetime: Optional[int] = Field(None, description="使用时间,Unix 时间戳") + status: Optional[int] = Field(1, ge=1, le=2, description="状态 1未使用 2已使用") + kpool: Optional[str] = Field(None, max_length=2000, description="到期时间或相关数据") + display: int = Field(1, ge=1, le=2, description="启用状态 1启用 2作废") + day_num: Optional[int] = Field(None, ge=0, description="激活天数") + endtime: Optional[int] = Field(None, description="结束时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class CdkeyCreate(CdkeyBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class CdkeyUpdate(CdkeyBase): + weid: Optional[int] = None + cid: Optional[int] = None + code: Optional[str] = None + uid: Optional[int] = None + createtime: Optional[int] = None + usetime: Optional[int] = None + status: Optional[int] = None + kpool: Optional[str] = None + display: Optional[int] = None + day_num: Optional[int] = None + endtime: Optional[int] = None + + +class CdkeyInDB(CdkeyBase): + id: int + + class Config: + orm_mode = True + + +class CdkeyResponse(CdkeyInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class CdkeyListResponse(BaseModel): + data: List[CdkeyResponse] + + +class CdkeyCateBase(BaseModel): + weid: int = Field(..., description="站点 ID") + title: str = Field(..., max_length=255, description="分类标题") + createtime: Optional[int] = Field(None, description="创建时间,Unix 时间戳") + qpool: Optional[str] = Field(None, max_length=2000, description="题库") + kpool: Optional[str] = Field(None, max_length=2000, description="知识库") + msg: Optional[str] = Field(None, max_length=255, description="提示信息") + status: Optional[int] = Field(1, ge=1, le=2, description="状态 1启用 2禁用") + is_delete: Optional[int] = Field(1, ge=1, le=2, description="删除状态 1正常 2删除") + papers: str = Field(..., max_length=2000, description="试卷 IDs") + + class Config: + orm_mode = True + + +class CdkeyCateCreate(CdkeyCateBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class CdkeyCateUpdate(CdkeyCateBase): + weid: Optional[int] = None + title: Optional[str] = None + createtime: Optional[int] = None + qpool: Optional[str] = None + kpool: Optional[str] = None + msg: Optional[str] = None + status: Optional[int] = None + is_delete: Optional[int] = None + papers: Optional[str] = None + + +class CdkeyCateInDB(CdkeyCateBase): + id: int + + class Config: + orm_mode = True + + +class CdkeyCateResponse(CdkeyCateInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class CdkeyCateListResponse(BaseModel): + data: List[CdkeyCateResponse] + + +class CdkeysBase(BaseModel): + weid: int = Field(..., description="站点 ID") + code_id: int = Field(..., ge=0, description="兑换码 ID") + kpool_id: int = Field(..., ge=0, description="绑定对象 ID(试卷或题库)") + type: int = Field(0, ge=0, le=2, description="绑定类型 1 试卷 2 题库") + + class Config: + orm_mode = True + + +class CdkeysCreate(CdkeysBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class CdkeysUpdate(CdkeysBase): + weid: Optional[int] = None + code_id: Optional[int] = None + kpool_id: Optional[int] = None + type: Optional[int] = None + + +class CdkeysInDB(CdkeysBase): + id: int + + class Config: + orm_mode = True + + +class CdkeysResponse(CdkeysInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class CdkeysListResponse(BaseModel): + data: List[CdkeysResponse] + + +# 练习 +class ExerciseBase(BaseModel): + weid: Optional[int] = Field(0, ge=0, description="站点 ID,默认为0") + uid: int = Field(..., ge=0, description="用户 ID") + testid: int = Field(..., ge=0, description="测试题 ID") + test_type: Optional[int] = Field(None, description="测试类型") + uanswer: Optional[str] = Field(None, max_length=255, description="用户答案") + istatus: Optional[int] = Field(1, ge=1, le=2, description="状态 1有效 2无效") + createtime: Optional[int] = Field(None, description="创建时间,Unix 时间戳") + isright: int = Field(..., ge=0, le=1, description="是否正确 1正确 0错误") + + class Config: + orm_mode = True + + +class ExerciseCreate(ExerciseBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class ExerciseUpdate(ExerciseBase): + weid: Optional[int] = None + uid: Optional[int] = None + testid: Optional[int] = None + test_type: Optional[int] = None + uanswer: Optional[str] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + isright: Optional[int] = None + + +class ExerciseInDB(ExerciseBase): + id: int + + class Config: + orm_mode = True + + +class ExerciseResponse(ExerciseInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class ExerciseListResponse(BaseModel): + data: List[ExerciseResponse] + + +class FeedbackBase(BaseModel): + weid: Optional[int] = Field(0, ge=0, description="站点 ID,默认为0") + uid: int = Field(..., ge=0, description="用户 ID") + testid: Optional[int] = Field(None, ge=0, description="测试题 ID") + relation: Optional[str] = Field(None, max_length=255, description="关联信息") + content: Optional[str] = Field(None, description="反馈内容") + istatus: Optional[int] = Field(1, ge=1, le=2, description="状态 1有效 2无效") + createtime: Optional[int] = Field(None, description="创建时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class FeedbackCreate(FeedbackBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class FeedbackUpdate(FeedbackBase): + weid: Optional[int] = None + uid: Optional[int] = None + testid: Optional[int] = None + relation: Optional[str] = None + content: Optional[str] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + + +class FeedbackInDB(FeedbackBase): + id: int + + class Config: + orm_mode = True + + +class FeedbackResponse(FeedbackInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class FeedbackListResponse(BaseModel): + data: List[FeedbackResponse] + + +class GiftBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID,默认为0") + name: str = Field(..., max_length=100, description="礼品名称") + price: int = Field(100, ge=0, description="礼品市场价格,默认为100") + coins: int = Field(500, ge=0, description="礼品所需金币,默认为500") + image: str = Field(..., max_length=255, description="礼品图片路径") + about: str = Field(..., description="礼品描述") + + class Config: + orm_mode = True + + +class GiftCreate(GiftBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class GiftUpdate(GiftBase): + weid: Optional[int] = None + name: Optional[str] = None + price: Optional[int] = None + coins: Optional[int] = None + image: Optional[str] = None + about: Optional[str] = None + + +class GiftInDB(GiftBase): + id: int + + class Config: + orm_mode = True + + +class GiftResponse(GiftInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class GiftListResponse(BaseModel): + data: List[GiftResponse] + + +class IndexBtnBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID,默认为0") + doid: int = Field(..., ge=0, description="操作 ID,默认为0") + title: str = Field(..., max_length=255, description="按钮标题") + icon: Optional[str] = Field(None, max_length=255, description="图片路径") + status: Optional[int] = Field(1, ge=1, le=2, description="显示状态 1 显示 2 不显示") + sort: Optional[int] = Field(0, ge=0, description="排序,默认为0") + types: int = Field(1, ge=1, le=2, description="类型 1模块功能 2题库") + library_id: int = Field(..., ge=0, description="关联的题库或模块 ID") + + class Config: + orm_mode = True + + +class IndexBtnCreate(IndexBtnBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class IndexBtnUpdate(IndexBtnBase): + weid: Optional[int] = None + doid: Optional[int] = None + title: Optional[str] = None + icon: Optional[str] = None + status: Optional[int] = None + sort: Optional[int] = None + types: Optional[int] = None + library_id: Optional[int] = None + + +class IndexBtnInDB(IndexBtnBase): + id: int + + class Config: + orm_mode = True + + +class IndexBtnResponse(IndexBtnInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class IndexBtnListResponse(BaseModel): + data: List[IndexBtnResponse] + + +class KnowledgeBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + one: Optional[int] = Field(0, ge=0, description="一级分类,默认为0") + two: Optional[int] = Field(0, ge=0, description="二级分类,默认为0") + three: Optional[int] = Field(0, ge=0, description="三级分类,默认为0") + title: str = Field(..., max_length=255, description="知识点标题") + content: str = Field(..., description="知识点内容") + status: Optional[int] = Field(2, ge=1, le=2, description="显示状态 1显示 2不显示,默认为2") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + istatus: Optional[int] = Field(1, ge=1, le=2, description="删除标识 1正常 2删除,默认为1") + + class Config: + orm_mode = True + + +class KnowledgeCreate(KnowledgeBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class KnowledgeUpdate(KnowledgeBase): + weid: Optional[int] = None + one: Optional[int] = None + two: Optional[int] = None + three: Optional[int] = None + title: Optional[str] = None + content: Optional[str] = None + status: Optional[int] = None + createtime: Optional[int] = None + istatus: Optional[int] = None + + +class KnowledgeInDB(KnowledgeBase): + id: int + + class Config: + orm_mode = True + + +class KnowledgeResponse(KnowledgeInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class KnowledgeListResponse(BaseModel): + data: List[KnowledgeResponse] + + +class KnowledgeCateBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + name: str = Field(..., max_length=255, description="知识点分类名称") + type: Optional[int] = Field(1, ge=1, le=2, description="分类类型 1刷知识点 2考前必备,默认为1") + pid: Optional[int] = Field(0, ge=0, description="父级分类 ID,默认为0表示顶级分类") + istatus: Optional[int] = Field(1, ge=1, le=2, description="删除标识 1正常 2删除,默认为1") + status: Optional[int] = Field(1, ge=1, le=2, description="显示状态 1显示 2隐藏,默认为1") + price: Decimal = Field(Decimal('0.00'), ge=0, description="价格,默认为0.00") + create_time: int = Field(..., description="创建时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class KnowledgeCateCreate(KnowledgeCateBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class KnowledgeCateUpdate(KnowledgeCateBase): + weid: Optional[int] = None + name: Optional[str] = None + type: Optional[int] = None + pid: Optional[int] = None + istatus: Optional[int] = None + status: Optional[int] = None + price: Optional[Decimal] = None + create_time: Optional[int] = None + + +class KnowledgeCateInDB(KnowledgeCateBase): + id: int + + class Config: + orm_mode = True + + +class KnowledgeCateResponse(KnowledgeCateInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class KnowledgeCateListResponse(BaseModel): + data: List[KnowledgeCateResponse] + + +class NoticeBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + type: int = Field(..., ge=1, le=2, description="公告类型,默认值需在数据库中明确") + title: str = Field(..., max_length=255, description="公告标题") + content: str = Field(..., description="公告内容") + image: Optional[str] = Field(None, max_length=255, description="活动公告的图片路径") + readnum: Optional[int] = Field(0, ge=0, description="阅读量,默认为0") + status: Optional[int] = Field(2, ge=1, le=2, description="公告状态 1显示 2不显示,默认为2") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + istatus: Optional[int] = Field(1, ge=1, le=2, description="删除标识 1正常 2删除,默认为1") + video_audio_id: Optional[str] = Field(None, max_length=255, description="音/视频ID") + pcate: Optional[int] = Field(None, ge=0, description="文章所属分类") + ccate: Optional[int] = Field(None, ge=0, description="文章所属子分类") + article_type: Optional[int] = Field(None, ge=1, le=2, description="文章类型 1文章 2视频") + + class Config: + orm_mode = True + + +class NoticeCreate(NoticeBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class NoticeUpdate(NoticeBase): + weid: Optional[int] = None + type: Optional[int] = None + title: Optional[str] = None + content: Optional[str] = None + image: Optional[str] = None + readnum: Optional[int] = None + status: Optional[int] = None + createtime: Optional[int] = None + istatus: Optional[int] = None + video_audio_id: Optional[str] = None + pcate: Optional[int] = None + ccate: Optional[int] = None + article_type: Optional[int] = None + + +class NoticeInDB(NoticeBase): + id: int + + class Config: + orm_mode = True + + +class NoticeResponse(NoticeInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class NoticeListResponse(BaseModel): + data: List[NoticeResponse] + + +class OrderBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + type: int = Field(..., ge=1, le=2, description="购买类型 1购买考试 2VIP购买") + out_trade_no: str = Field(..., max_length=255, description="订单号") + userid: int = Field(..., ge=0, description="用户 ID") + openid: Optional[str] = Field(None, max_length=255, description="购买者的 openid") + order_status: int = Field(..., ge=0, le=1, description="订单状态 0未支付 1已支付") + all_money: Decimal = Field(Decimal('0.00'), ge=0, description="总金额,默认为0.00") + true_money: Decimal = Field(..., ge=0, description="实付款") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + paytime: Optional[int] = Field(None, description="支付时间,Unix 时间戳") + msg: Optional[str] = Field(None, max_length=255, description="消息") + dataid: Optional[int] = Field(None, ge=0, description="关联数据 ID") + transaction_sn: Optional[str] = Field(None, max_length=255, description="第三方流水号") + istatus: Optional[int] = Field(1, ge=1, le=2, description="订单删除标识 1正常 2删除,默认为1") + + class Config: + orm_mode = True + + +class OrderCreate(OrderBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class OrderUpdate(OrderBase): + weid: Optional[int] = None + type: Optional[int] = None + out_trade_no: Optional[str] = None + userid: Optional[int] = None + openid: Optional[str] = None + order_status: Optional[int] = None + all_money: Optional[Decimal] = None + true_money: Optional[Decimal] = None + createtime: Optional[int] = None + paytime: Optional[int] = None + msg: Optional[str] = None + dataid: Optional[int] = None + transaction_sn: Optional[str] = None + istatus: Optional[int] = None + + +class OrderInDB(OrderBase): + id: int + + class Config: + orm_mode = True + + +class OrderResponse(OrderInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class OrderListResponse(BaseModel): + data: List[OrderResponse] + + +class PaperBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + title: str = Field(..., max_length=255, description="试卷标题") + type: Optional[int] = Field(1, ge=1, le=3, description="试卷类型,默认为1") + franction: str = Field(..., description="每个题型有多少及每个题多少分") + total_franction: Optional[int] = Field(0, ge=0, description="试卷总分值,默认为0") + status: Optional[int] = Field(2, ge=1, le=2, description="试卷状态 默认为2 待完善试卷 1 已完善试卷") + istatus: Optional[int] = Field(1, ge=1, le=2, description="是否删除的标识,默认为1") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + dnum: Optional[int] = Field(0, ge=0, description="做题人数,默认为0") + displayorder: Optional[int] = Field(0, ge=0, description="显示顺序,默认为0") + price: Decimal = Field(Decimal('0.00'), ge=0, description="试卷价格,默认为0.00") + times: int = Field(..., ge=0, description="试卷时间单位分") + is_repeat: int = Field(2, ge=1, le=2, description="重复答题 1可以 2否,默认为2") + + class Config: + orm_mode = True + + +class PaperCreate(PaperBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class PaperUpdate(PaperBase): + weid: Optional[int] = None + title: Optional[str] = None + type: Optional[int] = None + franction: Optional[str] = None + total_franction: Optional[int] = None + status: Optional[int] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + dnum: Optional[int] = None + displayorder: Optional[int] = None + price: Optional[Decimal] = None + times: Optional[int] = None + is_repeat: Optional[int] = None + + +class PaperInDB(PaperBase): + id: int + + class Config: + orm_mode = True + + +class PaperResponse(PaperInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class PaperListResponse(BaseModel): + data: List[PaperResponse] + + +class PaperTestBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + paperid: str = Field(..., max_length=255, + description="试卷 ID(注意:在表注释中提到的是试卷标题,但字段名为 paperid,通常应为试卷 ID)") + testid: int = Field(..., ge=0, description="试题 ID") + test_type: int = Field(..., ge=0, description="题型类型") + istatus: Optional[int] = Field(1, ge=1, le=2, description="是否删除的标识,默认为1") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class PaperTestCreate(PaperTestBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class PaperTestUpdate(PaperTestBase): + weid: Optional[int] = None + paperid: Optional[str] = None + testid: Optional[int] = None + test_type: Optional[int] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + + +class PaperTestInDB(PaperTestBase): + id: int + + class Config: + orm_mode = True + + +class PaperTestResponse(PaperTestInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class PaperTestListResponse(BaseModel): + data: List[PaperTestResponse] + + +class PhoneCodeBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + phone: str = Field(..., min_length=11, max_length=11, regex=r"^\d{11}$", description="手机号码") + code: int = Field(..., ge=100000, le=999999, description="手机验证码,通常为6位数字") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class PhoneCodeCreate(PhoneCodeBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class PhoneCodeUpdate(PhoneCodeBase): + weid: Optional[int] = None + phone: Optional[str] = None + code: Optional[int] = None + createtime: Optional[int] = None + + +class PhoneCodeInDB(PhoneCodeBase): + id: int + + class Config: + orm_mode = True + + +class PhoneCodeResponse(PhoneCodeInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class PhoneCodeListResponse(BaseModel): + data: List[PhoneCodeResponse] + + +class QYearBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + name: str = Field(..., max_length=255, description="年份名称") + status: Optional[int] = Field(1, ge=1, le=2, description="状态 1 显示 2不显示,默认为1") + istatus: Optional[int] = Field(1, ge=1, le=2, description="是否删除的标识,默认为1") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class QYearCreate(QYearBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class QYearUpdate(QYearBase): + weid: Optional[int] = None + name: Optional[str] = None + status: Optional[int] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + + +class QYearInDB(QYearBase): + id: int + + class Config: + orm_mode = True + + +class QYearResponse(QYearInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class QYearListResponse(BaseModel): + data: List[QYearResponse] + + +class SchoolBase(BaseModel): + weid: Optional[int] = Field(None, ge=0, description="站点 ID") + school_name: Optional[str] = Field(None, max_length=200, description="学校名称") + school_logo: Optional[str] = Field(None, max_length=200, description="学校 Logo URL") + school_info_intro: Optional[str] = Field(None, description="学校描述") + addtime: Optional[int] = Field(None, description="添加时间,Unix 时间戳") + mu_str: Optional[str] = Field(None, max_length=30, description="未知字段(mu_str)") + status: Optional[int] = Field(1, ge=1, le=2, description="状态,默认为1") + line_status: Optional[int] = Field(1, ge=1, le=2, description="线路状态,默认为1") + cookbook_status: Optional[int] = Field(1, ge=1, le=2, description="食谱状态,默认为1") + class_notice_status: Optional[int] = Field(1, ge=1, le=2, description="班级公告审核状态;1=不需要;2=需要,默认为1") + school_type: Optional[int] = Field(0, ge=0, description="学校类型,默认为0") + host_url: Optional[str] = Field(None, description="官网地址") + on_school: Optional[int] = Field(0, ge=0, description="在校天数,默认为0") + begin_day: Optional[int] = Field(0, ge=0, description="开始上课周数,默认为0") + am_much: Optional[int] = Field(0, ge=0, description="上午课数,默认为0") + pm_much: Optional[int] = Field(0, ge=0, description="下午课数,默认为0") + ye_much: Optional[int] = Field(0, ge=0, description="晚上课数,默认为0") + line_type: Optional[str] = Field(None, description="班级圈类别") + appointment: Optional[str] = Field(None, description="预约类别") + parents: Optional[int] = Field(3, ge=0, description="学生可绑定家长数,默认为3") + add_time: Optional[int] = Field(0, ge=0, description="添加时间,默认为0") + + class Config: + orm_mode = True + + +class SchoolCreate(SchoolBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class SchoolUpdate(SchoolBase): + school_id: Optional[int] = None # 允许更新时指定学校 ID + + +class SchoolInDB(SchoolBase): + school_id: int + + class Config: + orm_mode = True + + +class SchoolResponse(SchoolInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class SchoolListResponse(BaseModel): + data: List[SchoolResponse] + + +class SettingBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + mchid: Optional[str] = Field(None, max_length=50, description="微信支付商户ID") + pay_secret: Optional[str] = Field(None, max_length=50, description="支付密匙") + pay_open: Optional[int] = Field(0, ge=0, le=1, description="支付开启 1开启") + signcertpath: Optional[str] = Field(None, max_length=255, description="商户CERT证书路径") + signkeypath: Optional[str] = Field(None, max_length=255, description="商户KEY证书路径") + AccessKeyId: Optional[str] = Field(None, max_length=255, description="阿里云账号") + AccessKeySecret: Optional[str] = Field(None, max_length=255, description="阿里云秘钥") + SignName: Optional[str] = Field(None, max_length=255, description="阿里云短信签名") + TemplateCode: Optional[str] = Field(None, max_length=255, description="阿里云验证码模板id") + RegionId: Optional[str] = Field(None, max_length=255, description="阿里云视频点播区域名") + banner_height: Optional[int] = Field(232, ge=0, description="轮播图高") + shareupper: Optional[int] = Field(0, ge=0, description="每日分享获得积分上限") + share_title: Optional[str] = Field(None, max_length=255, description="分享标题") + istatus: Optional[int] = Field(1, ge=1, le=2, description="是否删除的标识,默认为1") + is_display: Optional[int] = Field(1, ge=1, le=2, description="公告是否显示,默认为1") + display_num: Optional[int] = Field(5, ge=0, description="公告显示条数,默认为5") + use_integral_num: Optional[int] = Field(None, ge=0, description="高频题消耗积分个数") + franction: Optional[str] = Field(None, description="每个题型有多少每题多少分") + paper_time: Optional[int] = Field(None, ge=0, description="考试时长单位(分)") + reward_integral: Optional[int] = Field(None, ge=0, description="答对一题奖励积分数量") + medal: Optional[str] = Field(None, description="勋章设置") + share_integral: Optional[int] = Field(None, ge=0, description="每次分享可得积分") + sms_accessKeyId: Optional[str] = Field(None, max_length=255, description="短信accesskeyid") + sms_accessKeySecret: Optional[str] = Field(None, max_length=255, description="短信accesskeysecret") + about: Optional[str] = Field(None, description="关于我们") + wechat_number: Optional[str] = Field(None, max_length=255, description="商家微信号") + standard: Optional[int] = Field(5, ge=0, description="每日答题达标数量") + pass_: Optional[str] = Field(None, max_length=255, description="通过条件") + good: Optional[str] = Field(None, max_length=255, description="良好条件") + excellent: Optional[str] = Field(None, max_length=255, description="优秀条件") + randoms: Optional[str] = Field(None, max_length=255, description="随机条件") + randoms_icon: Optional[str] = Field(None, max_length=255, description="随机图标") + randoms_rule: Optional[str] = Field(None, max_length=255, description="随机规则") + notdone: Optional[str] = Field(None, max_length=255, description="未完成条件") + notdone_icon: Optional[str] = Field(None, max_length=255, description="未完成图标") + notdone_rule: Optional[str] = Field(None, max_length=255, description="未完成规则") + qhig: Optional[str] = Field(None, max_length=255, description="未知字段(qhig)") + qhig_icon: Optional[str] = Field(None, max_length=255, description="未知字段(qhig_icon)") + qhig_rule: Optional[str] = Field(None, max_length=255, description="未知字段(qhig_rule)") + qint: Optional[str] = Field(None, max_length=255, description="未知字段(qint)") + qint_icon: Optional[str] = Field(None, max_length=255, description="未知字段(qint_icon)") + qint_rule: Optional[str] = Field(None, max_length=255, description="未知字段(qint_rule)") + qhot: Optional[str] = Field(None, max_length=255, description="未知字段(qhot)") + qhot_icon: Optional[str] = Field(None, max_length=255, description="未知字段(qhot_icon)") + qhot_rule: Optional[str] = Field(None, max_length=255, description="未知字段(qhot_rule)") + qdiff: Optional[str] = Field(None, max_length=255, description="未知字段(qdiff)") + qdiff_icon: Optional[str] = Field(None, max_length=255, description="未知字段(qdiff_icon)") + qdiff_rule: Optional[str] = Field(None, max_length=255, description="未知字段(qdiff_rule)") + countdown: Optional[str] = Field(None, max_length=255, description="事件名称") + countdowntime: Optional[datetime] = Field(None, description="时间点") + time_display: Optional[int] = Field(1, ge=1, le=2, description="倒计时显示,默认为1") + student_open: Optional[int] = Field(1, ge=1, le=2, description="学生开启 1开启,默认为1") + freepoolnum: Optional[int] = Field(0, ge=0, description="题库体验题数,默认为0") + freeknowledgenum: Optional[int] = Field(0, ge=0, description="知识点体验章数,默认为0") + info_status: int = Field(1, ge=1, le=2, description="是否必须完善信息1是") + app_id: str = Field(..., max_length=50, description="微信公众公众号Appid") + app_secret: str = Field(..., max_length=50, description="微信公众SERECT") + IOS: int = Field(2, ge=1, le=2, description="1开启 2关闭,默认为2") + customer_service: str = Field(..., max_length=255, description="客服二维码") + + class Config: + orm_mode = True + + +class SettingCreate(SettingBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class SettingUpdate(SettingBase): + weid: Optional[int] = None + mchid: Optional[str] = None + pay_secret: Optional[str] = None + pay_open: Optional[int] = None + signcertpath: Optional[str] = None + signkeypath: Optional[str] = None + AccessKeyId: Optional[str] = None + AccessKeySecret: Optional[str] = None + SignName: Optional[str] = None + TemplateCode: Optional[str] = None + RegionId: Optional[str] = None + banner_height: Optional[int] = None + shareupper: Optional[int] = None + share_title: Optional[str] = None + istatus: Optional[int] = None + is_display: Optional[int] = None + display_num: Optional[int] = None + use_integral_num: Optional[int] = None + franction: Optional[str] = None + paper_time: Optional[int] = None + reward_integral: Optional[int] = None + medal: Optional[str] = None + share_integral: Optional[int] = None + sms_accessKeyId: Optional[str] = None + sms_accessKeySecret: Optional[str] = None + about: Optional[str] = None + wechat_number: Optional[str] = None + standard: Optional[int] = None + pass_: Optional[str] = None + good: Optional[str] = None + excellent: Optional[str] = None + randoms: Optional[str] = None + randoms_icon: Optional[str] = None + randoms_rule: Optional[str] = None + notdone: Optional[str] = None + notdone_icon: Optional[str] = None + notdone_rule: Optional[str] = None + qhig: Optional[str] = None + qhig_icon: Optional[str] = None + qhig_rule: Optional[str] = None + qint: Optional[str] = None + qint_icon: Optional[str] = None + qint_rule: Optional[str] = None + qhot: Optional[str] = None + qhot_icon: Optional[str] = None + qhot_rule: Optional[str] = None + qdiff: Optional[str] = None + qdiff_icon: Optional[str] = None + qdiff_rule: Optional[str] = None + countdown: Optional[str] = None + countdowntime: Optional[datetime] = None + time_display: Optional[int] = None + student_open: Optional[int] = None + freepoolnum: Optional[int] = None + freeknowledgenum: Optional[int] = None + info_status: Optional[int] = None + app_id: Optional[str] = None + app_secret: Optional[str] = None + IOS: Optional[int] = None + customer_service: Optional[str] = None + + +class SettingInDB(SettingBase): + id: int + + class Config: + orm_mode = True + + +class SettingResponse(SettingInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class SettingListResponse(BaseModel): + data: List[SettingResponse] + + +class ShareRecordBase(BaseModel): + weid: Optional[int] = Field(0, ge=0, description="站点 ID") + uid: int = Field(..., ge=0, description="用户 ID") + num: Optional[int] = Field(None, ge=0, description="分享次数") + istatus: Optional[int] = Field(1, ge=1, le=2, description="是否删除的标识,默认为1") + day: Optional[date] = Field(None, description="记录哪一天") + createtime: Optional[int] = Field(None, description="创建时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class ShareRecordCreate(ShareRecordBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class ShareRecordUpdate(ShareRecordBase): + weid: Optional[int] = None + uid: Optional[int] = None + num: Optional[int] = None + istatus: Optional[int] = None + day: Optional[date] = None + createtime: Optional[int] = None + + +class ShareRecordInDB(ShareRecordBase): + id: int + + class Config: + orm_mode = True + + +class ShareRecordResponse(ShareRecordInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class ShareRecordListResponse(BaseModel): + data: List[ShareRecordResponse] + + +class SonSimpleBase(BaseModel): + weid: str = Field(..., max_length=150, description="站点 ID") + son_title: str = Field(..., max_length=255, description="子标题") + + class Config: + orm_mode = True + + +class SonSimpleCreate(SonSimpleBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class SonSimpleUpdate(SonSimpleBase): + weid: Optional[str] = None + son_title: Optional[str] = None + + +class SonSimpleInDB(SonSimpleBase): + id: int + + class Config: + orm_mode = True + + +class SonSimpleResponse(SonSimpleInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class SonSimpleListResponse(BaseModel): + data: List[SonSimpleResponse] + + +class TestBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + type: int = Field(..., ge=0, le=255, description="试题类型") + title: str = Field(..., max_length=255, description="试题题目 仅在列表显示 试卷内不显示") + libraryid: Optional[int] = Field(0, ge=0, description="题库id") + question: str = Field(..., description="题目") + qimage: Optional[str] = Field(None, description="试题图片") + qaudio: Optional[str] = Field(None, description="问题音频") + a_type: Optional[int] = Field(0, ge=0, le=255, description="选项类型") + option: Optional[str] = Field(None, description="选项") + rightkey: str = Field(..., description="正确答案") + analysis: str = Field(..., description="答案解析") + aimage: Optional[str] = Field(None, description="解析图片") + istatus: Optional[int] = Field(1, ge=1, le=2, description="是否删除的标识,默认为1") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + anum: Optional[int] = Field(0, ge=0, description="本题答题次数 仅考试") + rnum: Optional[int] = Field(0, ge=0, description="正确回答次数 仅考试") + level: Optional[int] = Field(1, ge=1, le=5, description="难度等级,默认为1") + qvideo: Optional[str] = Field(None, description="问题视频") + analysis_audio: Optional[str] = Field(None, description="音频解析") + knowledge: Optional[str] = Field(None, description="所属知识点类别") + type_classification: Optional[str] = Field(None, description="类型分类") + q_year: Optional[str] = Field(None, description="年份") + pid: Optional[int] = Field(0, ge=0, description="问题父id") + son_status: Optional[int] = Field(None, description="语音题是否加了小题") + display: Optional[int] = Field(1, ge=1, le=2, description="1-显示2-不显示,默认为1") + son_simple: int = Field(0, ge=0, description="子题简化") + + class Config: + orm_mode = True + + +class TestCreate(TestBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class TestUpdate(TestBase): + weid: Optional[int] = None + type: Optional[int] = None + title: Optional[str] = None + libraryid: Optional[int] = None + question: Optional[str] = None + qimage: Optional[str] = None + qaudio: Optional[str] = None + a_type: Optional[int] = None + option: Optional[str] = None + rightkey: Optional[str] = None + analysis: Optional[str] = None + aimage: Optional[str] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + anum: Optional[int] = None + rnum: Optional[int] = None + level: Optional[int] = None + qvideo: Optional[str] = None + analysis_audio: Optional[str] = None + knowledge: Optional[str] = None + type_classification: Optional[str] = None + q_year: Optional[str] = None + pid: Optional[int] = None + son_status: Optional[int] = None + display: Optional[int] = None + son_simple: Optional[int] = None + + +class TestInDB(TestBase): + id: int + createtime: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int): + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + class Config: + orm_mode = True + + +class TestResponse(TestInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class TestListResponse(BaseModel): + data: List[TestResponse] + + +class TestTypeBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + name: str = Field(..., max_length=255, description="试题库名称") + pid: Optional[int] = Field(0, ge=0, description="默认0为顶级分类") + gpid: Optional[int] = Field(0, ge=0, description="默认0") + price: Optional[Decimal] = Field(Decimal('0.00'), ge=0, description="价格") + status: Optional[int] = Field(1, ge=0, le=1, description="题库状态,默认为1") + is_student: Optional[int] = Field(0, ge=0, le=1, description="学员专享 1是,默认为0") + istatus: Optional[int] = Field(1, ge=0, le=1, description="是否删除的标识,默认为1") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + display_order: int = Field(0, description="显示顺序,默认为0") + + class Config: + orm_mode = True + + +class TestTypeCreate(TestTypeBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class TestTypeUpdate(TestTypeBase): + weid: Optional[int] = None + name: Optional[str] = None + pid: Optional[int] = None + gpid: Optional[int] = None + price: Optional[Decimal] = None + status: Optional[int] = None + is_student: Optional[int] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + display_order: Optional[int] = None + + +class TestTypeInDB(TestTypeBase): + id: int + createtime: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int): + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + class Config: + orm_mode = True + + +class TestTypeResponse(TestTypeInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class TestTypeListResponse(BaseModel): + data: List[TestTypeResponse] + + +class TypeCateBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + name: str = Field(..., max_length=255, description="分类名称") + status: Optional[int] = Field(1, ge=1, le=2, description="状态 1 显示 2不显示,默认为1") + istatus: Optional[int] = Field(1, ge=0, le=1, description="是否删除的标识,默认为1") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class TypeCateCreate(TypeCateBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class TypeCateUpdate(TypeCateBase): + weid: Optional[int] = None + name: Optional[str] = None + status: Optional[int] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + + +class TypeCateInDB(TypeCateBase): + id: int + createtime: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int): + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + class Config: + orm_mode = True + + +class TypeCateResponse(TypeCateInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class TypeCateListResponse(BaseModel): + data: List[TypeCateResponse] diff --git a/mooc/schemas/goouc_fullexam_user.py b/mooc/schemas/goouc_fullexam_user.py new file mode 100644 index 0000000..42ea2d6 --- /dev/null +++ b/mooc/schemas/goouc_fullexam_user.py @@ -0,0 +1,940 @@ +from pydantic import BaseModel, Field +from typing import Optional, List +from datetime import datetime +from decimal import Decimal + + +class UserBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + openid: str = Field(..., max_length=255, description="用户标识") + unionid: Optional[str] = Field(None, max_length=255, description="联合用户标识") + nickname: Optional[str] = Field(None, max_length=255, description="用户昵称 可保存特殊符号") + headimg: Optional[str] = Field(None, max_length=255, description="用户头像") + name: Optional[str] = Field(None, max_length=50, description="用户姓名") + phone: Optional[str] = Field(None, max_length=11, description="手机号", regex=r"^\d{11}$") + gradeid: Optional[int] = Field(None, ge=0, description="选择年级ID") + classid: Optional[int] = Field(None, ge=0, description="参加班级的ID") + groupid: Optional[int] = Field(None, ge=0, description="群组ID") + nativeplace: Optional[str] = Field(None, max_length=255, description="籍贯") + province: Optional[str] = Field(None, max_length=255, description="省") + city: Optional[str] = Field(None, max_length=255, description="市") + county: Optional[str] = Field(None, max_length=255, description="县") + ismember: Optional[int] = Field(2, ge=1, le=2, description="是否是会员 1 是会员 2不是,默认为2") + password: Optional[str] = Field(None, max_length=255, description="用户登录密码") + member_endtime: Optional[str] = Field(None, max_length=255, description="会员到期时间") + status: Optional[int] = Field(1, ge=0, le=1, description="是否拉黑,默认为1") + last_login_time: int = Field(..., description="最近一次登录时间,Unix 时间戳") + integral: Optional[int] = Field(0, ge=0, description="用户积分数,默认为0") + balance: Optional[Decimal] = Field(Decimal('0.00'), ge=0, description="用户余额,默认为0.00") + qrcode: Optional[str] = Field(None, max_length=255, description="用户二维码路径") + pid: Optional[int] = Field(0, ge=0, description="用户自己注册 为0 扫描其他人二维码 为二维码人的ID,默认为0") + istatus: Optional[int] = Field(1, ge=0, le=1, description="是否删除的标识,默认为1") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + id_card: Optional[str] = Field(None, max_length=255, description="身份证号") + student_id: Optional[str] = Field(None, max_length=200, description="学号") + school: Optional[str] = Field(None, max_length=255, description="学校") + level: Optional[int] = Field(0, ge=0, description="用户等级,默认为0") + grade: Optional[str] = Field(None, max_length=255, description="年级") + count_day: Optional[int] = Field(0, ge=0, description="累计天数,默认为0") + is_band: int = Field(0, ge=0, le=1, description="是否绑定微信 1是0否,默认为0") + h5_openid: str = Field(..., max_length=255, description="H5 用户标识") + + class Config: + orm_mode = True + + +class UserCreate(UserBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class UserUpdate(UserBase): + weid: Optional[int] = None + openid: Optional[str] = None + unionid: Optional[str] = None + nickname: Optional[str] = None + headimg: Optional[str] = None + name: Optional[str] = None + phone: Optional[str] = None + gradeid: Optional[int] = None + classid: Optional[int] = None + groupid: Optional[int] = None + nativeplace: Optional[str] = None + province: Optional[str] = None + city: Optional[str] = None + county: Optional[str] = None + ismember: Optional[int] = None + password: Optional[str] = None + member_endtime: Optional[str] = None + status: Optional[int] = None + last_login_time: Optional[int] = None + integral: Optional[int] = None + balance: Optional[Decimal] = None + qrcode: Optional[str] = None + pid: Optional[int] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + id_card: Optional[str] = None + student_id: Optional[str] = None + school: Optional[str] = None + level: Optional[int] = None + grade: Optional[str] = None + count_day: Optional[int] = None + is_band: Optional[int] = None + h5_openid: Optional[str] = None + + +class UserInDB(UserBase): + id: int + last_login_time: Optional[datetime] = Field(None, description="最近一次登录时间") + createtime: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.last_login_time, int): + obj.last_login_time = datetime.fromtimestamp(obj.last_login_time) + if isinstance(obj.createtime, int): + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + class Config: + orm_mode = True + + +class UserResponse(UserInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class UserListResponse(BaseModel): + data: List[UserResponse] + + +class UserCollectionPractionBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + uid: int = Field(..., ge=0, description="用户ID") + testid: int = Field(..., ge=0, description="试题ID") + test_type: int = Field(..., ge=0, le=255, description="试题类型") + istatus: Optional[int] = Field(1, ge=0, le=1, description="删除状态,默认为1") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + iscollect: Optional[int] = Field(2, ge=0, le=2, description="是否收藏 1是 2不是,默认为2") + + class Config: + orm_mode = True + + +class UserCollectionPractionCreate(UserCollectionPractionBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class UserCollectionPractionUpdate(UserCollectionPractionBase): + weid: Optional[int] = None + uid: Optional[int] = None + testid: Optional[int] = None + test_type: Optional[int] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + iscollect: Optional[int] = None + + +class UserCollectionPractionInDB(UserCollectionPractionBase): + id: int + createtime: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int): + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + class Config: + orm_mode = True + + +class UserCollectionPractionResponse(UserCollectionPractionInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class UserCollectionPractionListResponse(BaseModel): + data: List[UserCollectionPractionResponse] + + +class UserDoexamBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + uid: int = Field(..., ge=0, description="用户ID") + examid: int = Field(..., ge=0, description="已发布的试卷、考试或练习的ID") + franction: Optional[int] = Field(0, ge=0, description="得分情况,默认为0") + usetime: str = Field('0', max_length=20, description="考试用时,默认为'0'") + level: Optional[str] = Field(None, max_length=255, description="级别") + istatus: Optional[int] = Field(1, ge=0, le=1, description="删除状态,默认为1") + createtime: int = Field(..., description="交卷时间,Unix 时间戳") + recordid: int = Field(..., ge=0, description="考试记录id") + evaluation: int = Field(2, ge=1, le=3, description="评阅状态 1已评2未评默认2 3批改中") + + class Config: + orm_mode = True + + +class UserDoexamCreate(UserDoexamBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class UserDoexamUpdate(UserDoexamBase): + weid: Optional[int] = None + uid: Optional[int] = None + examid: Optional[int] = None + franction: Optional[int] = None + usetime: Optional[str] = None + level: Optional[str] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + recordid: Optional[int] = None + evaluation: Optional[int] = None + + +class UserDoexamInDB(UserDoexamBase): + id: int + createtime: Optional[datetime] = Field(None, description="交卷时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int): + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + class Config: + orm_mode = True + + +class UserDoexamResponse(UserDoexamInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class UserDoexamListResponse(BaseModel): + data: List[UserDoexamResponse] + + +class UserDoOtherExamBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + uid: int = Field(..., ge=0, description="用户ID") + recordid: int = Field(..., ge=0, description="区分是哪一次考试的记录ID") + franction: Optional[int] = Field(0, ge=0, description="得分情况,默认为0") + usetime: str = Field('0', max_length=20, description="考试用时,默认为'0'") + level: Optional[str] = Field(None, max_length=255, description="级别") + istatus: Optional[int] = Field(1, ge=0, le=1, description="删除状态,默认为1") + createtime: int = Field(..., description="交卷时间,Unix 时间戳") + type: Optional[int] = Field(None, ge=2, le=3, description="类型 2-优先未做 3-智能考试") + + class Config: + orm_mode = True + + +class UserDoOtherExamCreate(UserDoOtherExamBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class UserDoOtherExamUpdate(UserDoOtherExamBase): + weid: Optional[int] = None + uid: Optional[int] = None + recordid: Optional[int] = None + franction: Optional[int] = None + usetime: Optional[str] = None + level: Optional[str] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + type: Optional[int] = None + + +class UserDoOtherExamInDB(UserDoOtherExamBase): + id: int + createtime: Optional[datetime] = Field(None, description="交卷时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int): + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + class Config: + orm_mode = True + + +class UserDoOtherExamResponse(UserDoOtherExamInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class UserDoOtherExamListResponse(BaseModel): + data: List[UserDoOtherExamResponse] + + +class UserDoOtherExamAnswerBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + uid: int = Field(..., ge=0, description="用户ID") + recordid: int = Field(..., ge=0, description="区分是哪一次考试的记录ID") + testid: int = Field(..., ge=0, description="试题ID") + test_type: int = Field(..., ge=0, le=255, description="试题类型") + uanswer: Optional[str] = Field(None, description="用户答案") + franction: Optional[int] = Field(0, ge=0, description="得分情况,默认为0") + isright: int = Field(..., ge=0, le=1, description="是否正确") + ischeck: Optional[int] = Field(1, ge=0, le=1, description="是否批改 默认为已批改") + istatus: Optional[int] = Field(1, ge=0, le=1, description="删除状态,默认为1") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + type: Optional[int] = Field(None, ge=2, le=3, description="类型 2-优先未做 3-智能考试") + + class Config: + orm_mode = True + + +class UserDoOtherExamAnswerCreate(UserDoOtherExamAnswerBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class UserDoOtherExamAnswerUpdate(UserDoOtherExamAnswerBase): + weid: Optional[int] = None + uid: Optional[int] = None + recordid: Optional[int] = None + testid: Optional[int] = None + test_type: Optional[int] = None + uanswer: Optional[str] = None + franction: Optional[int] = None + isright: Optional[int] = None + ischeck: Optional[int] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + type: Optional[int] = None + + +class UserDoOtherExamAnswerInDB(UserDoOtherExamAnswerBase): + id: int + createtime: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int): + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + class Config: + orm_mode = True + + +class UserDoOtherExamAnswerResponse(UserDoOtherExamAnswerInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class UserDoOtherExamAnswerListResponse(BaseModel): + data: List[UserDoOtherExamAnswerResponse] + + +class UserExamAnswerBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + uid: int = Field(..., ge=0, description="用户ID") + examid: int = Field(..., ge=0, description="已发布的试卷、考试或练习的ID") + testid: int = Field(..., ge=0, description="试题ID") + test_type: int = Field(..., ge=0, le=255, description="试题类型") + uanswer: Optional[str] = Field(None, description="用户答案") + franction: Optional[int] = Field(0, ge=0, description="得分情况,默认为0") + isright: int = Field(..., ge=0, le=1, description="是否正确") + ischeck: Optional[int] = Field(1, ge=0, le=1, description="是否批改 默认为已批改") + istatus: Optional[int] = Field(1, ge=0, le=1, description="删除状态,默认为1") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + recordid: Optional[int] = Field(None, ge=0, description="考试记录id") + type: Optional[int] = Field(None, ge=1, le=1, description="类型只有1-全真") + simple_score: Optional[int] = Field(None, ge=0, description="简答题评分") + comments: str = Field(..., description="简答题评语") + simple_evaluation: int = Field(2, ge=1, le=3, description="简答题评阅状态 1已批改默认2未3批改中") + + class Config: + orm_mode = True + + +class UserExamAnswerCreate(UserExamAnswerBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class UserExamAnswerUpdate(UserExamAnswerBase): + weid: Optional[int] = None + uid: Optional[int] = None + examid: Optional[int] = None + testid: Optional[int] = None + test_type: Optional[int] = None + uanswer: Optional[str] = None + franction: Optional[int] = None + isright: Optional[int] = None + ischeck: Optional[int] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + recordid: Optional[int] = None + type: Optional[int] = None + simple_score: Optional[int] = None + comments: Optional[str] = None + simple_evaluation: Optional[int] = None + + +class UserExamAnswerInDB(UserExamAnswerBase): + id: int + createtime: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int): + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + class Config: + orm_mode = True + + +class UserExamAnswerResponse(UserExamAnswerInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class UserExamAnswerListResponse(BaseModel): + data: List[UserExamAnswerResponse] + + +class UserFormidBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + uid: int = Field(..., ge=0, description="用户ID") + formid: str = Field(..., max_length=255, description="表单ID") + istatus: Optional[int] = Field(1, ge=0, le=1, description="删除状态,默认为1") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class UserFormidCreate(UserFormidBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class UserFormidUpdate(UserFormidBase): + weid: Optional[int] = None + uid: Optional[int] = None + formid: Optional[str] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + + +class UserFormidInDB(UserFormidBase): + id: int + createtime: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int): + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + class Config: + orm_mode = True + + +class UserFormidResponse(UserFormidInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class UserFormidListResponse(BaseModel): + data: List[UserFormidResponse] + + +class UserGiftBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + uid: int = Field(..., ge=0, description="用户ID") + giftid: int = Field(..., ge=0, description="礼品ID") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + status: Optional[int] = Field(0, ge=0, le=255, description="状态,默认为0") + updatetime: Optional[int] = Field(None, description="更新时间,Unix 时间戳") + consignee_name: Optional[str] = Field(None, max_length=255, description="收货人姓名") + consignee_phone: Optional[str] = Field(None, max_length=255, description="收货人电话") + consignee_address: Optional[str] = Field(None, max_length=255, description="收货人地址") + + class Config: + orm_mode = True + + +class UserGiftCreate(UserGiftBase): + pass # 如果创建时需要额外字段或默认值不同,可以在这里添加 + + +class UserGiftUpdate(UserGiftBase): + weid: Optional[int] = None + uid: Optional[int] = None + giftid: Optional[int] = None + createtime: Optional[int] = None + status: Optional[int] = None + updatetime: Optional[int] = None + consignee_name: Optional[str] = None + consignee_phone: Optional[str] = None + consignee_address: Optional[str] = None + + +class UserGiftInDB(UserGiftBase): + id: int + createtime: Optional[datetime] = Field(None, description="创建时间") + updatetime: Optional[datetime] = Field(None, description="更新时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int): + obj.createtime = datetime.fromtimestamp(obj.createtime) + if isinstance(obj.updatetime, int) and obj.updatetime is not None: + obj.updatetime = datetime.fromtimestamp(obj.updatetime) + return super().from_orm(obj) + + class Config: + orm_mode = True + + +class UserGiftResponse(UserGiftInDB): + pass # 可以根据需要添加额外的字段或调整现有字段 + + +# 用于批量操作的模型 +class UserGiftListResponse(BaseModel): + data: List[UserGiftResponse] + + +class UserKnowledgeCateBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + uid: int = Field(0, ge=0, description="用户ID") + cate: Optional[int] = Field(0, ge=0, description="知识点ID") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + istatus: Optional[int] = Field(1, ge=0, le=1, description="是否删除的标识,默认为1") + + class Config: + orm_mode = True + + +class UserKnowledgeCateCreate(UserKnowledgeCateBase): + pass + + +class UserKnowledgeCateUpdate(UserKnowledgeCateBase): + weid: Optional[int] = None + uid: Optional[int] = None + cate: Optional[int] = None + createtime: Optional[int] = None + istatus: Optional[int] = None + + +class UserKnowledgeCateInDB(UserKnowledgeCateBase): + id: int + createtime: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int): + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + +class UserKnowledgeCateResponse(UserKnowledgeCateInDB): + pass + + +class UserKnowledgeCateListResponse(BaseModel): + data: List[UserKnowledgeCateResponse] + + +class UserMemberBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + status: Optional[int] = Field(2, ge=0, le=2, description="是否开启购买会员,默认为2") + scale: Decimal = Field(Decimal('1.00'), ge=0, le=1, description="折扣比例,默认为1.00") + info: Optional[str] = Field(None, description="详细信息") + price: Decimal = Field(Decimal('0.00'), ge=0, description="VIP单月价格,默认为0.00") + istui: Optional[int] = Field(0, ge=0, description="推荐购买的,默认为0") + istatus: Optional[int] = Field(1, ge=0, le=1, description="删除状态,默认为1") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class UserMemberCreate(UserMemberBase): + pass + + +class UserMemberUpdate(UserMemberBase): + weid: Optional[int] = None + status: Optional[int] = None + scale: Optional[Decimal] = None + info: Optional[str] = None + price: Optional[Decimal] = None + istui: Optional[int] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + + +class UserMemberInDB(UserMemberBase): + id: int + createtime: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int): + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + +class UserMemberResponse(UserMemberInDB): + pass + + +class UserMemberListResponse(BaseModel): + data: List[UserMemberResponse] + + +class UserPoolBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + uid: int = Field(0, ge=0, description="用户ID") + poolid: Optional[int] = Field(0, ge=0, description="题库ID") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + istatus: Optional[int] = Field(1, ge=0, le=1, description="是否删除的标识,默认为1") + paperid: int = Field(0, ge=0, description="试卷id") + + class Config: + orm_mode = True + + +class UserPoolCreate(UserPoolBase): + pass + + +class UserPoolUpdate(UserPoolBase): + weid: Optional[int] = None + uid: Optional[int] = None + poolid: Optional[int] = None + createtime: Optional[int] = None + istatus: Optional[int] = None + paperid: Optional[int] = None + + +class UserPoolInDB(UserPoolBase): + id: int + createtime: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int): + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + +class UserPoolResponse(UserPoolInDB): + pass + + +class UserPoolListResponse(BaseModel): + data: List[UserPoolResponse] + + +class UserQHighBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + user_id: int = Field(..., ge=0, description="用户ID") + question_id: int = Field(..., ge=0, description="试题ID") + istatus: Optional[int] = Field(1, ge=0, le=1, description="删除状态,默认为1") + create_time: int = Field(..., description="创建时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class UserQHighCreate(UserQHighBase): + pass + + +class UserQHighUpdate(UserQHighBase): + weid: Optional[int] = None + user_id: Optional[int] = None + question_id: Optional[int] = None + istatus: Optional[int] = None + create_time: Optional[int] = None + + +class UserQHighInDB(UserQHighBase): + id: int + create_time: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.create_time, int): + obj.create_time = datetime.fromtimestamp(obj.create_time) + return super().from_orm(obj) + + +class UserQHighResponse(UserQHighInDB): + pass + + +class UserQHighListResponse(BaseModel): + data: List[UserQHighResponse] + + +class UserQIntensiveBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + user_id: int = Field(..., ge=0, description="用户ID") + question_id: int = Field(..., ge=0, description="试题ID") + istatus: Optional[int] = Field(1, ge=0, le=1, description="删除状态,默认为1") + create_time: int = Field(..., description="创建时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class UserQIntensiveCreate(UserQIntensiveBase): + pass + + +class UserQIntensiveUpdate(UserQIntensiveBase): + weid: Optional[int] = None + user_id: Optional[int] = None + question_id: Optional[int] = None + istatus: Optional[int] = None + create_time: Optional[int] = None + + +class UserQIntensiveInDB(UserQIntensiveBase): + id: int + create_time: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.create_time, int): + obj.create_time = datetime.fromtimestamp(obj.create_time) + return super().from_orm(obj) + + +class UserQIntensiveResponse(UserQIntensiveInDB): + pass + + +class UserQIntensiveListResponse(BaseModel): + data: List[UserQIntensiveResponse] + + +class UserQTypeBase(BaseModel): + weid: Optional[int] = Field(0, ge=0, description="站点 ID") + uid: int = Field(..., ge=0, description="用户ID") + type_id: int = Field(..., ge=0, description="题型ID") + last_id: Optional[int] = Field(None, ge=0, description="最后退出时的题目ID") + istatus: Optional[int] = Field(1, ge=0, le=255, description="删除状态,默认为1") + createtime: Optional[int] = Field(None, description="创建时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class UserQTypeCreate(UserQTypeBase): + pass + + +class UserQTypeUpdate(UserQTypeBase): + weid: Optional[int] = None + uid: Optional[int] = None + type_id: Optional[int] = None + last_id: Optional[int] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + + +class UserQTypeInDB(UserQTypeBase): + id: int + createtime: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int) and obj.createtime is not None: + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + +class UserQTypeResponse(UserQTypeInDB): + pass + + +class UserQTypeListResponse(BaseModel): + data: List[UserQTypeResponse] + + +class UserReadBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + uid: int = Field(..., ge=0, description="用户ID") + noticeid: int = Field(..., ge=0, description="公告/活动/文章ID") + istatus: Optional[int] = Field(1, ge=0, le=1, description="删除状态,默认为1") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class UserReadCreate(UserReadBase): + pass + + +class UserReadUpdate(UserReadBase): + weid: Optional[int] = None + uid: Optional[int] = None + noticeid: Optional[int] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + + +class UserReadInDB(UserReadBase): + id: int + createtime: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int): + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + +class UserReadResponse(UserReadInDB): + pass + + +class UserReadListResponse(BaseModel): + data: List[UserReadResponse] + + +class UserSpecialBase(BaseModel): + weid: Optional[int] = Field(0, ge=0, description="站点 ID") + uid: int = Field(..., ge=0, description="用户ID") + special_id: int = Field(..., ge=0, description="特殊ID") + last_id: Optional[int] = Field(None, ge=0, description="最后退出时的题目ID") + istatus: Optional[int] = Field(1, ge=0, le=255, description="删除状态,默认为1") + createtime: Optional[int] = Field(None, description="创建时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class UserSpecialCreate(UserSpecialBase): + pass + + +class UserSpecialUpdate(UserSpecialBase): + weid: Optional[int] = None + uid: Optional[int] = None + special_id: Optional[int] = None + last_id: Optional[int] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + + +class UserSpecialInDB(UserSpecialBase): + id: int + createtime: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int) and obj.createtime is not None: + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + +class UserSpecialResponse(UserSpecialInDB): + pass + + +class UserSpecialListResponse(BaseModel): + data: List[UserSpecialResponse] + + +class UserSpequenceBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + user_id: int = Field(..., ge=0, description="用户ID") + question_id: int = Field(..., ge=0, description="下标ID,这儿是顺序id") + lib_id: Optional[int] = Field(None, ge=0, description="题库id") + istatus: Optional[int] = Field(1, ge=0, le=1, description="删除状态,默认为1") + create_time: int = Field(..., description="创建时间,Unix 时间戳") + + class Config: + orm_mode = True + + +class UserSpequenceCreate(UserSpequenceBase): + pass + + +class UserSpequenceUpdate(UserSpequenceBase): + weid: Optional[int] = None + user_id: Optional[int] = None + question_id: Optional[int] = None + lib_id: Optional[int] = None + istatus: Optional[int] = None + create_time: Optional[int] = None + + +class UserSpequenceInDB(UserSpequenceBase): + id: int + create_time: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.create_time, int): + obj.create_time = datetime.fromtimestamp(obj.create_time) + return super().from_orm(obj) + + +class UserSpequenceResponse(UserSpequenceInDB): + pass + + +class UserSpequenceListResponse(BaseModel): + data: List[UserSpequenceResponse] + + +class UserWrongPractionBase(BaseModel): + weid: int = Field(..., ge=0, description="站点 ID") + uid: int = Field(..., ge=0, description="用户ID") + testid: int = Field(..., ge=0, description="试题ID") + test_type: int = Field(..., ge=0, le=255, description="试题类型") + uanswer: Optional[str] = Field(None, description="用户答案") + istatus: Optional[int] = Field(1, ge=0, le=1, description="删除状态,默认为1") + createtime: int = Field(..., description="创建时间,Unix 时间戳") + iscollect: Optional[int] = Field(2, ge=0, le=2, description="是否收藏,默认为2") + + class Config: + orm_mode = True + + +class UserWrongPractionCreate(UserWrongPractionBase): + pass + + +class UserWrongPractionUpdate(UserWrongPractionBase): + weid: Optional[int] = None + uid: Optional[int] = None + testid: Optional[int] = None + test_type: Optional[int] = None + uanswer: Optional[str] = None + istatus: Optional[int] = None + createtime: Optional[int] = None + iscollect: Optional[int] = None + + +class UserWrongPractionInDB(UserWrongPractionBase): + id: int + createtime: Optional[datetime] = Field(None, description="创建时间") + + @classmethod + def from_orm(cls, obj): + if isinstance(obj.createtime, int): + obj.createtime = datetime.fromtimestamp(obj.createtime) + return super().from_orm(obj) + + +class UserWrongPractionResponse(UserWrongPractionInDB): + pass + + +class UserWrongPractionListResponse(BaseModel): + data: List[UserWrongPractionResponse]