from collectSports.items import * class Storage(object): def __init__(self): pass def zaopan(self,re): data=CollectsportsItem() data['zq_league']=data['zq_match']=[] for index in re['data']: lg=ZqLeagueItem() lg['league_id']=index['league_id'] lg['league_name']=index['league_name'] 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'] 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['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