| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- from collectSports.items import *
- import uuid
- class Storage(object):
- def __init__(self):
- pass
- def zaopan(self, re):
- data = CollectsportsItem()
- data['csource'] = 'zaopan'
- data['zq_league'] = data['zq_match'] = []
- for index in re['data']:
- i_uuid = uuid.uuid4()
- # print(i_uuid)
- lg = ZqLeagueItem()
- # lg['league_id'] = index['league_id']
- lg['league_name'] = index['league_name']
- lg['uuid'] = i_uuid
- # lg['source'] = 'hg0088'
- lg['content']={'league_id':index['league_id'],'source':'hg0088'}
- mc = ZqMatch()
- mc['match_id'] = index['match_id']
- mc['half_match_id'] = index['half_match_id']
- mc['host_id'] = index['host_id']
- mc['guest_id'] = index['guest_id']
- mc['host_name'] = index['host_name']
- mc['guest_name'] = index['guest_name']
- mc['is_half'] = 0
- mc['league_id'] = index['league_id']
- mc['is_roll'] = index['is_roll'] # 是否滚球
- mc['mdate'] = index['mdate']
- mc['mtime'] = index['mtime']
- mc['is_corner'] = index['is_corner']
- mc['uuid'] = i_uuid
- mc['source'] = 'hg0088'
- data['zq_match'].append(mc)
- mc['is_half'] = 1
- mc['match_id'] = index['half_match_id']
- mc['half_match_id'] = 0
- data['zq_match'].append(mc)
- data['zq_league'].append(lg)
- return data
- def zhibo(self, re):
- data = CollectsportsItem()
- data['csource'] = 'zhibo'
- data['zq_zhibo'] = []
- for index in re:
- lg = ZqZhibo()
- lg['game_type'] = index['game_type']
- lg['start_time'] = index['start_time']
- lg['host_team'] = index['host_team']
- lg['guest_team'] = index['guest_team']
- lg['doing'] = index['doing']
- lg['showid'] = index['showid']
- lg['shower'] = index['shower']
- lg['league_name'] = index['league_name']
- data['zq_zhibo'].append(lg)
- return data
- def chain(self, re):
- data = CollectsportsItem()
- data['csource'] = 'chain'
- data['zq_league'] = data['zq_chain'] = []
- for index in re:
- lg = ZqLeagueItem()
- lg['start_time'] = index['start_time']
- lg['league_id'] = index['league_id']
- lg['league_name'] = index['league_name']
- lg['league_subname'] = index['league_subname']
- lg['team_num'] = index['dcount']
- lg['game_type'] = index['game_type']
- for item in index['items']:
- mc = ZqChain()
- mc['league_id'] = index['league_id']
- mc['status'] = item['status']
- mc['code'] = item['code']
- mc['name'] = item['name']
- mc['enabled'] = item['enabled']
- mc['odds'] = item['odds']
- data['zq_chain'].append(mc)
- data['zq_league'].append(lg)
- return data
- def today(self, re):
- data = CollectsportsItem()
- data['csource'] = 'today'
- data['zq_today'] = []
- for index in re:
- lg = ZqToday()
- lg['match_id'] = index['match_id']
- lg['is_roll'] = index['is_roll']
- lg['is_corner'] = index['is_corner']
- data['zq_today'].append(lg)
- return data
|