class RemoteProxy(Base): id = db.Column(db.Integer, primary_key=True, autoincrement=True) remoteProxy = db.Column(db.String(30), nullable=False) # 带端口号的http地址 无/结尾 port = db.Column(db.String(7), nullable=False) # 端口 school = db.relationship('School', back_populates='proxy') schoolId = db.Column(db.Integer, db.ForeignKey('school.schoolId'), nullable=False)
class School(Base): schoolId = db.Column(db.Integer, primary_key=True, autoincrement=True) schoolName = db.Column(db.String(40), nullable=False, unique=True) schoolAbbr = db.Column(db.String(10), nullable=False) proxy = db.relationship('RemoteProxy', back_populates='school') admins = db.relationship('Admin', back_populates='school') successPeople = db.relationship('Success', back_populates='school') remote = db.Column(db.Boolean, default=False) # 默认不使用内网
class Admin(Base): id = db.Column(db.Integer, primary_key=True, autoincrement=True) account = db.Column(db.String(20), nullable=False, unique=True, index=True) password = db.Column(db.String(20), nullable=False) permissions = db.Column(db.Integer, default=AdminPermission.team) status = db.Column(db.String(10), default=UserStatus.normal) school = db.relationship('School', back_populates='admins') schoolId = db.Column(db.Integer, db.ForeignKey('school.schoolId'), nullable=False)
class Success(Base): id = db.Column(db.Integer, primary_key=True, autoincrement=True) school = db.relationship('School', back_populates='successPeople') schoolId = db.Column(db.Integer, db.ForeignKey('school.schoolId'), nullable=False) portraitUri = db.Column(db.String(50)) info = db.Column(db.Text) userId = db.Column(db.Integer)
class Token(Base): id = db.Column(db.BigInteger,primary_key=True, autoincrement=True) value = db.Column(db.String(140), index=True, nullable=False) limitPerDay = db.Column(db.Integer,default=80000)#日限额,默认300000次一天 status = db.Column(db.SmallInteger,default=1)#正常 permission = db.Column(db.SmallInteger,default=0)#0 无看头像权限 1 有查看头像权限 10 有全部权限