示例#1
0
class Member(db.Model):
    __tablename__ = 'member'

    id = db.Column(Integer, primary_key=True)
    nickname = db.Column(String(100), nullable=False, server_default=FetchedValue())
    mobile = db.Column(String(11), nullable=False, server_default=FetchedValue())
    sex = db.Column(Integer, nullable=False, server_default=FetchedValue())
    avatar = db.Column(String(200), nullable=False, server_default=FetchedValue())
    salt = db.Column(String(32), nullable=False, server_default=FetchedValue())
    reg_ip = db.Column(String(100), nullable=False, server_default=FetchedValue())
    status = db.Column(Integer, nullable=False, server_default=FetchedValue())
    updated_time = db.Column(DateTime, nullable=False, server_default=FetchedValue())
    created_time = db.Column(DateTime, nullable=False, server_default=FetchedValue())

    @property
    def status_desc(self):
        return app.config['STATUS_MAPPING'][ str( self.status ) ]

    @property
    def sex_desc(self):
        sex_mapping = {
            "0":"未知",
            "1":"男",
            "2":"女"
        }
        return sex_mapping[str(self.sex)]
示例#2
0
class Store_Member(db.Model):
    __tablename__ = 'store_member'

    id = db.Column(Integer, primary_key=True)
    petname = db.Column(String(100),
                        nullable=False,
                        server_default=FetchedValue())
    petage = db.Column(Integer, nullable=False, server_default=FetchedValue())
    petsex = db.Column(Integer, nullable=False, server_default=FetchedValue())
    hostname = db.Column(String(100),
                         nullable=False,
                         server_default=FetchedValue())
    hostphone = db.Column(String(32),
                          nullable=False,
                          server_default=FetchedValue())
    store_id = db.Column(Integer,
                         nullable=False,
                         server_default=FetchedValue())
    status = db.Column(Integer, nullable=False, server_default=FetchedValue())
    updated_time = db.Column(DateTime,
                             nullable=False,
                             server_default=FetchedValue())
    created_time = db.Column(DateTime,
                             nullable=False,
                             server_default=FetchedValue())

    @property
    def status_desc(self):
        return app.config['STATUS_MAPPING'][str(self.status)]

    @property
    def sex_desc(self):
        sex_mapping = {"0": "未知", "1": "公", "2": "母"}
        return sex_mapping[str(self.sex)]
示例#3
0
class Image(db.Model):
    __tablename__ = 'images'

    id = db.Column(Integer, primary_key=True)
    file_key = db.Column(String(60),
                         nullable=False,
                         server_default=FetchedValue())
    created_time = db.Column(DateTime,
                             nullable=False,
                             server_default=FetchedValue())
示例#4
0
class StatDailySite(db.Model):
    __tablename__ = 'stat_daily_site'

    id = db.Column(Integer, primary_key=True)
    date = db.Column(Date, nullable=False, index=True)
    total_pay_money = db.Column(Numeric(10, 2),
                                nullable=False,
                                server_default=FetchedValue())
    total_member_count = db.Column(Integer, nullable=False)
    total_new_member_count = db.Column(Integer, nullable=False)
    total_order_count = db.Column(Integer, nullable=False)
    total_shared_count = db.Column(Integer, nullable=False)
    updated_time = db.Column(DateTime,
                             nullable=False,
                             server_default=FetchedValue())
    created_time = db.Column(DateTime,
                             nullable=False,
                             server_default=FetchedValue())
示例#5
0
class AppAccessLog(db.Model):
    __tablename__ = 'app_access_log'

    id = db.Column(Integer, primary_key=True)
    uid = db.Column(BigInteger,
                    nullable=False,
                    index=True,
                    server_default=FetchedValue())
    referer_url = db.Column(String(255),
                            nullable=False,
                            server_default=FetchedValue())
    target_url = db.Column(String(255),
                           nullable=False,
                           server_default=FetchedValue())
    query_params = db.Column(Text, nullable=False)
    ua = db.Column(String(255), nullable=False, server_default=FetchedValue())
    ip = db.Column(String(32), nullable=False, server_default=FetchedValue())
    note = db.Column(String(1000),
                     nullable=False,
                     server_default=FetchedValue())
    created_time = db.Column(DateTime,
                             nullable=False,
                             server_default=FetchedValue())
示例#6
0
class AppErrorLog(db.Model):
    __tablename__ = 'app_error_log'

    id = db.Column(Integer, primary_key=True)
    referer_url = db.Column(String(255),
                            nullable=False,
                            server_default=FetchedValue())
    target_url = db.Column(String(255),
                           nullable=False,
                           server_default=FetchedValue())
    query_params = db.Column(Text, nullable=False)
    content = db.Column(String, nullable=False)
    created_time = db.Column(DateTime,
                             nullable=False,
                             server_default=FetchedValue())
示例#7
0
class StatDailyMember(db.Model):
    __tablename__ = 'stat_daily_member'
    __table_args__ = (db.Index('idx_date_member_id', 'date', 'member_id'), )

    id = db.Column(Integer, primary_key=True)
    date = db.Column(Date, nullable=False)
    member_id = db.Column(Integer,
                          nullable=False,
                          server_default=FetchedValue())
    total_shared_count = db.Column(Integer,
                                   nullable=False,
                                   server_default=FetchedValue())
    total_pay_money = db.Column(Numeric(10, 2),
                                nullable=False,
                                server_default=FetchedValue())
    updated_time = db.Column(DateTime,
                             nullable=False,
                             server_default=FetchedValue())
    created_time = db.Column(DateTime,
                             nullable=False,
                             server_default=FetchedValue())
示例#8
0
class User(db.Model):
    __tablename__ = 'user'

    id = db.Column(BigInteger, primary_key=True)
    nickname = db.Column(String(100), nullable=False, server_default=FetchedValue())
    mobile = db.Column(String(20), nullable=False, server_default=FetchedValue())
    email = db.Column(String(100), nullable=False, server_default=FetchedValue())
    sex = db.Column(Integer, nullable=False, server_default=FetchedValue())
    avatar = db.Column(String(64), nullable=False, server_default=FetchedValue())
    login_name = db.Column(String(20), nullable=False, unique=True, server_default=FetchedValue())
    login_pwd = db.Column(String(32), nullable=False, server_default=FetchedValue())
    login_salt = db.Column(String(32), nullable=False, server_default=FetchedValue())
    status = db.Column(Integer, nullable=False, server_default=FetchedValue())
    updated_time = db.Column(DateTime, nullable=False, server_default=FetchedValue())
    created_time = db.Column(DateTime, nullable=False, server_default=FetchedValue())