|
|
@@ -1,65 +1,33 @@
|
|
|
-import asyncio
|
|
|
import datetime
|
|
|
-import json
|
|
|
-import aiohttp
|
|
|
import time
|
|
|
import logging
|
|
|
|
|
|
-from motor.motor_asyncio import AsyncIOMotorClient
|
|
|
+import pymongo
|
|
|
+from twisted.internet import defer, reactor
|
|
|
from .ball_func import fuhao
|
|
|
from ..utils.helper import Helper
|
|
|
from .ball_func import new_time
|
|
|
-# from concurrent.futures import ThreadPoolExecutor
|
|
|
-# from requests_futures.sessions import FuturesSession
|
|
|
|
|
|
+from ..settings import M_HOST, M_USER, M_PASSWORD, M_POST, M_DB, LEAGUE_URL, ODDS_URL, MATCH_URL, MATCH_RESULT
|
|
|
|
|
|
-class Zuqiupipeline(object):
|
|
|
|
|
|
+class Zuqiupipeline(object):
|
|
|
def open_spider(self, spider):
|
|
|
- self.connection = AsyncIOMotorClient("mongodb://{}:{}@{}:{}/database?authSource={}".format('kaiyou', 'kaiyou', '192.168.2.200', 27017, 'kaiyou'))
|
|
|
- self.session = aiohttp.ClientSession()
|
|
|
- self.url = 'http://admin.5gogo.com'
|
|
|
+ # self.connection = AsyncIOMotorClient("mongodb://{}:{}@{}:{}/database?authSource={}".format('kaiyou', 'kaiyou', '192.168.2.200', 27017, 'kaiyou'))
|
|
|
+ # session = aiohttp.ClientSession()
|
|
|
+ self.mongo = pymongo.MongoClient(host=M_HOST, username=M_USER, password=M_PASSWORD, port=M_POST)
|
|
|
+ self.db = self.mongo[M_DB]
|
|
|
|
|
|
+ @defer.inlineCallbacks
|
|
|
def process_item(self, item, spider):
|
|
|
- loop = asyncio.get_event_loop()
|
|
|
- tasks = [
|
|
|
- asyncio.ensure_future(self._league(item)),
|
|
|
- asyncio.ensure_future(self._match(item)),
|
|
|
- asyncio.ensure_future(self._odds(item))
|
|
|
- ]
|
|
|
- loop.run_until_complete(asyncio.wait(tasks))
|
|
|
+ out = defer.Deferred()
|
|
|
+ reactor.callInThread(self._do_calculation, item, out)
|
|
|
+ yield out
|
|
|
+ defer.returnValue(item)
|
|
|
|
|
|
- async def _league(self, item):
|
|
|
- logger = logging.getLogger(__name__)
|
|
|
- # 联赛id
|
|
|
- league_id = item['league_id']
|
|
|
- # 联赛name
|
|
|
- league_name = item['league_name']
|
|
|
- # 联赛接口写入
|
|
|
- last_time = '2019-12-31 23:59:59'
|
|
|
- uuid = Helper.genearte_MD5(league_name + 'hg3535')
|
|
|
- _zq_league = await self.connection.get_database('kaiyou').zq_league35.find_one({'uuid': uuid})
|
|
|
- if not _zq_league:
|
|
|
- league_dict = {"game_code": "zq", "title": "league", "source": "hg3535"}
|
|
|
- league_list = []
|
|
|
- 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]
|
|
|
- league_data = dict(zip(league_key, league_value))
|
|
|
- league_list.append(league_data)
|
|
|
- league_dict['data'] = league_list
|
|
|
- response_data = await self.session.post(self.url + '/setLeague', data={"data": json.dumps(league_dict),
|
|
|
- "token": 'JlUo1415650051585d481566c10c9'})
|
|
|
- if response_data.status == 200:
|
|
|
- await self.connection.get_database('kaiyou').zq_league35.insert_one(league_data)
|
|
|
- logger.info(league_dict)
|
|
|
- else:
|
|
|
- logger.warning(response_data.status)
|
|
|
- logger.warning(league_dict)
|
|
|
- else:
|
|
|
- logger.info('足球联赛已存在')
|
|
|
-
|
|
|
- async def _match(self, item):
|
|
|
+ def _do_calculation(self, item, out):
|
|
|
logger = logging.getLogger(__name__)
|
|
|
+ # 比赛日期
|
|
|
try:
|
|
|
data_game = item['data_game'].split("/")
|
|
|
month = str(data_game[1].strip())
|
|
|
@@ -72,11 +40,13 @@ class Zuqiupipeline(object):
|
|
|
'Aug': '08', 'Sep': '09', 'Oct': '10', 'Nov': '11', 'Dec': '12'}
|
|
|
month = month_dict[months]
|
|
|
day = str(data_game[0])
|
|
|
+
|
|
|
# 比赛时间
|
|
|
time_game = str(item['time_game'])
|
|
|
# 比赛时间,时间戳
|
|
|
- # datetime.datetime.now().year
|
|
|
us_time = str(datetime.datetime.now().year) + "-" + month + "-" + day + " " + time_game + ":00"
|
|
|
+ # 现在时间,时间戳
|
|
|
+ utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
|
|
|
# 比赛id
|
|
|
match_id = item['game_id']
|
|
|
# 联赛id
|
|
|
@@ -90,10 +60,22 @@ class Zuqiupipeline(object):
|
|
|
# number
|
|
|
tag_number = item['number']
|
|
|
pt = item['pt']
|
|
|
- # corner_ball = item['corner_ball']
|
|
|
+ corner_ball = item['corner_ball']
|
|
|
match_date, match_time, time3 = new_time(us_time)
|
|
|
# 联赛接口写入
|
|
|
- uuid = Helper.genearte_MD5(league_name + 'hg3535')
|
|
|
+ last_time = '{}-12-31 23:59:59'.format(datetime.datetime.now().year)
|
|
|
+ league_list = []
|
|
|
+ uuid = Helper.genearte_uuid(league_name + 'hg3535')
|
|
|
+ if self.db.zq_league35.find({'lg_id': league_id}).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]
|
|
|
+ league_data = dict(zip(league_key, league_value))
|
|
|
+ league_list.append(league_data)
|
|
|
+ league_dict['data'] = league_list
|
|
|
+ response_data = Helper.async_post(LEAGUE_URL, league_dict)
|
|
|
+ if "成功" in response_data:
|
|
|
+ self.db.zq_league35.insert(league_list)
|
|
|
pt_dict = {'1': 'is_today', '2': 'is_morningplate', '3': 'is_stringscene', '4': 'is_rollball'}
|
|
|
pt_status = pt_dict[pt]
|
|
|
if pt == '3':
|
|
|
@@ -111,10 +93,9 @@ class Zuqiupipeline(object):
|
|
|
is_rollball = 0
|
|
|
is_morningplate = 0
|
|
|
is_stringscene = 0
|
|
|
- _zq_match = await self.connection.get_database('kaiyou').zq_competition35.find_one({'match_id': match_id, pt_status: 1})
|
|
|
|
|
|
- if not _zq_match:
|
|
|
- match_list = []
|
|
|
+ match_list = []
|
|
|
+ if self.db.zq_competition35.find({'match_id': match_id, pt_status: 1}).count() < 1:
|
|
|
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",
|
|
|
@@ -124,81 +105,21 @@ class Zuqiupipeline(object):
|
|
|
match_data = dict(zip(match_kay, match_value))
|
|
|
match_list.append(match_data)
|
|
|
match_dict['data'] = match_list
|
|
|
- response_data = await self.session.post(self.url + '/setMatch',
|
|
|
- data={"data": json.dumps(match_data), "token": 'JlUo1415650051585d481566c10c9'})
|
|
|
- if response_data.status == 200:
|
|
|
- await self.connection.get_database('kaiyou').zq_competition35.insert_one(match_data)
|
|
|
+ response_data = Helper.async_post(MATCH_URL, match_dict)
|
|
|
+ if "成功" in response_data:
|
|
|
+ self.db.zq_competition35.insert(match_data)
|
|
|
else:
|
|
|
- logger.warning(response_data.status)
|
|
|
+ logger.warning('足球赛事表提交失败, {}'.format(response_data))
|
|
|
logger.warning(match_dict)
|
|
|
else:
|
|
|
- logger.info('足球赛事已存在')
|
|
|
-
|
|
|
- async def _odds(self, item):
|
|
|
- logger = logging.getLogger(__name__)
|
|
|
- # 比赛日期
|
|
|
- try:
|
|
|
- data_game = item['data_game'].split("/")
|
|
|
- # print(data_game)
|
|
|
- month = str(data_game[1].strip())
|
|
|
- day = str(data_game[0])
|
|
|
- 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])
|
|
|
+ logger.info('足球赛事已存在,不提交')
|
|
|
|
|
|
- # 比赛时间
|
|
|
- time_game = str(item['time_game'])
|
|
|
- # 比赛时间,时间戳
|
|
|
- # datetime.datetime.now().year
|
|
|
- us_time = str(datetime.datetime.now().year) + "-" + month + "-" + day + " " + time_game + ":00"
|
|
|
- # r_ctime = str(datetime.datetime.now().year) + "-" + month + "-" + day
|
|
|
- # 现在时间,时间戳
|
|
|
- utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
|
|
|
- # expire_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time() + 60))
|
|
|
- # 比赛id
|
|
|
- match_id = item['game_id']
|
|
|
- # 联赛id
|
|
|
- league_id = item['league_id']
|
|
|
- # 联赛name
|
|
|
- league_name = item['league_name']
|
|
|
- # # 主队
|
|
|
- team_home = item['team_home']
|
|
|
- # 客队
|
|
|
- team_guest = item['team_guest']
|
|
|
- # number
|
|
|
- tag_number = item['number']
|
|
|
- pt = item['pt']
|
|
|
- corner_ball = item['corner_ball']
|
|
|
- match_date, match_time, time3 = new_time(us_time)
|
|
|
- # 联赛接口写入
|
|
|
- # last_time = '2019-12-31 23:59:59'
|
|
|
- uuid = Helper.genearte_MD5(league_name + 'hg3535')
|
|
|
- # 赔率
|
|
|
- _zq_odds = await self.connection.get_database('kaiyou').zq_zodds35.find_one({'match_id': match_id})
|
|
|
- if _zq_odds:
|
|
|
- _uid_list = _zq_odds['uid']
|
|
|
- pass
|
|
|
- else:
|
|
|
- _uid_list = []
|
|
|
- # try:
|
|
|
- # result = self.db.hg3535_zq_odds.find_one({'match_id': match_id, 'pt': pt})
|
|
|
- # uuid_list = result['odds_only']
|
|
|
- # except:
|
|
|
- # uuid_list = []
|
|
|
- # result = ''
|
|
|
- # p_code, p_id = get_pcode(corner_ball, 'goal_size')
|
|
|
- # 构建唯一索引
|
|
|
p_code = "GS"
|
|
|
half_size_guest = item["half_size_guest"]
|
|
|
half_size_guest_rule = item["half_size_guest_rule"]
|
|
|
half_size_home = item["half_size_home"]
|
|
|
half_size_home_rule = item["half_size_home_rule"]
|
|
|
- zuqiu = item['zuqiu']
|
|
|
+ # zuqiu = item['zuqiu']
|
|
|
data_list = []
|
|
|
odds_onlys = []
|
|
|
# half_size_guest
|
|
|
@@ -206,8 +127,8 @@ class Zuqiupipeline(object):
|
|
|
hash_str = p_code + "gss_h" + str(index) + str(half_size_guest_rule[index]) + str(
|
|
|
value) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + "gss_h" + str(index) + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
half_size_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
@@ -215,16 +136,14 @@ class Zuqiupipeline(object):
|
|
|
half_size_guest_value = [match_id, league_id, "gss_h", "0", index, p_code, value, condition,
|
|
|
odds_only, sole, "hg3535", "0", ""]
|
|
|
half_size_guest_data = dict(zip(half_size_guest_key, half_size_guest_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(half_size_guest_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(half_size_guest_data)
|
|
|
# half_size_home
|
|
|
for index, value in enumerate(half_size_home):
|
|
|
hash_str = p_code + "gsb_h" + str(index) + str(half_size_home_rule[index]) + str(
|
|
|
value) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + "gsb_h" + str(index) + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
half_size_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
@@ -232,10 +151,7 @@ class Zuqiupipeline(object):
|
|
|
half_size_home_value = [match_id, league_id, "gsb_h", "0", index, p_code, value, condition,
|
|
|
odds_only, sole, "hg3535", "0", ""]
|
|
|
half_size_home_data = dict(zip(half_size_home_key, half_size_home_value))
|
|
|
- # if uid_num < 1:
|
|
|
- if odds_only not in _uid_list:
|
|
|
- _uid_list.append(odds_only)
|
|
|
- data_list.append(half_size_home_data)
|
|
|
+ data_list.append(half_size_home_data)
|
|
|
|
|
|
# 全场场大小
|
|
|
size_guest = item["size_guest"]
|
|
|
@@ -247,8 +163,8 @@ class Zuqiupipeline(object):
|
|
|
hash_str = p_code + "gsb" + str(index) + str(size_home_rule[index]) + str(value) + "hg3535" + str(
|
|
|
match_id)
|
|
|
sole_str = p_code + "gsb" + str(index) + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
size_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
@@ -256,16 +172,14 @@ class Zuqiupipeline(object):
|
|
|
size_home_value = [match_id, league_id, "gsb", "0", index, p_code, value, condition, odds_only,
|
|
|
sole, "hg3535", "0", ""]
|
|
|
size_home_data = dict(zip(size_home_key, size_home_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(size_home_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(size_home_data)
|
|
|
# size_guest
|
|
|
for index, value in enumerate(size_guest):
|
|
|
hash_str = p_code + "gss" + str(index) + str(size_guest_rule[index]) + str(value) + "hg3535" + str(
|
|
|
match_id)
|
|
|
sole_str = p_code + "gss" + str(index) + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
size_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
@@ -273,11 +187,8 @@ class Zuqiupipeline(object):
|
|
|
size_guest_value = [match_id, league_id, "gss", "0", index, p_code, value, condition, odds_only,
|
|
|
sole, "hg3535", "0", ""]
|
|
|
size_home_data = dict(zip(size_guest_key, size_guest_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(size_home_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(size_home_data)
|
|
|
|
|
|
- # p_code, p_id = get_pcode(corner_ball, 'concede')
|
|
|
p_code = 'CO'
|
|
|
half_concede_home_rule = item["half_concede_home_rule"]
|
|
|
half_concede_home = item["half_concede_home"]
|
|
|
@@ -288,8 +199,8 @@ class Zuqiupipeline(object):
|
|
|
hash_str = p_code + "cog_h" + str(index) + str(half_concede_guest_rule[index]) + str(
|
|
|
value) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + "cog_h" + str(index) + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
half_concede_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
@@ -297,17 +208,15 @@ class Zuqiupipeline(object):
|
|
|
half_concede_guest_value = [match_id, league_id, "cog_h", "0", index, p_code, value, condition,
|
|
|
odds_only, sole, "hg3535", "0", ""]
|
|
|
half_concede_guest_data = dict(zip(half_concede_guest_key, half_concede_guest_value))
|
|
|
- # if uid_num < 1:
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(half_concede_guest_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(half_concede_guest_data)
|
|
|
+
|
|
|
# half_concede_home
|
|
|
for index, value in enumerate(half_concede_home):
|
|
|
hash_str = p_code + "coh_h" + str(index) + str(half_concede_home_rule[index]) + str(
|
|
|
value) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + "coh_h" + str(index) + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
half_concede_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
@@ -315,9 +224,7 @@ class Zuqiupipeline(object):
|
|
|
half_concede_home_value = [match_id, league_id, "coh_h", "0", index, p_code, value, condition,
|
|
|
odds_only, sole, "hg3535", "0", ""]
|
|
|
half_concede_home_data = dict(zip(half_concede_home_key, half_concede_home_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(half_concede_home_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(half_concede_home_data)
|
|
|
|
|
|
concede_guest = item["concede_guest"]
|
|
|
concede_guest_rule = item["concede_guest_rule"]
|
|
|
@@ -328,8 +235,8 @@ class Zuqiupipeline(object):
|
|
|
hash_str = p_code + "cog" + str(index) + str(concede_guest_rule[index]) + str(
|
|
|
value) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + "cog" + str(index) + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
concede_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
@@ -337,16 +244,14 @@ class Zuqiupipeline(object):
|
|
|
concede_guest_value = [match_id, league_id, "cog", "0", index, p_code, value, condition,
|
|
|
odds_only, sole, "hg3535", "0", ""]
|
|
|
concede_guest_data = dict(zip(concede_guest_key, concede_guest_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(concede_guest_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(concede_guest_data)
|
|
|
# concede_home
|
|
|
for index, value in enumerate(concede_home):
|
|
|
hash_str = p_code + "coh" + str(index) + str(concede_home_rule[index]) + str(
|
|
|
value) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + "coh" + str(index) + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
concede_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
@@ -354,12 +259,9 @@ class Zuqiupipeline(object):
|
|
|
concede_home_value = [match_id, league_id, "coh", "0", index, p_code, value, condition, odds_only,
|
|
|
sole, "hg3535", "0", ""]
|
|
|
concede_guest_data = dict(zip(concede_home_key, concede_home_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(concede_guest_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(concede_guest_data)
|
|
|
|
|
|
# 独赢----------------------------------------------------------------------------------------------------------
|
|
|
- # p_code, p_id = get_pcode(corner_ball, 'capot')
|
|
|
p_code = 'C'
|
|
|
half_capot_home = item["half_capot_home"]
|
|
|
half_capot_guest = item["half_capot_guest"]
|
|
|
@@ -371,92 +273,80 @@ class Zuqiupipeline(object):
|
|
|
# half_capot_home
|
|
|
hash_str = p_code + "ch_h" + '0' + '1' + str(half_capot_home) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + "ch_h" + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
half_capot_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
half_capot_home_value = [match_id, league_id, "ch_h", "0", 0, p_code, half_capot_home, '1',
|
|
|
odds_only, sole, "hg3535", "0", ""]
|
|
|
half_capot_homet_data = dict(zip(half_capot_home_key, half_capot_home_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(half_capot_homet_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(half_capot_homet_data)
|
|
|
|
|
|
# half_capot_guest
|
|
|
hash_str = p_code + "cg_h" + '0' + '2' + str(half_capot_guest) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + "cg_h" + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
half_capot_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
half_capot_guest_value = [match_id, league_id, "cg_h", "0", 0, p_code, half_capot_guest, '2',
|
|
|
odds_only, sole, "hg3535", "0", ""]
|
|
|
half_capot_guest_data = dict(zip(half_capot_guest_key, half_capot_guest_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(half_capot_guest_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(half_capot_guest_data)
|
|
|
|
|
|
# half_capot_dogfall
|
|
|
hash_str = p_code + "cd_h" + '0' + 'X' + str(half_capot_dogfall) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + "cd_h" + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
half_capot_dogfall_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
half_capot_dogfall_value = [match_id, league_id, "cd_h", "0", 0, p_code, half_capot_dogfall, 'X',
|
|
|
odds_only, sole, "hg3535", "0", ""]
|
|
|
half_capot_dogfall_data = dict(zip(half_capot_dogfall_key, half_capot_dogfall_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(half_capot_dogfall_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(half_capot_dogfall_data)
|
|
|
|
|
|
# capot_dogfall
|
|
|
hash_str = p_code + "cd" + '0' + 'X' + str(capot_dogfall) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + "cd" + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
capot_dogfall_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
capot_dogfall_value = [match_id, league_id, "cd", "0", 0, p_code, capot_dogfall, 'X', odds_only,
|
|
|
sole, "hg3535", "0", ""]
|
|
|
capot_dogfall_data = dict(zip(capot_dogfall_key, capot_dogfall_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(capot_dogfall_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(capot_dogfall_data)
|
|
|
|
|
|
# capot_home
|
|
|
hash_str = p_code + "ch" + '0' + '1' + str(capot_home) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + "ch" + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
capot_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
capot_home_value = [match_id, league_id, "ch", "0", 0, p_code, capot_home, '1',
|
|
|
odds_only, sole, "hg3535", "0", ""]
|
|
|
capot_homet_data = dict(zip(capot_home_key, capot_home_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(capot_homet_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(capot_homet_data)
|
|
|
|
|
|
# capot_guest
|
|
|
hash_str = p_code + "cg" + '0' + '2' + str(capot_guest) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + "cg" + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
capot_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
capot_guest_value = [match_id, league_id, "cg", "0", 0, p_code, capot_home, '2',
|
|
|
odds_only, sole, "hg3535", "0", ""]
|
|
|
capot_guest_data = dict(zip(capot_guest_key, capot_guest_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(capot_guest_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(capot_guest_data)
|
|
|
|
|
|
# 入球数单双-----------------------------------------------------------------------------------------------------
|
|
|
# p_code, p_id = get_pcode(corner_ball, 'two_sides')
|
|
|
@@ -469,89 +359,77 @@ class Zuqiupipeline(object):
|
|
|
# odd_even_odd
|
|
|
hash_str = p_code + "tss" + '0' + '单' + str(odd_even_odd) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + "tss" + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
single_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
single_value = [match_id, league_id, "tss", "0", 0, p_code, odd_even_odd, '单',
|
|
|
odds_only, sole, "hg3535", "0", ""]
|
|
|
single_data = dict(zip(single_key, single_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(single_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(single_data)
|
|
|
|
|
|
# odd_even_even
|
|
|
hash_str = p_code + "tsd" + '0' + '双' + str(odd_even_even) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + "tsd" + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
double_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
double_value = [match_id, league_id, "tsd", "0", 0, p_code, odd_even_even, '双',
|
|
|
odds_only, sole, "hg3535", "0", ""]
|
|
|
double_data = dict(zip(double_key, double_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(double_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(double_data)
|
|
|
|
|
|
# half_odd_even_even
|
|
|
hash_str = p_code + "tsd_h" + '0' + '双' + str(half_odd_even_even) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + "tsd_h" + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
half_double_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
half_double_value = [match_id, league_id, "tsd_h", "0", 0, p_code, half_odd_even_even, '双',
|
|
|
odds_only, sole, "hg3535", "0", ""]
|
|
|
half_double_data = dict(zip(half_double_key, half_double_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(half_double_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(half_double_data)
|
|
|
|
|
|
# half_odd_even_odd
|
|
|
hash_str = p_code + "tss_h" + '0' + '单' + str(half_odd_even_odd) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + "tss_h" + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
half_single_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
half_single_value = [match_id, league_id, "tss_h", "0", 0, p_code, half_odd_even_odd, '单', odds_only,
|
|
|
sole, "hg3535", "0", ""]
|
|
|
half_single_data = dict(zip(half_single_key, half_single_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(half_single_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(half_single_data)
|
|
|
|
|
|
# 总入球数 ------------------------------------------------------------------------------------------------------
|
|
|
- # p_code, p_id = get_pcode(corner_ball, 'total_goal')
|
|
|
p_code = 'TG'
|
|
|
total_goals = item['total_goal']
|
|
|
- total_dict = {'tg0': '0-1', 'tg1': '2-3', 'tg2': '4-6', 'tg3': '7或以上', 'tg0_h': '0', "tg1_h": '1',
|
|
|
+ total_dict = {'tg0': '0-1', 'tg1': '2-3', 'tg2': '4-6','tg3': '7或以上', 'tg0_h': '0', "tg1_h": '1',
|
|
|
"tg2_h": '2', "tg3_h": '3或以上'}
|
|
|
# 全场入球数 单双
|
|
|
# 上半场入球数 单双
|
|
|
for key, value in total_goals.items():
|
|
|
hash_str = p_code + key + '0' + total_dict[key] + str(value) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + key + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
total_goals_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
total_goals_value = [match_id, league_id, key, "0", 0, p_code, value, total_dict[key], odds_only,
|
|
|
sole, "hg3535", "0", ""]
|
|
|
total_goals_data = dict(zip(total_goals_key, total_goals_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(total_goals_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(total_goals_data)
|
|
|
|
|
|
# 全场半场 ------------------------------------------------------------------------------------------------------
|
|
|
half_fulls = item['half_full']
|
|
|
- # p_code, p_id = get_pcode(corner_ball, 'half_full')
|
|
|
p_code = 'HF'
|
|
|
full_dict = {"hfhh": "主主", "hfhd": "主和", "hfhg": "主客", "hfdh": "和主",
|
|
|
"hfdd": "和和", "hfdg": "和客", "hfgh": "客主", "hfgd": "客和", "hfgg": "客客"}
|
|
|
@@ -559,21 +437,18 @@ class Zuqiupipeline(object):
|
|
|
for key, value in half_fulls.items():
|
|
|
hash_str = p_code + key + '0' + full_dict[key] + str(value) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + key + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
half_fulls_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- "odds_only", "sole", "source", "type", "team"]
|
|
|
+ "odds_only", "sole", "source", "type", "team"]
|
|
|
half_fulls_value = [match_id, league_id, key, "0", 0, p_code, value, full_dict[key], odds_only,
|
|
|
- sole, "hg3535", "0", ""]
|
|
|
+ sole, "hg3535", "0", ""]
|
|
|
half_fulls_data = dict(zip(half_fulls_key, half_fulls_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(half_fulls_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(half_fulls_data)
|
|
|
|
|
|
- # 波胆------------------------------------------------------------------------------------------------------------------
|
|
|
+ # 波胆-----------------------------------------------------------------------------------------------------------
|
|
|
bodan_datas = item['bodan_data']
|
|
|
- # p_code, p_id = get_pcode(corner_ball, 'bodan')
|
|
|
p_code = 'B'
|
|
|
bodan_dict = {"b10": "1-0", "b20": "2-0", "b21": "2-1", "b30": "3-0", "b31": "3-1", "b32": "3-2",
|
|
|
"b40": "4-0", "b41": "4-1", "b42": "4-2", "b43": "4-3", "b01": "0-1", "b02": "0-2",
|
|
|
@@ -587,17 +462,15 @@ class Zuqiupipeline(object):
|
|
|
for key, value in bodan_datas.items():
|
|
|
hash_str = p_code + key + '0' + bodan_dict[key] + str(value) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + key + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
bodan_dict_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
"odds_only", "sole", "source", "type", "team"]
|
|
|
bodan_dict_value = [match_id, league_id, key, "0", 0, p_code, value, bodan_dict[key], odds_only,
|
|
|
sole, "hg3535", "0", ""]
|
|
|
bodan_dict_data = dict(zip(bodan_dict_key, bodan_dict_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(bodan_dict_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(bodan_dict_data)
|
|
|
|
|
|
# 最先进球/最后进球 ----------------------------------------------------------------------------------------------
|
|
|
first_last_balls = item['first_last_ball']
|
|
|
@@ -608,21 +481,16 @@ class Zuqiupipeline(object):
|
|
|
for key, value in first_last_balls.items():
|
|
|
hash_str = p_code + key + '0' + first_last_dict[key] + str(value) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + key + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
- first_last_balls_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
|
|
|
- "condition",
|
|
|
- "odds_only", "sole", "source", "type", "team"]
|
|
|
- first_last_balls_value = [match_id, league_id, key, "0", 0, p_code, value, first_last_dict[key],
|
|
|
- odds_only,
|
|
|
- sole, "hg3535", "0", ""]
|
|
|
+ first_last_balls_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
+ "odds_only", "sole", "source", "type", "team"]
|
|
|
+ first_last_balls_value = [match_id, league_id, key, "0", 0, p_code, value, first_last_dict[key], odds_only,
|
|
|
+ sole, "hg3535", "0", ""]
|
|
|
first_last_balls_data = dict(zip(first_last_balls_key, first_last_balls_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(first_last_balls_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(first_last_balls_data)
|
|
|
|
|
|
- # p_code, p_id = get_pcode(corner_ball, 'tema_ball')
|
|
|
# 球队得分大小
|
|
|
p_code = 'TB'
|
|
|
# 全场
|
|
|
@@ -635,667 +503,42 @@ class Zuqiupipeline(object):
|
|
|
for key, value in full_dicts.items():
|
|
|
hash_str = p_code + key + '0' + full_dict_rules[key] + str(value) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + key + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
full_dict_rules_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
|
|
|
- "condition", "odds_only", "sole", "source", "type", "team"]
|
|
|
+ "condition", "odds_only", "sole", "source", "type", "team"]
|
|
|
full_dict_rules_value = [match_id, league_id, key, "0", 0, p_code, value, full_dict_rules[key],
|
|
|
- odds_only, sole, "hg3535", "0", ""]
|
|
|
+ odds_only,sole, "hg3535", "0", ""]
|
|
|
full_dict_rules_data = dict(zip(full_dict_rules_key, full_dict_rules_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(full_dict_rules_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(full_dict_rules_data)
|
|
|
#
|
|
|
if half_dicts:
|
|
|
for key, value in half_dicts.items():
|
|
|
hash_str = p_code + key + '0' + half_dict_rules[key] + str(value) + "hg3535" + str(match_id)
|
|
|
sole_str = p_code + key + '0' + str(match_id) + "hg3535"
|
|
|
- odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- sole = Helper.genearte_MD5(sole_str)
|
|
|
+ odds_only = Helper.genearte_MD5(hash_str, pt)
|
|
|
+ sole = Helper.genearte_MD5(sole_str, pt)
|
|
|
odds_onlys.append(odds_only)
|
|
|
half_dicts_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
|
|
|
- "condition", "odds_only", "sole", "source", "type", "team"]
|
|
|
+ "condition","odds_only", "sole", "source", "type", "team"]
|
|
|
half_dicts_value = [match_id, league_id, key, "0", 0, p_code, value, half_dict_rules[key],
|
|
|
- odds_only, sole, "hg3535", "0", ""]
|
|
|
+ odds_only, sole, "hg3535", "0", ""]
|
|
|
half_dicts_data = dict(zip(half_dicts_key, half_dicts_value))
|
|
|
- if odds_only not in _uid_list:
|
|
|
- data_list.append(half_dicts_data)
|
|
|
- _uid_list.append(odds_only)
|
|
|
+ data_list.append(half_dicts_data)
|
|
|
if pt == '3':
|
|
|
ris_stringscene = 1
|
|
|
else:
|
|
|
ris_stringscene = 0
|
|
|
- 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, tag_number, uuid,
|
|
|
- ris_stringscene, utime, pt]
|
|
|
+ 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, tag_number, uuid, ris_stringscene, utime, pt]
|
|
|
odds_dict = dict(zip(odds_key, odds_value))
|
|
|
if data_list:
|
|
|
- # print(odds_dict)
|
|
|
- # response_data = Helper.async_post(self.url + '/setOdds', odds_dict)
|
|
|
- response_data = await self.session.post(self.url + '/setOdds',
|
|
|
- data={"data": json.dumps(odds_dict), "token": 'JlUo1415650051585d481566c10c9'})
|
|
|
- if response_data.status == 200:
|
|
|
- # self.db.hg3535_zq_odds.update({'match_id': match_id, 'pt': pt}, {
|
|
|
- # '$set': {"data": data_list, "odds_only": odds_onlys, "utime": utime}}, upsert=True)
|
|
|
- if _zq_odds:
|
|
|
- pass
|
|
|
- await self.connection.get_database('kaiyou').zq_odds35.update_one({'match_id': match_id}, {'$set': {'uid': odds_onlys}})
|
|
|
- else:
|
|
|
- await self.connection.get_database('kaiyou').zq_odds35.insert_one(
|
|
|
- {'match_id': match_id, 'uid': odds_onlys})
|
|
|
+ response_data = Helper.async_post(ODDS_URL, odds_dict)
|
|
|
+ if "成功" in response_data:
|
|
|
+ logger.info('足球详细赔率提交成功, {}'.format(response_data))
|
|
|
+ logger.info(odds_dict)
|
|
|
else:
|
|
|
- logger.info('赔率提交失败')
|
|
|
-
|
|
|
- # async def match_all(self, item, spider):
|
|
|
- # zq_odds = []
|
|
|
- # # url = 'http://192.168.2.200:9093'
|
|
|
- # url = 'http://admin.5gogo.com'
|
|
|
- # # zq_competitions = []
|
|
|
- # logger = logging.getLogger(__name__)
|
|
|
- # # 比赛日期
|
|
|
- # try:
|
|
|
- # data_game = item['data_game'].split("/")
|
|
|
- # # print(data_game)
|
|
|
- # month = str(data_game[1].strip())
|
|
|
- # day = str(data_game[0])
|
|
|
- # 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])
|
|
|
- #
|
|
|
- # # 比赛时间
|
|
|
- # time_game = str(item['time_game'])
|
|
|
- # # 比赛时间,时间戳
|
|
|
- # # datetime.datetime.now().year
|
|
|
- # us_time = str(datetime.datetime.now().year) + "-" + month + "-" + day + " " + time_game + ":00"
|
|
|
- # r_ctime = str(datetime.datetime.now().year) + "-" + month + "-" + day
|
|
|
- # # 现在时间,时间戳
|
|
|
- # utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
|
|
|
- # expire_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time() + 60))
|
|
|
- # # 比赛id
|
|
|
- # match_id = item['game_id']
|
|
|
- # # 联赛id
|
|
|
- # league_id = item['league_id']
|
|
|
- # # 联赛name
|
|
|
- # league_name = item['league_name']
|
|
|
- # # # 主队
|
|
|
- # team_home = item['team_home']
|
|
|
- # # 客队
|
|
|
- # team_guest = item['team_guest']
|
|
|
- # # number
|
|
|
- # tag_number = item['number']
|
|
|
- # pt = item['pt']
|
|
|
- # corner_ball = item['corner_ball']
|
|
|
- # match_date, match_time, time3 = new_time(us_time)
|
|
|
- # # 联赛接口写入
|
|
|
- # last_time = '2019-12-31 23:59:59'
|
|
|
- # league_dict = {"game_code": "zq", "title": "league", "source": "hg3535"}
|
|
|
- # league_list = []
|
|
|
- # uuid = Helper.genearte_MD5(league_name + '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]
|
|
|
- # league_data = dict(zip(league_key, league_value))
|
|
|
- # league_list.append(league_data)
|
|
|
- # league_dict['data'] = league_list
|
|
|
- # if self.db.hg3535_zq_league.find({'lg_id': league_id}).count() < 1:
|
|
|
- # response_data = Helper.async_post(url + '/setLeague', league_dict)
|
|
|
- # print(response_data)
|
|
|
- # self.db.hg3535_zq_league.insert(league_list)
|
|
|
- # competition = self.db.hg3535_zq_competition.find_one({"match_id": str(match_id)})
|
|
|
- # match_list = []
|
|
|
- # if competition:
|
|
|
- # print('赛事已存在,修改赛事四状态')
|
|
|
- # is_morningplate = competition['is_morningplate']
|
|
|
- # is_rollball = competition['is_rollball']
|
|
|
- # is_stringscene = competition['is_stringscene']
|
|
|
- # is_today = competition['is_today']
|
|
|
- # lmtime = competition['match_time']
|
|
|
- # if pt == '3':
|
|
|
- # if is_stringscene != 1 or lmtime != match_time:
|
|
|
- # 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"]
|
|
|
- # match_value = [team_home, team_guest, league_id, 0, match_id, match_date, match_time, tag_number,
|
|
|
- # "hg3535",is_rollball, is_morningplate, 1, us_time, uuid, 0, is_today]
|
|
|
- # match_data = dict(zip(match_kay, match_value))
|
|
|
- # match_list.append(match_data)
|
|
|
- # match_dict['data'] = match_list
|
|
|
- # response_data = Helper.async_post(url + '/setMatch', match_dict)
|
|
|
- # print(response_data)
|
|
|
- # self.db.hg3535_zq_competition.update({'match_id': str(match_id)}, {"$set": {"is_stringscene": 1, "match_time": match_time}}, upsert=True)
|
|
|
- # if pt == '2':
|
|
|
- # if is_morningplate != 1 or lmtime != match_time:
|
|
|
- # 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"]
|
|
|
- # match_value = [team_home, team_guest, league_id, 0, match_id, match_date, match_time, tag_number,
|
|
|
- # "hg3535",is_rollball, 1, is_stringscene, us_time, uuid, 0, is_today]
|
|
|
- # match_data = dict(zip(match_kay, match_value))
|
|
|
- # match_list.append(match_data)
|
|
|
- # match_dict['data'] = match_list
|
|
|
- # response_data = Helper.async_post(url + '/setMatch', match_dict)
|
|
|
- # print(response_data)
|
|
|
- # self.db.hg3535_zq_competition.update({'match_id': str(match_id)}, {"$set": {"is_morningplate": 1, "match_time": match_time}}, upsert=True)
|
|
|
- # if pt == '1':
|
|
|
- # if is_today != 1 or lmtime != match_time:
|
|
|
- # 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"]
|
|
|
- # match_value = [team_home, team_guest, league_id, 0, match_id, match_date, match_time, tag_number,
|
|
|
- # "hg3535",is_rollball, is_morningplate, is_stringscene, us_time, uuid, 0, 1]
|
|
|
- # match_data = dict(zip(match_kay, match_value))
|
|
|
- # match_list.append(match_data)
|
|
|
- # match_dict['data'] = match_list
|
|
|
- # response_data = Helper.async_post(url + '/setMatch', match_dict)
|
|
|
- # print(response_data)
|
|
|
- # self.db.hg3535_zq_competition.update({'match_id': str(match_id)}, {"$set": {"is_today": 1, "match_time": match_time}}, upsert=True)
|
|
|
- #
|
|
|
- # else:
|
|
|
- # print("赛事已存在,赛事状态时间为改变,不做修改")
|
|
|
- # else:
|
|
|
- # if pt == '3':
|
|
|
- # is_rollball = 0
|
|
|
- # is_today = 0
|
|
|
- # is_morningplate = 0
|
|
|
- # is_stringscene = 1
|
|
|
- # elif pt == '2':
|
|
|
- # is_rollball = 0
|
|
|
- # is_today = 0
|
|
|
- # is_morningplate = 1
|
|
|
- # is_stringscene = 0
|
|
|
- # else:
|
|
|
- # is_today = 1
|
|
|
- # is_rollball = 0
|
|
|
- # is_morningplate = 0
|
|
|
- # is_stringscene = 0
|
|
|
- # # 赛事接口写入
|
|
|
- # 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"]
|
|
|
- # match_value = [team_home, team_guest, league_id, 0, match_id, match_date, match_time, tag_number, "hg3535",
|
|
|
- # is_rollball, is_morningplate, is_stringscene, us_time, uuid, 0, is_today]
|
|
|
- # match_data = dict(zip(match_kay, match_value))
|
|
|
- # match_list.append(match_data)
|
|
|
- # match_dict['data'] = match_list
|
|
|
- # response_data = Helper.async_post(url + '/setMatch', match_dict)
|
|
|
- # self.db.hg3535_zq_competition.insert(match_list)
|
|
|
- # print(response_data)
|
|
|
- # # 赔率
|
|
|
- # try:
|
|
|
- # result = self.db.hg3535_zq_odds.find_one({'match_id': match_id, 'pt': pt})
|
|
|
- # uuid_list = result['odds_only']
|
|
|
- # except:
|
|
|
- # uuid_list = []
|
|
|
- # result = ''
|
|
|
- # # p_code, p_id = get_pcode(corner_ball, 'goal_size')
|
|
|
- # # 构建唯一索引
|
|
|
- # p_code = "GS"
|
|
|
- # half_size_guest = item["half_size_guest"]
|
|
|
- # half_size_guest_rule = item["half_size_guest_rule"]
|
|
|
- # half_size_home = item["half_size_home"]
|
|
|
- # half_size_home_rule = item["half_size_home_rule"]
|
|
|
- # zuqiu = item['zuqiu']
|
|
|
- # data_list = []
|
|
|
- # odds_onlys = []
|
|
|
- # # half_size_guest
|
|
|
- # for index, value in enumerate(half_size_guest):
|
|
|
- # hash_str = p_code + "gss_h" + str(index) + str(half_size_guest_rule[index]) + str(
|
|
|
- # value) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + "gss_h" + str(index) + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # half_size_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # condition = fuhao(half_size_guest_rule[index])
|
|
|
- # half_size_guest_value = [match_id, league_id, "gss_h", "0", index, p_code, value, condition,
|
|
|
- # odds_only, sole, "hg3535", "0", ""]
|
|
|
- # half_size_guest_data = dict(zip(half_size_guest_key, half_size_guest_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(half_size_guest_data)
|
|
|
- # # half_size_home
|
|
|
- # for index, value in enumerate(half_size_home):
|
|
|
- # hash_str = p_code + "gsb_h" + str(index) + str(half_size_home_rule[index]) + str(
|
|
|
- # value) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + "gsb_h" + str(index) + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # half_size_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # condition = fuhao(half_size_home_rule[index])
|
|
|
- # half_size_home_value = [match_id, league_id, "gsb_h", "0", index, p_code, value, condition,
|
|
|
- # odds_only, sole, "hg3535", "0", ""]
|
|
|
- # half_size_home_data = dict(zip(half_size_home_key, half_size_home_value))
|
|
|
- # # if uid_num < 1:
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(half_size_home_data)
|
|
|
- #
|
|
|
- # # 全场场大小
|
|
|
- # size_guest = item["size_guest"]
|
|
|
- # size_guest_rule = item["size_guest_rule"]
|
|
|
- # size_home = item["size_home"]
|
|
|
- # size_home_rule = item["size_home_rule"]
|
|
|
- # # size_home
|
|
|
- # for index, value in enumerate(size_home):
|
|
|
- # hash_str = p_code + "gsb" + str(index) + str(size_home_rule[index]) + str(value) + "hg3535" + str(
|
|
|
- # match_id)
|
|
|
- # sole_str = p_code + "gsb" + str(index) + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # size_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # condition = fuhao(size_home_rule[index])
|
|
|
- # size_home_value = [match_id, league_id, "gsb", "0", index, p_code, value, condition, odds_only,
|
|
|
- # sole, "hg3535", "0", ""]
|
|
|
- # size_home_data = dict(zip(size_home_key, size_home_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(size_home_data)
|
|
|
- # # size_guest
|
|
|
- # for index, value in enumerate(size_guest):
|
|
|
- # hash_str = p_code + "gss" + str(index) + str(size_guest_rule[index]) + str(value) + "hg3535" + str(
|
|
|
- # match_id)
|
|
|
- # sole_str = p_code + "gss" + str(index) + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # size_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # condition = fuhao(size_guest_rule[index])
|
|
|
- # size_guest_value = [match_id, league_id, "gss", "0", index, p_code, value, condition, odds_only,
|
|
|
- # sole, "hg3535", "0", ""]
|
|
|
- # size_home_data = dict(zip(size_guest_key, size_guest_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(size_home_data)
|
|
|
- #
|
|
|
- # # p_code, p_id = get_pcode(corner_ball, 'concede')
|
|
|
- # p_code = 'CO'
|
|
|
- # half_concede_home_rule = item["half_concede_home_rule"]
|
|
|
- # half_concede_home = item["half_concede_home"]
|
|
|
- # half_concede_guest_rule = item["half_concede_guest_rule"]
|
|
|
- # half_concede_guest = item["half_concede_guest"]
|
|
|
- # # half_concede_home
|
|
|
- # for index, value in enumerate(half_concede_guest):
|
|
|
- # hash_str = p_code + "cog_h" + str(index) + str(half_concede_guest_rule[index]) + str(
|
|
|
- # value) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + "cog_h" + str(index) + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # half_concede_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # condition = fuhao(half_concede_guest_rule[index])
|
|
|
- # half_concede_guest_value = [match_id, league_id, "cog_h", "0", index, p_code, value, condition,
|
|
|
- # odds_only, sole, "hg3535", "0", ""]
|
|
|
- # half_concede_guest_data = dict(zip(half_concede_guest_key, half_concede_guest_value))
|
|
|
- # # if uid_num < 1:
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(half_concede_guest_data)
|
|
|
- # # half_concede_home
|
|
|
- # for index, value in enumerate(half_concede_home):
|
|
|
- # hash_str = p_code + "coh_h" + str(index) + str(half_concede_home_rule[index]) + str(
|
|
|
- # value) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + "coh_h" + str(index) + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # half_concede_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # condition = fuhao(half_concede_home_rule[index])
|
|
|
- # half_concede_home_value = [match_id, league_id, "coh_h", "0", index, p_code, value, condition,
|
|
|
- # odds_only, sole, "hg3535", "0", ""]
|
|
|
- # half_concede_home_data = dict(zip(half_concede_home_key, half_concede_home_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(half_concede_home_data)
|
|
|
- #
|
|
|
- # concede_guest = item["concede_guest"]
|
|
|
- # concede_guest_rule = item["concede_guest_rule"]
|
|
|
- # concede_home = item["concede_home"]
|
|
|
- # concede_home_rule = item["concede_home_rule"]
|
|
|
- # # concede_guest
|
|
|
- # for index, value in enumerate(concede_guest):
|
|
|
- # hash_str = p_code + "cog" + str(index) + str(concede_guest_rule[index]) + str(
|
|
|
- # value) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + "cog" + str(index) + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # concede_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # condition = fuhao(concede_guest[index])
|
|
|
- # concede_guest_value = [match_id, league_id, "cog", "0", index, p_code, value, condition,
|
|
|
- # odds_only, sole, "hg3535", "0", ""]
|
|
|
- # concede_guest_data = dict(zip(concede_guest_key, concede_guest_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(concede_guest_data)
|
|
|
- # # concede_home
|
|
|
- # for index, value in enumerate(concede_home):
|
|
|
- # hash_str = p_code + "coh" + str(index) + str(concede_home_rule[index]) + str(
|
|
|
- # value) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + "coh" + str(index) + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # concede_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # condition = fuhao(concede_home_rule[index])
|
|
|
- # concede_home_value = [match_id, league_id, "coh", "0", index, p_code, value, condition, odds_only,
|
|
|
- # sole, "hg3535", "0", ""]
|
|
|
- # concede_guest_data = dict(zip(concede_home_key, concede_home_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(concede_guest_data)
|
|
|
- #
|
|
|
- # # 独赢----------------------------------------------------------------------------------------------------------
|
|
|
- # # p_code, p_id = get_pcode(corner_ball, 'capot')
|
|
|
- # p_code = 'C'
|
|
|
- # half_capot_home = item["half_capot_home"]
|
|
|
- # half_capot_guest = item["half_capot_guest"]
|
|
|
- # half_capot_dogfall = item["half_capot_dogfall"]
|
|
|
- # capot_home = item["capot_home"]
|
|
|
- # capot_guest = item["capot_guest"]
|
|
|
- # capot_dogfall = item["capot_dogfall"]
|
|
|
- #
|
|
|
- # # half_capot_home
|
|
|
- # hash_str = p_code + "ch_h" + '0' + '1' + str(half_capot_home) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + "ch_h" + '0' + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # half_capot_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # half_capot_home_value = [match_id, league_id, "ch_h", "0", 0, p_code, half_capot_home, '1',
|
|
|
- # odds_only, sole, "hg3535", "0", ""]
|
|
|
- # half_capot_homet_data = dict(zip(half_capot_home_key, half_capot_home_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(half_capot_homet_data)
|
|
|
- #
|
|
|
- # # half_capot_guest
|
|
|
- # hash_str = p_code + "cg_h" + '0' + '2' + str(half_capot_guest) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + "cg_h" + '0' + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # half_capot_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # half_capot_guest_value = [match_id, league_id, "cg_h", "0", 0, p_code, half_capot_guest, '2',
|
|
|
- # odds_only, sole, "hg3535", "0", ""]
|
|
|
- # half_capot_guest_data = dict(zip(half_capot_guest_key, half_capot_guest_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(half_capot_guest_data)
|
|
|
- #
|
|
|
- # # half_capot_dogfall
|
|
|
- # hash_str = p_code + "cd_h" + '0' + 'X' + str(half_capot_dogfall) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + "cd_h" + '0' + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # half_capot_dogfall_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # half_capot_dogfall_value = [match_id, league_id, "cd_h", "0", 0, p_code, half_capot_dogfall, 'X',
|
|
|
- # odds_only, sole, "hg3535", "0", ""]
|
|
|
- # half_capot_dogfall_data = dict(zip(half_capot_dogfall_key, half_capot_dogfall_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(half_capot_dogfall_data)
|
|
|
- #
|
|
|
- # # capot_dogfall
|
|
|
- # hash_str = p_code + "cd" + '0' + 'X' + str(capot_dogfall) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + "cd" + '0' + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # capot_dogfall_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # capot_dogfall_value = [match_id, league_id, "cd", "0", 0, p_code, capot_dogfall, 'X', odds_only,
|
|
|
- # sole, "hg3535", "0", ""]
|
|
|
- # capot_dogfall_data = dict(zip(capot_dogfall_key, capot_dogfall_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(capot_dogfall_data)
|
|
|
- #
|
|
|
- # # capot_home
|
|
|
- # hash_str = p_code + "ch" + '0' + '1' + str(capot_home) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + "ch" + '0' + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # capot_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # capot_home_value = [match_id, league_id, "ch", "0", 0, p_code, capot_home, '1',
|
|
|
- # odds_only, sole, "hg3535", "0", ""]
|
|
|
- # capot_homet_data = dict(zip(capot_home_key, capot_home_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(capot_homet_data)
|
|
|
- #
|
|
|
- # # capot_guest
|
|
|
- # hash_str = p_code + "cg" + '0' + '2' + str(capot_guest) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + "cg" + '0' + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # capot_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # capot_guest_value = [match_id, league_id, "cg", "0", 0, p_code, capot_home, '2',
|
|
|
- # odds_only, sole, "hg3535", "0", ""]
|
|
|
- # capot_guest_data = dict(zip(capot_guest_key, capot_guest_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(capot_guest_data)
|
|
|
- #
|
|
|
- # # 入球数单双-----------------------------------------------------------------------------------------------------
|
|
|
- # # p_code, p_id = get_pcode(corner_ball, 'two_sides')
|
|
|
- # p_code = 'TS'
|
|
|
- # odd_even_odd = item["odd_even_odd"]
|
|
|
- # odd_even_even = item["odd_even_even"]
|
|
|
- # half_odd_even_odd = item["half_odd_even_odd"]
|
|
|
- # half_odd_even_even = item["half_odd_even_even"]
|
|
|
- #
|
|
|
- # # odd_even_odd
|
|
|
- # hash_str = p_code + "tss" + '0' + '单' + str(odd_even_odd) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + "tss" + '0' + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # single_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # single_value = [match_id, league_id, "tss", "0", 0, p_code, odd_even_odd, '单',
|
|
|
- # odds_only, sole, "hg3535", "0", ""]
|
|
|
- # single_data = dict(zip(single_key, single_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(single_data)
|
|
|
- #
|
|
|
- # # odd_even_even
|
|
|
- # hash_str = p_code + "tsd" + '0' + '双' + str(odd_even_even) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + "tsd" + '0' + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # double_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # double_value = [match_id, league_id, "tsd", "0", 0, p_code, odd_even_even, '双',
|
|
|
- # odds_only, sole, "hg3535", "0", ""]
|
|
|
- # double_data = dict(zip(double_key, double_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(double_data)
|
|
|
- #
|
|
|
- # # half_odd_even_even
|
|
|
- # hash_str = p_code + "tsd_h" + '0' + '双' + str(half_odd_even_even) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + "tsd_h" + '0' + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # half_double_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # half_double_value = [match_id, league_id, "tsd_h", "0", 0, p_code, half_odd_even_even, '双',
|
|
|
- # odds_only, sole, "hg3535", "0", ""]
|
|
|
- # half_double_data = dict(zip(half_double_key, half_double_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(half_double_data)
|
|
|
- #
|
|
|
- # # half_odd_even_odd
|
|
|
- # hash_str = p_code + "tss_h" + '0' + '单' + str(half_odd_even_odd) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + "tss_h" + '0' + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # half_single_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # half_single_value = [match_id, league_id, "tss_h", "0", 0, p_code, half_odd_even_odd, '单', odds_only,
|
|
|
- # sole, "hg3535", "0", ""]
|
|
|
- # half_single_data = dict(zip(half_single_key, half_single_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(half_single_data)
|
|
|
- #
|
|
|
- # # 总入球数 ------------------------------------------------------------------------------------------------------
|
|
|
- # # p_code, p_id = get_pcode(corner_ball, 'total_goal')
|
|
|
- # p_code = 'TG'
|
|
|
- # total_goals = item['total_goal']
|
|
|
- # total_dict = {'tg0': '0-1', 'tg1': '2-3', 'tg2': '4-6','tg3': '7或以上', 'tg0_h': '0', "tg1_h": '1',
|
|
|
- # "tg2_h": '2', "tg3_h": '3或以上'}
|
|
|
- # # 全场入球数 单双
|
|
|
- # # 上半场入球数 单双
|
|
|
- # for key, value in total_goals.items():
|
|
|
- # hash_str = p_code + key + '0' + total_dict[key] + str(value) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + key + '0' + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # total_goals_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # total_goals_value = [match_id, league_id, key, "0", 0, p_code, value, total_dict[key], odds_only,
|
|
|
- # sole, "hg3535", "0", ""]
|
|
|
- # total_goals_data = dict(zip(total_goals_key, total_goals_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(total_goals_data)
|
|
|
- #
|
|
|
- # # 全场半场 ------------------------------------------------------------------------------------------------------
|
|
|
- # half_fulls = item['half_full']
|
|
|
- # # p_code, p_id = get_pcode(corner_ball, 'half_full')
|
|
|
- # p_code = 'HF'
|
|
|
- # full_dict = {"hfhh": "主主", "hfhd": "主和", "hfhg": "主客", "hfdh": "和主",
|
|
|
- # "hfdd": "和和", "hfdg": "和客", "hfgh": "客主", "hfgd": "客和", "hfgg": "客客"}
|
|
|
- # if half_fulls:
|
|
|
- # for key, value in half_fulls.items():
|
|
|
- # hash_str = p_code + key + '0' + full_dict[key] + str(value) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + key + '0' + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # half_fulls_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # half_fulls_value = [match_id, league_id, key, "0", 0, p_code, value, full_dict[key], odds_only,
|
|
|
- # sole, "hg3535", "0", ""]
|
|
|
- # half_fulls_data = dict(zip(half_fulls_key, half_fulls_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(half_fulls_data)
|
|
|
- #
|
|
|
- # # 波胆------------------------------------------------------------------------------------------------------------------
|
|
|
- # bodan_datas = item['bodan_data']
|
|
|
- # # p_code, p_id = get_pcode(corner_ball, 'bodan')
|
|
|
- # p_code = 'B'
|
|
|
- # bodan_dict = {"b10": "1-0", "b20": "2-0", "b21": "2-1", "b30": "3-0", "b31": "3-1", "b32": "3-2",
|
|
|
- # "b40": "4-0", "b41": "4-1", "b42": "4-2", "b43": "4-3", "b01": "0-1", "b02": "0-2",
|
|
|
- # "b12": "1-2", "b03": "0-3", "b13": "1-3", "b23": "2-3", "b04": "0-4", "b14": "1-4",
|
|
|
- # "b24": "2-4", "b34": "3-4", "b00": "0-0", "b11": "1-1", "b22": "2-2", "b33": "3-3",
|
|
|
- # "b44": "4-4", "bo": "其他", "b10_h": "1-0", "b20_h": "2-0", "b21_h": "2-1", "b30_h": "3-0",
|
|
|
- # "b31_h": "3-1", "b32_h": "3-2", "b01_h": "0-1", "b02_h": "0-2", "b12_h": "1-2", "b03_h": "0-3",
|
|
|
- # "b13_h": "1-3", "b23_h": "2-3", "b00_h": "0-0", "b11_h": "1-1", "b22_h": "2-2", "b33_h": "3-3",
|
|
|
- # "bo_h": "其他"}
|
|
|
- # if bodan_datas:
|
|
|
- # for key, value in bodan_datas.items():
|
|
|
- # hash_str = p_code + key + '0' + bodan_dict[key] + str(value) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + key + '0' + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # bodan_dict_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # bodan_dict_value = [match_id, league_id, key, "0", 0, p_code, value, bodan_dict[key], odds_only,
|
|
|
- # sole, "hg3535", "0", ""]
|
|
|
- # bodan_dict_data = dict(zip(bodan_dict_key, bodan_dict_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(bodan_dict_data)
|
|
|
- #
|
|
|
- # # 最先进球/最后进球 ----------------------------------------------------------------------------------------------
|
|
|
- # first_last_balls = item['first_last_ball']
|
|
|
- # # p_code, p_id = get_pcode(corner_ball, 'first_last_ball')
|
|
|
- # p_code = 'FLB'
|
|
|
- # first_last_dict = {"flbfh": "最先进球", "flbfg": "最先进球", "flblh": "最后进球", "flblg": "最后进球", "flbn": "没有进球"}
|
|
|
- # if first_last_balls:
|
|
|
- # for key, value in first_last_balls.items():
|
|
|
- # hash_str = p_code + key + '0' + first_last_dict[key] + str(value) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + key + '0' + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # first_last_balls_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
|
|
|
- # "odds_only", "sole", "source", "type", "team"]
|
|
|
- # first_last_balls_value = [match_id, league_id, key, "0", 0, p_code, value, first_last_dict[key], odds_only,
|
|
|
- # sole, "hg3535", "0", ""]
|
|
|
- # first_last_balls_data = dict(zip(first_last_balls_key, first_last_balls_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(first_last_balls_data)
|
|
|
- #
|
|
|
- # # p_code, p_id = get_pcode(corner_ball, 'tema_ball')
|
|
|
- # # 球队得分大小
|
|
|
- # p_code = 'TB'
|
|
|
- # # 全场
|
|
|
- # full_dicts = item['full_data']
|
|
|
- # # 上半场
|
|
|
- # half_dicts = item['half_data']
|
|
|
- # full_dict_rules = item['full_data_rule']
|
|
|
- # half_dict_rules = item['half_data_rule']
|
|
|
- # if full_dicts:
|
|
|
- # for key, value in full_dicts.items():
|
|
|
- # hash_str = p_code + key + '0' + full_dict_rules[key] + str(value) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + key + '0' + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # full_dict_rules_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
|
|
|
- # "condition", "odds_only", "sole", "source", "type", "team"]
|
|
|
- # full_dict_rules_value = [match_id, league_id, key, "0", 0, p_code, value, full_dict_rules[key],
|
|
|
- # odds_only,sole, "hg3535", "0", ""]
|
|
|
- # full_dict_rules_data = dict(zip(full_dict_rules_key, full_dict_rules_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(full_dict_rules_data)
|
|
|
- # #
|
|
|
- # if half_dicts:
|
|
|
- # for key, value in half_dicts.items():
|
|
|
- # hash_str = p_code + key + '0' + half_dict_rules[key] + str(value) + "hg3535" + str(match_id)
|
|
|
- # sole_str = p_code + key + '0' + str(match_id) + "hg3535"
|
|
|
- # odds_only = Helper.genearte_MD5(hash_str)
|
|
|
- # sole = Helper.genearte_MD5(sole_str)
|
|
|
- # odds_onlys.append(odds_only)
|
|
|
- # half_dicts_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
|
|
|
- # "condition","odds_only", "sole", "source", "type", "team"]
|
|
|
- # half_dicts_value = [match_id, league_id, key, "0", 0, p_code, value, half_dict_rules[key],
|
|
|
- # odds_only, sole, "hg3535", "0", ""]
|
|
|
- # half_dicts_data = dict(zip(half_dicts_key, half_dicts_value))
|
|
|
- # if odds_only not in uuid_list:
|
|
|
- # data_list.append(half_dicts_data)
|
|
|
- # if pt == '3':
|
|
|
- # ris_stringscene = 1
|
|
|
- # else:
|
|
|
- # ris_stringscene = 0
|
|
|
- # 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, tag_number, uuid, ris_stringscene, utime, pt]
|
|
|
- # odds_dict = dict(zip(odds_key, odds_value))
|
|
|
- # if data_list:
|
|
|
- # # print(odds_dict)
|
|
|
- # response_data = Helper.async_post(url + '/setOdds', odds_dict)
|
|
|
- # print(response_data)
|
|
|
- # if "成功" in response_data:
|
|
|
- # if result:
|
|
|
- # self.db.hg3535_zq_odds.update({'match_id': match_id, 'pt': pt}, {'$set': {"data": data_list, "odds_only": odds_onlys, "utime": utime}}, upsert=True)
|
|
|
- # else:
|
|
|
- # self.db.hg3535_zq_odds.insert(odds_dict)
|
|
|
+ logger.warning('足球相信赔率提交失败, {}'.format(response_data))
|
|
|
+ logger.warning(odds_dict)
|
|
|
+ reactor.callFromThread(out.callback, item)
|