|
|
@@ -33,6 +33,19 @@ class Roll_Zuqiupipeline(object):
|
|
|
# 现在时间,时间戳
|
|
|
utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
|
|
|
cdate = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
|
+ try:
|
|
|
+ data_game = item['data_game'].split("/")
|
|
|
+ month = str(data_game[1].strip())
|
|
|
+ day = str(data_game[0]).strip()
|
|
|
+ except Exception as e:
|
|
|
+ logger.warning(e)
|
|
|
+ data_game = item['data_game'].split(" ")
|
|
|
+ months = str(data_game[1].strip())
|
|
|
+ month_dict = {'Jan': '01', 'Feb': '02', 'Mar': '03', 'Apr': '04', 'May': '05', 'Jun': '06', 'Jul': '07',
|
|
|
+ 'Aug': '08', 'Sep': '09', 'Oct': '10', 'Nov': '11', 'Dec': '12'}
|
|
|
+ month = month_dict[months]
|
|
|
+ day = str(data_game[0]).strip()
|
|
|
+ us_date = '{}-{}-{}'.format(datetime.datetime.now().year, month, day)
|
|
|
match_date = cdate.split(' ')[0]
|
|
|
match_time = cdate.split(' ')[1]
|
|
|
# 比赛id
|
|
|
@@ -54,9 +67,9 @@ class Roll_Zuqiupipeline(object):
|
|
|
match_score = "{}:{}".format(score_home, score_guest)
|
|
|
last_time = '{}-12-31 23:59:59'.format(datetime.datetime.now().year)
|
|
|
league_list = []
|
|
|
- uuid = Helper.genearte_uuid(league_name + 'hg3535')
|
|
|
+ uuid = Helper.genearte_uuid(league_name)
|
|
|
horn_team = item['horn_team']
|
|
|
- if self.db.zq_league35.find({'league_id': league_id}).count() < 1:
|
|
|
+ if self.db.zq_league35.find({'uuid': uuid}).count() < 1:
|
|
|
league_dict = {"game_code": "zq", "title": "league", "source": "hg3535"}
|
|
|
league_key = ["name_chinese", "kind", "match_mode", "if_stop", "last_time", "lg_id", "source", "uuid"]
|
|
|
league_value = [league_name, "1", "1", "0", last_time, league_id, "hg3535", uuid]
|
|
|
@@ -77,15 +90,15 @@ class Roll_Zuqiupipeline(object):
|
|
|
logger.warning(league_dict)
|
|
|
else:
|
|
|
logger.info('足球滚球联赛已存在, 不存在')
|
|
|
-
|
|
|
- if self.db.zq_competition35.find({"match_id": match_id, 'is_rollball': 1}).count() < 1:
|
|
|
+ match_identity = Helper.genearte_uuid(team_home + team_guest + us_date)
|
|
|
+ if self.db.zq_competition35.find({"match_identity": match_identity, 'is_rollball': 1}).count() < 1:
|
|
|
match_list = []
|
|
|
match_dict = {"game_code": "zq", "title": "match", "source": "hg3535"}
|
|
|
match_kay = ["home_team", "guest_team", "lg_id", "status", "match_id", "match_date", "match_time",
|
|
|
"tag", "source", "is_rollball", "is_morningplate", "is_stringscene", "us_time", "uuid",
|
|
|
- "half_match_id", "is_today", "is_horn"]
|
|
|
+ "half_match_id", "is_today", "is_horn", 'match_identity']
|
|
|
match_value = [team_home, team_guest, league_id, 1, match_id, match_date, match_time, number,
|
|
|
- "hg3535", 1, 0, 0, utime, uuid, 0, 0, 0]
|
|
|
+ "hg3535", 1, 0, 0, utime, uuid, 0, 0, 0, match_identity]
|
|
|
match_data = dict(zip(match_kay, match_value))
|
|
|
match_list.append(match_data)
|
|
|
match_dict['data'] = match_list
|
|
|
@@ -526,9 +539,9 @@ class Roll_Zuqiupipeline(object):
|
|
|
data_list.append(horn_oe_data)
|
|
|
|
|
|
odds_key = ["game_code", "title", "match_id", "lg_id", "data", "source", "odds_only", "tag", "uuid",
|
|
|
- "is_stringscene", "utime", "pt"]
|
|
|
+ "is_stringscene", "utime", "pt", 'match_identity']
|
|
|
odds_value = ["zq", "odds", match_id, league_id, data_list, "hg3535", odds_onlys, number, uuid,
|
|
|
- 0, utime, pt]
|
|
|
+ 0, utime, pt, match_identity]
|
|
|
odds_dict = dict(zip(odds_key, odds_value))
|
|
|
if data_list:
|
|
|
res = Helper.async_post(ODDS_URL, odds_dict)
|
|
|
@@ -550,7 +563,7 @@ class Roll_Zuqiupipeline(object):
|
|
|
"guest_rate": 0, "home_score": score_home,
|
|
|
"guest_score": score_guest, "all_goal": all_goal, "status": 1,
|
|
|
"first_score": "", "last_score": "", "match_score": match_score, "uuid": uuid,
|
|
|
- "match_winer": "", "match_time": time_game,
|
|
|
+ "match_winer": "", "match_time": time_game, 'match_identity': match_identity,
|
|
|
"match_process": half_way, "tag": number,
|
|
|
"match_id": match_id, "p_code": ""}
|
|
|
data_list.append(zq_rball)
|
|
|
@@ -576,125 +589,126 @@ class Roll_Zuqiupipeline(object):
|
|
|
logger.warning(r_data_dict)
|
|
|
except Exception as e:
|
|
|
logger.warning('滚球数据接口异常,提交失败, {}'.format(e))
|
|
|
- # 角球分割处理--------------------------------------------------------------------------------------------------
|
|
|
- if horn_team:
|
|
|
- team_home = horn_team['horn_home']
|
|
|
- team_guest = horn_team['horn_guest']
|
|
|
- horn_scoreh = horn_team['horn_scoreh']
|
|
|
- horn_scoreg = horn_team['horn_scoreg']
|
|
|
- all_goal = int(horn_scoreh) + int(horn_scoreg)
|
|
|
- match_id = horn_team['horn_id']
|
|
|
- # half_way = item['half_way']
|
|
|
- match_score = "{}:{}".format(horn_scoreh, horn_scoreg)
|
|
|
- if self.db.zq_competition35.find({"match_id": match_id, 'is_rollball': 1}).count() < 1:
|
|
|
- match_list = []
|
|
|
- match_dict = {"game_code": "zq", "title": "match", "source": "hg3535"}
|
|
|
- match_kay = ["home_team", "guest_team", "lg_id", "status", "match_id", "match_date", "match_time",
|
|
|
- "tag", "source", "is_rollball", "is_morningplate", "is_stringscene", "us_time", "uuid",
|
|
|
- "half_match_id", "is_today", "is_horn"]
|
|
|
- match_value = [team_home, team_guest, league_id, 1, match_id, match_date, match_time, number,
|
|
|
- "hg3535", 1, 0, 0, utime, uuid, 0, 0, 1]
|
|
|
- match_data = dict(zip(match_kay, match_value))
|
|
|
- match_list.append(match_data)
|
|
|
- match_dict['data'] = match_list
|
|
|
- res = Helper.async_post(MATCH_URL, match_dict)
|
|
|
- if res:
|
|
|
- if res.get('status') == 1:
|
|
|
- self.db.zq_competition35.insert(match_data)
|
|
|
- logger.info('足球滚球角球, 赛事提交成功, {}'.format(res))
|
|
|
- logger.info(match_data)
|
|
|
- else:
|
|
|
- logger.warning('足球滚球赛事, 角球提交失败, {}'.format(res))
|
|
|
- logger.warning(match_data)
|
|
|
- else:
|
|
|
- logger.warning('足球滚球赛事接口异常, 角球赛事提交失败, {}'.format(res))
|
|
|
- logger.warning(match_data)
|
|
|
- else:
|
|
|
- logger.info('足球滚球赛事已存在, 不提交')
|
|
|
- data_list = []
|
|
|
- odds_onlys = []
|
|
|
- p_code = 'CB'
|
|
|
- horn_ou_dict = item['horn_ou_dict']
|
|
|
- horn_ou_dict_rule = item['horn_ou_dict_rule']
|
|
|
- horn_oe_dict = item['horn_oe_dict']
|
|
|
- horn_oe_dict_rule = item['horn_oe_dict_rule']
|
|
|
- if horn_ou_dict:
|
|
|
- for key, value in horn_ou_dict.items():
|
|
|
- hash_str = p_code + key + '0' + horn_ou_dict_rule[key] + str(value) + "hg3535" + str(match_id)
|
|
|
- sole_str = p_code + key + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
- sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
- horn_ou_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
|
|
|
- "condition", "odds_only", "sole", "source", "type", "team"]
|
|
|
- horn_ou_value = [match_id, league_id, key, "0", 0, p_code, value, horn_ou_dict_rule[key],
|
|
|
- odds_only, sole, "hg3535", "0", ""]
|
|
|
- horn_ou_data = dict(zip(horn_ou_key, horn_ou_value))
|
|
|
- data_list.append(horn_ou_data)
|
|
|
-
|
|
|
- if horn_oe_dict:
|
|
|
- for key, value in horn_oe_dict.items():
|
|
|
- hash_str = p_code + key + '0' + horn_oe_dict_rule[key] + str(value) + "hg3535" + str(match_id)
|
|
|
- sole_str = p_code + key + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
- sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
- horn_oe_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
|
|
|
- "condition", "odds_only", "sole", "source", "type", "team"]
|
|
|
- horn_oe_value = [match_id, league_id, key, "0", 0, p_code, value, horn_oe_dict_rule[key],
|
|
|
- odds_only, sole, "hg3535", "0", ""]
|
|
|
- horn_oe_data = dict(zip(horn_oe_key, horn_oe_value))
|
|
|
- data_list.append(horn_oe_data)
|
|
|
-
|
|
|
- odds_key = ["game_code", "title", "match_id", "lg_id", "data", "source", "odds_only", "tag", "uuid",
|
|
|
- "is_stringscene", "utime", "pt"]
|
|
|
- odds_value = ["zq", "odds", match_id, league_id, data_list, "hg3535", odds_onlys, number, uuid,
|
|
|
- 0, utime, pt]
|
|
|
- odds_dict = dict(zip(odds_key, odds_value))
|
|
|
- if data_list:
|
|
|
- res = Helper.async_post(ODDS_URL, odds_dict)
|
|
|
- if res:
|
|
|
- if res.get('status') == 1:
|
|
|
- logger.info('足球滚球, 角球详细赔率提交成功, {}'.format(res))
|
|
|
- logger.info(odds_dict)
|
|
|
- else:
|
|
|
- logger.warning('足球滚球, 角球详细赔率提交失败, {}'.format(res))
|
|
|
- logger.warning(odds_dict)
|
|
|
- else:
|
|
|
- logger.warning('足球滚球, 角球详细赔率接口异常,提交失败, {}'.format(res))
|
|
|
- logger.warning(odds_dict)
|
|
|
- else:
|
|
|
- logger.info('足球滚球, 角球详细赔率列表为空')
|
|
|
- data_list = []
|
|
|
- zq_rball = {"home_team": team_home, "guest_team": team_guest,
|
|
|
- "lg_id": league_id, "home_rate": 0,
|
|
|
- "guest_rate": 0, "home_score": horn_scoreh,
|
|
|
- "guest_score": horn_scoreg, "all_goal": all_goal, "status": 1,
|
|
|
- "first_score": "", "last_score": "", "match_score": match_score, "uuid": uuid,
|
|
|
- "match_winer": "", "match_time": time_game,
|
|
|
- "match_process": half_way, "tag": number,
|
|
|
- "match_id": match_id, "p_code": ""}
|
|
|
- data_list.append(zq_rball)
|
|
|
- r_data_dict = {
|
|
|
- "game_code": "zq",
|
|
|
- "title": "match_result_r",
|
|
|
- "source": "hg3535",
|
|
|
- "data": data_list
|
|
|
- }
|
|
|
- if data_list:
|
|
|
- try:
|
|
|
- res = Helper.async_post(MATCH_RESULT, r_data_dict)
|
|
|
- if res:
|
|
|
- if res.get('status') == 1:
|
|
|
- logger.info('足球滚球, 角球结果记录提交成功, {}'.format(res))
|
|
|
- self.db.zq_match_result35.insert(zq_rball)
|
|
|
- logger.info(r_data_dict)
|
|
|
- else:
|
|
|
- logger.warning('足球滚球, 角球结果记录提交失败, {}'.format(res))
|
|
|
- logger.warning(r_data_dict)
|
|
|
- else:
|
|
|
- logger.warning('足球滚球, 角球结果记录接口异常,提交失败, {}'.format(res))
|
|
|
- logger.warning(r_data_dict)
|
|
|
- except Exception as e:
|
|
|
- logger.warning('滚球数据接口异常, 角球结果提交失败, {}'.format(e))
|
|
|
+ # # 角球分割处理--------------------------------------------------------------------------------------------------
|
|
|
+ # if horn_team:
|
|
|
+ # team_home = horn_team['horn_home']
|
|
|
+ # team_guest = horn_team['horn_guest']
|
|
|
+ # horn_scoreh = horn_team['horn_scoreh']
|
|
|
+ # horn_scoreg = horn_team['horn_scoreg']
|
|
|
+ # all_goal = int(horn_scoreh) + int(horn_scoreg)
|
|
|
+ # match_id = horn_team['horn_id']
|
|
|
+ # # half_way = item['half_way']
|
|
|
+ # match_score = "{}:{}".format(horn_scoreh, horn_scoreg)
|
|
|
+ # match_identity = Helper.genearte_uuid(team_home + team_guest + us_date)
|
|
|
+ # if self.db.zq_competition35.find({"match_identity": match_identity, 'is_rollball': 1}).count() < 1:
|
|
|
+ # match_list = []
|
|
|
+ # match_dict = {"game_code": "zq", "title": "match", "source": "hg3535"}
|
|
|
+ # match_kay = ["home_team", "guest_team", "lg_id", "status", "match_id", "match_date", "match_time",
|
|
|
+ # "tag", "source", "is_rollball", "is_morningplate", "is_stringscene", "us_time", "uuid",
|
|
|
+ # "half_match_id", "is_today", "is_horn", 'match_identity']
|
|
|
+ # match_value = [team_home, team_guest, league_id, 1, match_id, match_date, match_time, number,
|
|
|
+ # "hg3535", 1, 0, 0, utime, uuid, 0, 0, 1, match_identity]
|
|
|
+ # match_data = dict(zip(match_kay, match_value))
|
|
|
+ # match_list.append(match_data)
|
|
|
+ # match_dict['data'] = match_list
|
|
|
+ # res = Helper.async_post(MATCH_URL, match_dict)
|
|
|
+ # if res:
|
|
|
+ # if res.get('status') == 1:
|
|
|
+ # self.db.zq_competition35.insert(match_data)
|
|
|
+ # logger.info('足球滚球角球, 赛事提交成功, {}'.format(res))
|
|
|
+ # # logger.info(match_data)
|
|
|
+ # else:
|
|
|
+ # logger.warning('足球滚球赛事, 角球提交失败, {}'.format(res))
|
|
|
+ # # logger.warning(match_data)
|
|
|
+ # else:
|
|
|
+ # logger.warning('足球滚球赛事接口异常, 角球赛事提交失败, {}'.format(res))
|
|
|
+ # # logger.warning(match_data)
|
|
|
+ # else:
|
|
|
+ # logger.info('足球滚球赛事已存在, 不提交')
|
|
|
+ # data_list = []
|
|
|
+ # odds_onlys = []
|
|
|
+ # p_code = 'CB'
|
|
|
+ # horn_ou_dict = item['horn_ou_dict']
|
|
|
+ # horn_ou_dict_rule = item['horn_ou_dict_rule']
|
|
|
+ # horn_oe_dict = item['horn_oe_dict']
|
|
|
+ # horn_oe_dict_rule = item['horn_oe_dict_rule']
|
|
|
+ # if horn_ou_dict:
|
|
|
+ # for key, value in horn_ou_dict.items():
|
|
|
+ # hash_str = p_code + key + '0' + horn_ou_dict_rule[key] + str(value) + "hg3535" + str(match_id)
|
|
|
+ # sole_str = p_code + key + '0' + str(match_id) + "hg3535"
|
|
|
+ # odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ # sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
+ # horn_ou_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
|
|
|
+ # "condition", "odds_only", "sole", "source", "type", "team"]
|
|
|
+ # horn_ou_value = [match_id, league_id, key, "0", 0, p_code, value, horn_ou_dict_rule[key],
|
|
|
+ # odds_only, sole, "hg3535", "0", ""]
|
|
|
+ # horn_ou_data = dict(zip(horn_ou_key, horn_ou_value))
|
|
|
+ # data_list.append(horn_ou_data)
|
|
|
+ #
|
|
|
+ # if horn_oe_dict:
|
|
|
+ # for key, value in horn_oe_dict.items():
|
|
|
+ # hash_str = p_code + key + '0' + horn_oe_dict_rule[key] + str(value) + "hg3535" + str(match_id)
|
|
|
+ # sole_str = p_code + key + '0' + str(match_id) + "hg3535"
|
|
|
+ # odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ # sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
+ # horn_oe_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
|
|
|
+ # "condition", "odds_only", "sole", "source", "type", "team"]
|
|
|
+ # horn_oe_value = [match_id, league_id, key, "0", 0, p_code, value, horn_oe_dict_rule[key],
|
|
|
+ # odds_only, sole, "hg3535", "0", ""]
|
|
|
+ # horn_oe_data = dict(zip(horn_oe_key, horn_oe_value))
|
|
|
+ # data_list.append(horn_oe_data)
|
|
|
+ #
|
|
|
+ # odds_key = ["game_code", "title", "match_id", "lg_id", "data", "source", "odds_only", "tag", "uuid",
|
|
|
+ # "is_stringscene", "utime", "pt", 'match_identity']
|
|
|
+ # odds_value = ["zq", "odds", match_id, league_id, data_list, "hg3535", odds_onlys, number, uuid,
|
|
|
+ # 0, utime, pt, match_identity]
|
|
|
+ # odds_dict = dict(zip(odds_key, odds_value))
|
|
|
+ # if data_list:
|
|
|
+ # res = Helper.async_post(ODDS_URL, odds_dict)
|
|
|
+ # if res:
|
|
|
+ # if res.get('status') == 1:
|
|
|
+ # logger.info('足球滚球, 角球详细赔率提交成功, {}'.format(res))
|
|
|
+ # # logger.info(odds_dict)
|
|
|
+ # else:
|
|
|
+ # logger.warning('足球滚球, 角球详细赔率提交失败, {}'.format(res))
|
|
|
+ # # logger.warning(odds_dict)
|
|
|
+ # else:
|
|
|
+ # logger.warning('足球滚球, 角球详细赔率接口异常,提交失败, {}'.format(res))
|
|
|
+ # # logger.warning(odds_dict)
|
|
|
+ # else:
|
|
|
+ # logger.info('足球滚球, 角球详细赔率列表为空')
|
|
|
+ # data_list = []
|
|
|
+ # zq_rball = {"home_team": team_home, "guest_team": team_guest,
|
|
|
+ # "lg_id": league_id, "home_rate": 0,
|
|
|
+ # "guest_rate": 0, "home_score": horn_scoreh,
|
|
|
+ # "guest_score": horn_scoreg, "all_goal": all_goal, "status": 1,
|
|
|
+ # "first_score": "", "last_score": "", "match_score": match_score, "uuid": uuid,
|
|
|
+ # "match_winer": "", "match_time": time_game,
|
|
|
+ # "match_process": half_way, "tag": number,
|
|
|
+ # "match_id": match_id, "p_code": "", 'match_identity': match_identity}
|
|
|
+ # data_list.append(zq_rball)
|
|
|
+ # r_data_dict = {
|
|
|
+ # "game_code": "zq",
|
|
|
+ # "title": "match_result_r",
|
|
|
+ # "source": "hg3535",
|
|
|
+ # "data": data_list
|
|
|
+ # }
|
|
|
+ # if data_list:
|
|
|
+ # try:
|
|
|
+ # res = Helper.async_post(MATCH_RESULT, r_data_dict)
|
|
|
+ # if res:
|
|
|
+ # if res.get('status') == 1:
|
|
|
+ # logger.info('足球滚球, 角球结果记录提交成功, {}'.format(res))
|
|
|
+ # self.db.zq_match_result35.insert(zq_rball)
|
|
|
+ # # logger.info(r_data_dict)
|
|
|
+ # else:
|
|
|
+ # logger.warning('足球滚球, 角球结果记录提交失败, {}'.format(res))
|
|
|
+ # # logger.warning(r_data_dict)
|
|
|
+ # else:
|
|
|
+ # logger.warning('足球滚球, 角球结果记录接口异常,提交失败, {}'.format(res))
|
|
|
+ # # logger.warning(r_data_dict)
|
|
|
+ # except Exception as e:
|
|
|
+ # logger.warning('滚球数据接口异常, 角球结果提交失败, {}'.format(e))
|
|
|
reactor.callFromThread(out.callback, item)
|
|
|
|
|
|
|