|
@@ -7,7 +7,7 @@ import time
|
|
|
import logging
|
|
import logging
|
|
|
from twisted.internet import defer, reactor
|
|
from twisted.internet import defer, reactor
|
|
|
from ..utils.helper import Helper
|
|
from ..utils.helper import Helper
|
|
|
-from ..settings import M_HOST, M_USER, M_PASSWORD, M_POST, M_DB, LEAGUE_URL, ODDS_URL, MATCH_URL, MATCH_RESULT
|
|
|
|
|
|
|
+from ..settings import M_HOST, M_USER, M_PASSWORD, M_POST, M_DB, POST_URL
|
|
|
|
|
|
|
|
|
|
|
|
|
class Roll_Banqiupipeline(object):
|
|
class Roll_Banqiupipeline(object):
|
|
@@ -78,7 +78,7 @@ class Roll_Banqiupipeline(object):
|
|
|
league_data = dict(zip(league_key, league_value))
|
|
league_data = dict(zip(league_key, league_value))
|
|
|
league_list.append(league_data)
|
|
league_list.append(league_data)
|
|
|
league_dict['data'] = league_list
|
|
league_dict['data'] = league_list
|
|
|
- res = Helper.async_post(LEAGUE_URL, league_dict)
|
|
|
|
|
|
|
+ res = Helper.async_post('{}/setLeague'.format(POST_URL), league_dict)
|
|
|
if res:
|
|
if res:
|
|
|
if res.get('status') == 1:
|
|
if res.get('status') == 1:
|
|
|
self.db.bq_league35.insert(league_data)
|
|
self.db.bq_league35.insert(league_data)
|
|
@@ -102,16 +102,14 @@ class Roll_Banqiupipeline(object):
|
|
|
match_data = dict(zip(match_key, match_value))
|
|
match_data = dict(zip(match_key, match_value))
|
|
|
match_list.append(match_data)
|
|
match_list.append(match_data)
|
|
|
match_dict['data'] = match_list
|
|
match_dict['data'] = match_list
|
|
|
- res = Helper.async_post(MATCH_URL, match_dict)
|
|
|
|
|
|
|
+ res = Helper.async_post('{}/setMatch'.format(POST_URL), match_dict)
|
|
|
if res:
|
|
if res:
|
|
|
if res.get('status') == 1:
|
|
if res.get('status') == 1:
|
|
|
self.db.bq_competition35.insert(match_data)
|
|
self.db.bq_competition35.insert(match_data)
|
|
|
else:
|
|
else:
|
|
|
logger.warning('棒球滚球赛事提交失败, {}, {}'.format(res, match_data))
|
|
logger.warning('棒球滚球赛事提交失败, {}, {}'.format(res, match_data))
|
|
|
- # logger.warning(match_data)
|
|
|
|
|
else:
|
|
else:
|
|
|
logger.warning('棒球滚球赛事,接口异常,提交失败, {}, {}'.format(res, match_data))
|
|
logger.warning('棒球滚球赛事,接口异常,提交失败, {}, {}'.format(res, match_data))
|
|
|
- # logger.warning(match_data)
|
|
|
|
|
else:
|
|
else:
|
|
|
logger.info("棒球赛事已存在,棒球赛事状态时间未改变,不做修改")
|
|
logger.info("棒球赛事已存在,棒球赛事状态时间未改变,不做修改")
|
|
|
"""赔率"""
|
|
"""赔率"""
|
|
@@ -184,17 +182,14 @@ class Roll_Banqiupipeline(object):
|
|
|
0, cdate, pt, match_identity]
|
|
0, cdate, pt, match_identity]
|
|
|
odds_dict = dict(zip(odds_key, odds_value))
|
|
odds_dict = dict(zip(odds_key, odds_value))
|
|
|
if data_list:
|
|
if data_list:
|
|
|
- res = Helper.async_post(ODDS_URL, odds_dict)
|
|
|
|
|
|
|
+ res = Helper.async_post('{}/setOdds'.format(POST_URL), odds_dict)
|
|
|
if res:
|
|
if res:
|
|
|
if res.get('status') == 1:
|
|
if res.get('status') == 1:
|
|
|
logger.info('棒球滚球赔率提交成功, {}'.format(res))
|
|
logger.info('棒球滚球赔率提交成功, {}'.format(res))
|
|
|
- # logger.info(odds_dict)
|
|
|
|
|
else:
|
|
else:
|
|
|
logger.warning('棒球滚球赔率提交失败, {}, {}'.format(res, odds_dict))
|
|
logger.warning('棒球滚球赔率提交失败, {}, {}'.format(res, odds_dict))
|
|
|
- # logger.warning(odds_dict)
|
|
|
|
|
else:
|
|
else:
|
|
|
logger.warning('棒球滚球赔率接口异常,提交失败, {}, {}'.format(res, odds_dict))
|
|
logger.warning('棒球滚球赔率接口异常,提交失败, {}, {}'.format(res, odds_dict))
|
|
|
- # logger.warning(odds_dict)
|
|
|
|
|
else:
|
|
else:
|
|
|
logger.info('棒球滚球详细赔率列表为空, 不提交')
|
|
logger.info('棒球滚球详细赔率列表为空, 不提交')
|
|
|
"""赛事结果"""
|
|
"""赛事结果"""
|
|
@@ -217,18 +212,15 @@ class Roll_Banqiupipeline(object):
|
|
|
}
|
|
}
|
|
|
if da_list:
|
|
if da_list:
|
|
|
try:
|
|
try:
|
|
|
- res = Helper.async_post(MATCH_RESULT, r_data_dict)
|
|
|
|
|
|
|
+ res = Helper.async_post('{}/setMatchResult'.format(POST_URL), r_data_dict)
|
|
|
if res.get('status') == 1:
|
|
if res.get('status') == 1:
|
|
|
logger.info('棒球滚球结果记录提交成功, {}'.format(res))
|
|
logger.info('棒球滚球结果记录提交成功, {}'.format(res))
|
|
|
self.db.bq_match_result35.insert(bq_rball)
|
|
self.db.bq_match_result35.insert(bq_rball)
|
|
|
- # logger.info(r_data_dict)
|
|
|
|
|
else:
|
|
else:
|
|
|
logger.warning('棒球滚球结果记录提交失败, {}, {}'.format(res, r_data_dict))
|
|
logger.warning('棒球滚球结果记录提交失败, {}, {}'.format(res, r_data_dict))
|
|
|
- # logger.warning(r_data_dict)
|
|
|
|
|
|
|
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
|
- logger.warning("滚球接口数据异常, 提交失败, {}".format(e))
|
|
|
|
|
- # logging.warning(r_data_dict)
|
|
|
|
|
|
|
+ logger.warning("滚球接口数据异常, 提交失败, {}, {}".format(e, r_data_dict))
|
|
|
else:
|
|
else:
|
|
|
logger.info('棒球滚球结果记录为空, 不提交')
|
|
logger.info('棒球滚球结果记录为空, 不提交')
|
|
|
reactor.callFromThread(out.callback, item)
|
|
reactor.callFromThread(out.callback, item)
|