From ae8d76a456b64c1c6c4ebf11b6ec33b7df217b1a Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期一, 18 八月 2025 13:43:46 +0800 Subject: [PATCH] bug修复 --- utils/kpl_data_db_util.py | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/utils/kpl_data_db_util.py b/utils/kpl_data_db_util.py index 5107280..a112386 100644 --- a/utils/kpl_data_db_util.py +++ b/utils/kpl_data_db_util.py @@ -1,19 +1,35 @@ from db.mysql_data_delegate import Mysqldb +from third_data.history_k_data_util import HistoryKDatasUtils from utils import tool class KPLLimitUpDataUtil: @classmethod - def get_latest_block_infos(cls, min_day=tool.date_sub(tool.get_now_date_str(), 180), code=None): + def get_latest_block_infos(cls, min_day=tool.date_sub(tool.get_now_date_str(), 180), code=None, + max_day=tool.get_now_date_str()): """ @param min_day: 榛樿鑾峰彇180澶╀箣鍓嶇殑 @param code: 浠g爜 @return: 鏈�杩戠殑娑ㄥ仠鏉垮潡淇℃伅 """ - sql = f"SELECT r.`_code`, r.`_day`, r.`_hot_block_name`, r.`_blocks` FROM `kpl_limit_up_record` r WHERE r.`_day`>'{min_day}'" + sql = f"SELECT r.`_code`, r.`_day`, r.`_hot_block_name`, r.`_blocks`, r.`_open` FROM `kpl_limit_up_record` r WHERE r.`_day`>='{min_day}' and r.`_day` <'{max_day}'" + if code: sql += f" AND _code='{code}'" sql += " order by _create_time" mysqldb = Mysqldb() results = mysqldb.select_all(sql) return results + + @classmethod + def get_latest_block_infos_by_day(cls, day=tool.get_now_date_str()): + sql = f"SELECT * FROM `kpl_limit_up_record` r WHERE r.`_day`='{day}'" + mysqldb = Mysqldb() + results = mysqldb.select_all(sql) + return results + + +if __name__ == '__main__': + # 鍒犻櫎涓嶆槸浜ゆ槗鏃ユ湡鐨勬暟鎹� + datas = KPLLimitUpDataUtil.get_latest_block_infos() + len(datas) -- Gitblit v1.8.0