"block","name"=>"indexfocus","row"=>"5","orderby"=>"weigh"]); $data['hotNews'] = \addons\cms\model\Archives::getArchivesList(["id"=>"item","limit"=>"5","channel"=>"43","type"=>"sons"]); $data['industry'] = \addons\cms\model\Archives::getArchivesList(["id"=>"item","limit"=>"4","channel"=>"44","type"=>"sons"]); $data['fly'] = \addons\cms\model\Archives::getArchivesList(["id"=>"item","limit"=>"6","channel"=>"45","type"=>"sons"]); $data['atlas'] = \addons\cms\model\Archives::getArchivesList(["id"=>"item","limit"=>"4","channel"=>"46","type"=>"sons"]); $data['video'] = \addons\cms\model\Archives::getArchivesList(["id"=>"item","channel"=>"47","addon"=>"video","limit"=>"0,5"]); foreach ($data as $keys => $vals) { if (count($vals) > 1) { foreach ($vals as $key => $val) { $data[$key][$key] = $val->toArray(); } } } return json($data); } //地区筛选 public function area_club(){ $club = new ClubModel(); $province = $this->request->param("province"); if($province) $where['province'] = $province; $city = $this->request->param("city"); if($city) $where['city'] = $city; $district = $this->request->param("district"); if($district) $where['district'] = $district; // if(empty($club_id)) $this->error('缺少参数'); // var_dump($where);exit; $club_res = $club->field('id,name,logo,flag,name_short') ->where($where)->where('status in (9)') ->orderRaw('convert(name_short using gbk) ASC') ->select(); return json($club_res); } public function all_club(){ $club = new ClubModel(); $club_res = $club->field('id,name,logo,flag,name_short')->where('status in (9)') ->orderRaw('convert(name_short using gbk) ASC') ->select(); return json($club_res); } public function club_detail(){ $club = new ClubModel(); $invate = new ClubInvate(); $player = new Players(); $Archives = new Archives(); $MatchRanking = new MatchRanking(); $League = new League(); $club_id = $this->request->param("club_id"); $LeagueClubIntegral = new LeagueClubIntegral(); if(empty($club_id)) $this->error('缺少参数'); $Archives_res = $Archives->where('channel_id',73)->select(); unset($Archives_res[1]);//国家集训队 unset($Archives_res[4]);//测试站 // var_dump($Archives_res);exit; $station_integral = [];$j = 0; $lastElement = end($Archives_res); foreach ($Archives_res as $value){ $club_integral_res = $LeagueClubIntegral->where('club_id',$club_id)->where('match_id',$value['id'])->find(); if(!empty($club_integral_res)){ //复用积分排名 $res = $League->club_integral($value['id'],$club_integral_res['name_short']); // var_dump($res['number']);exit; $player_count = $MatchRanking->where('match_id',$value['id'])->where('name_short',$club_integral_res['name_short'])->where('course',101)->where('other_round',1)->count(); $station_integral[] = array('match_id'=>$value['id'],'name'=> $value['title'],'sum_grade'=>$club_integral_res['sum_grade'],'number'=>$res['integral_sort'],'player_number'=>$player_count,'nostart'=>0); // var_dump($player_count);exit; }else{ $station_integral[] = array('match_id'=>$value['id'],'name'=> $value['title'],'sum_grade'=>0,'number'=>0,'player_number'=>0,'nostart'=>0); } //判断最后一场比赛是否未开始 if($value['id'] == $lastElement['id']){ $res = db("cms_addonproducts")->where('id',$value['id'])->find(); if(strtotime($res['stime']) > time()){ // var_dump(strtotime($res['stime']));exit; $station_integral[$j]['nostart'] = 1; } // var_dump($res['stime']);exit; } $j++; // var_dump($club_integral_res);exit; } // var_dump($station_integral);exit; $club_res = $club->field('id,user_id,name,name_short,province,city,district,logo,flag,competition_slogan,leader')->where('id',$club_id)->find(); $all_invate = $invate->where('club_id',$club_res['id'])->where('status',6)->where('deletetime',null)->select(); $all_player = []; $i = 0; foreach ($all_invate as $v){ $player_info = $player->field('id,real_name,player_pic')->where('id',$v['player_id'])->find(); $all_player[$i] = $player_info; $i++; } $club_res['all_player'] = $all_player; $club_res['station_integral'] = $station_integral; return json($club_res); } public function randclub(){ $club = new ClubModel(); $club_res = $club->field('id,user_id,name,name_short,province,city,district,logo,flag,competition_slogan,leader')->where('status',9)->orderRaw("rand()")->limit(6)->select(); $invate = new ClubInvate(); $player = new Players(); foreach ($club_res as &$val){ $all_invate = $invate->where('club_id',$val['id'])->where('status',6)->select(); $all_player = []; $i = 0; foreach ($all_invate as $v){ $player_info = $player->field('id,real_name,player_pic')->where('id',$v['player_id'])->find(); $all_player[$i] = $player_info; $i++; } $val['all_player'] = $all_player; } return json($club_res); } }