class Category(db.Model): __tablename__ = 'category' id = db.Column(db.Integer, primary_key=True, unique=True) name = db.Column(db.String(50, 'utf8mb4_0900_ai_ci'), nullable=False, server_default=db.FetchedValue()) updated_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue()) created_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue())
class ShoppingCart(db.Model): __tablename__ = 'shopping_cart' id = db.Column(db.Integer, primary_key=True) member_id = db.Column(db.BigInteger, nullable=False, index=True, server_default=db.FetchedValue()) food_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) quantity = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) updated_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue()) created_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue())
class ShareHistory(db.Model): __tablename__ = 'share_history' id = db.Column(db.Integer, primary_key=True) member_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) share_url = db.Column(db.String(200), nullable=False, server_default=db.FetchedValue()) created_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue())
class PaymentOrderItem(db.Model): __tablename__ = 'payment_order_item' id = db.Column(db.Integer, primary_key=True) pay_order_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue()) member_id = db.Column(db.BigInteger, nullable=False, server_default=db.FetchedValue()) quantity = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue()) food_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue()) note = db.Column(db.Text, nullable=False) status = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) updated_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue()) created_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue())
class PaymentOrderCallbackData(db.Model): __tablename__ = 'payment_order_callback_data' id = db.Column(db.Integer, primary_key=True) pay_order_id = db.Column(db.Integer, nullable=False, unique=True, server_default=db.FetchedValue()) pay_data = db.Column(db.Text, nullable=False) refund_data = db.Column(db.Text, nullable=False) updated_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue()) created_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue())
class FoodStockChangeLog(db.Model): __tablename__ = 'food_stock_change_log' id = db.Column(db.Integer, primary_key=True) food_id = db.Column(db.Integer, nullable=False, index=True) unit = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) total_stock = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) note = db.Column(db.String(100), nullable=False, server_default=db.FetchedValue()) created_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue())
class OauthMemberBind(db.Model): __tablename__ = 'oauth_member_bind' __table_args__ = (db.Index('idx_type_openid', 'type', 'openid'), ) id = db.Column(db.Integer, primary_key=True) member_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) client_type = db.Column(db.String(20), nullable=False, server_default=db.FetchedValue()) type = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) openid = db.Column(db.String(80), nullable=False, server_default=db.FetchedValue()) unionid = db.Column(db.String(100), nullable=False, server_default=db.FetchedValue()) extra = db.Column(db.Text, nullable=False) updated_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue()) created_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue())
class Food(db.Model): __tablename__ = 'food' id = db.Column(db.Integer, primary_key=True) category = db.Column(db.String(100, 'utf8mb4_0900_ai_ci'), nullable=False, server_default=db.FetchedValue()) name = db.Column(db.String(100, 'utf8mb4_0900_ai_ci'), nullable=False, server_default=db.FetchedValue()) price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue()) priced = db.Column(db.Numeric(10, 2), nullable=False) imageName = db.Column(db.String(255, 'utf8mb4_0900_ai_ci'), nullable=False) imageURL = db.Column(db.String(255, 'utf8mb4_0900_ai_ci'), nullable=False, server_default=db.FetchedValue()) description = db.Column(db.String(255, 'utf8mb4_0900_ai_ci'), nullable=False, server_default=db.FetchedValue()) stock = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) status = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) cover = db.Column(db.Integer, nullable=False) month_count = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) total_count = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) view_count = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) comment_count = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) updated_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue()) created_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue())
class PaymentOrder(db.Model): __tablename__ = 'payment_order' __table_args__ = (db.Index('idx_member_id_status', 'member_id', 'status'), ) id = db.Column(db.Integer, primary_key=True) order_sn = db.Column(db.String(40), nullable=False, unique=True, server_default=db.FetchedValue()) member_id = db.Column(db.BigInteger, nullable=False, server_default=db.FetchedValue()) total_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue()) yun_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue()) pay_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue()) pay_sn = db.Column(db.String(128), nullable=False, server_default=db.FetchedValue()) prepay_id = db.Column(db.String(128), nullable=False, server_default=db.FetchedValue()) note = db.Column(db.Text, nullable=False) status = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) express_status = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) express_address_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) express_info = db.Column(db.String(1000), nullable=False, server_default=db.FetchedValue()) comment_status = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue()) pay_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue()) updated_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue()) created_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue()) @property def pay_status(self): tmp_status = self.status if self.status == 1: tmp_status = self.express_status if self.express_status == 1 and self.comment_status == 0: tmp_status = -5 if self.express_status == 1 and self.comment_status == 1: tmp_status = 1 return tmp_status @property def status_desc(self): return app.config['PAY_STATUS_DISPLAY_MAPPING'][str(self.pay_status)] @property def order_number(self): order_number = self.created_time.strftime("%Y%m%d%H%M%S") order_number = order_number + str(self.id).zfill(5) return order_number