def query_game_info_day(query_date, query_type="DAY_NEXT"): # 查询某一天之后的数据 if query_type == 'DAY_NEXT': result = DBUtils.executeOne( "SELECT * FROM football_game_info where start_datetime > %s " "order by start_datetime", query_date) else: # 查询某一天的数据 result = DBUtils.executeOne( "SELECT * FROM football_game_info where start_datetime like %s " "order by start_datetime", query_date + '%') if result is None: result = [] return result
def query_jishioupei_echart3(gameId): """ :param gameId: :return: 返回即时让球欧赔凯里 """ sql = """select kelly_win_num,kelly_avg_num,kelly_lost_num from pay_info where game_id=%s and insert_datetime=(select max(insert_datetime) from pay_info where game_id=%s)""" return DBUtils.executeOne(sql,(gameId,gameId))
def insert_bodan_std(bodan_std): """ 插入波胆标准差 :param bodan_std: :return: 插入条数 """ return DBUtils.executeOne( "INSERT INTO bifen_bodan_std(game_id,win_bodan_std,dogfall_bodan_std" ",lose_bodan_std) values (%s,%s,%s,%s)", bodan_std)
def query_oupei_echart3(gameId): """ 查询对应比赛的初始凯利值 :param gameId: 比赛编号 :return: """ sql = """select kelly_win_num,kelly_avg_num,kelly_lost_num from rangqiu_startvalue_info where game_id=%s and insert_datetime=(select max(insert_datetime) from rangqiu_startvalue_info where game_id=%s)""" return DBUtils.executeOne(sql,(gameId,gameId))
def query_oupei_gameId(): """获取game_id列表""" sql = """select game_id from oupei_startvalue_info""" game_id = DBUtils.executeOne(sql) gameId_list = [] for gameId in game_id: gameId_id = gameId["game_id"] gameId_list.append(gameId_id) # print(gameId_list) return set(gameId_list)
def query_game_dates(before_days=12): """ 查询12天之后的日期 """ dd = (datetime.today() + timedelta(days=-before_days)).strftime('%Y-%m-%d') all_date = DBUtils.executeOne( "SELECT substr(start_datetime,1,10) as start_datetime FROM football_game_info where" " start_datetime>%s group by substr(start_datetime,1,10) " "order by substr(start_datetime,1,10) desc", dd) if all_date is None: all_date = [] return all_date
def query_oupei_echart2(gameId): """ 查询对应比赛的初始凯利值 :param gameId: 比赛编号 :return: """ sql="""select kelly_win_num,kelly_avg_num,kelly_lost_num from oupei_startvalue_info where game_id=%s and insert_datetime=(select max(insert_datetime) from oupei_startvalue_info where game_id=%s)""" #select * from oupei_startvalue_info where game_id='807259' and insert_datetime=(select max(insert_datetime) from oupei_startvalue_info where game_id='807259'); try: return DBUtils.executeOne(sql, (gameId,gameId)) except Exception as e: return None
def query_oupei_echart(dd, gameId): """ 查询指定日期到现在的数据库 :param dd: 日期 :param gameId: 比赛编号 :return: 结果 """ sql = """select game_id, GROUP_CONCAT( eu_win_num SEPARATOR ',' ) AS eu_win_num, GROUP_CONCAT( eu_avg_num SEPARATOR ',' ) AS eu_avg_num, GROUP_CONCAT( eu_lost_num SEPARATOR ',' ) AS eu_lost_num, GROUP_CONCAT( kelly_win_num SEPARATOR ',' ) AS kelly_win_num, GROUP_CONCAT( kelly_avg_num SEPARATOR ',' ) AS kelly_avg_num, GROUP_CONCAT( kelly_lost_num SEPARATOR ',' ) AS kelly_lost_num, insert_datetime FROM oupei_info where insert_datetime > %s and game_id=%s GROUP BY game_id,insert_datetime""" return DBUtils.executeOne(sql, (dd, gameId))