database.py修改为类

This commit is contained in:
shmilylty
2019-08-09 18:47:01 +08:00
parent 4c63bd672f
commit b21e31a223
6 changed files with 174 additions and 175 deletions
+4 -5
View File
@@ -13,7 +13,7 @@ import config
from config import logger
from . import utils
from .domain import Domain
from common import database
from common.database import Database
lock = threading.Lock()
@@ -259,10 +259,9 @@ class Module(object):
def save_db(self):
lock.acquire()
db_conn = database.connect_db()
table_name = self.domain.replace('.', '_')
database.create_table(db_conn, table_name)
db = Database()
db.create_table(self.domain)
source, results = self.results
# 将结果存入数据库中
database.save_db(db_conn, table_name, results, source)
db.save_db(self.domain, results, source)
lock.release()