From 31aaea603a5943c43e5f26b9c966c97c2d51aabf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=B4=E5=A8=83=E9=85=B1?= Date: Thu, 2 Feb 2017 19:50:55 +0800 Subject: [PATCH] add "glzjinmod" interface --- apiconfig.py | 2 +- db_transfer.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apiconfig.py b/apiconfig.py index 58ea33a..cbeba7f 100644 --- a/apiconfig.py +++ b/apiconfig.py @@ -1,5 +1,5 @@ # Config -API_INTERFACE = 'sspanelv2' #mudbjson, sspanelv2, sspanelv3, sspanelv3ssr, muapiv2(not support) +API_INTERFACE = 'sspanelv2' #mudbjson, sspanelv2, sspanelv3, sspanelv3ssr, glzjinmod, muapiv2(not support) UPDATE_TIME = 60 SERVER_PUB_ADDR = '127.0.0.1' # mujson_mgr need this to generate ssr link diff --git a/db_transfer.py b/db_transfer.py index fa10a4b..fc9b0f5 100644 --- a/db_transfer.py +++ b/db_transfer.py @@ -391,8 +391,11 @@ class Dbv3Transfer(DbTransfer): def __init__(self): super(Dbv3Transfer, self).__init__() self.key_list += ['id', 'method'] + self.ss_node_info_name = 'ss_node_info_log' if get_config().API_INTERFACE == 'sspanelv3ssr': self.key_list += ['obfs', 'protocol'] + if get_config().API_INTERFACE == 'glzjinmod': + self.ss_node_info_name = 'ss_node_info' self.start_time = time.time() def update_all_user(self, dt_transfer): @@ -473,14 +476,14 @@ class Dbv3Transfer(DbTransfer): cur = conn.cursor() try: - cur.execute("INSERT INTO `ss_node_info_log` (`id`, `node_id`, `uptime`, `load`, `log_time`) VALUES (NULL, '" + \ + cur.execute("INSERT INTO `" + self.ss_node_info_name + "` (`id`, `node_id`, `uptime`, `load`, `log_time`) VALUES (NULL, '" + \ str(self.cfg["node_id"]) + "', '" + str(self.uptime()) + "', '" + \ str(self.load()) + "', unix_timestamp()); ") except Exception as e: logging.error(e) cur.close() except: - logging.warn('no `ss_node_online_log` or `ss_node_info_log` in db') + logging.warn('no `ss_node_online_log` or `" + self.ss_node_info_name + "` in db') conn.close() return update_transfer