from app import db class EntityBase(object): def to_json(self): fields = self.__dict__ if "_sa_instance_state" in fields: del fields["_sa_instance_state"] return fields class School(db.Model, EntityBase): """ 表名,字段名 """ __tablename__ = "school_list" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(255)) province = db.Column(db.String(255)) city = db.Column(db.String(255)) feature = db.Column(db.String(255)) hotValue = db.Column(db.String(255)) pic = db.Column(db.String(255)) category = db.Column(db.String(255)) batchTimes = db.Column(db.String(255)) def to_dict(self): return { 'name': self.name, 'province': self.province, 'city': self.city, 'feature': self.feature, 'hotValue': self.hotValue, 'pic': self.pic, 'category': self.category, 'batchTimes': self.batchTimes } class Csdn(db.Model, EntityBase): """ 表名,字段名 """ __tablename__ = "score" id = db.Column(db.Integer, primary_key=True) nickname = db.Column(db.String(255)) username = db.Column(db.String(255)) cateName = db.Column(db.String(255)) totalScore = db.Column(db.Float) regtime = db.Column(db.String(255)) yuanli = db.Column(db.Integer) fangwen = db.Column(db.Integer) yuanchuang = db.Column(db.Integer) zongbang = db.Column(db.Integer) fensi = db.Column(db.Integer) tie = db.Column(db.Integer) ip = db.Column(db.String(255)) url = db.Column(db.String(255))