|
@ -410,13 +410,19 @@ class DbTransfer(TransferBase): |
|
|
class Dbv3Transfer(DbTransfer): |
|
|
class Dbv3Transfer(DbTransfer): |
|
|
def __init__(self): |
|
|
def __init__(self): |
|
|
super(Dbv3Transfer, self).__init__() |
|
|
super(Dbv3Transfer, self).__init__() |
|
|
self.key_list += ['id', 'method'] |
|
|
self.update_node_state = True if get_config().API_INTERFACE != 'legendsockssr' else False |
|
|
|
|
|
if self.update_node_state: |
|
|
|
|
|
self.key_list += ['id'] |
|
|
|
|
|
self.key_list += ['method'] |
|
|
|
|
|
if self.update_node_state: |
|
|
self.ss_node_info_name = 'ss_node_info_log' |
|
|
self.ss_node_info_name = 'ss_node_info_log' |
|
|
if get_config().API_INTERFACE == 'sspanelv3ssr': |
|
|
if get_config().API_INTERFACE == 'sspanelv3ssr': |
|
|
self.key_list += ['obfs', 'protocol'] |
|
|
self.key_list += ['obfs', 'protocol'] |
|
|
if get_config().API_INTERFACE == 'glzjinmod': |
|
|
if get_config().API_INTERFACE == 'glzjinmod': |
|
|
self.key_list += ['obfs', 'protocol'] |
|
|
self.key_list += ['obfs', 'protocol'] |
|
|
self.ss_node_info_name = 'ss_node_info' |
|
|
self.ss_node_info_name = 'ss_node_info' |
|
|
|
|
|
else: |
|
|
|
|
|
self.key_list += ['obfs', 'protocol'] |
|
|
self.start_time = time.time() |
|
|
self.start_time = time.time() |
|
|
|
|
|
|
|
|
def update_all_user(self, dt_transfer): |
|
|
def update_all_user(self, dt_transfer): |
|
@ -458,6 +464,7 @@ class Dbv3Transfer(DbTransfer): |
|
|
query_sub_when2 += ' WHEN %s THEN d+%s' % (id, int(transfer[1] * self.cfg["transfer_mul"])) |
|
|
query_sub_when2 += ' WHEN %s THEN d+%s' % (id, int(transfer[1] * self.cfg["transfer_mul"])) |
|
|
update_transfer[id] = transfer |
|
|
update_transfer[id] = transfer |
|
|
|
|
|
|
|
|
|
|
|
if self.update_node_state: |
|
|
cur = conn.cursor() |
|
|
cur = conn.cursor() |
|
|
try: |
|
|
try: |
|
|
if id in self.port_uid_table: |
|
|
if id in self.port_uid_table: |
|
@ -486,6 +493,7 @@ class Dbv3Transfer(DbTransfer): |
|
|
logging.error(e) |
|
|
logging.error(e) |
|
|
cur.close() |
|
|
cur.close() |
|
|
|
|
|
|
|
|
|
|
|
if self.update_node_state: |
|
|
try: |
|
|
try: |
|
|
cur = conn.cursor() |
|
|
cur = conn.cursor() |
|
|
try: |
|
|
try: |
|
@ -518,6 +526,7 @@ class Dbv3Transfer(DbTransfer): |
|
|
|
|
|
|
|
|
cur = conn.cursor() |
|
|
cur = conn.cursor() |
|
|
|
|
|
|
|
|
|
|
|
if self.update_node_state: |
|
|
node_info_keys = ['traffic_rate'] |
|
|
node_info_keys = ['traffic_rate'] |
|
|
try: |
|
|
try: |
|
|
cur.execute("SELECT " + ','.join(node_info_keys) +" FROM ss_node where `id`='" + str(self.cfg["node_id"]) + "'") |
|
|
cur.execute("SELECT " + ','.join(node_info_keys) +" FROM ss_node where `id`='" + str(self.cfg["node_id"]) + "'") |
|
|