From 77da8f7f017bd63fab4b49c24014b27ab615f5e1 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期二, 23 一月 2024 18:46:06 +0800 Subject: [PATCH] 添加由于l2数据而不能买的接口 --- log_module/log_export.py | 34 ++++++++++++++++++++++++++++++++-- 1 files changed, 32 insertions(+), 2 deletions(-) diff --git a/log_module/log_export.py b/log_module/log_export.py index f87e22a..16e9679 100644 --- a/log_module/log_export.py +++ b/log_module/log_export.py @@ -112,6 +112,12 @@ return time_ +def __get_async_log_time(line): + line = line.split(" - ")[1] + time_str = line[line.find("[") + 1:line.find("[") + 9] + return time_str + + # 鑾峰彇L2姣忔鎵归噺澶勭悊鏁版嵁鐨勪綅缃寖鍥� def get_l2_process_position(code, date=None): if not date: @@ -224,6 +230,30 @@ except: pass return index_list, buy_queues + + +# 鑾峰彇l2涓嶈兘涔扮殑鍘熷洜 +def get_l2_cant_buy_reasons(code, date=None): + if not date: + date = datetime.datetime.now().strftime("%Y-%m-%d") + fdatas = [] + path_str = "{}/logs/gp/l2/l2_not_buy_reasons.{}.log".format(constant.get_path_prefix(), date) + lines = __load_file_content(path_str) + for line in lines: + if not line: + break + if line.find(f"{code}#") < 0: + continue + + line = line.split(" - ")[1] + time_str = line[line.find("[") + 1:line.find("[") + 9] + data = line[line.find("]") + 1:].strip() + code_ = data.split("#")[0].strip() + data = data.split("#")[1].strip() + if code_ != code: + continue + fdatas.append((time_str, data)) + return fdatas # 鑾峰彇H绾ф挙鍗曡绠楃粨鏋� @@ -447,9 +477,9 @@ if data.startswith("["): data = data[data.find("]") + 1:].strip() code = data.split("#")[0] - l2_data = eval( data.split("#")[1]) + l2_data = eval(data.split("#")[1]) if code not in fdatas: - fdatas[code]=[] + fdatas[code] = [] fdatas[code].append(l2_data) except: pass -- Gitblit v1.8.0