|
|
@@ -283,8 +283,9 @@ class Zuqiupipeline(object):
|
|
|
"us_time": ctime
|
|
|
}
|
|
|
}
|
|
|
- zq_odds.append(payload)
|
|
|
+ zq_odds.insert(0, payload)
|
|
|
r = requests.post(url, data={"data": json.dumps(zq_odds)})
|
|
|
+ # logger.warning(r.text)
|
|
|
print(r.text)
|
|
|
return item
|
|
|
|
|
|
@@ -362,7 +363,7 @@ class Lanqiupipeline(object):
|
|
|
league_id=league_id, p_code='concede', condition=concedes_dict_rule[key], game_code='lq', zq_odds=lq_odds)
|
|
|
if odd_evens_dict:
|
|
|
for key, value in odd_evens_dict.items():
|
|
|
- two_post(data=value, match_id=game_id, odds_code=key, p_id=2,
|
|
|
+ one_post(data=value, match_id=game_id, odds_code=key, p_id=2,
|
|
|
league_id=league_id, p_code='two_sides', condition=odd_evens_dict_rule[key], game_code='lq', zq_odds=lq_odds)
|
|
|
# 总分单双 数据插入数据库
|
|
|
if total_sizes_dict:
|
|
|
@@ -451,9 +452,11 @@ class Lanqiupipeline(object):
|
|
|
"us_time": us_time
|
|
|
}
|
|
|
}
|
|
|
- lq_odds.append(payload)
|
|
|
+ lq_odds.insert(0, payload)
|
|
|
r = requests.post(url, data={"data": json.dumps(lq_odds)})
|
|
|
+ # logger.warning(r.text)
|
|
|
print(r.text)
|
|
|
+ return item
|
|
|
|
|
|
|
|
|
# 网球 让球&大小盘--------------------------------------------------------------------------------------------------------
|
|
|
@@ -470,7 +473,7 @@ class Wangqiupipeline(object):
|
|
|
# result = item['result']
|
|
|
# 比赛id
|
|
|
game_id = item['game_id']
|
|
|
- print(game_id)
|
|
|
+ # print(game_id)
|
|
|
# 球队1
|
|
|
team_home = item['team_home']
|
|
|
# 球队2
|
|
|
@@ -552,9 +555,6 @@ class Wangqiupipeline(object):
|
|
|
"us_time": us_time
|
|
|
}
|
|
|
}
|
|
|
- resp = requests.post(url, data={"data": json.dumps(payload)})
|
|
|
- print(json.dumps(payload))
|
|
|
- print(resp.text)
|
|
|
if pt == 2:
|
|
|
payload = {
|
|
|
"game_code": "wq",
|
|
|
@@ -576,9 +576,6 @@ class Wangqiupipeline(object):
|
|
|
"us_time": us_time
|
|
|
}
|
|
|
}
|
|
|
- resp = requests.post(url, data={"data": json.dumps(payload)})
|
|
|
- print(json.dumps(payload))
|
|
|
- print(resp.text)
|
|
|
if pt == 3:
|
|
|
payload = {
|
|
|
"game_code": "wq",
|
|
|
@@ -600,10 +597,7 @@ class Wangqiupipeline(object):
|
|
|
"us_time": us_time
|
|
|
}
|
|
|
}
|
|
|
- # resp = requests.post(url, data={"data": json.dumps(payload)})
|
|
|
- # print(json.dumps(payload))
|
|
|
- # print(resp.text)
|
|
|
- wq_odds.append(payload)
|
|
|
+ wq_odds.insert(0, payload)
|
|
|
# 让盘
|
|
|
if concedes_dict:
|
|
|
for key, value in concedes_dict.items():
|
|
|
@@ -624,7 +618,10 @@ class Wangqiupipeline(object):
|
|
|
if kemps_dict:
|
|
|
for key, value in kemps_dict.items():
|
|
|
one_post(data=value, match_id=game_id, odds_code=key, p_id=2, league_id=league_id, p_code='kemp', condition=key, game_code='wq', zq_odds=wq_odds)
|
|
|
+ # b = json.dumps(wq_odds)
|
|
|
+ # print(b)
|
|
|
r = requests.post(url, data={"data": json.dumps(wq_odds)})
|
|
|
+ # logger.warning(r.text)
|
|
|
print(r.text)
|
|
|
return item
|
|
|
|
|
|
@@ -885,19 +882,15 @@ class Guanjunpipeline(object):
|
|
|
ball = item['ball']
|
|
|
# 插入st_zq_odds表
|
|
|
r_hash = hash_func(league_id, new_champion, tema_home, champion_team)
|
|
|
- # odds_only = r_hash
|
|
|
- # s_hash = hash_func(league_id, league_name, ball, 0)
|
|
|
- # url = 'http://sports.5gogo.com/Sports/WriteSports/setSports'
|
|
|
+ # 冠军联赛
|
|
|
+ guanl = guanl_post(ball=ball, league_name=league_name, league_id=league_id, time3=time3)
|
|
|
+ gj_odds.append(guanl)
|
|
|
# 冠军赛事
|
|
|
gs = gs_post(ball=ball, league_id=league_id, league_name=league_name, data_game=data_game)
|
|
|
gj_odds.append(gs)
|
|
|
# 冠军赔率
|
|
|
go = go_post(ball=ball, league_id=league_id, new_champion=new_champion, new_league_name=new_league_name, value=champion_team, r_hash=r_hash, new_hash=new_hash, tema_home=tema_home)
|
|
|
gj_odds.append(go)
|
|
|
- # 冠军联赛
|
|
|
- guanl = guanl_post(ball=ball, league_name=league_name, league_id=league_id, time3=time3)
|
|
|
- gj_odds.append(guanl)
|
|
|
-
|
|
|
r = requests.post(url, data={"data": json.dumps(gj_odds)})
|
|
|
# logger.warning(r.text)
|
|
|
print(r.text)
|
|
|
@@ -907,21 +900,42 @@ class Guanjunpipeline(object):
|
|
|
class Liansaipipeline(object):
|
|
|
def process_item(self, item, spider):
|
|
|
logger = logging.getLogger(__name__)
|
|
|
+ ls_list = []
|
|
|
+ url = 'http://admin.5gogo.com/setSports'
|
|
|
area_id = item["area_id"]
|
|
|
area_name = item["area_name"]
|
|
|
st_league = item["st_league"]
|
|
|
+ print(st_league)
|
|
|
name_chinese = item["name_chinese"]
|
|
|
ball = item['ball']
|
|
|
# utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
|
|
|
area_dict = {"南美洲": 3, "北美洲": 4, "欧洲": 5, "大洋洲": 6, "南极洲": 7, "非洲": 1, "世界": 8, "亚洲": 2}
|
|
|
if ball == "足球":
|
|
|
- liansai(area_name=area_name, name_chinese=name_chinese, st_league=st_league, area_dict=area_dict, game_code='zq', qiu='足球')
|
|
|
+ z_ls = liansai(area_name=area_name, name_chinese=name_chinese, st_league=st_league, area_dict=area_dict, game_code='zq', qiu='足球')
|
|
|
+ ls_list.append(z_ls)
|
|
|
+ r = requests.post(url, data={"data": json.dumps(ls_list)})
|
|
|
+ # logger.warning(r.text)
|
|
|
+ # print(r.text)
|
|
|
elif ball == "篮球":
|
|
|
- liansai(area_name=area_name, name_chinese=name_chinese, st_league=st_league, area_dict=area_dict, game_code='lq', qiu='篮球')
|
|
|
+ l_ls = liansai(area_name=area_name, name_chinese=name_chinese, st_league=st_league, area_dict=area_dict, game_code='lq', qiu='篮球')
|
|
|
+ ls_list.append(l_ls)
|
|
|
+ # if st_league == 29037:
|
|
|
+ # print(l_ls)
|
|
|
+ r = requests.post(url, data={"data": json.dumps(ls_list)})
|
|
|
+ logger.warning(r.text)
|
|
|
+ # print(r.text)
|
|
|
elif ball == "网球":
|
|
|
- liansai(area_name=area_name, name_chinese=name_chinese, st_league=st_league, area_dict=area_dict, game_code='wq', qiu='网球')
|
|
|
+ w_ls = liansai(area_name=area_name, name_chinese=name_chinese, st_league=st_league, area_dict=area_dict, game_code='wq', qiu='网球')
|
|
|
+ ls_list.append(w_ls)
|
|
|
+ r = requests.post(url, data={"data": json.dumps(ls_list)})
|
|
|
+ # logger.warning(r.text)
|
|
|
+ print(r.text)
|
|
|
elif ball == "棒球":
|
|
|
- liansai(area_name=area_name, name_chinese=name_chinese, st_league=st_league, area_dict=area_dict, game_code='bq', qiu='棒球')
|
|
|
+ b_ls = liansai(area_name=area_name, name_chinese=name_chinese, st_league=st_league, area_dict=area_dict, game_code='bq', qiu='棒球')
|
|
|
+ ls_list.append(b_ls)
|
|
|
+ r = requests.post(url, data={"data": json.dumps(ls_list)})
|
|
|
+ print(r.text)
|
|
|
+ # logger.warning(r.text)
|
|
|
return item
|
|
|
|
|
|
|
|
|
@@ -930,6 +944,8 @@ class Liansaipipeline(object):
|
|
|
class Roll_Zuqiupipeline(object):
|
|
|
def process_item(self, item, spider):
|
|
|
logger = logging.getLogger(__name__)
|
|
|
+ url = 'http://admin.5gogo.com/setSports'
|
|
|
+ roll_zq = []
|
|
|
# 比赛日期
|
|
|
try:
|
|
|
data_game = item['data_game'].split("/")
|
|
|
@@ -944,7 +960,7 @@ class Roll_Zuqiupipeline(object):
|
|
|
day = str(data_game[0])
|
|
|
# 比赛时间
|
|
|
time_game = str(item['time_game'])
|
|
|
- print(time_game)
|
|
|
+ # print(time_game)
|
|
|
# 比赛时间,时间戳
|
|
|
ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"
|
|
|
r_ctime = "2019" + "-" + month + "-" + day
|
|
|
@@ -977,17 +993,17 @@ class Roll_Zuqiupipeline(object):
|
|
|
half_size_home_rule = item["half_size_home_rule"]
|
|
|
try:
|
|
|
# 让球 数据插入数据库
|
|
|
- two_post(data=half_size_home, match_id=competition_id, odds_code='half_goal_size_big', p_id=p_id, league_id=league_id, p_code=p_code, condition=half_size_home_rule, game_code='zq')
|
|
|
+ two_post(data=half_size_home, match_id=competition_id, odds_code='half_goal_size_big', p_id=p_id, league_id=league_id, p_code=p_code, condition=half_size_home_rule, game_code='zq', zq_odds=roll_zq)
|
|
|
# 让球 数据插入数据库
|
|
|
- two_post(data=half_size_guest, match_id=competition_id, odds_code='half_goal_size_small', p_id=p_id, league_id=league_id, p_code=p_code, condition=half_size_guest_rule, game_code='zq')
|
|
|
+ two_post(data=half_size_guest, match_id=competition_id, odds_code='half_goal_size_small', p_id=p_id, league_id=league_id, p_code=p_code, condition=half_size_guest_rule, game_code='zq', zq_odds=roll_zq)
|
|
|
|
|
|
# 全场场大小
|
|
|
size_guest = item["size_guest"]
|
|
|
size_guest_rule = item["size_guest_rule"]
|
|
|
size_home = item["size_home"]
|
|
|
size_home_rule = item["size_home_rule"]
|
|
|
- two_post(data=size_guest, match_id=competition_id, odds_code='goal_size_small', p_id=p_id, league_id=league_id, p_code=p_code, condition=size_guest_rule, game_code='zq')
|
|
|
- two_post(data=size_home, match_id=competition_id, odds_code='goal_size_big', p_id=p_id, league_id=league_id, p_code=p_code, condition=size_home_rule, game_code='zq')
|
|
|
+ two_post(data=size_guest, match_id=competition_id, odds_code='goal_size_small', p_id=p_id, league_id=league_id, p_code=p_code, condition=size_guest_rule, game_code='zq', zq_odds=roll_zq)
|
|
|
+ two_post(data=size_home, match_id=competition_id, odds_code='goal_size_big', p_id=p_id, league_id=league_id, p_code=p_code, condition=size_home_rule, game_code='zq', zq_odds=roll_zq)
|
|
|
p_code, p_id = get_pcode(corner_ball, 'concede')
|
|
|
# 上半场让球
|
|
|
half_concede_home_rule = item["half_concede_home_rule"]
|
|
|
@@ -995,15 +1011,15 @@ class Roll_Zuqiupipeline(object):
|
|
|
half_concede_guest_rule = item["half_concede_guest_rule"]
|
|
|
half_concede_guest = item["half_concede_guest"]
|
|
|
# 上半场让球
|
|
|
- two_post(data=half_concede_home, match_id=competition_id, odds_code='half_concede_home', p_id=p_id, league_id=league_id, p_code=p_code, condition=half_concede_home_rule, game_code='zq')
|
|
|
- two_post(data=half_concede_guest, match_id=competition_id, odds_code='half_concede_guest', p_id=p_id, league_id=league_id, p_code=p_code, condition=half_concede_guest_rule, game_code='zq')
|
|
|
+ two_post(data=half_concede_home, match_id=competition_id, odds_code='half_concede_home', p_id=p_id, league_id=league_id, p_code=p_code, condition=half_concede_home_rule, game_code='zq', zq_odds=roll_zq)
|
|
|
+ two_post(data=half_concede_guest, match_id=competition_id, odds_code='half_concede_guest', p_id=p_id, league_id=league_id, p_code=p_code, condition=half_concede_guest_rule, game_code='zq', zq_odds=roll_zq)
|
|
|
concede_guest = item["concede_guest"]
|
|
|
concede_guest_rule = item["concede_guest_rule"]
|
|
|
concede_home = item["concede_home"]
|
|
|
concede_home_rule = item["concede_home_rule"]
|
|
|
# 全场让球
|
|
|
- two_post(data=concede_guest, match_id=competition_id, odds_code='concede_guest', p_id=p_id, league_id=league_id, p_code=p_code, condition=concede_guest_rule, game_code='zq')
|
|
|
- two_post(data=concede_home, match_id=competition_id, odds_code='concede_home', p_id=p_id, league_id=league_id, p_code=p_code, condition=concede_home_rule, game_code='zq')
|
|
|
+ two_post(data=concede_guest, match_id=competition_id, odds_code='concede_guest', p_id=p_id, league_id=league_id, p_code=p_code, condition=concede_guest_rule, game_code='zq', zq_odds=roll_zq)
|
|
|
+ two_post(data=concede_home, match_id=competition_id, odds_code='concede_home', p_id=p_id, league_id=league_id, p_code=p_code, condition=concede_home_rule, game_code='zq', zq_odds=roll_zq)
|
|
|
|
|
|
p_code, p_id = get_pcode(corner_ball, 'capot')
|
|
|
# 独赢-------------------------------------------------------------------------------------------------------------------
|
|
|
@@ -1016,22 +1032,22 @@ class Roll_Zuqiupipeline(object):
|
|
|
capot_dogfall = item["capot_dogfall"]
|
|
|
# 上半场独赢 主队
|
|
|
one_post(data=half_capot_home, match_id=competition_id, odds_code='half_capot_home', p_id=p_id,
|
|
|
- league_id=league_id, p_code=p_code, condition=1, game_code='zq')
|
|
|
+ league_id=league_id, p_code=p_code, condition=1, game_code='zq', zq_odds=roll_zq)
|
|
|
# 上半场独赢 客队
|
|
|
one_post(data=half_capot_guest, match_id=competition_id, odds_code='half_capot_guest', p_id=p_id,
|
|
|
- league_id=league_id, p_code=p_code, condition=2, game_code='zq')
|
|
|
+ league_id=league_id, p_code=p_code, condition=2, game_code='zq', zq_odds=roll_zq)
|
|
|
# 上半场独赢 和
|
|
|
one_post(data=half_capot_dogfall, match_id=competition_id, odds_code='half_capot_dogfall', p_id=p_id,
|
|
|
- league_id=league_id, p_code=p_code, condition='X', game_code='zq')
|
|
|
+ league_id=league_id, p_code=p_code, condition='X', game_code='zq', zq_odds=roll_zq)
|
|
|
# 全场独赢 主队
|
|
|
one_post(data=capot_home, match_id=competition_id, odds_code='capot_home', p_id=p_id,
|
|
|
- league_id=league_id, p_code=p_code, condition=1, game_code='zq')
|
|
|
+ league_id=league_id, p_code=p_code, condition=1, game_code='zq', zq_odds=roll_zq)
|
|
|
# 全场独赢 客队
|
|
|
one_post(data=capot_guest, match_id=competition_id, odds_code='capot_guest', p_id=p_id,
|
|
|
- league_id=league_id, p_code=p_code, condition=2, game_code='zq')
|
|
|
+ league_id=league_id, p_code=p_code, condition=2, game_code='zq', zq_odds=roll_zq)
|
|
|
# 全场独赢 和
|
|
|
one_post(data=capot_dogfall, match_id=competition_id, odds_code='capot_dogfall', p_id=p_id,
|
|
|
- league_id=league_id, p_code=p_code, condition='X', game_code='zq')
|
|
|
+ league_id=league_id, p_code=p_code, condition='X', game_code='zq', zq_odds=roll_zq)
|
|
|
|
|
|
# 入球数单双-------------------------------------------------------------------------------------------------------------
|
|
|
p_code, p_id = get_pcode(corner_ball, 'two_sides')
|
|
|
@@ -1042,14 +1058,14 @@ class Roll_Zuqiupipeline(object):
|
|
|
# 全场入球数 单双
|
|
|
# 上半场入球数 单双
|
|
|
one_post(data=odd_even_odd, match_id=competition_id, odds_code='two_sides_single', p_id=p_id,
|
|
|
- league_id=league_id, p_code=p_code, condition='单', game_code='zq')
|
|
|
+ league_id=league_id, p_code=p_code, condition='单', game_code='zq', zq_odds=roll_zq)
|
|
|
one_post(data=odd_even_even, match_id=competition_id, odds_code='two_sides_double', p_id=p_id,
|
|
|
- league_id=league_id, p_code=p_code, condition='双', game_code='zq')
|
|
|
+ league_id=league_id, p_code=p_code, condition='双', game_code='zq', zq_odds=roll_zq)
|
|
|
# 全场入球数 单双
|
|
|
one_post(data=half_odd_even_odd, match_id=competition_id, odds_code='half_two_sides_single', p_id=p_id,
|
|
|
- league_id=league_id, p_code=p_code, condition='双', game_code='zq')
|
|
|
+ league_id=league_id, p_code=p_code, condition='双', game_code='zq', zq_odds=roll_zq)
|
|
|
one_post(data=half_odd_even_even, match_id=competition_id, odds_code='half_two_sides_double', p_id=p_id,
|
|
|
- league_id=league_id, p_code=p_code, condition='双', game_code='zq')
|
|
|
+ league_id=league_id, p_code=p_code, condition='双', game_code='zq', zq_odds=roll_zq)
|
|
|
# 总入球数 --------------------------------------------------------------------------------------------------------------
|
|
|
p_code, p_id = get_pcode(corner_ball, 'total_goal')
|
|
|
total_goals = item['total_goal']
|
|
|
@@ -1058,7 +1074,7 @@ class Roll_Zuqiupipeline(object):
|
|
|
"half_total_goal_two": '2', "half_total_goal_three": '3或以上'}
|
|
|
for key, value in total_goals.items():
|
|
|
one_post(data=value, match_id=competition_id, odds_code=key, p_id=p_id,
|
|
|
- league_id=league_id, p_code=p_code, condition=total_dict[key], game_code='zq')
|
|
|
+ league_id=league_id, p_code=p_code, condition=total_dict[key], game_code='zq', zq_odds=roll_zq)
|
|
|
|
|
|
# 全场半场 --------------------------------------------------------------------------------------------------------------
|
|
|
half_fulls = item['half_full']
|
|
|
@@ -1071,7 +1087,7 @@ class Roll_Zuqiupipeline(object):
|
|
|
if half_fulls:
|
|
|
for key, value in half_fulls.items():
|
|
|
# if value:
|
|
|
- one_post(data=value, match_id=competition_id, odds_code=key, p_id=p_id, league_id=league_id, p_code=p_code, condition=full_dict[key], game_code='zq')
|
|
|
+ one_post(data=value, match_id=competition_id, odds_code=key, p_id=p_id, league_id=league_id, p_code=p_code, condition=full_dict[key], game_code='zq', zq_odds=roll_zq)
|
|
|
# 波胆------------------------------------------------------------------------------------------------------------------
|
|
|
bodan_datas = item['bodan_data']
|
|
|
p_code, p_id = get_pcode(corner_ball, 'bodan')
|
|
|
@@ -1099,7 +1115,7 @@ class Roll_Zuqiupipeline(object):
|
|
|
"halfbodanother": "其他"}
|
|
|
if bodan_datas:
|
|
|
for key, value in bodan_datas.items():
|
|
|
- one_post(data=value, match_id=competition_id, odds_code=key, p_id=p_id, league_id=league_id, p_code=p_code, condition=bodan_dict[key], game_code='zq')
|
|
|
+ one_post(data=value, match_id=competition_id, odds_code=key, p_id=p_id, league_id=league_id, p_code=p_code, condition=bodan_dict[key], game_code='zq', zq_odds=roll_zq)
|
|
|
|
|
|
# 最先进球/最后进球 ------------------------------------------------------------------------------------------------------
|
|
|
first_last_balls = item['first_last_ball']
|
|
|
@@ -1109,7 +1125,7 @@ class Roll_Zuqiupipeline(object):
|
|
|
if first_last_balls:
|
|
|
for key, value in first_last_balls.items():
|
|
|
# 构建唯一索引
|
|
|
- one_post(data=value, match_id=competition_id, odds_code=key, p_id=p_id, league_id=league_id, p_code=p_code, condition=first_last_dict[key], game_code='zq')
|
|
|
+ one_post(data=value, match_id=competition_id, odds_code=key, p_id=p_id, league_id=league_id, p_code=p_code, condition=first_last_dict[key], game_code='zq', zq_odds=roll_zq)
|
|
|
|
|
|
p_code, p_id = get_pcode(corner_ball, 'tema_ball')
|
|
|
full_dicts = item['full_data']
|
|
|
@@ -1118,10 +1134,10 @@ class Roll_Zuqiupipeline(object):
|
|
|
half_dict_rules = item['half_data_rule']
|
|
|
if full_dicts:
|
|
|
for key, value in full_dicts.items():
|
|
|
- one_post(data=value, match_id=competition_id, odds_code=key, p_id=p_id, league_id=league_id, p_code=p_code, condition=full_dict_rules[key], game_code='zq')
|
|
|
+ one_post(data=value, match_id=competition_id, odds_code=key, p_id=p_id, league_id=league_id, p_code=p_code, condition=full_dict_rules[key], game_code='zq', zq_odds=roll_zq)
|
|
|
if half_dicts:
|
|
|
for key, value in half_dicts.items():
|
|
|
- one_post(data=value, match_id=competition_id, odds_code=key, p_id=p_id, league_id=league_id, p_code=p_code, condition=half_dict_rules[key], game_code='zq')
|
|
|
+ one_post(data=value, match_id=competition_id, odds_code=key, p_id=p_id, league_id=league_id, p_code=p_code, condition=half_dict_rules[key], game_code='zq', zq_odds=roll_zq)
|
|
|
zq_competition = {
|
|
|
"game_code": "zq",
|
|
|
"title": "competition",
|
|
|
@@ -1142,9 +1158,10 @@ class Roll_Zuqiupipeline(object):
|
|
|
"us_time": None
|
|
|
}
|
|
|
}
|
|
|
+ roll_zq.append(zq_competition)
|
|
|
zq_match_result = {
|
|
|
"game_code": "zq",
|
|
|
- "title": "match_result",
|
|
|
+ "title": "match_result_record",
|
|
|
"data": {
|
|
|
"home_team": team_home,
|
|
|
"guest_team": team_home,
|
|
|
@@ -1169,14 +1186,20 @@ class Roll_Zuqiupipeline(object):
|
|
|
"source": "hg3535"
|
|
|
}
|
|
|
}
|
|
|
+ roll_zq.append(zq_match_result)
|
|
|
except Exception as e:
|
|
|
logger.warning(e)
|
|
|
+ r = requests.post(url, data={"data": json.dumps(roll_zq)})
|
|
|
+ # logger.warning(r.text)
|
|
|
+ print(r.text)
|
|
|
return item
|
|
|
|
|
|
|
|
|
# 滚球篮球 插入
|
|
|
class Roll_Lanqiupipeline(object):
|
|
|
def process_item(self, item, spider):
|
|
|
+ url = 'http://admin.5gogo.com/setSports'
|
|
|
+ roll_lq = []
|
|
|
# 使用twisted将mysql插入变成异步执行
|
|
|
logger = logging.getLogger(__name__)
|
|
|
# 联赛id
|
|
|
@@ -1235,96 +1258,101 @@ class Roll_Lanqiupipeline(object):
|
|
|
capots_dict = item['capot']
|
|
|
team_scores_dict = item['team_score']
|
|
|
team_scores_dict_rule = item['team_score_rule']
|
|
|
- try:
|
|
|
- if concedes_dict:
|
|
|
- for key, value in concedes_dict.items():
|
|
|
- two_post(data=value, match_id=game_id, odds_code=key, p_id=1, league_id=league_id, p_code='concede', condition=concedes_dict_rule[key], game_code='lq')
|
|
|
-
|
|
|
- if odd_evens_dict:
|
|
|
- for key, value in odd_evens_dict.items():
|
|
|
- two_post(data=value, match_id=game_id, odds_code=key, p_id=2, league_id=league_id, p_code='two_sides',
|
|
|
- condition=odd_evens_dict_rule[key], game_code='lq')
|
|
|
+ if concedes_dict:
|
|
|
+ for key, value in concedes_dict.items():
|
|
|
+ two_post(data=value, match_id=game_id, odds_code=key, p_id=1, league_id=league_id, p_code='concede', condition=concedes_dict_rule[key], game_code='lq', zq_odds=roll_lq)
|
|
|
+ if total_sizes_dict:
|
|
|
+ for key, value in total_sizes_dict.items():
|
|
|
+ two_post(data=value, match_id=game_id, odds_code=key, p_id=3, league_id=league_id, p_code='total_size',
|
|
|
+ condition=total_sizes_dict_rule[key], game_code='lq', zq_odds=roll_lq)
|
|
|
|
|
|
- if total_sizes_dict:
|
|
|
- for key, value in total_sizes_dict.items():
|
|
|
- two_post(data=value, match_id=game_id, odds_code=key, p_id=3, league_id=league_id, p_code='total_size',
|
|
|
- condition=total_sizes_dict_rule[key], game_code='lq')
|
|
|
+ if odd_evens_dict:
|
|
|
+ for key, value in odd_evens_dict.items():
|
|
|
+ # two_post(data=value, match_id=game_id, odds_code=key, p_id=2, league_id=league_id, p_code='two_sides',
|
|
|
+ # condition=odd_evens_dict_rule[key], game_code='lq', zq_odds=roll_lq)
|
|
|
+ one_post(data=value, match_id=game_id, odds_code=key, p_id=2, league_id=league_id,
|
|
|
+ p_code='two_sides', condition=odd_evens_dict_rule[key], game_code='lq', zq_odds=roll_lq)
|
|
|
|
|
|
- last_home = last_numbers_dict['last_home']
|
|
|
- if last_home:
|
|
|
- for key, value in last_home.items():
|
|
|
- one_post(data=value, match_id=game_id, odds_code="last_home" + key, p_id=4, league_id=league_id, p_code='last_home', condition=key, game_code='lq')
|
|
|
+ last_home = last_numbers_dict['last_home']
|
|
|
+ if last_home:
|
|
|
+ for key, value in last_home.items():
|
|
|
+ one_post(data=value, match_id=game_id, odds_code="last_home" + key, p_id=4, league_id=league_id, p_code='last_home', condition=key, game_code='lq', zq_odds=roll_lq)
|
|
|
|
|
|
- last_guest = last_numbers_dict['last_guest']
|
|
|
- if last_guest:
|
|
|
- for key, value in last_guest.items():
|
|
|
- one_post(data=value, match_id=game_id, odds_code="last_guest" + key, p_id=4, league_id=league_id,
|
|
|
- p_code='last_guest', condition=key, game_code='lq')
|
|
|
+ last_guest = last_numbers_dict['last_guest']
|
|
|
+ if last_guest:
|
|
|
+ for key, value in last_guest.items():
|
|
|
+ one_post(data=value, match_id=game_id, odds_code="last_guest" + key, p_id=4, league_id=league_id,
|
|
|
+ p_code='last_guest', condition=key, game_code='lq', zq_odds=roll_lq)
|
|
|
|
|
|
- if capots_dict:
|
|
|
- for key, value in capots_dict.items():
|
|
|
- one_post(data=value, match_id=game_id, odds_code=key, p_id=5, league_id=league_id,
|
|
|
- p_code='capot', condition=None, game_code='lq')
|
|
|
+ if capots_dict:
|
|
|
+ for key, value in capots_dict.items():
|
|
|
+ one_post(data=value, match_id=game_id, odds_code=key, p_id=5, league_id=league_id,
|
|
|
+ p_code='capot', condition=None, game_code='lq', zq_odds=roll_lq)
|
|
|
|
|
|
- if team_scores_dict:
|
|
|
- for key, value in team_scores_dict.items():
|
|
|
- one_post(data=value, match_id=game_id, odds_code=key, p_id=6, league_id=league_id,
|
|
|
- p_code='team_score', condition=team_scores_dict_rule[key], game_code='lq')
|
|
|
- lq_competition = {
|
|
|
- "game_code": "lq",
|
|
|
- "title": "competition",
|
|
|
- "data": {
|
|
|
- "home_team": team_home,
|
|
|
- "guest_team": team_guest,
|
|
|
- "lg_id": league_id,
|
|
|
- "status": 1,
|
|
|
- "match_id": game_id,
|
|
|
- "match_date": r_ctime,
|
|
|
- "match_time": None,
|
|
|
- "tag": number,
|
|
|
- "source": 'hg3535',
|
|
|
- "is_rollball": 1,
|
|
|
- "is_today": 0,
|
|
|
- "is_morningplate": 0,
|
|
|
- "is_stringscene": 0,
|
|
|
- "us_time": None
|
|
|
- }
|
|
|
+ if team_scores_dict:
|
|
|
+ for key, value in team_scores_dict.items():
|
|
|
+ two_post(data=value, match_id=game_id, odds_code=key, p_id=6, league_id=league_id,
|
|
|
+ p_code='team_score', condition=team_scores_dict_rule[key], game_code='lq', zq_odds=roll_lq)
|
|
|
+ lq_competition = {
|
|
|
+ "game_code": "lq",
|
|
|
+ "title": "competition",
|
|
|
+ "data": {
|
|
|
+ "home_team": team_home,
|
|
|
+ "guest_team": team_guest,
|
|
|
+ "lg_id": league_id,
|
|
|
+ "status": 1,
|
|
|
+ "match_id": game_id,
|
|
|
+ "match_date": r_ctime,
|
|
|
+ "match_time": None,
|
|
|
+ "tag": number,
|
|
|
+ "source": 'hg3535',
|
|
|
+ "is_rollball": 1,
|
|
|
+ "is_today": 0,
|
|
|
+ "is_morningplate": 0,
|
|
|
+ "is_stringscene": 0,
|
|
|
+ "us_time": None
|
|
|
}
|
|
|
- lq_match_result = {
|
|
|
- "game_code": "lq",
|
|
|
- "title": "match_result",
|
|
|
- "data": {
|
|
|
- "home_team": team_home,
|
|
|
- "guest_team": team_home,
|
|
|
- "lg_id": league_id,
|
|
|
- "home_rate": None,
|
|
|
- "guest_rate": None,
|
|
|
- "home_score": score_home,
|
|
|
- "guest_score": score_guest,
|
|
|
- "all_goal": None,
|
|
|
- "status": 1,
|
|
|
- "first_score": None,
|
|
|
- "last_score": None,
|
|
|
- "match_score": match_score,
|
|
|
- "match_winer": None,
|
|
|
- "match_time": time_game,
|
|
|
- "match_process": jijie,
|
|
|
- "tag": number,
|
|
|
- "match_id": game_id,
|
|
|
- "u_home_score": None,
|
|
|
- "u_guest_score": None,
|
|
|
- "p_code": None,
|
|
|
- "source": "hg3535"
|
|
|
- }
|
|
|
+ }
|
|
|
+ roll_lq.insert(0, lq_competition)
|
|
|
+ lq_match_result = {
|
|
|
+ "game_code": "lq",
|
|
|
+ "title": "match_result_record",
|
|
|
+ "data": {
|
|
|
+ "home_team": team_home,
|
|
|
+ "guest_team": team_home,
|
|
|
+ "lg_id": league_id,
|
|
|
+ "home_rate": None,
|
|
|
+ "guest_rate": None,
|
|
|
+ "home_score": score_home,
|
|
|
+ "guest_score": score_guest,
|
|
|
+ "all_goal": None,
|
|
|
+ "status": 1,
|
|
|
+ "first_score": None,
|
|
|
+ "last_score": None,
|
|
|
+ "match_score": match_score,
|
|
|
+ "match_winer": None,
|
|
|
+ "match_time": time_game,
|
|
|
+ "match_process": jijie,
|
|
|
+ "tag": number,
|
|
|
+ "match_id": game_id,
|
|
|
+ "u_home_score": None,
|
|
|
+ "u_guest_score": None,
|
|
|
+ "p_code": None,
|
|
|
+ "source": "hg3535"
|
|
|
}
|
|
|
- except:
|
|
|
- pass
|
|
|
+ }
|
|
|
+ roll_lq.append(lq_match_result)
|
|
|
+ r = requests.post(url, data={"data": json.dumps(roll_lq)})
|
|
|
+ # logger.warning(r.text)
|
|
|
+ print(r.text)
|
|
|
return item
|
|
|
|
|
|
|
|
|
# 滚球网球 插入
|
|
|
class Roll_Wangqiupipeline(object):
|
|
|
def process_item(self, item, spider):
|
|
|
+ url = 'http://admin.5gogo.com/setSports'
|
|
|
+ roll_wq = []
|
|
|
logger = logging.getLogger(__name__)
|
|
|
# 联赛id
|
|
|
league_id = item['league_id']
|
|
|
@@ -1386,27 +1414,33 @@ 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():
|
|
|
- one_post(data=value, match_id=game_id, odds_code=key, p_id=6, league_id=league_id,
|
|
|
- p_code='dishes', condition=concedes_dict_rule[key], game_code='wq')
|
|
|
+ sq_dict = item['sq_dict']
|
|
|
+ new_sq_dict = json.dumps(sq_dict)
|
|
|
+ # if concedes_dict:
|
|
|
+ # for key, value in concedes_dict.items():
|
|
|
+ # one_post(data=value, match_id=game_id, odds_code=key, p_id=6, league_id=league_id,
|
|
|
+ # p_code='dishes', condition=concedes_dict_rule[key], game_code='wq', zq_odds=roll_wq)
|
|
|
+ three_post(data=concedes_dict, match_id=game_id, p_id=6, league_id=league_id, p_code='dishes',
|
|
|
+ condition=concedes_dict_rule, game_code='wq', zq_odds=roll_wq)
|
|
|
if kemps_dict:
|
|
|
for key, value in kemps_dict.items():
|
|
|
one_post(data=value, match_id=game_id, odds_code=key, p_id=2, league_id=league_id,
|
|
|
- p_code='kemp', condition=None, game_code='wq')
|
|
|
- if bureaus_dict:
|
|
|
- for key, value in bureaus_dict.items():
|
|
|
- one_post(data=value, match_id=game_id, odds_code=key, p_id=3, league_id=league_id,
|
|
|
- p_code='bureau', condition=None, game_code='wq')
|
|
|
+ p_code='kemp', condition=None, game_code='wq', zq_odds=roll_wq)
|
|
|
+ # if bureaus_dict:
|
|
|
+ # for key, value in bureaus_dict.items():
|
|
|
+ # one_post(data=value, match_id=game_id, odds_code=key, p_id=3, league_id=league_id,
|
|
|
+ # p_code='bureau', condition=bureaus_dict_rule[key], game_code='wq', zq_odds=roll_wq)
|
|
|
+ three_post(data=bureaus_dict, match_id=game_id, p_id=3, league_id=league_id, p_code='bureau',
|
|
|
+ condition=bureaus_dict_rule, game_code='wq', zq_odds=roll_wq)
|
|
|
|
|
|
if total_number_dict:
|
|
|
for key, value in total_number_dict.items():
|
|
|
one_post(data=value, match_id=game_id, odds_code=key, p_id=3, league_id=league_id,
|
|
|
- p_code='total_number', condition=total_number_dict_rule[key], game_code='wq')
|
|
|
+ p_code='total_number', condition=total_number_dict_rule[key], game_code='wq', zq_odds=roll_wq)
|
|
|
if odd_evens_dict:
|
|
|
for key, value in odd_evens_dict.items():
|
|
|
one_post(data=value, match_id=game_id, odds_code=key, p_id=5, league_id=league_id,
|
|
|
- p_code='two_sides', condition=odd_evens_dict_rule[key], game_code='wq')
|
|
|
+ p_code='two_sides', condition=odd_evens_dict_rule[key], game_code='wq', zq_odds=roll_wq)
|
|
|
wq_competition = {
|
|
|
"game_code": "wq",
|
|
|
"title": "competition",
|
|
|
@@ -1427,17 +1461,30 @@ class Roll_Wangqiupipeline(object):
|
|
|
"us_time": None
|
|
|
}
|
|
|
}
|
|
|
+ roll_wq.append(wq_competition)
|
|
|
wq_match_result = {
|
|
|
"game_code": "wq",
|
|
|
- "title": "match_result",
|
|
|
+ "title": "match_result_record",
|
|
|
"data": {
|
|
|
- "home_team": team_home,
|
|
|
- "guest_team": team_home,
|
|
|
+ "update_time": '',
|
|
|
+ "home_player_let_plate": "",
|
|
|
+ "guest_player_let_plate": "",
|
|
|
+ "home_player_let_inning": "",
|
|
|
+ "guest_player_let_inning": "",
|
|
|
+ "all_inning": "",
|
|
|
+ "first_score_player": "",
|
|
|
+ "last_score_player": "",
|
|
|
+ "first_inning_score": "",
|
|
|
+ "second_inning_score": "",
|
|
|
+ "third_inning_score": "",
|
|
|
+ "match_winer_player": "",
|
|
|
+ "home_player_name": team_home,
|
|
|
+ "guest_player_name": team_home,
|
|
|
"lg_id": league_id,
|
|
|
"home_rate": None,
|
|
|
"guest_rate": None,
|
|
|
- "home_score": score_home,
|
|
|
- "guest_score": score_guest,
|
|
|
+ "home_player_score": score_home,
|
|
|
+ "guest_player_score": score_guest,
|
|
|
"all_goal": None,
|
|
|
"status": 1,
|
|
|
"first_score": None,
|
|
|
@@ -1451,15 +1498,27 @@ class Roll_Wangqiupipeline(object):
|
|
|
"u_home_score": None,
|
|
|
"u_guest_score": None,
|
|
|
"p_code": None,
|
|
|
- "source": "hg3535"
|
|
|
+ "source": "hg3535",
|
|
|
+ "result_mark": new_sq_dict
|
|
|
}
|
|
|
}
|
|
|
+ roll_wq.append(wq_match_result)
|
|
|
+ # print(json.dumps(roll_wq))
|
|
|
+ r = requests.post(url, data={"data": json.dumps(roll_wq)})
|
|
|
+ # logger.warning(r.text)
|
|
|
+ print(r.text)
|
|
|
+ print(json.dumps(roll_wq))
|
|
|
return item
|
|
|
+
|
|
|
+
|
|
|
# 滚球棒球 插入
|
|
|
class Roll_Banqiupipeline(object):
|
|
|
def process_item(self, item, spider):
|
|
|
# 使用twisted将mysql插入变成异步执行
|
|
|
+ logger = logging.getLogger(__name__)
|
|
|
# 联赛id
|
|
|
+ url = 'http://admin.5gogo.com/setSports'
|
|
|
+ roll_bq = []
|
|
|
league_id = item['league_id']
|
|
|
# 联赛名
|
|
|
league_name = item['league_name']
|
|
|
@@ -1511,40 +1570,29 @@ class Roll_Banqiupipeline(object):
|
|
|
# 总得分单双
|
|
|
odd_evens_dict = item['odd_evens_dict']
|
|
|
odd_evens_dict_rule = item['odd_evens_dict_rule']
|
|
|
-
|
|
|
- # 让球
|
|
|
- concede = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 1, 'p_code': "concede",
|
|
|
- 'source': "hg3535", 'expire_time': expire_time, 'sort': 0}
|
|
|
- # bqone_intodb(data1=concedes_dict, data2=concede, data3=concedes_dict_rule, cursor=self.cursor)
|
|
|
- # 总得分:大/小
|
|
|
- total_size = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 2, 'p_code': "total_size",
|
|
|
- 'source': "hg3535", 'expire_time': expire_time, 'sort': 0}
|
|
|
- # bqone_intodb(data1=total_size_dict, data2=total_size, data3=total_size_dict_rule, cursor=self.cursor)
|
|
|
-
|
|
|
- odd_even = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 3, 'p_code': "two_sides",
|
|
|
- 'source': "hg3535", 'expire_time': expire_time, 'sort': 0}
|
|
|
-
|
|
|
# 赛事失效时间
|
|
|
# n_time = out_time(ctime, 3.5)
|
|
|
+ new_match_score_dict = json.dumps(match_score_dict)
|
|
|
# 插入独赢
|
|
|
if capots_dict:
|
|
|
for key, value in capots_dict.items():
|
|
|
one_post(data=value, match_id=game_id, odds_code=key, p_id=2, league_id=league_id,
|
|
|
- p_code='capot', condition=None, game_code='bq')
|
|
|
+ p_code='capot', condition=None, game_code='bq', zq_odds=roll_bq)
|
|
|
#让球
|
|
|
if concedes_dict:
|
|
|
for key, value in concedes_dict.items():
|
|
|
one_post(data=value, match_id=game_id, odds_code=key, p_id=1, league_id=league_id,
|
|
|
- p_code='concede', condition=concedes_dict_rule[key], game_code='bq')
|
|
|
+ p_code='concede', condition=concedes_dict_rule[key], game_code='bq', zq_odds=roll_bq)
|
|
|
|
|
|
if total_size_dict:
|
|
|
for key, value in total_size_dict.items():
|
|
|
one_post(data=value, match_id=game_id, odds_code=key, p_id=1, league_id=league_id,
|
|
|
- p_code='total_size', condition=total_size_dict_rule[key], game_code='bq')
|
|
|
+ p_code='total_size', condition=total_size_dict_rule[key], game_code='bq', zq_odds=roll_bq)
|
|
|
if odd_evens_dict:
|
|
|
for key, value in odd_evens_dict.items():
|
|
|
one_post(data=value, match_id=game_id, odds_code=key, p_id=1, league_id=league_id,
|
|
|
- p_code='two_sides', condition=odd_evens_dict_rule[key], game_code='bq')
|
|
|
+ p_code='two_sides', condition=odd_evens_dict_rule[key], game_code='bq', zq_odds=roll_bq)
|
|
|
+ # print(r_ctime)
|
|
|
bq_competition = {
|
|
|
"game_code": "bq",
|
|
|
"title": "competition",
|
|
|
@@ -1554,7 +1602,7 @@ class Roll_Banqiupipeline(object):
|
|
|
"lg_id": league_id,
|
|
|
"status": 1,
|
|
|
"match_id": game_id,
|
|
|
- "match_date": None,
|
|
|
+ "match_date": r_ctime,
|
|
|
"match_time": None,
|
|
|
"tag": number,
|
|
|
"source": 'hg3535',
|
|
|
@@ -1565,9 +1613,10 @@ class Roll_Banqiupipeline(object):
|
|
|
"us_time": None
|
|
|
}
|
|
|
}
|
|
|
+ roll_bq.append(bq_competition)
|
|
|
bq_match_result = {
|
|
|
"game_code": "bq",
|
|
|
- "title": "match_result",
|
|
|
+ "title": "match_result_record",
|
|
|
"data": {
|
|
|
"home_team": team_home,
|
|
|
"guest_team": team_guest,
|
|
|
@@ -1576,23 +1625,27 @@ class Roll_Banqiupipeline(object):
|
|
|
"guest_rate": None,
|
|
|
"home_score": score_home,
|
|
|
"guest_score": score_guest,
|
|
|
- "all_goal": None,
|
|
|
+ # "all_goal": None,
|
|
|
"status": 1,
|
|
|
"first_score": None,
|
|
|
"last_score": None,
|
|
|
"match_score": None,
|
|
|
"match_winer": None,
|
|
|
- "match_time": r_ctime,
|
|
|
+ "match_time": None,
|
|
|
"match_process": jijie,
|
|
|
"tag": number,
|
|
|
"match_id": game_id,
|
|
|
- "u_home_score": None,
|
|
|
- "u_guest_score": None,
|
|
|
- "p_code": None,
|
|
|
+ # "u_home_score": None,
|
|
|
+ # "u_guest_score": None,
|
|
|
+ # "p_code": None,
|
|
|
"source": "hg3535",
|
|
|
- 'match_score_t': match_score_dict
|
|
|
+ "result_mark": new_match_score_dict
|
|
|
}
|
|
|
}
|
|
|
+ roll_bq.append(bq_match_result)
|
|
|
+ r = requests.post(url, data={"data": json.dumps(roll_bq)})
|
|
|
+ # logger.warning(r.text)
|
|
|
+ print(r.text)
|
|
|
return item
|
|
|
|
|
|
|