| | |
| | | import cc.mrbird.febs.dapp.service.DappSimulateDataService; |
| | | import cc.mrbird.febs.dapp.service.DappSystemService; |
| | | import cc.mrbird.febs.dapp.service.IMallNewsInfoService; |
| | | import cc.mrbird.febs.dapp.soccer.dto.LeaguesApiDto; |
| | | import cc.mrbird.febs.dapp.vo.MallGoodsListVo; |
| | | import cc.mrbird.febs.dapp.vo.NewsListVo; |
| | | import cc.mrbird.febs.dapp.vo.SimulateDataVo; |
| | | import cc.mrbird.febs.rabbit.producer.ChainProducer; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.mashape.unirest.http.HttpResponse; |
| | | import com.mashape.unirest.http.Unirest; |
| | | import com.mashape.unirest.http.exceptions.UnirestException; |
| | |
| | | import io.swagger.annotations.ApiResponses; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jline.utils.Log; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | return new FebsResponse().success().data(news); |
| | | } |
| | | |
| | | @ApiOperation(value = "testApi", notes = "testApi") |
| | | @ApiOperation(value = "获取国家", notes = "获取国家") |
| | | @GetMapping(value = "/testApi") |
| | | public FebsResponse testApi() { |
| | | HttpResponse<String> response = null; |
| | |
| | | } catch (UnirestException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return new FebsResponse().success().data(response); |
| | | log.info(String.valueOf(response)); |
| | | log.info(response.getBody()); |
| | | log.info(String.valueOf(response.getRawBody())); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取联赛", notes = "获取联赛") |
| | | @PostMapping(value = "/leaguesApi") |
| | | public FebsResponse leaguesApi(LeaguesApiDto leaguesApiDto) { |
| | | HttpResponse<String> response = null; |
| | | int season = ObjectUtil.isEmpty(leaguesApiDto.getSeason()) ? DateUtil.date().year() : leaguesApiDto.getSeason(); |
| | | String current = ObjectUtil.isEmpty(leaguesApiDto.getCurrent()) ? "true" : leaguesApiDto.getCurrent(); |
| | | try { |
| | | /** |
| | | * https://v3.football.api-sports.io/leagues?season=2023¤t=true |
| | | */ |
| | | response = Unirest.get(" https://v3.football.api-sports.io/leagues") |
| | | .header("x-rapidapi-key", "87f8d87d629d1704ba49622cb978eb81") |
| | | .header("x-rapidapi-host", "v3.football.api-sports.io") |
| | | .queryString("season",season) |
| | | .queryString("current",current) |
| | | .asString(); |
| | | } catch (UnirestException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | log.info(String.valueOf(response)); |
| | | log.info(response.getBody()); |
| | | log.info(String.valueOf(response.getRawBody())); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | |