|
|
@@ -1528,14 +1528,14 @@ class Roll_Lanqiupipeline(object):
|
|
|
if odd_evens_dict:
|
|
|
for key, value in odd_evens_dict.items():
|
|
|
if value:
|
|
|
- for x, y in enumerate(value):
|
|
|
- new_hash = hash_func(match_id=game_id, odds_code=key, sort=x, p_id=2)
|
|
|
- odds_only = r_func(match_id=game_id, odds_code=key, sort=x, p_id=2,odd=y)
|
|
|
- sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only =%s;"
|
|
|
- self.cursor.execute(sql1, (int(league_id), key, int(game_id), utime, utime,y, 2, "two_sides",x, "hg3535", new_hash, odd_evens_dict_rule[key][x],odds_only,1,utime, y,odds_only))
|
|
|
- # 更新主队st_zq_odds_record表
|
|
|
- sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s);"
|
|
|
- self.cursor.execute(sql2, (int(league_id), key, int(game_id), utime, utime,y, 2, "two_sides", x, "hg3535", odd_evens_dict_rule[key][x],odds_only,1))
|
|
|
+ # for x, y in enumerate(value):
|
|
|
+ new_hash = hash_func(match_id=game_id, odds_code=key, sort=x, p_id=2)
|
|
|
+ odds_only = r_func(match_id=game_id, odds_code=key, sort=x, p_id=2,odd=y)
|
|
|
+ sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only =%s;"
|
|
|
+ self.cursor.execute(sql1, (int(league_id), key, int(game_id), utime, utime,y, 2, "two_sides",x, "hg3535", new_hash, odd_evens_dict_rule[key],odds_only,1,utime, y,odds_only))
|
|
|
+ # 更新主队st_zq_odds_record表
|
|
|
+ sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s);"
|
|
|
+ self.cursor.execute(sql2, (int(league_id), key, int(game_id), utime, utime,y, 2, "two_sides", x, "hg3535", odd_evens_dict_rule[key],odds_only,1))
|
|
|
|
|
|
if total_sizes_dict:
|
|
|
for key, value in total_sizes_dict.items():
|
|
|
@@ -1679,95 +1679,97 @@ class Roll_Wangqiupipeline(object):
|
|
|
# 总局数单双
|
|
|
odd_evens_dict = item['odd_evens_dict']
|
|
|
odd_evens_dict_rule = item['odd_evens_dict_rule']
|
|
|
- if concedes_dict:
|
|
|
- for key, value in concedes_dict.items():
|
|
|
- if value:
|
|
|
- new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=1)
|
|
|
- odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=1,odd=value)
|
|
|
- sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
|
|
|
- self.cursor.execute(sql1, (
|
|
|
- int(league_id), key, int(game_id), utime, utime,value, 1, "dishes_home", 0, "hg3535", new_hash,
|
|
|
- concedes_dict_rule[key],odds_only,1,utime, value,odds_only))
|
|
|
- # 更新主队st_zq_odds_record表
|
|
|
- sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
|
|
|
- self.cursor.execute(sql2, (
|
|
|
- int(league_id), key, int(game_id), utime, utime, value, 1, "dishes_home", 0, "hg3535",
|
|
|
- concedes_dict_rule[key],odds_only,1))
|
|
|
- #插入结果表
|
|
|
- sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
|
|
|
- self.cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
|
|
|
- # 插入记录表
|
|
|
- sql4 = "insert into st_wq_result_record(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);"
|
|
|
- self.cursor.execute(sql4, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00'))
|
|
|
+ try:
|
|
|
+ if concedes_dict:
|
|
|
+ for key, value in concedes_dict.items():
|
|
|
+ if value:
|
|
|
+ new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=1)
|
|
|
+ odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=1,odd=value)
|
|
|
+ sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
|
|
|
+ self.cursor.execute(sql1, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime,value, 1, "dishes_home", 0, "hg3535", new_hash,
|
|
|
+ concedes_dict_rule[key],odds_only,1,utime, value,odds_only))
|
|
|
+ # 更新主队st_zq_odds_record表
|
|
|
+ sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
|
|
|
+ self.cursor.execute(sql2, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime, value, 1, "dishes_home", 0, "hg3535",
|
|
|
+ concedes_dict_rule[key],odds_only,1))
|
|
|
+ #插入结果表
|
|
|
+ sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
|
|
|
+ self.cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
|
|
|
+ # 插入记录表
|
|
|
+ sql4 = "insert into st_wq_result_record(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);"
|
|
|
+ self.cursor.execute(sql4, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00'))
|
|
|
+
|
|
|
+ if kemps_dict:
|
|
|
+ for key, value in kemps_dict.items():
|
|
|
+ if value:
|
|
|
+ new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=2)
|
|
|
+ odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=2,odd=value)
|
|
|
+ sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
|
|
|
+ self.cursor.execute(sql1, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime, value, 2, "kemp", 0, "hg3535", new_hash,odds_only,1,utime, value,odds_only))
|
|
|
+ # 更新主队st_zq_odds_record表
|
|
|
+ sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s,%s,%s);"
|
|
|
+ self.cursor.execute(sql2, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime,value, 2, "kemp", 0, "hg3535",odds_only,1))
|
|
|
|
|
|
- if kemps_dict:
|
|
|
- for key, value in kemps_dict.items():
|
|
|
- if value:
|
|
|
- new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=2)
|
|
|
- odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=2,odd=value)
|
|
|
- sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
|
|
|
- self.cursor.execute(sql1, (
|
|
|
- int(league_id), key, int(game_id), utime, utime, value, 2, "kemp", 0, "hg3535", new_hash,odds_only,1,utime, value,odds_only))
|
|
|
- # 更新主队st_zq_odds_record表
|
|
|
- sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s,%s,%s);"
|
|
|
- self.cursor.execute(sql2, (
|
|
|
- int(league_id), key, int(game_id), utime, utime,value, 2, "kemp", 0, "hg3535",odds_only,1))
|
|
|
-
|
|
|
- sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
|
|
|
- self.cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
|
|
|
-
|
|
|
- if bureaus_dict:
|
|
|
- for key, value in bureaus_dict.items():
|
|
|
- if value:
|
|
|
- new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=3)
|
|
|
- odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=3,odd=value)
|
|
|
- sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only =%s;"
|
|
|
- self.cursor.execute(sql1, (
|
|
|
- int(league_id), key, int(game_id), utime, utime, value, 3, "bureau", 0, "hg3535", new_hash,
|
|
|
- bureaus_dict_rule[key],odds_only,1,utime, value,odds_only))
|
|
|
- # 更新主队st_zq_odds_record表
|
|
|
- sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
|
|
|
- self.cursor.execute(sql2, (
|
|
|
- int(league_id), key, int(game_id), utime, utime,value, 3, "bureau", 0, "hg3535",
|
|
|
- bureaus_dict_rule[key],odds_only,1))
|
|
|
- sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
|
|
|
- self.cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
|
|
|
-
|
|
|
- if total_number_dict:
|
|
|
- for key, value in total_number_dict.items():
|
|
|
- if value:
|
|
|
- # for x, y in enumerate(value):
|
|
|
- new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=4)
|
|
|
- odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=4,odd=value)
|
|
|
- # print(value)
|
|
|
- sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
|
|
|
- self.cursor.execute(sql1, (
|
|
|
- int(league_id), key, int(game_id), utime, utime,value, 4, "total_number", 0, "hg3535", new_hash,
|
|
|
- total_number_dict_rule[key],odds_only,1,utime, value,odds_only))
|
|
|
- # 更新主队st_zq_odds_record表
|
|
|
- sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
|
|
|
- self.cursor.execute(sql2, (
|
|
|
- int(league_id), key, int(game_id), utime, utime, value, 4, "total_number", 0, "hg3535",
|
|
|
- total_number_dict_rule[key],odds_only,1))
|
|
|
- sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
|
|
|
- self.cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
|
|
|
-
|
|
|
- if odd_evens_dict:
|
|
|
- for key, value in odd_evens_dict.items():
|
|
|
- if value:
|
|
|
- new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=5)
|
|
|
- odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=5,odd=value)
|
|
|
- sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
|
|
|
- self.cursor.execute(sql1, (
|
|
|
- int(league_id), key, int(game_id), utime, utime,value, 5, "two_game_sides", 0, "hg3535", new_hash,
|
|
|
- odd_evens_dict_rule[key],odds_only,1,utime, value,odds_only))
|
|
|
- # 更新主队st_zq_odds_record表
|
|
|
- sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
|
|
|
- self.cursor.execute(sql2, (
|
|
|
- int(league_id), key, int(game_id), utime, utime, value, 5, "two_game_sides", 0, "hg3535",odd_evens_dict_rule[key],odds_only,1))
|
|
|
- sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
|
|
|
- self.cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
|
|
|
+ sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
|
|
|
+ self.cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
|
|
|
|
|
|
+ if bureaus_dict:
|
|
|
+ for key, value in bureaus_dict.items():
|
|
|
+ if value:
|
|
|
+ new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=3)
|
|
|
+ odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=3,odd=value)
|
|
|
+ sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only =%s;"
|
|
|
+ self.cursor.execute(sql1, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime, value, 3, "bureau", 0, "hg3535", new_hash,
|
|
|
+ bureaus_dict_rule[key],odds_only,1,utime, value,odds_only))
|
|
|
+ # 更新主队st_zq_odds_record表
|
|
|
+ sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
|
|
|
+ self.cursor.execute(sql2, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime,value, 3, "bureau", 0, "hg3535",
|
|
|
+ bureaus_dict_rule[key],odds_only,1))
|
|
|
+ sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
|
|
|
+ self.cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
|
|
|
+
|
|
|
+ if total_number_dict:
|
|
|
+ for key, value in total_number_dict.items():
|
|
|
+ if value:
|
|
|
+ # for x, y in enumerate(value):
|
|
|
+ new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=4)
|
|
|
+ odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=4,odd=value)
|
|
|
+ # print(value)
|
|
|
+ sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
|
|
|
+ self.cursor.execute(sql1, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime,value, 4, "total_number", 0, "hg3535", new_hash,
|
|
|
+ total_number_dict_rule[key],odds_only,1,utime, value,odds_only))
|
|
|
+ # 更新主队st_zq_odds_record表
|
|
|
+ sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
|
|
|
+ self.cursor.execute(sql2, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime, value, 4, "total_number", 0, "hg3535",
|
|
|
+ total_number_dict_rule[key],odds_only,1))
|
|
|
+ sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
|
|
|
+ self.cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
|
|
|
+
|
|
|
+ if odd_evens_dict:
|
|
|
+ for key, value in odd_evens_dict.items():
|
|
|
+ if value:
|
|
|
+ new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=5)
|
|
|
+ odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=5,odd=value)
|
|
|
+ sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
|
|
|
+ self.cursor.execute(sql1, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime,value, 5, "two_game_sides", 0, "hg3535", new_hash,
|
|
|
+ odd_evens_dict_rule[key],odds_only,1,utime, value,odds_only))
|
|
|
+ # 更新主队st_zq_odds_record表
|
|
|
+ sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
|
|
|
+ self.cursor.execute(sql2, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime, value, 5, "two_game_sides", 0, "hg3535",odd_evens_dict_rule[key],odds_only,1))
|
|
|
+ sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
|
|
|
+ self.cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
# 插入赛事表
|
|
|
try:
|
|
|
Competition_sql = "insert into st_wq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,type,source,is_rollball,status) values (%s, %s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s,%s) on conflict(match_id) do update set tag = %s, status = %s;"
|
|
|
@@ -1860,95 +1862,98 @@ class Roll_Banqiupipeline(object):
|
|
|
# 赛事失效时间
|
|
|
# n_time = out_time(ctime, 3.5)
|
|
|
# 插入独赢
|
|
|
- if capots_dict:
|
|
|
- for key, value in capots_dict.items():
|
|
|
- if value:
|
|
|
- new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=2)
|
|
|
- odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=2,odd=value)
|
|
|
- sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,odds_only,expire_time,is_rollball) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s,expire_time=%s;"
|
|
|
- self.cursor.execute(sql1, (
|
|
|
- int(league_id), key, int(game_id), utime, utime, value, 4, "capot", 0, "hg3535", new_hash,
|
|
|
- odds_only, expire_time,1,utime, value, odds_only,expire_time))
|
|
|
- # 更新主队st_zq_odds_record表
|
|
|
- sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s,%s);"
|
|
|
- self.cursor.execute(sql2, (
|
|
|
- int(league_id), key, int(game_id), utime, utime, value, 4, "capot", 0, "hg3535", odds_only,1))
|
|
|
- res = json.dumps(match_score_dict)
|
|
|
- sql3 = "insert into st_bq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, status,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source,match_score_t) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
|
|
|
- self.cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, 1,'','',qiudui,'',utime,r_ctime,jijie,number,int(game_id),0,0,'hg3535',res,utime,qiudui,r_ctime,jijie,score_home,score_guest))
|
|
|
- # 插入赛事表
|
|
|
- Competition_sql = "insert into st_bq_competition(home_team,guest_team,lg_id,status,match_id,ctime,utime,tag,source,type,is_rollball) values(%s, %s, %s, %s, %s, %s, %s,%s, %s,%s,%s) on conflict(match_id) do update set tag=%s,is_rollball=%s,utime=%s;"
|
|
|
- self.cursor.execute(Competition_sql, (team_home, team_guest, league_id, 1,game_id,utime, utime, number,"hg3535",1,1,number,1,utime))
|
|
|
+ try:
|
|
|
+ if capots_dict:
|
|
|
+ for key, value in capots_dict.items():
|
|
|
+ if value:
|
|
|
+ new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=2)
|
|
|
+ odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=2,odd=value)
|
|
|
+ sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,odds_only,expire_time,is_rollball) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s,expire_time=%s;"
|
|
|
+ self.cursor.execute(sql1, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime, value, 4, "capot", 0, "hg3535", new_hash,
|
|
|
+ odds_only, expire_time,1,utime, value, odds_only,expire_time))
|
|
|
+ # 更新主队st_zq_odds_record表
|
|
|
+ sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s,%s);"
|
|
|
+ self.cursor.execute(sql2, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime, value, 4, "capot", 0, "hg3535", odds_only,1))
|
|
|
+ res = json.dumps(match_score_dict)
|
|
|
+ sql3 = "insert into st_bq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, status,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source,match_score_t) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
|
|
|
+ self.cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, 1,'','',qiudui,'',utime,r_ctime,jijie,number,int(game_id),0,0,'hg3535',res,utime,qiudui,r_ctime,jijie,score_home,score_guest))
|
|
|
+ # 插入赛事表
|
|
|
+ Competition_sql = "insert into st_bq_competition(home_team,guest_team,lg_id,status,match_id,ctime,utime,tag,source,type,is_rollball) values(%s, %s, %s, %s, %s, %s, %s,%s, %s,%s,%s) on conflict(match_id) do update set tag=%s,is_rollball=%s,utime=%s;"
|
|
|
+ self.cursor.execute(Competition_sql, (team_home, team_guest, league_id, 1,game_id,utime, utime, number,"hg3535",1,1,number,1,utime))
|
|
|
|
|
|
- #让球
|
|
|
- if concedes_dict:
|
|
|
- for key, value in concedes_dict.items():
|
|
|
- if value:
|
|
|
- new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=1)
|
|
|
- odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=1,odd=value)
|
|
|
- sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
|
|
|
- self.cursor.execute(sql1, (
|
|
|
- int(league_id), key, int(game_id), utime, utime,value, 1, "concede", 0, "hg3535", new_hash,
|
|
|
- concedes_dict_rule[key],odds_only,1,utime, value,odds_only))
|
|
|
- # 更新主队st_zq_odds_record表
|
|
|
- sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
|
|
|
- self.cursor.execute(sql2, (
|
|
|
- int(league_id), key, int(game_id), utime, utime, value, 1, "concede", 0, "hg3535",
|
|
|
- concedes_dict_rule[key],odds_only,1))
|
|
|
- #插入结果表
|
|
|
- res = json.dumps(match_score_dict)
|
|
|
- # r = pymysql.escape_string(res)
|
|
|
- sql3 = "insert into st_bq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, status,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source,match_score_t) values (%s,%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score_t = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
|
|
|
- self.cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, 1,'','','','',utime,r_ctime,jijie,number,int(game_id),0,0,'hg3535',res,utime,res,r_ctime,jijie,score_home,score_guest))
|
|
|
- # 插入记录表
|
|
|
- sql4 = "insert into st_bq_result_record(lg_id, home_team, guest_team, home_score, guest_score,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
|
|
|
- self.cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '','','',utime,r_ctime,jijie,number,int(game_id),'hg3535',0))
|
|
|
-
|
|
|
- if total_size_dict:
|
|
|
- for key, value in total_size_dict.items():
|
|
|
- if value:
|
|
|
- new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=2)
|
|
|
- odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=2,odd=value)
|
|
|
- sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
|
|
|
- self.cursor.execute(sql1, (
|
|
|
- int(league_id), key, int(game_id), utime, utime,value, 2, "total_size", 0, "hg3535", new_hash,
|
|
|
- total_size_dict_rule[key],odds_only,1,utime, value,odds_only))
|
|
|
- # 更新主队st_zq_odds_record表
|
|
|
- sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
|
|
|
- self.cursor.execute(sql2, (
|
|
|
- int(league_id), key, int(game_id), utime, utime, value, 2, "total_size", 0, "hg3535",
|
|
|
- total_size_dict_rule[key],odds_only,1))
|
|
|
- #插入结果表
|
|
|
- res = json.dumps(match_score_dict)
|
|
|
- # r = pymysql.escape_string(res)
|
|
|
- sql3 = "insert into st_bq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, status,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source,match_score_t) values (%s,%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score_t = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
|
|
|
- self.cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, 1,'','','','',utime,r_ctime,jijie,number,int(game_id),0,0,'hg3535',res,utime,res,r_ctime,jijie,score_home,score_guest))
|
|
|
- # 插入记录表
|
|
|
- sql4 = "insert into st_bq_result_record(lg_id, home_team, guest_team, home_score, guest_score,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
|
|
|
- self.cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '','','',utime,r_ctime,jijie,number,int(game_id),'hg3535',1))
|
|
|
-
|
|
|
- if odd_evens_dict:
|
|
|
- for key, value in odd_evens_dict.items():
|
|
|
- if value:
|
|
|
- new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=3)
|
|
|
- odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=3,odd=value)
|
|
|
- sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
|
|
|
- self.cursor.execute(sql1, (
|
|
|
- int(league_id), key, int(game_id), utime, utime,value, 3, "two_sides", 0, "hg3535", new_hash,
|
|
|
- odd_evens_dict_rule[key],odds_only,1,utime, value,odds_only))
|
|
|
- # 更新主队st_zq_odds_record表
|
|
|
- sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
|
|
|
- self.cursor.execute(sql2, (
|
|
|
- int(league_id), key, int(game_id), utime, utime, value, 3, "two_sides", 0, "hg3535",
|
|
|
- odd_evens_dict_rule[key],odds_only,1))
|
|
|
- #插入结果表
|
|
|
- res = json.dumps(match_score_dict)
|
|
|
- # r = pymysql.escape_string(res)
|
|
|
- sql3 = "insert into st_bq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, status,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source,match_score_t) values (%s,%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score_t = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
|
|
|
- self.cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, 1,'','','','',utime,r_ctime,jijie,number,int(game_id),0,0,'hg3535',res,utime,res,r_ctime,jijie,score_home,score_guest))
|
|
|
- # 插入记录表
|
|
|
- sql4 = "insert into st_bq_result_record(lg_id, home_team, guest_team, home_score, guest_score,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
|
|
|
- self.cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '','','',utime,r_ctime,jijie,number,int(game_id),'hg3535',1))
|
|
|
+ #让球
|
|
|
+ if concedes_dict:
|
|
|
+ for key, value in concedes_dict.items():
|
|
|
+ if value:
|
|
|
+ new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=1)
|
|
|
+ odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=1,odd=value)
|
|
|
+ sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
|
|
|
+ self.cursor.execute(sql1, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime,value, 1, "concede", 0, "hg3535", new_hash,
|
|
|
+ concedes_dict_rule[key],odds_only,1,utime, value,odds_only))
|
|
|
+ # 更新主队st_zq_odds_record表
|
|
|
+ sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
|
|
|
+ self.cursor.execute(sql2, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime, value, 1, "concede", 0, "hg3535",
|
|
|
+ concedes_dict_rule[key],odds_only,1))
|
|
|
+ #插入结果表
|
|
|
+ res = json.dumps(match_score_dict)
|
|
|
+ # r = pymysql.escape_string(res)
|
|
|
+ sql3 = "insert into st_bq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, status,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source,match_score_t) values (%s,%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score_t = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
|
|
|
+ self.cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, 1,'','','','',utime,r_ctime,jijie,number,int(game_id),0,0,'hg3535',res,utime,res,r_ctime,jijie,score_home,score_guest))
|
|
|
+ # 插入记录表
|
|
|
+ sql4 = "insert into st_bq_result_record(lg_id, home_team, guest_team, home_score, guest_score,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
|
|
|
+ self.cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '','','',utime,r_ctime,jijie,number,int(game_id),'hg3535',0))
|
|
|
+
|
|
|
+ if total_size_dict:
|
|
|
+ for key, value in total_size_dict.items():
|
|
|
+ if value:
|
|
|
+ new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=2)
|
|
|
+ odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=2,odd=value)
|
|
|
+ sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
|
|
|
+ self.cursor.execute(sql1, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime,value, 2, "total_size", 0, "hg3535", new_hash,
|
|
|
+ total_size_dict_rule[key],odds_only,1,utime, value,odds_only))
|
|
|
+ # 更新主队st_zq_odds_record表
|
|
|
+ sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
|
|
|
+ self.cursor.execute(sql2, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime, value, 2, "total_size", 0, "hg3535",
|
|
|
+ total_size_dict_rule[key],odds_only,1))
|
|
|
+ #插入结果表
|
|
|
+ res = json.dumps(match_score_dict)
|
|
|
+ # r = pymysql.escape_string(res)
|
|
|
+ sql3 = "insert into st_bq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, status,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source,match_score_t) values (%s,%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score_t = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
|
|
|
+ self.cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, 1,'','','','',utime,r_ctime,jijie,number,int(game_id),0,0,'hg3535',res,utime,res,r_ctime,jijie,score_home,score_guest))
|
|
|
+ # 插入记录表
|
|
|
+ sql4 = "insert into st_bq_result_record(lg_id, home_team, guest_team, home_score, guest_score,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
|
|
|
+ self.cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '','','',utime,r_ctime,jijie,number,int(game_id),'hg3535',1))
|
|
|
+
|
|
|
+ if odd_evens_dict:
|
|
|
+ for key, value in odd_evens_dict.items():
|
|
|
+ if value:
|
|
|
+ new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=3)
|
|
|
+ odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=3,odd=value)
|
|
|
+ sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
|
|
|
+ self.cursor.execute(sql1, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime,value, 3, "two_sides", 0, "hg3535", new_hash,
|
|
|
+ odd_evens_dict_rule[key],odds_only,1,utime, value,odds_only))
|
|
|
+ # 更新主队st_zq_odds_record表
|
|
|
+ sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
|
|
|
+ self.cursor.execute(sql2, (
|
|
|
+ int(league_id), key, int(game_id), utime, utime, value, 3, "two_sides", 0, "hg3535",
|
|
|
+ odd_evens_dict_rule[key],odds_only,1))
|
|
|
+ #插入结果表
|
|
|
+ res = json.dumps(match_score_dict)
|
|
|
+ # r = pymysql.escape_string(res)
|
|
|
+ sql3 = "insert into st_bq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, status,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source,match_score_t) values (%s,%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score_t = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
|
|
|
+ self.cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, 1,'','','','',utime,r_ctime,jijie,number,int(game_id),0,0,'hg3535',res,utime,res,r_ctime,jijie,score_home,score_guest))
|
|
|
+ # 插入记录表
|
|
|
+ sql4 = "insert into st_bq_result_record(lg_id, home_team, guest_team, home_score, guest_score,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
|
|
|
+ self.cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '','','',utime,r_ctime,jijie,number,int(game_id),'hg3535',1))
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
return item
|
|
|
|
|
|
def close_spider(self, spider):
|