RollingBall.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Jonlin
  5. * Date: 2019/3/21
  6. * Time: 14:07
  7. */
  8. namespace App\Sports\Controller;
  9. use BaseController\Controller;
  10. use \System\Model;
  11. class RollingBall extends Controller{
  12. public function init() {
  13. $this->commonFunction = C()->get('commonFunction');
  14. }
  15. /**
  16. * @throws \Exception
  17. * 首页足球滚球
  18. */
  19. public function zqrollingball(){
  20. $models = $this->commonFunction->getModels('zq',1);
  21. $model_result = $models['model_result'];
  22. $model_match = $models['model_match'];
  23. //获取 滚球查询条件
  24. $where = $this->commonFunction->getState('StRollBall',$model_match);
  25. $result =lm($model_match,"Sports")
  26. ->join($model_result,$model_result.'.match_id',$model_match.'.match_id')
  27. ->select($model_match.'.match_id',$model_match.'.tag','match_date as start_date',$model_match.'.match_time as start_time',$model_match.'.home_team',$model_match.'.guest_team','home_score','guest_score',$model_result.'.match_time','match_process')
  28. ->where($model_match.'.source',$this->source['source'])
  29. ->where($where)
  30. ->get()
  31. ->toarray();
  32. $data = [
  33. 'game_code'=>'zq',
  34. 'gameName'=>'足球',
  35. 'matchData'=>$result
  36. ];
  37. return $data;
  38. // Render($data, '1', lang('Tips','Sports')->get('success'));
  39. }
  40. /**
  41. * @throws \Exception
  42. * 首页篮球滚球
  43. */
  44. public function lqrollingball(){
  45. $models = $this->commonFunction->getModels('lq',1);
  46. $model_result = $models['model_result'];
  47. $model_match = $models['model_match'];
  48. //获取 滚球查询条件
  49. $where = $this->commonFunction->getState('StRollBall',$model_match);
  50. $result =lm($model_match,"Sports")
  51. ->join($model_result,$model_result.'.match_id',$model_match.'.match_id')
  52. ->select($model_match.'.match_id',$model_match.'.tag','match_date as start_date',$model_match.'.match_time as start_time',$model_match.'.home_team',$model_match.'.guest_team','home_score','guest_score',$model_result.'.match_time','match_process')
  53. ->where($model_match.'.source',$this->source['source'])
  54. ->where($where)
  55. ->get()
  56. ->toarray();
  57. $data = [
  58. 'game_code'=>'lq',
  59. 'gameName'=>'篮球',
  60. 'matchData'=>$result
  61. ];
  62. return $data;
  63. // Render($data, '1', lang('Tips','Sports')->get('success'));
  64. }
  65. public function wqrollingball(){
  66. $models = $this->commonFunction->getModels('wq',1);
  67. $model_result = $models['model_result'];
  68. $model_match = $models['model_match'];
  69. //获取 滚球查询条件
  70. $where = $this->commonFunction->getState('StRollBall',$model_match);
  71. $result =lm($model_match,"Sports")
  72. ->join($model_result,$model_result.'.match_id',$model_match.'.match_id')
  73. ->select($model_match.'.match_id',$model_match.'.tag','match_date as start_date',$model_match.'.match_time as start_time','home_player_name','guest_player_name','first_inning_score','second_inning_score','third_inning_score',$model_result.'.match_time','match_process')
  74. ->where($model_match.'.source',$this->source['source'])
  75. ->where($where)
  76. ->get()
  77. ->toarray();
  78. $data = [
  79. 'game_code'=>'wq',
  80. 'gameName'=>'网球',
  81. 'matchData'=>$result
  82. ];
  83. return $data;
  84. // Render($data, '1', lang('Tips','Sports')->get('success'));
  85. }
  86. public function bqrollingball(){
  87. $models = $this->commonFunction->getModels('bq',1);
  88. $model_result = $models['model_result'];
  89. $model_match = $models['model_match'];
  90. //获取 滚球查询条件
  91. $where = $this->commonFunction->getState('StRollBall',$model_match);
  92. $result =lm($model_match,"Sports")
  93. ->join($model_result,$model_result.'.match_id',$model_match.'.match_id')
  94. ->select($model_match.'.match_id',$model_match.'.tag','match_date as start_date',$model_match.'.match_time as start_time',$model_match.'.home_team',$model_match.'.guest_team','home_score','guest_score',$model_result.'.match_time','match_process')
  95. ->where($model_match.'.source',$this->source['source'])
  96. ->where($where)
  97. ->get()
  98. ->toarray();
  99. $data = [
  100. 'game_code'=>'bq',
  101. 'gameName'=>'棒球',
  102. 'matchData'=>$result
  103. ];
  104. return $data;
  105. // Render($data, '1', lang('Tips','Sports')->get('success'));
  106. }
  107. /**
  108. * 获取所有球类滚球
  109. */
  110. public function getRollingBall(){
  111. $zqRollingBall = $this->zqrollingball();
  112. $lqRollingBall = $this->lqrollingball();
  113. $wqRollingBall = $this->wqrollingball();
  114. $bqRollingBall = $this->bqrollingball();
  115. $data = [
  116. 'zqData' =>$zqRollingBall,
  117. 'lqData' =>$lqRollingBall,
  118. 'wqData' =>$wqRollingBall,
  119. 'bqData' =>$bqRollingBall,
  120. ];
  121. Render($data, '1', lang('Tips','Sports')->get('success'));
  122. }
  123. }