class AdminUser(PrimaryKeyBaseModel): u_name = db.Column(db.String(32), unique=True) _u_password = db.Column(db.String(128)) @property def u_password(self): raise Exception("密码不可读") @u_password.setter def u_password(self, password): self._u_password = generate_password_hash(password) def verity_password(self, password): return check_password_hash(self._u_password, password)
class Cinema(PrimaryKeyBaseModel): c_name = db.Column(db.String(64)) c_address = db.Column(db.String(256)) c_phone = db.Column(db.String(64)) c_user = db.Column(db.ForeignKey(CinemaUser.id))
class Hall(PrimaryKeyBaseModel): h_num = db.Column(db.String(32)) h_mode = db.Column(db.String(32)) h_seats = db.Column(db.String(256)) h_cinema = db.Column(db.ForeignKey(Cinema.id))
class MovieOrder(PrimaryKeyBaseModel): o_movie = db.Column(db.ForeignKey(Movie.id)) o_user = db.Column(db.ForeignKey(CinemaUser.id)) o_create_time = db.Column(db.DateTime, default=datetime.now()) o_status = db.Column(db.String(10), default=NON_PAYMENT)
class Movie(PrimaryKeyBaseModel): m_name = db.Column(db.String(64), unique=True) m_duration = db.Column(db.Integer, default=90) m_type = db.Column(db.String(32))