feat(models): 添加schemas,models并生成部分 CRUD 接口

- 在 mooc/models/__init__.py 中添加了 part3中数据库表的导入
- 新增了 mooc/crud/crud_goouc_fullexam.py 文件,实现了 goouc_fullexam 相关表的 CRUD 接口
- 添加了 Advert、Banji、Banner 等多个模型类的 CRUD 操作方法
This commit is contained in:
jieyuu 2025-01-06 00:30:49 +08:00
parent 556670c805
commit 3ed18a297e
6 changed files with 3721 additions and 1 deletions

View File

@ -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)

View File

@ -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())

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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]