Пример #1
0
class TrackingModel(db.Model):
    __tablename__ = 'tracking'

    id = db.Column(db.Integer, primary_key=True)
    logtime = db.Column(db.String(50), nullable=True)
    content = db.Column(db.String(1024), nullable=True)
    result = db.Column(db.String(1024), nullable=True)
    user_id = db.Column(db.Integer)
    remote_ip = db.Column(db.String(15), nullable=True)
Пример #2
0
class OnlineUserAmountModel(db.Model):
    __tablename__ = 'onlineuseramount'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    ipaddress = db.Column(db.String(15))
    online_user_amount = db.Column(db.Integer)
    server_local_time = db.Column(db.String(50))
    server_start_time = db.Column(db.String(50))
    addtime = db.Column(db.BigInteger)

    def __repr__(self):
        return '<OnlineUserAmountModel %r>' % (self.id)
Пример #3
0
class PushmessageModel(db.Model):
    __tablename__ = 'pushmessage'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    user_id = db.Column(db.Integer)
    email = db.Column(db.String(100))
    type = db.Column(db.String(20))
    data = db.Column(db.String(5000))
    timeStamp = db.Column(db.Float)
    status = db.Column(db.String(20))
    statusTimeStamp = db.Column(db.Float)
    memo = db.Column(db.String(100))
Пример #4
0
class SettingModel(db.Model):
    __tablename__ = 'setting'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(50))
    value = db.Column(db.String(255))
    additional = db.Column(db.String(255))
    status = db.Column(db.String(255))
    timestamp = db.Column(db.BigInteger)

    def __repr__(self):
        return '<SettingModel %r>' % (self.id)
Пример #5
0
class PWResourcesModel(db.Model):
    __tablename__ = 'pwresources'

    id = db.Column(db.Integer, primary_key=True)
    oripassword = db.Column(db.String(56), nullable=True)
    hashedpassword = db.Column(db.String(56), nullable=True)
    user_id = db.Column(db.Integer)
    usergroup_id = db.Column(db.Integer)
    quota = db.Column(db.Integer, default=-1)
    download = db.Column(db.BigInteger)
    upload = db.Column(db.BigInteger)

    def __repr__(self):
        return '<PWResourcesModel %r>' % (self.id)
Пример #6
0
class UserGroupModel(db.Model):
    __tablename__ = 'usergroup'

    id = db.Column(db.Integer, primary_key=True)
    group_name = db.Column(db.String(50), nullable=True)
    maxUserCapacity = db.Column(db.Integer, nullable=True)  #maxUserCapacity
    maxPwdCapacity = db.Column(
        db.Integer,
        nullable=True)  #maxPwdCapacity will > maxUserCapacity always
    current_used = db.Column(db.Integer, default=0, nullable=True)
    which_thunderservice = db.Column(db.String(40))

    def __repr__(self):
        return '<UserGroupModel %r>' % (self.id)
Пример #7
0
class RouteModel(db.Model):
    __tablename__ = 'routes'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    sequence = db.Column(db.Integer, nullable=True)
    online = db.Column(db.Integer)
    domain = db.Column(db.String(100), nullable=True)
    ipaddress = db.Column(db.String(15), nullable=True)
    port = db.Column(db.Integer, nullable=True)
    ipv6 = db.Column(db.Boolean)
    trojanVersion = db.Column(db.String(100))
    servernameEN = db.Column(db.String(100), nullable=True)
    servernameCN = db.Column(db.String(100), nullable=True)
    routeStartTime = db.Column(db.BigInteger)
    routeExpTime = db.Column(db.BigInteger)
    trafficLimit = db.Column(db.Integer, nullable=True)
    trafficUsed = db.Column(db.Integer, nullable=True)
    trafficStartAt = db.Column(db.BigInteger)
    trafficResetDay = db.Column(db.BigInteger)
    usergroup_id = db.Column(db.Integer)
    lastCheckTime = db.Column(db.BigInteger)
    certificateExpTime = db.Column(db.String(50))
    availablePwd = db.Column(db.Integer)
    routeLocalTime = db.Column(db.String(50))

    def __repr__(self):
        return '<RouteModel %r>' % (self.id)
Пример #8
0
class ThunderserviceModel(db.Model):
    __tablename__ = 'thunderservice'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    membershipCN = db.Column(db.String(20), nullable=False)
    membershipEN = db.Column(db.String(20), nullable=False)
    duration = db.Column(db.Integer)
    defaultClientAmount = db.Column(db.Integer)
    defaultTrafficAmount = db.Column(db.Integer)
    price = db.Column(db.Float)
    price_cn = db.Column(db.Float)
    onSalePrice = db.Column(db.Float)
    onSalePrice_cn = db.Column(db.Float)
    promotion = db.Column(db.Boolean)
    adwords = db.Column(db.String(100))
    description = db.Column(db.String(100))

    def __repr__(self):
        return '<ThunderserviceModel %r>' % (self.id)
