Storage.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. from collectSports.items import *
  2. class Storage(object):
  3. def __init__(self):
  4. pass
  5. def zaopan(self,re):
  6. data=CollectsportsItem()
  7. data['zq_league']=data['zq_match']=[]
  8. for index in re['data']:
  9. lg=ZqLeagueItem()
  10. lg['league_id']=index['league_id']
  11. lg['league_name']=index['league_name']
  12. mc=ZqMatch()
  13. mc['match_id']=index['match_id']
  14. mc['half_match_id']=index['half_match_id']
  15. mc['host_id']=index['host_id']
  16. mc['guest_id']=index['guest_id']
  17. mc['host_name']=index['host_name']
  18. mc['guest_name']=index['guest_name']
  19. mc['is_half']=0
  20. mc['league_id']=index['league_id']
  21. mc['is_roll']=index['is_roll'] #是否滚球
  22. mc['mdate']=index['mdate']
  23. mc['mtime']=index['mtime']
  24. mc['is_corner']=index['is_corner']
  25. data['zq_match'].append(mc)
  26. mc['is_half']=1
  27. mc['match_id']=index['half_match_id']
  28. mc['half_match_id']=0
  29. data['zq_match'].append(mc)
  30. data['zq_league'].append(lg)
  31. return data
  32. def zhibo(self,re):
  33. data=CollectsportsItem()
  34. data['zq_zhibo']=[]
  35. for index in re:
  36. lg=ZqZhibo()
  37. lg['game_type']=index['game_type']
  38. lg['start_time']=index['start_time']
  39. lg['host_team']=index['host_team']
  40. lg['guest_team']=index['guest_team']
  41. lg['doing']=index['doing']
  42. lg['showid']=index['showid']
  43. lg['shower']=index['shower']
  44. lg['league_name']=index['league_name']
  45. data['zq_zhibo'].append(lg)
  46. return data