加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
models.py 2.25 KB
一键复制 编辑 原始数据 按行查看 历史
from exts import db
class ProductModel(db.Model):
"""商品类"""
__tablename__ = "product"
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
product_id = db.Column(db.Integer, nullable=False)
product_name = db.Column(db.String(length=255), nullable=False)
product_category_id = db.Column(db.String(length=255), nullable=False)
amazon_id = db.Column(db.String(length=255), nullable=False)
product_image = db.Column(db.String(length=255), nullable=False)
product_category = db.Column(db.String(length=255), nullable=False)
product_ugc_tag = db.Column(db.String(length=255), nullable=False)
class RatingsModel(db.Model):
"""评分类"""
__tablename__ = "ratings"
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
user_id = db.Column(db.Integer, nullable=False)
product_id = db.Column(db.Integer, nullable=False)
rating = db.Column(db.Float, nullable=False)
rating_time = db.Column(db.DateTime, nullable=False)
class UserModel(db.Model):
"""用户类"""
__tablename__ = "user"
id = db.Column(db.BigInteger, primary_key=True, autoincrement=True)
user_id = db.Column(db.String(length=255), nullable=False)
account = db.Column(db.String(length=255), nullable=False)
password = db.Column(db.String(length=255), nullable=False)
email = db.Column(db.String(length=255), nullable=False)
class HistoricalTopProductsModel(db.Model):
"""历史热门类"""
__tablename__ = "historical_top_products"
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
product_id = db.Column(db.Integer, nullable=False)
class RecentlyTopProductsModel(db.Model):
"""近期热门类"""
__tablename__ = "recently_top_products"
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
product_id = db.Column(db.Integer, nullable=False)
product_count = db.Column(db.Integer, nullable=False)
year_month = db.Column(db.String(length=255), nullable=False)
class AverageProducts(db.Model):
"""商品平均评分类"""
__tablename__ = "average_products"
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
product_id = db.Column(db.Integer, nullable=False)
product_rating = db.Column(db.Float, nullable=False)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化