Пример #9
0
class CpuIOModel(db.Model):
    __tablename__ = 'cpuio'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    ipaddress = db.Column(db.String(15))
    cpu = db.Column(db.Float)
    mem = db.Column(db.Float)
    addtime = db.Column(db.BigInteger)

    def __repr__(self):
        return '<CpuIOModel %r>' % (self.id)
Пример #10
0
class LoadAverageModel(db.Model):
    __tablename__ = 'load_average'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    ipaddress = db.Column(db.String(15))
    one = db.Column(db.Float)
    five = db.Column(db.Float)
    fifteen = db.Column(db.Float)
    addtime = db.Column(db.BigInteger)

    def __repr__(self):
        return '<LoadAverageModel %r>' % (self.id)
Пример #11
0
class KModel(db.Model):
    __tablename__ = 'k'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    yearly = db.Column(db.String(20))
    monthly = db.Column(db.String(20))
    daily = db.Column(db.String(20))
    hourly = db.Column(db.String(20))
    minutely = db.Column(db.String(20))
    timestamp = db.Column(db.BigInteger)
    action = db.Column(db.String(20))
    parameter1 = db.Column(db.String(50))
    parameter2 = db.Column(db.String(50))

    def __repr__(self):
        return '<k %r>' % (self.id)
Пример #12
0
class NetworkModel(db.Model):
    __tablename__ = 'network'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    ipaddress = db.Column(db.String(15))
    up = db.Column(db.Integer)
    down = db.Column(db.Integer)
    total_up = db.Column(db.Integer)
    total_down = db.Column(db.Integer)
    up_packets = db.Column(db.Integer)
    down_packets = db.Column(db.Integer)
    addtime = db.Column(db.BigInteger)

    def __repr__(self):
        return '<NetworkModel %r>' % (self.id)
Пример #13
0
class DiskIOModel(db.Model):
    __tablename__ = 'diskio'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    ipaddress = db.Column(db.String(15))
    read_count = db.Column(db.Integer)
    write_count = db.Column(db.Integer)
    read_bytes = db.Column(db.Integer)
    write_bytes = db.Column(db.Integer)
    read_time = db.Column(db.BigInteger)
    write_time = db.Column(db.BigInteger)
    addtime = db.Column(db.BigInteger)

    def __repr__(self):
        return '<DiskIOModel %r>' % (self.id)
Пример #14
0
class OrderModel(db.Model):
    __tablename__ = 'orders'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    order_id = db.Column(db.String(30))
    user_id = db.Column(db.Integer)
    thunderservice_id = db.Column(db.Integer)
    placeOrderTime = db.Column(db.BigInteger)
    coupon = db.Column(db.String(20))
    paymentMethod = db.Column(db.String(20))
    paymentTime = db.Column(db.BigInteger)
    paymentSN = db.Column(db.String(100))
    emailNotification = db.Column(db.Boolean)
    amount = db.Column(db.Float)
    orderStatus = db.Column(db.String(20))
    thunderserviceStatus = db.Column(db.String(20))
    description = db.Column(db.String(100))

    def __repr__(self):
        return '<OrderModel %r>' % (self.id)
Пример #15
0
class UserModel(db.Model):
    __tablename__ = 'users'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(50), nullable=True)
    admin = db.Column(db.Boolean)
    email = db.Column(db.String(50), unique=True, nullable=False)
    email_verified = db.Column(db.Boolean)
    account_status = db.Column(db.String(20), nullable=True)
    password_hash = db.Column(db.String(255), nullable=True)
    password = db.Column(db.String(50), nullable=False)
    register_source = db.Column(db.String(50), nullable=True)
    register_datetime = db.Column(db.BigInteger)
    thunderservice_starttime = db.Column(db.BigInteger)
    thunderservice_endtime = db.Column(db.BigInteger)
    token = db.Column(db.String(255), nullable=True)
    refreshToken = db.Column(db.String(255), nullable=True)
    usergroup_id = db.Column(db.Integer)
    thunderservice_id = db.Column(db.Integer)
    thunderservice_client_amount = db.Column(db.Integer)
    thunderservice_traffic_amount = db.Column(db.BigInteger)
    thunderservice_up_traffic_used = db.Column(db.BigInteger)
    thunderservice_down_traffic_used = db.Column(db.BigInteger)
    last_login_datetime = db.Column(db.BigInteger)
    last_login_ipaddress = db.Column(db.String(50), nullable=True)
    mentor = db.Column(db.Integer)
    individual_coupon = db.Column(db.String(50), nullable=True)
    affiliate = db.Column(db.Boolean)
    password_reset = db.Column(db.String(255))
    password_reset_timestamp = db.Column(db.BigInteger)

    def set_password(self, password):
        self.password_hash = generate_password_hash(password)

    def check_password(self, password):
        return check_password_hash(self.password_hash, password)