class Parkinfo(db.Model): id = db.Column(db.Integer, primary_key=True) parknum = db.Column(db.Integer) cardnum = db.Column(db.String(50)) carnum = db.Column(db.String(50)) parkin = db.Column(db.DATE) parktemp = db.Column(db.Integer)
class City(Baseful): letter_id=db.Column(db.Integer,db.ForeignKey(Letter.id)) c_id=db.Column(db.Integer,default=0) c_parent_id=db.Column(db.Integer,default=0) c_region_name=db.Column(db.String(16)) c_city_code=db.Column(db.Integer,default=0) c_pinyin=db.Column(db.String(64))
class Cnns(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) c_name = db.Column(db.String(32)) c_type = db.Column(db.String(16)) c_format = db.Column(db.String(16)) c_path = db.Column(db.String(64)) c_isPublic = db.Column(db.Boolean, default=True)
class SampleCases(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) s_description = db.Column(db.String(64)) s_type = db.Column(db.String(32)) s_modelClsId = db.Column(db.Integer, db.ForeignKey(Cnns.id)) s_modelDetId = db.Column(db.Integer, db.ForeignKey(Cnns.id)) s_dataId = db.Column(db.Integer, db.ForeignKey(DataSets.id))
class Main(db.Model): # 必须继承自db.Model __tablename__ = 'movies' id = db.Column(db.Integer, primary_key=True, autoincrement=True) name = db.Column(db.String(64), unique=True) trackid = db.Column(db.String(64), unique=True)
class ApiCases(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) a_description = db.Column(db.String(64)) a_level = db.Column(db.String(16)) a_type = db.Column(db.String(32)) a_modelId = db.Column(db.Integer, db.ForeignKey(Cnns.id)) a_dataId = db.Column(db.Integer, db.ForeignKey(DataSets.id))
class Plant(db.Model): plantid = db.Column(db.Integer,primary_key=True) plantname = db.Column(db.String(100)) #植物姓名 water = db.Column(db.String(100)) #缺水状况 watertime = db.Column(db.DateTime) #上次浇水时间 waterinterval = db.Column(db.Integer) #浇水时间间隔 plantpic = db.Column(db.String(100)) #植物图片
class MovieUser(BaseModel): username = db.Column(db.String(32), unique=True) _password = db.Column(db.String(256)) phone = db.Column(db.String(32), unique=True) is_delete = db.Column(db.Boolean, default=False) permission = db.Column(db.Boolean, default=PERMISSION_NONE) @property def password(self): raise Exception("can't access") @password.setter def password(self, password_value): self._password = generate_password_hash(password_value) def check_password(self, password_value): return check_password_hash(self._password, password_value) def check_permission(self, permission): if (BLACK_USER & self.permission) == BLACK_USER: return False else: return permission & self.permission == permission
class Video(db.Model): __tablename__ = 'video' id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(255), unique=True) url = db.Column(db.String(255), unique=True) # 地址 info = db.Column(db.Text) # 简介 logo = db.Column(db.String(255), unique=True) # 封面 star = db.Column(db.SmallInteger) # 星级评分 playnum = db.Column(db.BigInteger) # 播放量 commentnum = db.Column(db.BigInteger) # 评论量 col_num = db.Column(db.Integer, default=0) #收藏量 up_num = db.Column(db.Integer, default=0) tag_id = db.Column(db.Integer, db.ForeignKey('tag.id')) # 所属标签 user_id = db.Column(db.Integer, db.ForeignKey('user.id')) # 所属用户 comments = db.relationship('Comment', backref='video') # 评论 video_cols = db.relationship('Videocol', backref='video') # 收藏 video_ups = db.relationship('Videoup', backref='video') #点赞 release_time = db.Column(db.Date) # 上映时间 area = db.Column(db.String(255)) # 上映地区 length = db.Column(db.String(100)) # 播放时长 addtime = db.Column(db.DateTime, index=True, default=datetime.now()) # 添加时间 def __repr__(self): return "<Video %r>" % self.title
class User(BaseModel): u_name = db.Column(db.String(32), unique=True) _u_password = db.Column(db.String(256)) is_super = db.Column(db.Boolean, default=False) @property def u_password(self): raise Exception("cant't access") @u_password.setter def u_password(self, password): self._u_password = generate_password_hash(password) def verify_password(self, password): return check_password_hash(self._u_password, password) def check_permission(self, permission_name): if self.is_super: return True permissions = UserPermission.query.filter( UserPermission.u_user_id.__eq__(self.id)) for permission in permissions: if Permission.query.get( permission.u_permission_id).p_name == permission_name: return True return False
class MovieUser(BaseModel): username = db.Column(db.String(32), unique=True) _password = db.Column(db.String(256)) phone = db.Column(db.String(32), unique=True) is_deleted = db.Column(db.Boolean, default=False) permission = db.Column(db.Integer, default=USER_COMMON) @property def password(self): raise Exception("You have no access to password.") @password.setter def password(self, passwd): self._password = generate_password_hash(passwd) def check_password(self, passwd): return check_password_hash(self._password, passwd) def check_permission(self, permission): # 权限值与运算判断权限, # 与之后,相同,则有权限,不同则无权限 if (USER_BLACK & self.permission) == USER_BLACK: return False else: return permission & self.permission == permission
class Goods(db.Model): g_id = db.Column(db.Integer, primary_key=True, autoincrement=True) g_name = db.Column(db.String(256), unique=True) g_img = db.Column(db.String(128), default=None) # 0为跑步机,1为瑜伽,2为视频,3为助眠 good_group_id = db.Column(db.Integer) g_price = db.Column(db.String(32))
class Collection(db.Model): col_id = db.Column(db.Integer, primary_key=True, autoincrement=True) col_name = db.Column(db.String(128)) col_img = db.Column(db.String(128), default=None) # 判断是属于0运动,1食品,2视频的哪一类 col_group_id = db.Column(db.Integer) col_user = db.Column(db.Integer, db.ForeignKey('user.u_id'))
class Message(BaseModel): id = db.Column(db.String(64), primary_key=True) sendId = db.Column(db.String(16)) receiveId = db.Column(db.String(16)) content = db.Column(db.String(1024)) status = db.Column(db.String(4), default='0') date = db.Column(db.DateTime)
class Students(BaseModel, db.Model): __tablename__ = 'Students' student_id = db.Column(db.Integer(), primary_key=True) student_name = db.Column(db.String(50)) student_password = db.Column(db.String(128)) lab_id = db.Column(db.Integer(), db.ForeignKey('Labs.lab_id')) admin = db.Column(db.Boolean, default=False) is_delete = db.Column(db.Boolean, default=False) #is_login = db.Column(db.Boolean, default=False) @property def stu_password(self): return self.student_password @stu_password.setter def stu_password(self, password): self.student_password = generate_password_hash(password) # 验证密码 def verify_password(self, password): return check_password_hash(self.student_password, password) # 权限判定 def check_permission(self, permission): return self.stu_permission & permission == permission def __repr__(self): return '<Students %r>' % self.student_name
class CinemaAdminUser(BaseModel): username = db.Column(db.String(32),unique=True) _password = db.Column(db.String(256)) phone = db.Column(db.String(32),unique=True) is_delete = db.Column(db.Boolean,default=False) is_verify = db.Column(db.Boolean,default=False) @property def password(self): raise Exception("password con't access") @password.setter def password(self,password_value): self._password = generate_password_hash(password_value) def check_password(self,password_value): return check_password_hash(self._password,password_value) def check_permission(self,permission): if not self.is_verify: return False permissions = CinemaUserPermission.query.filter_by(c_user_id = self.id) for user_permission in permissions: if permission == Permissions.query.get(user_permission.c_permission_id).p_name: return True return False
class Main(db.Model): __abstract__ = True id = db.Column(db.INTEGER, primary_key=True, autoincrement=True) img = db.Column(db.String(256)) name = db.Column(db.String(64)) trackid = db.Column(db.INTEGER, default=1)
class User(db.Model, UserMixin): uid = db.Column(db.Integer, primary_key=True, autoincrement=True) username = db.Column(db.String(30), nullable=False, unique=True) password = db.Column(db.String(128), nullable=False) phone = db.Column(db.String(11)) __tablename__ = 'user'
class Goods(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) # 图片 img = db.Column(db.String(200)) # 名称 name = db.Column(db.String(50)) # 价格 price = db.Column(db.String(50))
class UserModel(BaseModel, db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) u_name = db.Column(db.String(16), unique=True) u_password = db.Column(db.String(256)) u_email = db.Column(db.String(64), unique=True) is_active = db.Column(db.Boolean, default=False) is_delete = db.Column(db.Boolean, default=False) u_permission = db.Column(db.Integer, default=1)
class Notice(BaseModel): id = db.Column(db.String(32), primary_key=True) title = db.Column(db.String(128)) content = db.Column(db.String(1024)) type = db.Column(db.String(32)) creator = db.Column(db.String(32)) date = db.Column(db.DateTime) is_delete = db.Column(db.Boolean, default=False)
class About(db.Model): __tablename__ = 'about' id = db.Column(db.Integer, primary_key=True, autoincrement=True) company_name = db.Column(db.String(64), nullable=False) img1 = db.Column(db.String(64), nullable=False) img2 = db.Column(db.String(64), nullable=False) img3 = db.Column(db.String(64), nullable=False) content = db.Column(db.Text)
class Request(db.Model): __tablename__ = 'request' id = db.Column(db.Integer, primary_key=True, autoincrement=True) contact = db.Column(db.String(64), nullable=False) total = db.Column(db.Integer, nullable=False) objective_item = db.Column(db.Integer, db.ForeignKey('item.id')) create_time = db.Column(db.String(32), nullable=False, default=str(datetime.now())[:str(datetime.now()).rfind('.'):])
class SiteInfo(db.Model, BaseModel): id = db.Column(db.Integer, primary_key=True, autoincrement=True) sitename = db.Column(db.String(100)) #站点名称 website = db.Column(db.String(100)) #网站名称 url = db.Column(db.String(200)) reference = db.Column(db.String(200)) #备案 isclose = db.Column(db.Integer, default=0) #网站是否关闭 1关闭 __tablename__ = 'bbs_siteinfo'
class FriendLink(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) site = db.Column(db.String(100), nullable=False) url = db.Column(db.String(200)) logo = db.Column(db.String(300)) orderby = db.Column(db.Integer) description = db.Column(db.String(300)) __tablename__ = 'bbs_friendlink'
class User(BaseModel): id = db.Column(db.String(16), primary_key=True, unique=True) username = db.Column(db.String(32), unique=True) password = db.Column(db.String(256)) phone = db.Column(db.String(16)) name = db.Column(db.String(64)) status = db.Column(db.Boolean, default=False) is_delete = db.Column(db.Boolean, default=False)
class FoodType(db.Model): __tablename__ = 'axf_foodtype' id = db.Column(db.INTEGER, primary_key=True, autoincrement=True) typeid = db.Column(db.INTEGER, default=1) typename = db.Column(db.String(32)) childtypenames = db.Column(db.String(256)) typesort = db.Column(db.INTEGER, default=1)
class Animal(ModelBase, db.Model): __abstract__ = True id = db.Column(db.Integer, primary_key=True, autoincrement=True) a_name = db.Column(db.String(16), unique=True) a_height = db.Column(db.String(16)) a_weight = db.Column(db.String(16)) a_color = db.Column(db.String(16)) a_detail = db.Column(db.Text)
class UserModel(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) u_name = db.Column(db.String(32), unique=True) u_password = db.Column(db.String(256)) u_email = db.Column(db.String(64), unique=True) u_active = db.Column(db.Boolean, default=False) u_token = db.Column(db.String(256)) u_promission = db.Column(db.Integer, default=1)
class TopiClassify(db.Model): topicid = db.Column(db.Integer, primary_key=True, autoincrement=True) topicname = db.Column(db.String(64)) topicimg = db.Column(db.String(128)) # 底部标注 topicbottom = db.Column(db.String(128)) # 参与评论的人数 topic_com_num = db.Column(db.String(64))