Пример #1
0
class VideoList(db.Model):
    # __table__ == 'videolist'
    id = db.Column(db.INTEGER,primary_key=True)
    rid = db.Column(db.INTEGER,db.ForeignKey('roominfo_main.room_id'))
    video_url = db.Column(db.String(128))
    poster_url = db.Column(db.String(128))
    video_name = db.Column(db.String(64))

    def __init__(self,rid,v_url,p_url,v_name):
        self.rid = rid
        self.video_url = v_url
        self.poster_url = p_url
        self.video_name = v_name
Пример #2
0
class UserOther(db.Model):
    __tablename__ = 'user_other_info'
    id = db.Column(db.INTEGER,primary_key=True)
    uid = db.Column(db.INTEGER,db.ForeignKey('userinfo_main.user_id'))
    sex = db.Column(db.Enum('男','女','保密'),nullable=True)
    phone = db.Column(db.String(11),nullable=True)
    city = db.Column(db.String(15),nullable=True)
    ps = db.Column(db.Text,nullable=True)

    def __init__(self,uid,sex,phone,city,ps):
        self.uid = uid
        self.sex = sex
        self.phone = phone
        self.city = city
        self.ps = ps
Пример #3
0
class RoomComment(db.Model):
    # __tablename__ == 'room_comment'
    id = db.Column(db.INTEGER,primary_key=True)
    rid = db.Column(db.INTEGER,db.ForeignKey('roominfo_main.room_id'))
    uid = db.Column(db.INTEGER)
    comment = db.Column(db.Text)
    uname = db.Column(db.String(30))

    def __init__(self,rid,comment,uid,uname):
        self.rid = rid
        self.comment = comment
        self.uid = uid
        self.uname = uname
Пример #4
0
class UserMain(UserMixin,db.Model):
    __tablename__ = 'userinfo_main'
    user_id = db.Column(db.INTEGER,primary_key=True)
    user_name = db.Column(db.String(20),nullable=False,unique=True)
    u_passwd = db.Column(db.String(256),nullable=False)
    age = db.Column(db.INTEGER,nullable=False)
    email = db.Column(db.String(50),nullable=False)
    img = db.Column(db.String(128))

    other = db.relationship('UserOther',backref='userinfo_main',lazy='dynamic')
    fav = db.relationship('UserFav',backref='useinfo_main',lazy='dynamic')
    gift = db.relationship('UserGift',backref='userinfo_main',lazy='dynamic')
    score = db.relationship('UserScore',backref='userinfo_main',lazy='dynamic')

    def __init__(self,uname,pwd,age,email,img='img/user.jpg'):
        self.user_name = uname
        self.u_passwd = pwd
        self.age = age
        self.email = email
        self.img = img

    def __repr__(self):
        return 'userinfo %s %s'%(self.user_name,self.u_passwd)
Пример #5
0
class RoomMain(db.Model):
    __tablename__ = 'roominfo_main'
    room_id = db.Column(db.INTEGER,primary_key=True)
    room_name = db.Column(db.String(100))
    host_name = db.Column(db.String(50))
    img = db.Column(db.String(128))
    is_oline = db.Column(db.INTEGER)
    live_url = db.Column(db.String(128))
    host_img = db.Column(db.String(128))

    count = db.relationship('RoomCount',backref='roominfo_main',lazy='dynamic')
    gift = db.relationship('RoomGift',backref='roominfo_main',lazy='dynamic')
    type = db.relationship('RoomType',backref='roominfo_main',lazy='dynamic')
    comment = db.relationship('RoomComment',backref='roominfo_main',lazy='dynamic')
    videolist = db.relationship('VideoList',backref='roominfo_main',lazy='dynamic')


    def __init__(self,rname,hname,img,ol,url,himg='img/user.jpg'):
        self.room_name = rname
        self.host_name = hname
        self.img = img
        self.is_oline = ol
        self.live_url = url
        self.host_img = himg