admin
2025-06-04 287c506725b2d970f721f80169f83c2418cb0991
data_server.py
@@ -7,8 +7,7 @@
import dask
from code_attribute import gpcode_manager
from log import logger_request_debug
from log_module import log_analyse, log_export
from log_module import log_analyse, log_export, log, request_log_util
from output import limit_up_data_filter, output_util
from output.limit_up_data_filter import IgnoreCodeManager
from third_data import kpl_util, kpl_data_manager, kpl_api
@@ -44,10 +43,10 @@
            KPLLimitUpDataRecordManager.load_total_datas()
            total_datas = KPLLimitUpDataRecordManager.total_datas
        current_datas_results = hosting_api_util.common_request({"ctype":"get_kpl_limit_up_datas"})
        current_datas_results = hosting_api_util.common_request({"ctype": "get_kpl_limit_up_datas"})
        if type(current_datas_results) == str:
            current_datas_results = json.loads(current_datas_results)
        current_datas = current_datas_results.get("data")  #KPLLimitUpDataRecordManager.latest_origin_datas
        current_datas = current_datas_results.get("data")  # KPLLimitUpDataRecordManager.latest_origin_datas
        current_block_codes = {}
        for c in current_datas:
            if c[5] not in current_block_codes:
@@ -272,8 +271,7 @@
    def do_GET(self):
        path = self.path
        url = urlparse.urlparse(path)
        thread_id = random.randint(0, 1000000)
        logger_request_debug.info(f"GET 请求开始({thread_id}):{url.path}")
        request_log_util.request_info("DATA_SERVER_GET", f"GET 请求开始:{url.path}")
        try:
            if url.path == "/kpl/get_limit_up_list":
                response_data = self.__get_limit_up_list()
@@ -287,14 +285,12 @@
                result = hosting_api_util.get_from_data_server(url.path, ps_dict)
                self.__send_response(result)
        finally:
            logger_request_debug.info(f"GET 请求结束({thread_id}):{url.path}")
            request_log_util.request_info("DATA_SERVER_GET", f"GET 请求结束")
    def do_POST(self):
        thread_id = random.randint(0, 1000000)
        path = self.path
        url = urlparse.urlparse(path)
        logger_request_debug.info(f"POST 请求开始({thread_id}):{url.path}")
        request_log_util.request_info("DATA_SERVER_POST", f"POST 请求开始:{url.path}")
        try:
            if url.path == "/upload_kpl_data":
                # 接受开盘啦数据
@@ -302,7 +298,7 @@
                result_str = self.__process_kpl_data(params)
                self.__send_response(result_str)
        finally:
            logger_request_debug.info(f"POST 请求结束({thread_id}):{url.path}")
            request_log_util.request_info("DATA_SERVER_POST", f"POST 请求结束")
    def __process_kpl_data(self, data):
        data = json.loads(json.dumps(data).replace("概念", ""))