class Brand(BaseModel): __tablename__ = 'brand' id = db.Column(db.Integer, primary_key=True, autoincrement=True) name = db.Column(db.String(20), default='') def __init__(self, name): self.name = name
class ProductEmotionJd(BaseModel): __tablename__ = "product_emotion_jd" id = db.Column(db.Integer, primary_key=True, autoincrement=True) goods_id = db.Column(db.String(20), default='') year = db.Column(db.String(10), default=0) month = db.Column(db.String(10), default=0) day = db.Column(db.String(10), default=0)
class Category(BaseModel): __tablename__ = "category" id = db.Column(db.Integer, primary_key=True, autoincrement=True) parent_id = db.Column(db.Integer, default=0) name = db.Column(db.String(100), default='') def __init__(self, parent_id, name): self.parent_id = parent_id self.name = name
class User(BaseModel): __tablename__ = "user" id = db.Column(db.Integer, primary_key=True, autoincrement=True) username = db.Column(db.String(80), unique=False) email = db.Column(db.String(80), default='') def __init__(self, username, email=''): self.username = username self.email = email
class Attribute(BaseModel): __tablename__ = "attribute" id = db.Column(db.Integer, primary_key=True, autoincrement=True) cate_id = db.Column(db.Integer, default=0) name = db.Column(db.String(100), default='') rule = db.Column(db.String(100), default='') def __init__(self, cate_id, name, rule): self.cate_id = cate_id self.name = name self.rule = rule
class Origin(BaseModel): __tablename__ = 'origin' id = db.Column(db.Integer, primary_key=True, autoincrement=True) name = db.Column(db.String(20), default='') label = db.Column(db.String(10), default='') site = db.Column(db.String(100), default='') def __init__(self, name, label, site): self.name = name self.label = label self.site = site
class Product(BaseModel): __tablename__ = "product" id = db.Column(db.Integer, primary_key=True, autoincrement=True) origin_id = db.Column(db.Integer, default=0) goods_id = db.Column(db.String(20), default='') name = db.Column(db.String(20), default='') cate_id = db.Column(db.Integer) brand = db.Column(db.String(20), default='') title = db.Column(db.String(100), default='') price = db.Column(db.Float, default=0) comment_num = db.Column(db.Integer, default=0) photo = db.Column(db.String(255), default='') def __init__(self, origin_id, goods_id, name, cate_id, brand, title, price, comment_num, photo): self.origin_id = origin_id self.goods_id = goods_id self.name = name self.cate_id = cate_id self.brand = brand self.title = title self.price = price self.comment_num = comment_num self.photo = photo
class ProductStatisticsJd(BaseModel): __tablename__ = "product_statistics_jd" id = db.Column(db.Integer, primary_key=True, autoincrement=True) origin_id = db.Column(db.Integer, default=1) goods_id = db.Column(db.String(20), default='') price = db.Column(db.Float, default=0) comment_num = db.Column(db.Integer, default=0) sale_num = db.Column(db.Integer, default=0) year = db.Column(db.String(10), default='') month = db.Column(db.String(10), default='') day = db.Column(db.String(10), default='') def __init__(self, origin_id, goods_id, price, comment_num, sale_num, year, month, day): self.origin_id = origin_id self.goods_id = goods_id self.price = price self.comment_num = comment_num self.sale_num = sale_num self.year = year self.month = month self.day = day
class Crawler(BaseModel): __tablename__ = "crawler" id = db.Column(db.Integer, primary_key=True, autoincrement=True) product_id = db.Column(db.Integer, default=0) # 同一个产品涉及多个网站 origin_id = db.Column(db.Integer, default=0) website = db.Column(db.String(100), default='') starttime = db.Column(db.Integer, default=0) endtime = db.Column(db.Integer, default=0) schedule = db.Column(db.Integer, default=0) fields = db.Column(db.Text(), default='') is_use = db.Column(db.Integer, default=1) def __init__(self, product_id, origin_id, website, starttime, endtime, schedule, fields, is_use): self.product_id = product_id self.origin_id = origin_id self.website = website self.starttime = starttime self.endtime = endtime self.schedule = schedule self.fields = fields self.is_use = is_use
class CommentJd(BaseModel): __tablename__ = "comment_jd" id = db.Column(db.Integer, primary_key=True, autoincrement=True) crawler_id = db.Column(db.Integer) origin_id = db.Column(db.Integer, default=1) goods_id = db.Column(db.String(20), default='') username = db.Column(db.String(20), default='') content = db.Column(db.Text(), default='') time = db.Column(db.Integer) is_member = db.Column(db.Integer(), default=0) star = db.Column(db.Integer(), default=0) avater = db.Column(db.String(255), default='') year = db.Column(db.String(10), default=0) month = db.Column(db.String(10), default=0) day = db.Column(db.String(10), default=0) def __init__(self, crawler_id, origin_id, goods_id, username, content, time, is_member, star, avater, year, month, day): self.crawler_id = crawler_id self.origin_id = origin_id self.goods_id = goods_id self.username = username self.content = content self.time = time self.is_member = is_member self.star = star self.avater = avater self.year = year self.month = month self.day = day