request->param('course'); $match_id = $this->request->param('match_id'); $rankingService = new RankingService(); $collection['thirty_two'] = $rankingService->getRank(32, $match_id); $collection['sixteen'] = $rankingService->getRank(16, $match_id); $collection['eight'] = $rankingService->getRank(8, $match_id); $collection['four'] = $rankingService->getRank(4, $match_id); //$collection = $rankingService->getRank($course); if (!empty($collection)) { $res['code'] = 1; $res['data'] = $collection; $res['msg'] = "获取成功"; } else { $res['code'] = 0; $res['data'] = []; $res['msg'] = "数据为空"; } return json($res); } /** * 获取所有选手名单 * @Author:Soar * @Time:2023/11/23 9:41 * @return \think\response\Json */ public function getRankingAll() { // 解决跨域请求接口问题 header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies header('Access-Control-Expose-Headers: *'); //服务器 headers 白名单,可以让客户端进行访问 header('Access-Control-Allow-Headers: *'); // $course = $this->request->param('course'); $match_id = $this->request->param('match_id'); $rankingService = new RankingService(); $collection['thirty_two'] = $rankingService->getRoundAllPlayer(32, $match_id); $collection['sixteen'] = $rankingService->getRoundAllPlayer(16, $match_id); $collection['eight'] = $rankingService->getRoundAllPlayer(8, $match_id); $collection['four'] = $rankingService->getRoundAllPlayer(4, $match_id); $collection['finals'] = $rankingService->getRoundAllPlayer(1, $match_id); if (!empty($collection)) { $res['code'] = 1; $res['data'] = $collection; $res['msg'] = "获取成功"; } else { $res['code'] = 0; $res['data'] = []; $res['msg'] = "数据为空"; } return json($res); } /** * @Created by PhpStorm. * @Author:Soar * @Time:2023/11/23 9:41 * @return \think\response\Json */ #[Deprecated] public function getRankToSemiFinals() { $match_id = $this->request->param("match_id"); if (empty($match_id)) { $this->error("赛事id不可为空!"); } $rankingService = new RankingService(); $row = $rankingService->getSemiFinals(); if (!empty($row)) { $res['code'] = 1; $res['data'] = $row; $res['msg'] = "获取成功"; } else { $res['code'] = 0; $res['data'] = []; $res['msg'] = "数据为空"; } return json($res); } /** * 获取分组选手信息以及成绩列表 * @Author:Soar * @Time:2023/11/20 16:29 * @return \think\response\Json * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ #//[Deprecated] public function getRankForGroup() { // 解决跨域请求接口问题 header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies header('Access-Control-Expose-Headers: *'); //服务器 headers 白名单,可以让客户端进行访问 header('Access-Control-Allow-Headers: *'); $post['group'] = $this->request->param("group", "A"); $post['match_id'] = $this->request->param("match_id", 0); $post['course'] = $this->request->param("course", 32); if ($post['match_id'] != 0) { $rankingService = new RankingService(); $row = $rankingService->getRankGroup($post); } if (!empty($row)) { $res['code'] = 1; $res['data'] = $row; $res['msg'] = "获取成功"; } else { $res['code'] = 0; $res['data'] = []; $res['msg'] = "数据为空"; } return json($res); } /** * 根据赛事ID 获取决赛的所有成绩 * @Author:Soar * @Time:2023/11/23 11:09 * @return \think\response\Json */ public function getFinalsList() { // 解决跨域请求接口问题 header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies header('Access-Control-Expose-Headers: *'); //服务器 headers 白名单,可以让客户端进行访问 header('Access-Control-Allow-Headers: *'); $post['match_id'] = $this->request->param("match_id", 0); $post['name'] = $this->request->param("name", 0); if ($post['match_id'] != 0) { $rankingService = new RankingService(); $row = $rankingService->getRankFinals($post['match_id'],$post['name']); } if (!empty($row)) { $res['code'] = 1; $res['data'] = $row; $res['msg'] = "获取成功"; } else { $res['code'] = 0; $res['data'] = []; $res['msg'] = "数据为空"; } return json($res); } /** * 查询单个飞手的赛事成绩 * @Author:Soar * @Time:2023/11/23 11:07 * @return \think\response\Json */ public function getPlayerRanking() { // 解决跨域请求接口问题 header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies header('Access-Control-Expose-Headers: *'); //服务器 headers 白名单,可以让客户端进行访问 header('Access-Control-Allow-Headers: *'); $post['match_id'] = $this->request->param("match_id"); $post['player_id'] = $this->request->param("player_id"); if (!empty($post['match_id']) && $post['player_id']) { $rankingService = new RankingService(); $row = $rankingService->getPlayerRanking($post['match_id'], $post['player_id']); } if (!empty($row)) { $res['code'] = 1; $res['data'] = $row; $res['msg'] = "获取成功"; } else { $res['code'] = 0; $res['data'] = []; $res['msg'] = "数据为空"; } return json($res); } /** * 根据选手id、赛事id、赛程 获取所有轮次信息 * @Author:Soar * @Time:2023/12/12 16:53 * @return \think\response\Json */ public function getroundPlayer() { // 解决跨域请求接口问题 header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies header('Access-Control-Expose-Headers: *'); //服务器 headers 白名单,可以让客户端进行访问 header('Access-Control-Allow-Headers: *'); $match_id = $this->request->param("match_id");; $course = $this->request->param("course");; $player_id = $this->request->param("player_id");; if (empty($course) || empty($match_id) || empty($player_id)) { $this->error("非法请求!"); } $rankingService = new RankingService(); $row = $rankingService->getRoundPlayer($match_id, $course, $player_id); if (!empty($row)) { $res['code'] = 1; $res['data'] = $row; $res['msg'] = "获取成功"; } else { $res['code'] = 0; $res['data'] = []; $res['msg'] = "数据为空"; } return json($res); } /** * 前台报名页面,获取所有飞手成绩 * @Author:Soar * @Time:2023/12/18 11:15 * @return void */ public function getIndexRanking() { // 解决跨域请求接口问题 header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies header('Access-Control-Expose-Headers: *'); //服务器 headers 白名单,可以让客户端进行访问 header('Access-Control-Allow-Headers: *'); $match_id = $this->request->param("match_id");; if (empty($match_id)) { $this->error("非法请求!"); } $rankingService = new RankingService(); $row['thirty_two'] = $rankingService->getIndexRanking($match_id, 32); $row['sixteen'] = $rankingService->getIndexRanking($match_id, 16); $row['eight'] = $rankingService->getIndexRanking($match_id, 8); $row['four'] = $rankingService->getIndexRanking($match_id, 4); if (!empty($row)) { $res['code'] = 1; $res['data'] = $row; $res['msg'] = "获取成功"; } else { $res['code'] = 0; $res['data'] = []; $res['msg'] = "数据为空"; } return json($res); $this->success(); } public function getIndexRankingScore() { // 解决跨域请求接口问题 header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies header('Access-Control-Expose-Headers: *'); //服务器 headers 白名单,可以让客户端进行访问 header('Access-Control-Allow-Headers: *'); $match_id = $this->request->param("match_id");; if (empty($match_id)) { $this->error("非法请求!"); } $rankingService = new RankingService(); $row['thirty_two'] = $rankingService->getIndexRankingScore($match_id, 32); $row['sixteen'] = $rankingService->getIndexRankingScore($match_id, 16); $row['eight'] = $rankingService->getIndexRankingScore($match_id, 8); $row['four'] = $rankingService->getIndexRankingScore($match_id, 4); if (!empty($row)) { $res['code'] = 1; $res['data'] = $row; $res['msg'] = "获取成功"; } else { $res['code'] = 0; $res['data'] = []; $res['msg'] = "数据为空"; } return json($res); $this->success(); } /** * 详情页查询单个飞手最优成绩 * @Author:Soar * @Time:2023/12/21 15:52 * @return \think\response\Json */ public function getIndexPlayerRanking() { // 解决跨域请求接口问题 header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies header('Access-Control-Expose-Headers: *'); //服务器 headers 白名单,可以让客户端进行访问 header('Access-Control-Allow-Headers: *'); $post['match_id'] = $this->request->param("match_id"); $post['player_id'] = $this->request->param("player_id"); if (!empty($post['match_id']) && $post['player_id']) { $rankingService = new RankingService(); $row = $rankingService->getIndexPlayerRanking($post['match_id'], $post['player_id']); } if (!empty($row)) { $res['code'] = 1; $res['data'] = $row; $res['msg'] = "获取成功"; } else { $res['code'] = 0; $res['data'] = []; $res['msg'] = "数据为空"; } return json($res); } public function getCertificate() { // 解决跨域请求接口问题 header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies header('Access-Control-Expose-Headers: *'); //服务器 headers 白名单,可以让客户端进行访问 header('Access-Control-Allow-Headers: *'); $post['match_id'] = $this->request->param("match_id"); $post['player_id'] = $this->request->param("player_id"); if (!empty($post['match_id']) && $post['player_id']) { $rankingService = new RankingService(); $certificateService = new CertificateService(); $players = new \app\common\model\Players(); $player_info = $players->alias("a") ->join('user users', 'users.id = a.member_id', 'LEFT') ->where("a.id", $post['player_id']) ->find(); if (empty($players)) { $this->error("数据错误"); } $player_id = $player_info->member_number; $row['thirty_two'] = $rankingService->getOneRanking($post['match_id'], $player_id, 32); if (empty($row['thirty_two'])) { $this->error("数据错误或者比赛暂未开始!"); } $row['sixteen'] = $rankingService->getOneRanking($post['match_id'], $player_id, 16); $row['eight'] = $rankingService->getOneRanking($post['match_id'], $player_id, 8); $row['four'] = $rankingService->getOneRanking($post['match_id'], $player_id, 4); $row['finals'] = $rankingService->getFinalsIntegral($post['match_id'], $player_id); $row['player_info'] = $rankingService->getPlayerInfo($player_id); $row['bast'] = $rankingService->getPlayerBast($post['match_id'], $player_id, $row['player_info']); $addonproduct = db("cms_addonproduct"); $row['endtime'] = $addonproduct->where("id", $post['match_id'])->field("match_end_time, match_start_time, stime, etime, course_poster, is_open_course")->find(); // var_dump($row);exit; if (!empty($row['endtime']['course_poster'])) { $row['endtime']['course_poster'] = config("upload.cdnurl") ? config("upload.cdnurl").$row['endtime']['course_poster'] : config("upload.uploadurl").$row['endtime']['course_poster']; } if ($row['bast']['sort'] != 0) { $row['certificate_number']['certificate_number'] = $certificateService->getCertificate( [ 'match_id' => $post['match_id'], 'player_id' => $post['player_id'], 'member_id' => $row['player_info']['member_id'], 'club_id' => 0, ] ); } else { $row['certificate_number']['certificate_number'] = null; } } if (!empty($row)) { $res['code'] = 1; $res['data'] = $row; $res['msg'] = "获取成功"; } else { $res['code'] = 0; $res['data'] = []; $res['msg'] = "数据为空"; } return json($res); } }