RollingBall.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. $model_league = $models['model_league'];
  24. //获取 滚球查询条件
  25. $where = $this->commonFunction->getState('StRollBall',$model_match);
  26. $result =lm($model_match,"Sports")
  27. ->join($model_result,$model_result.'.match_id',$model_match.'.id')
  28. ->join($model_league,$model_league.'.id',$model_match.'.lg_id')
  29. ->select($model_match.'.id as 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')
  30. ->where([[$model_league.'.name_chinese','!=','']])
  31. ->where($where)
  32. ->get()
  33. ->toarray();
  34. $data = [
  35. 'game_code'=>'zq',
  36. 'gameName'=>'足球',
  37. 'matchData'=>$result
  38. ];
  39. return $data;
  40. // Render($data, '1', lang('Tips','Sports')->get('success'));
  41. }
  42. /**
  43. * @throws \Exception
  44. * 首页篮球滚球
  45. */
  46. public function lqrollingball(){
  47. $models = $this->commonFunction->getModels('lq',1);
  48. $model_result = $models['model_result'];
  49. $model_match = $models['model_match'];
  50. $model_league = $models['model_league'];
  51. //获取 滚球查询条件
  52. $where = $this->commonFunction->getState('StRollBall',$model_match);
  53. $result =lm($model_match,"Sports")
  54. ->join($model_result,$model_result.'.match_id',$model_match.'.id')
  55. ->join($model_league,$model_league.'.id',$model_match.'.lg_id')
  56. ->select($model_match.'.id as 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')
  57. ->where($where)
  58. ->where([[$model_league.'.name_chinese','!=','']])
  59. ->get()
  60. ->toarray();
  61. $data = [
  62. 'game_code'=>'lq',
  63. 'gameName'=>'篮球',
  64. 'matchData'=>$result
  65. ];
  66. return $data;
  67. // Render($data, '1', lang('Tips','Sports')->get('success'));
  68. }
  69. public function wqrollingball(){
  70. $models = $this->commonFunction->getModels('wq',1);
  71. $model_result = $models['model_result'];
  72. $model_match = $models['model_match'];
  73. $model_league = $models['model_league'];
  74. //获取 滚球查询条件
  75. $where = $this->commonFunction->getState('StRollBall',$model_match);
  76. $result =lm($model_match,"Sports")
  77. ->join($model_result,$model_result.'.match_id',$model_match.'.id')
  78. ->join($model_league,$model_league.'.id',$model_match.'.lg_id')
  79. ->select($model_match.'.id as 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')
  80. ->where($where)
  81. ->where([[$model_league.'.name_chinese','!=','']])
  82. ->get()
  83. ->toarray();
  84. $data = [
  85. 'game_code'=>'wq',
  86. 'gameName'=>'网球',
  87. 'matchData'=>$result
  88. ];
  89. return $data;
  90. // Render($data, '1', lang('Tips','Sports')->get('success'));
  91. }
  92. public function bqrollingball(){
  93. $models = $this->commonFunction->getModels('bq',1);
  94. $model_result = $models['model_result'];
  95. $model_match = $models['model_match'];
  96. $model_league = $models['model_league'];
  97. //获取 滚球查询条件
  98. $where = $this->commonFunction->getState('StRollBall',$model_match);
  99. $result =lm($model_match,"Sports")
  100. ->join($model_result,$model_result.'.match_id',$model_match.'.id')
  101. ->join($model_league,$model_league.'.id',$model_match.'.lg_id')
  102. ->select($model_match.'.id as 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')
  103. ->where($where)
  104. ->where([[$model_league.'.name_chinese','!=','']])
  105. ->get()
  106. ->toarray();
  107. $data = [
  108. 'game_code'=>'bq',
  109. 'gameName'=>'棒球',
  110. 'matchData'=>$result
  111. ];
  112. return $data;
  113. // Render($data, '1', lang('Tips','Sports')->get('success'));
  114. }
  115. /**
  116. * 获取所有球类滚球
  117. */
  118. public function getRollingBall(){
  119. $zqRollingBall = $this->zqrollingball();
  120. $lqRollingBall = $this->lqrollingball();
  121. $wqRollingBall = $this->wqrollingball();
  122. $bqRollingBall = $this->bqrollingball();
  123. $data = [
  124. 'zqData' =>$zqRollingBall,
  125. 'lqData' =>$lqRollingBall,
  126. 'wqData' =>$wqRollingBall,
  127. 'bqData' =>$bqRollingBall,
  128. ];
  129. Render($data, '1', lang('Tips','Sports')->get('success'));
  130. }
  131. }