diff --git a/mooc/models/core.py b/mooc/models/core.py new file mode 100644 index 0000000..475d011 --- /dev/null +++ b/mooc/models/core.py @@ -0,0 +1,148 @@ +from sqlalchemy import Column, Integer, String, Text, ForeignKey +from sqlalchemy.dialects.mysql import BIGINT +from mooc.db.database import Base + + +# ImsCoreCache模型用于映射数据库表ims_core_cache +class ImsCoreCache(Base): + __tablename__ = "ims_core_cache" + acid = Column(String(255), primary_key=True) # 将主键key改为acid,并假设合适的类型,可按需调整 + + class Config: + orm_mode = True + + +# ImsCoreCron模型用于映射数据库表ims_core_cron +class ImsCoreCron(Base): + __tablename__ = "ims_core_cron" + acid = Column(Integer, primary_key=True) # 将主键id改为acid + createtime = Column(Integer, nullable=True) + nextruntime = Column(Integer, nullable=True) + uniacid = Column(Integer, nullable=True) + cloudid = Column(Integer, nullable=True) + + class Config: + orm_mode = True + + +# ImsCoreCronRecord模型用于映射数据库表ims_core_cron_record +class ImsCoreCronRecord(Base): + __tablename__ = "ims_core_cron_record" + acid = Column(Integer, primary_key=True) # 将主键id改为acid + uniacid = Column(Integer, nullable=True) + tid = Column(Integer, nullable=True) + module = Column(String(255), nullable=True) + + class Config: + orm_mode = True + + +# ImsCoreJob模型用于映射数据库表ims_core_job +class ImsCoreJob(Base): + __tablename__ = "ims_core_job" + acid = Column(Integer, primary_key=True) # 将主键id改为acid + + class Config: + orm_mode = True + + +# ImsCoreMenu模型用于映射数据库表ims_core_menu +class ImsCoreMenu(Base): + __tablename__ = "ims_core_menu" + acid = Column(Integer, primary_key=True) # 将主键id改为acid + + class Config: + orm_mode = 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, ForeignKey('ims_users.uid'), nullable=True) # 假设关联ims_users表的uid字段,可按需调整 + + class Config: + orm_mode = True + + +# ImsCorePaylog模型用于映射数据库表ims_core_paylog +class ImsCorePaylog(Base): + __tablename__ = "ims_core_paylog" + acid = Column(BIGINT, primary_key=True) # 将主键plid改为acid,假设类型为BIGINT,可按需调整 + openid = Column(String(255), nullable=True) + tid = Column(Integer, nullable=True) + uniacid = Column(Integer, nullable=True) + uniontid = Column(String(255), nullable=True) + + class Config: + orm_mode = True + + +# ImsCorePerformance模型用于映射数据库表ims_core_performance +class ImsCorePerformance(Base): + __tablename__ = "ims_core_performance" + acid = Column(Integer, primary_key=True) # 将主键id改为acid + + class Config: + orm_mode = True + + +# ImsCoreQueue模型用于映射数据库表ims_core_queue +class ImsCoreQueue(Base): + __tablename__ = "ims_core_queue" + acid = Column(Integer, primary_key=True) # 将主键qid改为acid + uniacid = Column(Integer, nullable=True) + module = Column(String(255), nullable=True) + dateline = Column(Integer, nullable=True) + + class Config: + orm_mode = True + + +# ImsCoreRefundlog模型用于映射数据库表ims_core_refundlog +class ImsCoreRefundlog(Base): + __tablename__ = "ims_core_refundlog" + acid = Column(Integer, primary_key=True) # 将主键id改为acid + refund_uniontid = Column(String(255), nullable=True) + uniontid = Column(String(255), nullable=True) + + class Config: + orm_mode = True + + +# ImsCoreResource模型用于映射数据库表ims_core_resource +class ImsCoreResource(Base): + __tablename__ = "ims_core_resource" + acid = Column(Integer, primary_key=True) # 将主键mid改为acid + uniacid = Column(Integer, nullable=True) + type = Column(String(255), nullable=True) + + class Config: + orm_mode = True + + +# ImsCoreSendsmsLog模型用于映射数据库表ims_core_sendsms_log +class ImsCoreSendsmsLog(Base): + __tablename__ = "ims_core_sendsms_log" + acid = Column(Integer, primary_key=True) # 将主键id改为acid + + class Config: + orm_mode = True + + +# ImsCoreSessions模型用于映射数据库表ims_core_sessions +class ImsCoreSessions(Base): + __tablename__ = "ims_core_sessions" + acid = Column(String(255), primary_key=True) # 将主键sid改为acid + + class Config: + orm_mode = True + + +# ImsCoreSettings模型用于映射数据库表ims_core_settings +class ImsCoreSettings(Base): + __tablename__ = "ims_core_settings" + acid = Column(String(255), primary_key=True) # 将主键key改为acid + + class Config: + orm_mode = True \ No newline at end of file diff --git a/mooc/models/userapi.py b/mooc/models/userapi.py new file mode 100644 index 0000000..8de12a2 --- /dev/null +++ b/mooc/models/userapi.py @@ -0,0 +1,31 @@ +from sqlalchemy import Column, Integer, String, Text +from mooc.db.database import Base + + +# ImsUserapiCache模型用于映射数据库表ims_userapi_cache +class ImsUserapiCache(Base): + __tablename__ = "ims_userapi_cache" + + acid = Column(Integer, primary_key=True) + key = Column(String(32), nullable=False) + content = Column(Text, nullable=False) + lastupdate = Column(Integer, nullable=False) + + class Config: + orm_mode = True + + +# ImsUserapiReply模型用于映射数据库表ims_userapi_reply +class ImsUserapiReply(Base): + __tablename__ = "ims_userapi_reply" + + acid = Column(Integer, primary_key=True) + rid = Column(Integer, nullable=False) + description = Column(String(300), nullable=False) + apiurl = Column(String(300), nullable=False) + token = Column(String(32), nullable=False) + default_text = Column(String(100), nullable=False) + cachetime = Column(Integer, nullable=False) + + class Config: + orm_mode = True \ No newline at end of file diff --git a/mooc/models/users_all.py b/mooc/models/users_all.py new file mode 100644 index 0000000..a4a2724 --- /dev/null +++ b/mooc/models/users_all.py @@ -0,0 +1,375 @@ +from sqlalchemy import Column, Integer, String, Text, SmallInteger, TinyInt, UnsignedInteger +from mooc.db.database import Base + + +# ImsUsers模型用于映射数据库表ims_users +class ImsUsers(Base): + __tablename__ = "ims_users" + + acid = Column(Integer, primary_key=True) + owner_uid = Column(Integer, nullable=False) + groupid = Column(Integer, nullable=False) + founder_groupid = Column(Integer, nullable=False) + username = Column(String(255), nullable=False) + password = Column(String(255), nullable=False) + salt = Column(String(255), nullable=False) + type = Column(Integer, nullable=False) + status = Column(Integer, nullable=False) + joindate = Column(Integer, nullable=False) + joinip = Column(String(255), nullable=False) + lastvisit = Column(Integer, nullable=False) + lastip = Column(String(255), nullable=False) + remark = Column(Text, nullable=False) + starttime = Column(Integer, nullable=False) + endtime = Column(Integer, nullable=False) + register_type = Column(Integer, nullable=False) + openid = Column(String(255), nullable=False) + welcome_link = Column(Integer, nullable=False) + notice_setting = Column(String(255), nullable=False) + is_bind = Column(Integer, nullable=False) + + class Config: + orm_mode = True + + +# ImsUsersBind模型用于映射数据库表ims_users_bind +class ImsUsersBind(Base): + __tablename__ = "ims_users_bind" + + acid = Column(Integer, primary_key=True) + uid = Column(Integer, nullable=False) + bind_sign = Column(String(50), nullable=False) + third_type = Column(TinyInt, nullable=False) + third_nickname = Column(String(255), nullable=False) + + class Config: + orm_mode = True + + +# ImsUsersCreateGroup模型用于映射数据库表ims_users_create_group +class ImsUsersCreateGroup(Base): + __tablename__ = "ims_users_create_group" + + acid = Column(Integer, primary_key=True) + group_name = Column(String(50), nullable=False) + maxaccount = Column(Integer, nullable=False) + maxwxapp = Column(Integer, nullable=False) + maxwebapp = Column(Integer, nullable=False) + maxphoneapp = Column(Integer, nullable=False) + maxxzapp = Column(Integer, nullable=False) + maxaliapp = Column(Integer, nullable=False) + createtime = Column(Integer, nullable=False) + maxbaiduapp = Column(Integer, nullable=False) + maxtoutiaoapp = Column(Integer, nullable=False) + + class Config: + orm_mode = True + + +# ImsUsersGroup模型用于映射数据库表ims_users_group +class ImsUsersGroup(Base): + __tablename__ = "ims_users_group" + + acid = Column(UnsignedInteger, primary_key=True) + owner_uid = Column(Integer, nullable=False) + name = Column(String(50), nullable=False) + package = Column(String(5000), nullable=False) + maxaccount = Column(UnsignedInteger, nullable=False) + timelimit = Column(UnsignedInteger, nullable=False) + maxwxapp = Column(UnsignedInteger, nullable=False) + maxwebapp = Column(Integer, nullable=False) + maxphoneapp = Column(Integer, nullable=False) + maxxzapp = Column(Integer, nullable=False) + maxaliapp = Column(Integer, nullable=False) + maxbaiduapp = Column(Integer, nullable=False) + maxtoutiaoapp = Column(Integer, nullable=False) + + class Config: + orm_mode = True + + +# ImsUsersInvitation模型用于映射数据库表ims_users_invitation +class ImsUsersInvitation(Base): + __tablename__ = "ims_users_invitation" + + acid = Column(UnsignedInteger, primary_key=True) + code = Column(String(64), nullable=False) + fromuid = Column(UnsignedInteger, nullable=False) + inviteuid = Column(UnsignedInteger, nullable=False) + createtime = Column(UnsignedInteger, nullable=False) + + class Config: + orm_mode = True + + +# ImsUsersLastUse模型用于映射数据库表ims_users_lastuse +class ImsUsersLastUse(Base): + __tablename__ = "ims_users_lastuse" + + acid = Column(Integer, primary_key=True) + uid = Column(Integer, nullable=False) + uniacid = Column(Integer, nullable=False) + modulename = Column(String(100), nullable=False) + type = Column(String(100), nullable=False) + + class Config: + orm_mode = True + + +# ImsUsersLoginLogs模型用于映射数据库表ims_users_login_logs +class ImsUsersLoginLogs(Base): + __tablename__ = "ims_users_login_logs" + + acid = Column(UnsignedInteger, primary_key=True) + uid = Column(UnsignedInteger, nullable=False) + ip = Column(String(15), nullable=False) + city = Column(String(256), nullable=False) + login_at = Column(UnsignedInteger, nullable=False) + + class Config: + orm_mode = True + + +# ImsUsersOperateHistory模型用于映射数据库表ims_users_operate_history +class ImsUsersOperateHistory(Base): + __tablename__ = "ims_users_operate_history" + + acid = Column(UnsignedInteger, primary_key=True) + type = Column(TinyInt, nullable=False) + uid = Column(UnsignedInteger, nullable=False) + uniacid = Column(UnsignedInteger, nullable=False) + module_name = Column(String(100), nullable=False) + createtime = Column(Integer, nullable=False) + + class Config: + orm_mode = True + + +# ImsUsersOperateStar模型用于映射数据库表ims_users_operate_star +class ImsUsersOperateStar(Base): + __tablename__ = "ims_users_operate_star" + + acid = Column(UnsignedInteger, primary_key=True) + type = Column(TinyInt, nullable=False) + uid = Column(UnsignedInteger, nullable=False) + uniacid = Column(UnsignedInteger, nullable=False) + module_name = Column(String(100), nullable=False) + rank = Column(Integer, nullable=False) + createtime = Column(Integer, nullable=False) + + class Config: + orm_mode = True + + +# ImsUsersPermission模型用于映射数据库表ims_users_permission +class ImsUsersPermission(Base): + __tablename__ = "ims_users_permission" + + acid = Column(UnsignedInteger, primary_key=True) + uniacid = Column(UnsignedInteger, nullable=False) + uid = Column(UnsignedInteger, nullable=False) + type = Column(String(100), nullable=False) + permission = Column(String(10000), nullable=False) + url = Column(String(255), nullable=False) + modules = Column(Text, nullable=False) + templates = Column(Text, nullable=False) + + class Config: + orm_mode = True + + +# ImsUsersProfile模型用于映射数据库表ims_users_profile +class ImsUsersProfile(Base): + __tablename__ = "ims_users_profile" + + acid = Column(UnsignedInteger, primary_key=True) + uid = Column(UnsignedInteger, nullable=False) + createtime = Column(UnsignedInteger, nullable=False) + edittime = Column(Integer, nullable=False) + realname = Column(String(10), nullable=False) + nickname = Column(String(20), nullable=False) + avatar = Column(String(255), nullable=False) + qq = Column(String(15), nullable=False) + mobile = Column(String(11), nullable=False) + fakeid = Column(String(30), nullable=False) + vip = Column(TinyInt, nullable=False) + gender = Column(TinyInt, nullable=False) + birthyear = Column(UnsignedSmallInteger, nullable=False) + birthmonth = Column(UnsignedTinyInt, nullable=False) + birthday = Column(UnsignedTinyInt, nullable=False) + constellation = Column(String(10), nullable=False) + zodiac = Column(String(5), nullable=False) + telephone = Column(String(15), nullable=False) + idcard = Column(String(30), nullable=False) + studentid = Column(String(50), nullable=False) + grade = Column(String(10), nullable=False) + address = Column(String(255), nullable=False) + zipcode = Column(String(10), nullable=False) + nationality = Column(String(30), nullable=False) + resideprovince = Column(String(30), nullable=False) + residecity = Column(String(30), nullable=False) + residedist = Column(String(30), nullable=False) + graduateschool = Column(String(50), nullable=False) + company = Column(String(50), nullable=False) + education = Column(String(10), nullable=False) + occupation = Column(String(30), nullable=False) + position = Column(String(30), nullable=False) + revenue = Column(String(10), nullable=False) + affectivestatus = Column(String(30), nullable=False) + lookingfor = Column(String(255), nullable=False) + bloodtype = Column(String(5), nullable=False) + height = Column(String(5), nullable=False) + weight = Column(String(5), nullable=False) + alipay = Column(String(30), nullable=False) + msn = Column(String(30), nullable=False) + email = Column(String(50), nullable=False) + taobao = Column(String(30), nullable=False) + site = Column(String(30), nullable=False) + bio = Column(Text, nullable=False) + interest = Column(Text, nullable=False) + workerid = Column(String(64), nullable=False) + is_send_mobile_status = Column(TinyInt, nullable=False) + send_expire_status = Column(TinyInt, nullable=False) + + + + +# ImsUsersExtraGroup模型用于映射数据库表ims_users_extra_group +class ImsUsersExtraGroup(Base): + __tablename__ = "ims_users_extra_group" + + acid = Column(Integer, primary_key=True) + uid = Column(Integer, nullable=False) + uni_group_id = Column(Integer, nullable=False) + create_group_id = Column(Integer, nullable=False) + + class Config: + orm_mode = True + + +# ImsUsersExtraLimit模型用于映射数据库表ims_users_extra_limit +class ImsUsersExtraLimit(Base): + __tablename__ = "ims_users_extra_limit" + + acid = Column(Integer, primary_key=True) + uid = Column(Integer, nullable=False) + maxaccount = Column(Integer, nullable=False) + maxwxapp = Column(Integer, nullable=False) + maxwebapp = Column(Integer, nullable=False) + maxphoneapp = Column(Integer, nullable=False) + maxxzapp = Column(Integer, nullable=False) + maxaliapp = Column(Integer, nullable=False) + timelimit = Column(Integer, nullable=False) + maxbaiduapp = Column(Integer, nullable=False) + maxtoutiaoapp = Column(Integer, nullable=False) + + class Config: + orm_mode = True + + +# ImsUsersExtraModules模型用于映射数据库表ims_users_extra_modules +class ImsUsersExtraModules(Base): + __tablename__ = "ims_users_extra_modules" + + acid = Column(Integer, primary_key=True) + uid = Column(Integer, nullable=False) + module_name = Column(String(100), nullable=False) + support = Column(String(50), nullable=False) + + class Config: + orm_mode = True + + +# ImsUsersExtraTemplates模型用于映射数据库表ims_users_extra_templates +class ImsUsersExtraTemplates(Base): + __tablename__ = "ims_users_extra_templates" + + acid = Column(Integer, primary_key=True) + uid = Column(Integer, nullable=False) + template_id = Column(Integer, nullable=False) + + + +# ImsUsersFailedLogin模型用于映射数据库表ims_users_failed_login +class ImsUsersFailedLogin(Base): + __tablename__ = "ims_users_failed_login" + + acid = Column(Integer, primary_key=True) + ip = Column(String(15), nullable=False) + username = Column(String(32), nullable=False) + count = Column(TinyInt, nullable=False) + lastupdate = Column(Integer, nullable=False) + + + + +# ImsUsersFounderGroup模型用于映射数据库表ims_users_founder_group +class ImsUsersFounderGroup(Base): + __tablename__ = "ims_users_founder_group" + + acid = Column(UnsignedInteger, primary_key=True) + name = Column(String(50), nullable=False) + package = Column(String(5000), nullable=False) + maxaccount = Column(UnsignedInteger, nullable=False) + timelimit = Column(UnsignedInteger, nullable=False) + maxwxapp = Column(UnsignedInteger, nullable=False) + maxwebapp = Column(Integer, nullable=False) + maxphoneapp = Column(Integer, nullable=False) + maxxzapp = Column(Integer, nullable=False) + maxaliapp = Column(Integer, nullable=False) + maxbaiduapp = Column(Integer, nullable=False) + maxtoutiaoapp = Column(Integer, nullable=False) + + class Config: + orm_mode = True + + +# ImsUsersFounderOwnCreateGroups模型用于映射数据库表ims_users_founder_own_create_groups +class ImsUsersFounderOwnCreateGroups(Base): + __tablename__ = "ims_users_founder_own_create_groups" + + acid = Column(Integer, primary_key=True) + founder_uid = Column(Integer, nullable=False) + create_group_id = Column(Integer, nullable=False) + + class Config: + orm_mode = True + + +# ImsUsersFounderOwnUniGroups模型用于映射数据库表ims_users_founder_own_uni_groups +class ImsUsersFounderOwnUniGroups(Base): + __tablename__ = "ims_users_founder_own_uni_groups" + + acid = Column(Integer, primary_key=True) + founder_uid = Column(Integer, nullable=False) + uni_group_id = Column(Integer, nullable=False) + + class Config: + orm_mode = True + + +# ImsUsersFounderOwnUsers模型用于映射数据库表ims_users_founder_own_users +class ImsUsersFounderOwnUsers(Base): + __tablename__ = "ims_users_founder_own_users" + + acid = Column(Integer, primary_key=True) + uid = Column(Integer, nullable=False) + founder_uid = Column(Integer, nullable=False) + + class Config: + orm_mode = True + + +# ImsUsersFounderOwnUsersGroups模型用于映射数据库表ims_users_founder_own_users_groups +class ImsUsersFounderOwnUsersGroups(Base): + __tablename__ = "ims_users_founder_own_users_groups" + + acid = Column(Integer, primary_key=True) + founder_uid = Column(Integer, nullable=False) + users_group_id = Column(Integer, nullable=False) + + + class Config: + orm_mode = True + +