122 lines
4.3 KiB
PHP
122 lines
4.3 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace app\index\controller;
|
||
|
|
||
|
use app\admin\model\LeagueClubIntegral;
|
||
|
use app\admin\model\ClubInvate;
|
||
|
use app\admin\model\LeagueIntegral;
|
||
|
use app\admin\model\MatchContestant;
|
||
|
use app\admin\model\MatchRanking;
|
||
|
use app\admin\model\MatchScreen;
|
||
|
use app\admin\model\Players;
|
||
|
use app\admin\model\User;
|
||
|
use app\common\controller\Frontend;
|
||
|
use app\admin\service\RankingService;
|
||
|
use app\admin\controller\cms\Leagueround;
|
||
|
use app\admin\service\LeagueService;
|
||
|
|
||
|
class Broadcast extends Frontend
|
||
|
{
|
||
|
protected $noNeedLogin = ['*'];
|
||
|
|
||
|
public function _initialize()
|
||
|
{
|
||
|
parent::_initialize();
|
||
|
$this->rankingService = new RankingService();
|
||
|
$this->leagueRound = new Leagueround();
|
||
|
$this->leagueService = new LeagueService();
|
||
|
}
|
||
|
|
||
|
public function leageue_course_double_fail(){
|
||
|
$matchranking = new MatchRanking();
|
||
|
$match_id = $this->request->param("match_id");
|
||
|
$course = $this->request->param("course"); // 赛程
|
||
|
$other_round = $this->request->param("other_round", ''); // 轮次
|
||
|
// $row = $this->leagueService->getrank_course($match_id,$course,$other_round);
|
||
|
$row = $matchranking->field('id,match_id,player_id,player_name,name_short,channel,led_color,fly_num,times,grouping,achievement,other_round')->where('match_id',$match_id)->where('course',$course)->order('id')->select();
|
||
|
|
||
|
foreach($row as &$val){
|
||
|
$group_name = $this->win_or_lose_group($val['other_round']);
|
||
|
$val['group_name'] = $group_name;
|
||
|
}
|
||
|
if (!empty($row)) {
|
||
|
$res['code'] = 1;
|
||
|
$res['data'] = $row;
|
||
|
// $res['round'] = $round;
|
||
|
$res['msg'] = "获取成功";
|
||
|
} else {
|
||
|
$res['code'] = 0;
|
||
|
$res['data'] = [];
|
||
|
$res['round'] = '';
|
||
|
$res['msg'] = "获取失败";
|
||
|
}
|
||
|
|
||
|
return json($res);
|
||
|
}
|
||
|
|
||
|
public function win_or_lose_group($other_round){
|
||
|
switch ($other_round) {
|
||
|
case 1: $which_round = '胜者组';break;
|
||
|
case 2: $which_round = '胜者组';break;
|
||
|
case 3: $which_round = '败者组';break;
|
||
|
case 4: $which_round = '败者组';break;
|
||
|
case 5: $which_round = '败者组';break;
|
||
|
case 6: $which_round = '胜者组';break;
|
||
|
case 7: $which_round = '败者组';break;
|
||
|
case 8: $which_round = '败者组';break;
|
||
|
case 9: $which_round = '胜者组';break;
|
||
|
case 10: $which_round = '败者组';break;
|
||
|
case 11: $which_round = '败者组';break;
|
||
|
case 12: $which_round = '胜者组';break;
|
||
|
case 13: $which_round = '败者组';break;
|
||
|
|
||
|
}
|
||
|
return $which_round;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
//队伍总积分排行榜
|
||
|
public function club_allintegral(){
|
||
|
$LeagueClubIntegral = new LeagueClubIntegral();
|
||
|
$all_club = $LeagueClubIntegral->group('club_id')->select();
|
||
|
$arr = [];
|
||
|
foreach ($all_club as $value){
|
||
|
$arr[] = $LeagueClubIntegral->field('sum(sum_grade) as all_grade,club_id,club_name')->where('club_id',$value['club_id'])->select();
|
||
|
|
||
|
}
|
||
|
return json($arr);
|
||
|
}
|
||
|
|
||
|
//队伍分站赛积分
|
||
|
public function club_integral(){
|
||
|
$LeagueClubIntegral = new LeagueClubIntegral();
|
||
|
$match_id = $this->request->param('match_id');
|
||
|
$res = $LeagueClubIntegral->where('match_id',$match_id)->select();
|
||
|
// var_dump($all_club);exit;
|
||
|
return json($res);
|
||
|
}
|
||
|
|
||
|
//飞手总积分排行
|
||
|
public function player_allintegral(){
|
||
|
$LeagueIntegral = new LeagueIntegral();
|
||
|
$all_player = $LeagueIntegral->group('player_id')->select();
|
||
|
$arr = [];
|
||
|
foreach ($all_player as $value){
|
||
|
$arr[] = $LeagueIntegral->field('sum(grade) as all_grade,player_id,player_name')->where('player_id',$value['player_id'])->select();
|
||
|
|
||
|
}
|
||
|
return json($arr);
|
||
|
}
|
||
|
|
||
|
//飞手分站赛积分
|
||
|
public function player_integral(){
|
||
|
$LeagueIntegral = new LeagueIntegral();
|
||
|
$match_id = $this->request->param('match_id');
|
||
|
$res = $LeagueIntegral->where('match_id',$match_id)->select();
|
||
|
// var_dump($all_club);exit;
|
||
|
return json($res);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|