| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Jonlin
- * Date: 2019/3/26
- * Time: 9:16
- */
- namespace App\Sports\Controller;
- use BaseController\Controller;
- use \System\Model;
- class IndexNav extends Controller{
- public function navlist(){
- if(!empty($_REQUEST['type_code'])){
- $type_code = $_REQUEST['type_code'];
- }else{
- $type_code = 'StRollBall';
- }
- if(!empty($_REQUEST['gametype'])){
- $gametype = $_REQUEST['gametype'];
- }else{
- $gametype = 'zq';
- }
- //滚球
- if($type_code == 'StRollBall'){
- $leagues = lm('st_'.$gametype.'_competition','Sports')
- ->join('st_'.$gametype.'_league','st_'.$gametype.'_competition.lg_id','=','st_'.$gametype.'_league.id')
- ->select('st_'.$gametype.'_competition.lg_id','st_'.$gametype.'_league.name_chinese','st_'.$gametype.'_league.name_english')
- ->where('st_'.$gametype.'_competition.status','1')
- ->where('st_'.$gametype.'_competition.match_date',date("Y-m-d"))
- //->where('st_'.$gametype.'_competition.match_time','>',date("h:i:s"))
- ->distinct('st_'.$gametype.'_competition.lg_id')
- ->get();
- $match->name = $gametype;
- for($i=0;$i<count($leagues);$i++){
- $match->leaguedata[$i]->league_id = $leagues[$i]->lg_id;
- $match->leaguedata[$i]->league_name_chinese = $leagues[$i]->name_chinese;
- $match->leaguedata[$i]->league_name_english = $leagues[$i]->name_english;
- $num = lm('St_'.$gametype.'_competition','Sports')
- ->select('match_id')
- ->where('status','1')
- ->where('match_date',date("Y-m-d"))
- //->where('match_time','>',date("h:i:s"))
- ->where('lg_id',$leagues[$i]->lg_id)
- ->get();
- $match->leaguedata[$i]->num = count($num);
- $gamematch = lm('st_'.$gametype.'_competition','Sports')
- ->select('match_id','home_team','guest_team','match_date','match_time','status','tag')
- ->where('status','1')
- ->where('match_date',date("Y-m-d"))
- ->where('match_time','>',date("h:i:s"))
- ->where('lg_id',$leagues[$i]->lg_id)
- ->get();
- for($j=0;$j<count($gamematch);$j++){
- $match->leaguedata[$i]->matchdata[$j]->match_id = $gamematch[$j]->match_id;
- $match->leaguedata[$i]->matchdata[$j]->home_team = $gamematch[$j]->home_team;
- $match->leaguedata[$i]->matchdata[$j]->guest_team = $gamematch[$j]->guest_team;
- $match->leaguedata[$i]->matchdata[$j]->match_date = $gamematch[$j]->match_date;
- $match->leaguedata[$i]->matchdata[$j]->match_time = $gamematch[$j]->match_time;
- $match->leaguedata[$i]->matchdata[$j]->status = $gamematch[$j]->status;
- $match->leaguedata[$i]->matchdata[$j]->tag = $gamematch[$j]->tag;
- $odds = lm('st_'.$gametype.'_odds','Sports')
- ->select('id','odds_code','odds','condition','sort')
- ->where(function ($query) {
- $query->where('odds_code', 'concede_home')
- ->orWhere('odds_code', 'concede_guest')
- ->orWhere('odds_code', 'size_home')
- ->orWhere('odds_code', 'size_guest');
- })
- ->where('match_id',$gamematch[$j]->match_id)
- ->get()
- ->toArray();
- //根据 排序 获取 最新让球/大小玩法赔率
- $sort = array_column($odds,'sort');
- array_multisort($sort,SORT_DESC,$odds);
- $odds = array_slice($odds,0,4);
- for($a=0;$a<count($odds);$a++){
- $match->leaguedata[$i]->matchdata[$j]->oddsdata[$a] = $odds[$a];
- }
- }
- }
- Render($match, '1', lang('Tips','Sports')->get('success'));
- }
- // 即将
- else if($type_code == 'StSoon'){
- $leagues = lm('st_'.$gametype.'_competition','Sports')
- ->join('st_'.$gametype.'_league','st_'.$gametype.'_competition.lg_id','=','st_'.$gametype.'_league.id')
- ->select('st_'.$gametype.'_competition.lg_id','st_'.$gametype.'_league.name_chinese','st_'.$gametype.'_league.name_english')
- ->where('st_'.$gametype.'_competition.status','0')
- ->where('st_'.$gametype.'_competition.match_date',date("Y-m-d"))
- ->where('st_'.$gametype.'_competition.match_time','>',date("h:i:s"))
- ->distinct('st_'.$gametype.'_competition.lg_id')
- ->get();
- $match->name = $gametype;
- for($i=0;$i<count($leagues);$i++){
- $match->leaguedata[$i]->league_id = $leagues[$i]->lg_id;
- $match->leaguedata[$i]->league_name_chinese = $leagues[$i]->name_chinese;
- $match->leaguedata[$i]->league_name_english = $leagues[$i]->name_english;
- $num = lm('St_'.$gametype.'_competition','Sports')
- ->select('match_id')
- ->where('status','0')
- ->where('match_date',date("Y-m-d"))
- ->where('match_time','>',date("h:i:s"))
- ->where('lg_id',$leagues[$i]->lg_id)
- ->get();
- $match->leaguedata[$i]->num = count($num);
- $gamematch = lm('st_'.$gametype.'_competition','Sports')
- ->select('match_id','home_team','guest_team','match_date','match_time','status','tag')
- ->where('status','0')
- ->where('match_date',date("Y-m-d"))
- ->where('match_time','>',date("h:i:s"))
- ->where('lg_id',$leagues[$i]->lg_id)
- ->get();
- for($j=0;$j<count($gamematch);$j++){
- $match->leaguedata[$i]->matchdata[$j]->match_id = $gamematch[$j]->match_id;
- $match->leaguedata[$i]->matchdata[$j]->home_team = $gamematch[$j]->home_team;
- $match->leaguedata[$i]->matchdata[$j]->guest_team = $gamematch[$j]->guest_team;
- $match->leaguedata[$i]->matchdata[$j]->match_date = $gamematch[$j]->match_date;
- $match->leaguedata[$i]->matchdata[$j]->match_time = $gamematch[$j]->match_time;
- $match->leaguedata[$i]->matchdata[$j]->status = $gamematch[$j]->status;
- $match->leaguedata[$i]->matchdata[$j]->tag = $gamematch[$j]->tag;
- $odds = lm('st_'.$gametype.'_odds','Sports')
- ->select('id','odds_code','odds','condition','sort')
- ->where(function ($query) {
- $query->where('odds_code', 'concede_home')
- ->orWhere('odds_code', 'concede_guest')
- ->orWhere('odds_code', 'size_home')
- ->orWhere('odds_code', 'size_guest');
- })
- ->where('match_id',$gamematch[$j]->match_id)
- ->get()
- ->toArray();
- //根据 排序 获取 最新让球/大小玩法赔率
- $sort = array_column($odds,'sort');
- array_multisort($sort,SORT_DESC,$odds);
- $odds = array_slice($odds,0,4);
- for($a=0;$a<count($odds);$a++){
- $match->leaguedata[$i]->matchdata[$j]->oddsdata[$a] = $odds[$a];
- }
- }
- }
- Render($match, '1', lang('Tips','Sports')->get('success'));
- }
- //今日
- else if($type_code = 'StToday'){
- $leagues = lm('st_'.$gametype.'_competition','Sports')
- ->join('st_'.$gametype.'_league','st_'.$gametype.'_competition.lg_id','=','st_'.$gametype.'_league.id')
- ->select('st_'.$gametype.'_competition.lg_id','st_'.$gametype.'_league.name_chinese','st_'.$gametype.'_league.name_english')
- ->where('st_'.$gametype.'_competition.status','!=','2')
- ->where('st_'.$gametype.'_competition.match_date',date("Y-m-d"))
- ->where('st_'.$gametype.'_competition.match_time','>',date("h:i:s"))
- ->distinct('st_'.$gametype.'_competition.lg_id')
- ->get();
- $match->name = $gametype;
- for($i=0;$i<count($leagues);$i++){
- $match->leaguedata[$i]->league_id = $leagues[$i]->lg_id;
- $match->leaguedata[$i]->league_name_chinese = $leagues[$i]->name_chinese;
- $match->leaguedata[$i]->league_name_english = $leagues[$i]->name_english;
- $num = lm('St_'.$gametype.'_competition','Sports')
- ->select('match_id')
- ->where('status','!=','2')
- ->where('match_date',date("Y-m-d"))
- ->where('match_time','>',date("h:i:s"))
- ->where('lg_id',$leagues[$i]->lg_id)
- ->get();
- $match->leaguedata[$i]->num = count($num);
- $gamematch = lm('st_'.$gametype.'_competition','Sports')
- ->select('match_id','home_team','guest_team','match_date','match_time','status','tag')
- ->where('status','!=','2')
- ->where('match_date',date("Y-m-d"))
- ->where('match_time','>',date("h:i:s"))
- ->where('lg_id',$leagues[$i]->lg_id)
- ->get();
- for($j=0;$j<count($gamematch);$j++){
- $match->leaguedata[$i]->matchdata[$j]->match_id = $gamematch[$j]->match_id;
- $match->leaguedata[$i]->matchdata[$j]->home_team = $gamematch[$j]->home_team;
- $match->leaguedata[$i]->matchdata[$j]->guest_team = $gamematch[$j]->guest_team;
- $match->leaguedata[$i]->matchdata[$j]->match_date = $gamematch[$j]->match_date;
- $match->leaguedata[$i]->matchdata[$j]->match_time = $gamematch[$j]->match_time;
- $match->leaguedata[$i]->matchdata[$j]->status = $gamematch[$j]->status;
- $match->leaguedata[$i]->matchdata[$j]->tag = $gamematch[$j]->tag;
- $odds = lm('st_'.$gametype.'_odds','Sports')
- ->select('id','odds_code','odds','condition','sort')
- ->where(function ($query) {
- $query->where('odds_code', 'concede_home')
- ->orWhere('odds_code', 'concede_guest')
- ->orWhere('odds_code', 'size_home')
- ->orWhere('odds_code', 'size_guest');
- })
- ->where('match_id',$gamematch[$j]->match_id)
- ->get()
- ->toArray();
- //根据 排序 获取 最新让球/大小玩法赔率
- $sort = array_column($odds,'sort');
- array_multisort($sort,SORT_DESC,$odds);
- $odds = array_slice($odds,0,4);
- for($a=0;$a<count($odds);$a++){
- $match->leaguedata[$i]->matchdata[$j]->oddsdata[$a] = $odds[$a];
- }
- }
- }
- Render($match, '1', lang('Tips','Sports')->get('success'));
- }
- //早盘
- else if($type_code = 'StMorningPlate'){
- $leagues = lm('st_'.$gametype.'_competition','Sports')
- ->join('st_'.$gametype.'_league','st_'.$gametype.'_competition.lg_id','=','st_'.$gametype.'_league.id')
- ->select('st_'.$gametype.'_competition.lg_id','st_'.$gametype.'_league.name_chinese','st_'.$gametype.'_league.name_english')
- ->where('st_'.$gametype.'_competition.status','!=','2')
- ->where('st_'.$gametype.'_competition.match_date',date("Y-m-d"))
- ->where('st_'.$gametype.'_competition.match_time','>',date("h:i:s"))
- ->distinct('st_'.$gametype.'_competition.lg_id')
- ->get();
- $match->name = $gametype;
- for($i=0;$i<count($leagues);$i++){
- $match->leaguedata[$i]->league_id = $leagues[$i]->lg_id;
- $match->leaguedata[$i]->league_name_chinese = $leagues[$i]->name_chinese;
- $match->leaguedata[$i]->league_name_english = $leagues[$i]->name_english;
- $num = lm('St_'.$gametype.'_competition','Sports')
- ->select('match_id')
- ->where('status','!=','2')
- ->where('match_date',date("Y-m-d"))
- ->where('match_time','>',date("h:i:s"))
- ->where('lg_id',$leagues[$i]->lg_id)
- ->get();
- $match->leaguedata[$i]->num = count($num);
- $gamematch = lm('st_'.$gametype.'_competition','Sports')
- ->select('match_id','home_team','guest_team','match_date','match_time','status','tag')
- ->where('status','!=','2')
- ->where('match_date',date("Y-m-d"))
- ->where('match_time','>',date("h:i:s"))
- ->where('lg_id',$leagues[$i]->lg_id)
- ->get();
- for($j=0;$j<count($gamematch);$j++){
- $match->leaguedata[$i]->matchdata[$j]->match_id = $gamematch[$j]->match_id;
- $match->leaguedata[$i]->matchdata[$j]->home_team = $gamematch[$j]->home_team;
- $match->leaguedata[$i]->matchdata[$j]->guest_team = $gamematch[$j]->guest_team;
- $match->leaguedata[$i]->matchdata[$j]->match_date = $gamematch[$j]->match_date;
- $match->leaguedata[$i]->matchdata[$j]->match_time = $gamematch[$j]->match_time;
- $match->leaguedata[$i]->matchdata[$j]->status = $gamematch[$j]->status;
- $match->leaguedata[$i]->matchdata[$j]->tag = $gamematch[$j]->tag;
- $odds = lm('st_'.$gametype.'_odds','Sports')
- ->select('id','odds_code','odds','condition','sort')
- ->where(function ($query) {
- $query->where('odds_code', 'concede_home')
- ->orWhere('odds_code', 'concede_guest')
- ->orWhere('odds_code', 'size_home')
- ->orWhere('odds_code', 'size_guest');
- })
- ->where('match_id',$gamematch[$j]->match_id)
- ->get()
- ->toArray();
- //根据 排序 获取 最新让球/大小玩法赔率
- $sort = array_column($odds,'sort');
- array_multisort($sort,SORT_DESC,$odds);
- $odds = array_slice($odds,0,4);
- for($a=0;$a<count($odds);$a++){
- $match->leaguedata[$i]->matchdata[$j]->oddsdata[$a] = $odds[$a];
- }
- }
- }
- Render($match, '1', lang('Tips','Sports')->get('success'));
- }
- //串场
- else if($type_code = 'StStringScene'){
- $leagues = lm('st_'.$gametype.'_competition','Sports')
- ->join('st_'.$gametype.'_league','st_'.$gametype.'_competition.lg_id','=','st_'.$gametype.'_league.id')
- ->select('st_'.$gametype.'_competition.lg_id','st_'.$gametype.'_league.name_chinese','st_'.$gametype.'_league.name_english')
- ->where('st_'.$gametype.'_competition.status','!=','2')
- ->where('st_'.$gametype.'_competition.match_date',date("Y-m-d"))
- ->where('st_'.$gametype.'_competition.match_time','>',date("h:i:s"))
- ->distinct('st_'.$gametype.'_competition.lg_id')
- ->get();
- $match->name = $gametype;
- for($i=0;$i<count($leagues);$i++){
- $match->leaguedata[$i]->league_id = $leagues[$i]->lg_id;
- $match->leaguedata[$i]->league_name_chinese = $leagues[$i]->name_chinese;
- $match->leaguedata[$i]->league_name_english = $leagues[$i]->name_english;
- $num = lm('St_'.$gametype.'_competition','Sports')
- ->select('match_id')
- ->where('status','!=','2')
- ->where('match_date',date("Y-m-d"))
- ->where('match_time','>',date("h:i:s"))
- ->where('lg_id',$leagues[$i]->lg_id)
- ->get();
- $match->leaguedata[$i]->num = count($num);
- $gamematch = lm('st_'.$gametype.'_competition','Sports')
- ->select('match_id','home_team','guest_team','match_date','match_time','status','tag')
- ->where('status','!=','2')
- ->where('match_date',date("Y-m-d"))
- ->where('match_time','>',date("h:i:s"))
- ->where('lg_id',$leagues[$i]->lg_id)
- ->get();
- for($j=0;$j<count($gamematch);$j++){
- $match->leaguedata[$i]->matchdata[$j]->match_id = $gamematch[$j]->match_id;
- $match->leaguedata[$i]->matchdata[$j]->home_team = $gamematch[$j]->home_team;
- $match->leaguedata[$i]->matchdata[$j]->guest_team = $gamematch[$j]->guest_team;
- $match->leaguedata[$i]->matchdata[$j]->match_date = $gamematch[$j]->match_date;
- $match->leaguedata[$i]->matchdata[$j]->match_time = $gamematch[$j]->match_time;
- $match->leaguedata[$i]->matchdata[$j]->status = $gamematch[$j]->status;
- $match->leaguedata[$i]->matchdata[$j]->tag = $gamematch[$j]->tag;
- $odds = lm('st_'.$gametype.'_odds','Sports')
- ->select('id','odds_code','odds','condition','sort')
- ->where(function ($query) {
- $query->where('odds_code', 'concede_home')
- ->orWhere('odds_code', 'concede_guest')
- ->orWhere('odds_code', 'size_home')
- ->orWhere('odds_code', 'size_guest');
- })
- ->where('match_id',$gamematch[$j]->match_id)
- ->get()
- ->toArray();
- //根据 排序 获取 最新让球/大小玩法赔率
- $sort = array_column($odds,'sort');
- array_multisort($sort,SORT_DESC,$odds);
- $odds = array_slice($odds,0,4);
- for($a=0;$a<count($odds);$a++){
- $match->leaguedata[$i]->matchdata[$j]->oddsdata[$a] = $odds[$a];
- }
- }
- }
- Render($match, '1', lang('Tips','Sports')->get('success'));
- }
- //冠军
- else if($type_code = 'StChampion'){
- $leagues = lm('st_'.$gametype.'_competition','Sports')
- ->join('st_'.$gametype.'_league','st_'.$gametype.'_competition.lg_id','=','st_'.$gametype.'_league.id')
- ->select('st_'.$gametype.'_competition.lg_id','st_'.$gametype.'_league.name_chinese','st_'.$gametype.'_league.name_english')
- ->where('st_'.$gametype.'_competition.status','!=','2')
- ->where('st_'.$gametype.'_competition.match_date',date("Y-m-d"))
- ->where('st_'.$gametype.'_competition.match_time','>',date("h:i:s"))
- ->distinct('st_'.$gametype.'_competition.lg_id')
- ->get();
- $match->name = $gametype;
- for($i=0;$i<count($leagues);$i++){
- $match->leaguedata[$i]->league_id = $leagues[$i]->lg_id;
- $match->leaguedata[$i]->league_name_chinese = $leagues[$i]->name_chinese;
- $match->leaguedata[$i]->league_name_english = $leagues[$i]->name_english;
- $num = lm('St_'.$gametype.'_competition','Sports')
- ->select('match_id')
- ->where('status','!=','2')
- ->where('match_date',date("Y-m-d"))
- ->where('match_time','>',date("h:i:s"))
- ->where('lg_id',$leagues[$i]->lg_id)
- ->get();
- $match->leaguedata[$i]->num = count($num);
- $gamematch = lm('st_'.$gametype.'_competition','Sports')
- ->select('match_id','home_team','guest_team','match_date','match_time','status','tag')
- ->where('status','!=','2')
- ->where('match_date',date("Y-m-d"))
- ->where('match_time','>',date("h:i:s"))
- ->where('lg_id',$leagues[$i]->lg_id)
- ->get();
- for($j=0;$j<count($gamematch);$j++){
- $match->leaguedata[$i]->matchdata[$j]->match_id = $gamematch[$j]->match_id;
- $match->leaguedata[$i]->matchdata[$j]->home_team = $gamematch[$j]->home_team;
- $match->leaguedata[$i]->matchdata[$j]->guest_team = $gamematch[$j]->guest_team;
- $match->leaguedata[$i]->matchdata[$j]->match_date = $gamematch[$j]->match_date;
- $match->leaguedata[$i]->matchdata[$j]->match_time = $gamematch[$j]->match_time;
- $match->leaguedata[$i]->matchdata[$j]->status = $gamematch[$j]->status;
- $match->leaguedata[$i]->matchdata[$j]->tag = $gamematch[$j]->tag;
- $odds = lm('st_'.$gametype.'_odds','Sports')
- ->select('id','odds_code','odds','condition','sort')
- ->where(function ($query) {
- $query->where('odds_code', 'concede_home')
- ->orWhere('odds_code', 'concede_guest')
- ->orWhere('odds_code', 'size_home')
- ->orWhere('odds_code', 'size_guest');
- })
- ->where('match_id',$gamematch[$j]->match_id)
- ->get()
- ->toArray();
- //根据 排序 获取 最新让球/大小玩法赔率
- $sort = array_column($odds,'sort');
- array_multisort($sort,SORT_DESC,$odds);
- $odds = array_slice($odds,0,4);
- for($a=0;$a<count($odds);$a++){
- $match->leaguedata[$i]->matchdata[$j]->oddsdata[$a] = $odds[$a];
- }
- }
- }
- Render($match, '1', lang('Tips','Sports')->get('success'));
- }
- }
- }
|