Beispiel #1
0
class UserInfo(db.Model):
    __tablename__ = 'user_info'
    id = db.Column(db.Integer, primary_key=True)
    nickname = db.Column(db.String(255))
    userid = db.Column(db.Integer, db.ForeignKey('user.id'))
    def __repr__(self):
        return '<UserInfo %r>' % (self.nickname)
Beispiel #2
0
class User(db.Model):
    __tablename__ = 'user'
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(64))
    userpassword = db.Column(db.String(64))
    creatdate = db.Column(db.DateTime)
    updatedate = db.Column(db.DateTime)
    userinfo = db.relationship('UserInfo', uselist=False, backref='userinfo')
    def __repr__(self):
        return '<User %r>' % (self.username)
Beispiel #3
0
class App(db.Model):
    def gen_id(self):
        return uuid.uuid4().hex

    __tablename__ = 'youheng_app'
    uuid = db.Column(db.String(32), default=gen_id, primary_key=True)
    size = db.Column(db.String(32))
    version = db.Column(db.String(32))
    build = db.Column(db.Integer)
    url = db.Column(db.String(128))
    name = db.Column(db.String(16))
    describe = db.Column(db.String(128))

    time_creat = db.Column(db.DateTime)
    time_update = db.Column(db.DateTime)

    def add(self):
        db.session.add(self)
        db.session.commit()

    def delete(self):

        db.session.delete(self)
        db.session.commit()

    def save(self):
        db.session.commit()
Beispiel #4
0
class Fund(db.Model):
    def gen_id(self):
        return uuid.uuid4().hex

    __tablename__ = 'fund'
    uuid = db.Column(db.String(32), default=gen_id, primary_key=True)
    time_creat = db.Column(db.DateTime)
    time_update = db.Column(db.DateTime)
    fund_name = db.Column(db.String(64))
    fund_code = db.Column(db.String(64))
    mixamt = db.Column(db.Float)  #最低申购
    maxamt = db.Column(db.String(64))  #最高申购额
    feeratio = db.Column(db.Float)  #总费率
Beispiel #5
0
class Ask(db.Model):
    def gen_id(self):
        return uuid.uuid4().hex

    __tablename__ = 'youheng_ask'
    uuid = db.Column(db.String(32), default=gen_id, primary_key=True)
    key = db.Column(db.Text)
    result = db.Column(db.Text)
    image = db.Column(db.String(128))
    time_creat = db.Column(db.DateTime)

    def add(self):
        db.session.add(self)
        db.session.commit()

    def delete(self):
        db.session.delete(self)
        db.session.commit()

    def save(self):
        db.session.commit()
Beispiel #6
0
class YouhengUdid(db.Model):
    def gen_id(self):
        return uuid.uuid4().hex

    __tablename__ = 'youheng_udid'
    uuid = db.Column(db.String(32), default=gen_id, primary_key=True)
    udid = db.Column(db.String(64))
    id = db.Column(db.Integer)
    time_creat = db.Column(db.DateTime)

    def add(self):
        db.session.add(self)
        db.session.commit()

    def delete(self):

        db.session.delete(self)
        db.session.commit()

    def save(self):
        db.session.commit()
Beispiel #7
0
class User(db.Model):
    def gen_id(self):
        return uuid.uuid4().hex

    __tablename__ = 'user'
    uuid = db.Column(db.String(32), default=gen_id, primary_key=True)
    phone = db.Column(db.String(16))
    time_creat = db.Column(db.DateTime)
    password = db.Column(db.String(64))
    token = db.Column(db.String(64))
    mitoken = db.Column(db.JSON)

    def generate_auth_token(self, expiration=60 * 60 * 24):
        s = Serializer('leefeng', expires_in=expiration)
        return s.dumps({'id': self.uuid})

    @staticmethod
    def verify_auth_token(token):
        s = Serializer('leefeng')
        try:
            data = s.loads(token)
        except SignatureExpired:
            return None  # valid token, but expired
        except BadSignature:
            return None  # invalid token
        user = User.query.get(data['id'])
        return user
Beispiel #8
0
class YouhengDuyao(db.Model):
    def gen_id(self):
        return uuid.uuid4().hex

    __tablename__ = 'youheng_duyao'
    uuid = db.Column(db.String(32), default=gen_id, primary_key=True)
    text = db.Column(db.Text)
    isSend = db.Column(db.Boolean)
    type = db.Column(db.Integer)
    time_creat = db.Column(db.DateTime)
    time_send = db.Column(db.DateTime)

    # type = db.relationship('YouhengDuyaoType')
    # type = db.Column(db.Integer, db.ForeignKey('YouhengDuyaoType.uuid'))

    def add(self):
        db.session.add(self)
        db.session.commit()

    def delete(self):

        db.session.delete(self)
        db.session.commit()

    def save(self):
        db.session.commit()
Beispiel #9
0
class Question(db.Model):
    # def gen_id(self):
    #     return uuid.uuid4().hex

    __tablename__ = 'youheng_question'
    uuid = db.Column(db.Integer, primary_key=True)
    question = db.Column(db.Text)
    result = db.Column(db.Text)
    image = db.Column(db.String(128))
    time_creat = db.Column(db.DateTime)
    time_update = db.Column(db.DateTime)

    def add(self):
        db.session.add(self)
        db.session.commit()

    def delete(self):

        db.session.delete(self)
        db.session.commit()

    def save(self):
        db.session.commit()