Program/mooc/models/core.py
雨过 d23e374f4c
part2-按照新教程修改,并检查修改ai生成缺失部分
Signed-off-by: 雨过 <zxx1747362695@qq.com>
2025-01-05 15:04:45 +00:00

328 lines
13 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from sqlalchemy import Column, Integer, String, Text, BigInt,CHAR,ForeignKey, UnsignedInteger, TinyInt, Decimal
from sqlalchemy.dialects.mysql import BIGINT
from mooc.db.database import Base
# ImsCoreAttachment模型用于映射数据库表ims_core_attachment
class ImsCoreAttachment(Base):
__tablename__ = "ims_core_attachment"
acid = Column(UnsignedInteger, primary_key=True) # 将id改为acid
uniacid = Column(UnsignedInteger, nullable=False)
uid = Column(UnsignedInteger, nullable=False)
filename = Column(String(255), nullable=False)
attachment = Column(String(255), nullable=False)
type = Column(UnsignedInteger, nullable=False)
createtime = Column(UnsignedInteger, nullable=False)
module_upload_dir = Column(String(100), nullable=False)
group_id = Column(Integer, nullable=False)
displayorder = Column(Integer, nullable=False)
class Config:
from_attributes = True
# ImsCoreCache模型用于映射数据库表ims_core_cache
class ImsCoreCache(Base):
__tablename__ = "ims_core_cache"
acid = Column(String(100), primary_key=True) # 将key视为一种特殊的主键这里用acid替代原本的命名方式
value = Column(Text, nullable=False)
class Config:
from_attributes = True
# ImsCoreCron模型用于映射数据库表ims_core_cron
class ImsCoreCron(Base):
__tablename__ = "ims_core_cron"
acid = Column(UnsignedInteger, primary_key=True) # 将id改为acid
cloudid = Column(UnsignedInteger, nullable=False)
module = Column(String(50), nullable=False)
uniacid = Column(UnsignedInteger, nullable=False)
type = Column(TinyInt, nullable=False)
name = Column(String(50), nullable=False)
filename = Column(String(50), nullable=False)
lastruntime = Column(UnsignedInteger, nullable=False)
nextruntime = Column(UnsignedInteger, nullable=False)
weekday = Column(TinyInt, nullable=False)
day = Column(TinyInt, nullable=False)
hour = Column(TinyInt, nullable=False)
minute = Column(String(255), nullable=False)
extra = Column(String(5000), nullable=False)
status = Column(TinyInt, nullable=False)
createtime = Column(UnsignedInteger, nullable=False)
class Config:
from_attributes = True
# ImsCoreCronRecord模型用于映射数据库表ims_core_cron_record
class ImsCoreCronRecord(Base):
__tablename__ = "ims_core_cron_record"
acid = Column(UnsignedInteger, primary_key=True) # 将id改为acid
uniacid = Column(UnsignedInteger, nullable=False)
module = Column(String(50), nullable=False)
type = Column(String(50), nullable=False)
tid = Column(UnsignedInteger, nullable=False)
note = Column(String(500), nullable=False)
tag = Column(String(5000), nullable=False)
createtime = Column(UnsignedInteger, nullable=False)
class Config:
from_attributes = True
# ImsCoreJob模型用于映射数据库表ims_core_job
class ImsCoreJob(Base):
__tablename__ = "ims_core_job"
acid = Column(Integer, primary_key=True) # 将id改为acid
type = Column(TinyInt, nullable=False)
uniacid = Column(Integer, nullable=False)
payload = Column(String(255), nullable=False)
status = Column(TinyInt, nullable=False)
title = Column(String(22), nullable=False)
handled = Column(Integer, nullable=False)
total = Column(Integer, nullable=False)
createtime = Column(Integer, nullable=False)
updatetime = Column(Integer, nullable=False)
endtime = Column(Integer, nullable=False)
uid = Column(Integer, nullable=False)
isdeleted = Column(TinyInt, nullable=True)
class Config:
from_attributes = True
# ImsCoreMenu模型用于映射数据库表ims_core_menu
class ImsCoreMenu(Base):
__tablename__ = "ims_core_menu"
acid = Column(UnsignedInteger, primary_key=True) # 将id改为acid
pid = Column(UnsignedInteger, nullable=False)
title = Column(String(20), nullable=False)
name = Column(String(20), nullable=False)
url = Column(String(255), nullable=False)
append_title = Column(String(30), nullable=False)
append_url = Column(String(255), nullable=False)
displayorder = Column(TinyInt, nullable=False)
type = Column(String(15), nullable=False)
is_display = Column(TinyInt, nullable=False)
is_system = Column(TinyInt, nullable=False)
permission_name = Column(String(50), nullable=False)
group_name = Column(String(30), nullable=False)
icon = Column(String(20), nullable=False)
class Config:
from_attributes = True
# ImsCoreMenuShortcut模型用于映射数据库表ims_core_menu_shortcut
class ImsCoreMenuShortcut(Base):
__tablename__ = "ims_core_menu_shortcut"
acid = Column(Integer, primary_key=True) # 将id改为acid
uid = Column(Integer, nullable=False)
uniacid = Column(Integer, nullable=False)
modulename = Column(String(100), nullable=False)
displayorder = Column(Integer, nullable=False)
position = Column(String(100), nullable=False)
updatetime = Column(Integer, nullable=False)
class Config:
from_attributes = True
# ImsCorePaylog模型用于映射数据库表ims_core_paylog
class ImsCorePaylog(Base):
__tablename__ = "ims_core_paylog"
acid = Column(BigInt, primary_key=True, nullable=False) # 将plid改为acid注意类型为BigInt
type = Column(String(20), nullable=False)
uniacid = Column(Integer, nullable=False)
acid_original = Column(Integer, nullable=False) # 原表中还有个acid字段这里为避免混淆改名可按需调整
openid = Column(String(40), nullable=False)
uniontid = Column(String(64), nullable=False)
tid = Column(String(128), nullable=False)
fee = Column(Decimal(10, 2), nullable=False)
status = Column(TinyInt, nullable=False)
module = Column(String(50), nullable=False)
tag = Column(String(2000), nullable=False)
is_usecard = Column(TinyInt, nullable=False)
card_type = Column(TinyInt, nullable=False)
card_id = Column(String(50), nullable=False)
card_fee = Column(Decimal(10, 2), nullable=False)
encrypt_code = Column(String(100), nullable=False)
is_wish = Column(TinyInt, nullable=False)
class Config:
from_attributes = True
# ImsCorePerformance模型用于映射数据库表ims_core_performance
class ImsCorePerformance(Base):
__tablename__ = "ims_core_performance"
acid = Column(UnsignedInteger, primary_key=True) # 将id改为acid
type = Column(TinyInt, nullable=False)
runtime = Column(String(10), nullable=False)
runurl = Column(String(512), nullable=False)
runsql = Column(String(512), nullable=False)
createtime = Column(Integer, nullable=False)
class Config:
from_attributes = True
# ImsCoreQueue模型用于映射数据库表ims_core_queue
class ImsCoreQueue(Base):
__tablename__ = "ims_core_queue"
acid = Column(BigInt, primary_key=True) # 将qid改为acid类型对应BigInt
uniacid = Column(UnsignedInteger, nullable=False)
acid_original = Column(UnsignedInteger, nullable=False) # 原表中还有acid字段这里改名避免混淆可按需调整
message = Column(String(2000), nullable=False)
params = Column(String(1000), nullable=False)
keyword = Column(String(1000), nullable=False)
response = Column(String(2000), nullable=False)
module = Column(String(50), nullable=False)
type = Column(TinyInt, nullable=False)
dateline = Column(UnsignedInteger, nullable=False)
class Config:
from_attributes = True
# ImsCoreRefundlog模型用于映射数据库表ims_core_refundlog
class ImsCoreRefundlog(Base):
__tablename__ = "ims_core_refundlog"
acid = Column(Integer, primary_key=True) # 将id改为acid
uniacid = Column(Integer, nullable=False)
refund_uniontid = Column(String(64), nullable=False)
reason = Column(String(80), nullable=False)
uniontid = Column(String(64), nullable=False)
fee = Column(Decimal(10, 2), nullable=False)
status = Column(Integer, nullable=False)
is_wish = Column(TinyInt, nullable=False)
class Config:
from_attributes = True
# ImsCoreResource模型用于映射数据库表ims_core_resource
class ImsCoreResource(Base):
__tablename__ = "ims_core_resource"
acid = Column(Integer, primary_key=True) # 将mid改为acid
uniacid = Column(UnsignedInteger, nullable=False)
media_id = Column(String(100), nullable=False)
trunk = Column(UnsignedInteger, nullable=False)
type = Column(String(10), nullable=False)
dateline = Column(UnsignedInteger, nullable=False)
class Config:
from_attributes = True
# ImsCoreQueue模型用于映射数据库表ims_core_queue
class ImsCoreQueue(Base):
__tablename__ = "ims_core_queue"
acid = Column(BigInt, primary_key=True) # 将qid改为acid类型对应BigInt
uniacid = Column(UnsignedInteger, nullable=False)
acid_original = Column(UnsignedInteger, nullable=False) # 原表中还有acid字段这里改名避免混淆可按需调整
message = Column(String(2000), nullable=False)
params = Column(String(1000), nullable=False)
keyword = Column(String(1000), nullable=False)
response = Column(String(2000), nullable=False)
module = Column(String(50), nullable=False)
type = Column(TinyInt, nullable=False)
dateline = Column(UnsignedInteger, nullable=False)
class Config:
from_attributes = True
# ImsCoreRefundlog模型用于映射数据库表ims_core_refundlog
class ImsCoreRefundlog(Base):
__tablename__ = "ims_core_refundlog"
acid = Column(Integer, primary_key=True) # 将id改为acid
uniacid = Column(Integer, nullable=False)
refund_uniontid = Column(String(64), nullable=False)
reason = Column(String(80), nullable=False)
uniontid = Column(String(64), nullable=False)
fee = Column(Decimal(10, 2), nullable=False)
status = Column(Integer, nullable=False)
is_wish = Column(TinyInt, nullable=False)
class Config:
from_attributes = True
from sqlalchemy import Column, Integer, String, UnsignedInteger
from mooc.db.database import Base
# ImsCoreResource模型用于映射数据库表ims_core_resource
class ImsCoreResource(Base):
__tablename__ = "ims_core_resource"
acid = Column(Integer, primary_key=True) # 将mid改为acid
uniacid = Column(UnsignedInteger, nullable=False)
media_id = Column(String(100), nullable=False)
trunk = Column(UnsignedInteger, nullable=False)
type = Column(String(10), nullable=False)
dateline = Column(UnsignedInteger, nullable=False)
class Config:
from_attributes = True
# ImsCoreResource模型用于映射数据库表ims_core_resource
class ImsCoreResource(Base):
__tablename__ = "ims_core_resource"
acid = Column(Integer, primary_key=True) # 将mid改为acid
uniacid = Column(UnsignedInteger, nullable=False)
media_id = Column(String(100), nullable=False)
trunk = Column(UnsignedInteger, nullable=False)
type = Column(String(10), nullable=False)
dateline = Column(UnsignedInteger, nullable=False)
class Config:
from_attributes = True
# ImsCoreSendsmsLog模型用于映射数据库表ims_core_sendsms_log
class ImsCoreSendsmsLog(Base):
__tablename__ = "ims_core_sendsms_log"
acid = Column(UnsignedInteger, primary_key=True) # 将id改为acid
uniacid = Column(UnsignedInteger, nullable=False)
mobile = Column(String(11), nullable=False)
content = Column(String(255), nullable=False)
result = Column(String(255), nullable=False)
createtime = Column(UnsignedInteger, nullable=False)
class Config:
from_attributes = True
from sqlalchemy import Column, Integer, String, UnsignedInteger
from mooc.db.database import Base
# ImsCoreSessions模型用于映射数据库表ims_core_sessions
class ImsCoreSessions(Base):
__tablename__ = "ims_core_sessions"
acid = Column(CHAR(32), primary_key=True) # 将sid作为主键对应类型为CHAR(32)
uniacid = Column(UnsignedInteger, nullable=False)
openid = Column(String(50), nullable=False)
data = Column(String(2000), nullable=False)
expiretime = Column(UnsignedInteger, nullable=False)
class Config:
from_attributes = True
# ImsCoreSettings模型用于映射数据库表ims_core_settings
class ImsCoreSettings(Base):
__tablename__ = "ims_core_settings"
acid = Column(String(255), primary_key=True) # 将主键key改为acid
class Config:
from_attributes = True