rank) ? $req->rank : 0; $id = isset($req->id) ? $req->id : 0; $gameType = isset($req->gameType) ? $req->gameType : 0; // 赛事种类获取 $gameTypeModel = new \App\Models\StGameType(); $getGameTypeSelect = ['id', 'game_name', 'game_code']; $getGameTypeWhere['status'] = 1; if (empty($gameType)) { $msg = '运动类型为空'; return ['code' => $code, 'msg' => $msg, 'data' => '']; } $getGameTypeWhere['id'] = $gameType; $getGameType = $gameTypeModel -> getGameType($getGameTypeSelect, $getGameTypeWhere); // 获取级联数据 $cascadeModel = new \App\Models\Cascade(); /*$a = $cascadeModel -> getLeague('*', '', $getGameType[0]['game_code']); echo json_encode($a);die;*/ $result = []; switch ($rank) { // 级联关系[0洲,1国家,2联赛,3球队] case 0: $getResultSelect = ['id', 'title', 'source']; $result = $cascadeModel -> allArea($getResultSelect); break; case 1: $getResultSelect = ['country_id', 'name_chinese', 'name_english', 'country_ico', 'country_area', 'id', 'source']; $getResultWhere['country_area'] = $id; $result = $cascadeModel -> getCountryByArea($getResultSelect, $getResultWhere, $getGameType[0]['game_code'], $gameType); break; case 2: $getResultSelect = ['name_chinese', 'name_english', 'kind', 'league_pic', 'country_id', 'area_id', 'id', 'lg_id']; $getResultWhere['country_id'] = $id; $result = $cascadeModel -> league($getResultSelect, $getResultWhere, $getGameType[0]['game_code']); break; case 3: $getResultSelect = ['id', 'home_team', 'guest_team', 'lg_id']; $getResultWhere['lg_id'] = $id; $result['competition'] = $cascadeModel -> getCompetition($getResultSelect, $getResultWhere, $getGameType[0]['game_code']); break; } $msg = 'success'; return ['code' => $code, 'msg' => $msg, 'data' => $result]; } } ?>