| | |
| | | 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.soccer.entity.SoccerLeagues; |
| | | import cc.mrbird.febs.dapp.soccer.mapper.SoccerLeaguesMapper; |
| | | 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.collection.CollUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.mashape.unirest.http.HttpResponse; |
| | | import com.mashape.unirest.http.Unirest; |
| | | import com.mashape.unirest.http.exceptions.UnirestException; |
| | |
| | | |
| | | private final DappMemberService dappMemberService; |
| | | private final IMallNewsInfoService newsService; |
| | | private final SoccerLeaguesMapper soccerLeaguesMapper; |
| | | |
| | | @ApiOperation(value = "地址是否存在", notes = "地址是否存在") |
| | | @GetMapping(value = "/exist/{address}") |
| | |
| | | } |
| | | log.info(String.valueOf(response)); |
| | | log.info(response.getBody()); |
| | | JSONObject parseObj = JSONUtil.parseObj(response.getBody()); |
| | | Object responseStr = parseObj.get("response"); |
| | | JSONArray jsonArray = JSONUtil.parseArray(responseStr); |
| | | if(CollUtil.isNotEmpty(jsonArray)){ |
| | | for(Object list : jsonArray){ |
| | | cn.hutool.json.JSONObject parseObj1 = JSONUtil.parseObj(list); |
| | | Object leagueObj = parseObj1.get("league"); |
| | | cn.hutool.json.JSONObject parseObjLeague = JSONUtil.parseObj(leagueObj); |
| | | JSONObject leagueStr = JSONUtil.parseObj(parseObjLeague); |
| | | System.out.println(leagueStr); |
| | | int id = (int)leagueStr.get("id"); |
| | | String type = (String)leagueStr.get("type"); |
| | | String name = (String)leagueStr.get("name"); |
| | | String logo = (String)leagueStr.get("logo"); |
| | | System.out.println(id); |
| | | System.out.println(type); |
| | | System.out.println(name); |
| | | System.out.println(logo); |
| | | |
| | | SoccerLeagues soccerLeagues = new SoccerLeagues(); |
| | | soccerLeagues.setLeaguesId(id); |
| | | soccerLeagues.setLeaguesName(name); |
| | | soccerLeagues.setLeaguesType(type); |
| | | soccerLeagues.setLeaguesLogo(logo); |
| | | soccerLeaguesMapper.insert(soccerLeagues); |
| | | } |
| | | } |
| | | System.out.println(jsonArray); |
| | | log.info(String.valueOf(response.getRawBody())); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String json = "{\n" + |
| | | " \"get\": \"leagues\",\n" + |
| | | " \"parameters\": {\n" + |
| | | " \"id\": \"53\",\n" + |
| | | " \"season\": \"2023\",\n" + |
| | | " \"current\": \"true\"\n" + |
| | | " },\n" + |
| | | " \"errors\": [],\n" + |
| | | " \"results\": 1,\n" + |
| | | " \"paging\": {\n" + |
| | | " \"current\": 1,\n" + |
| | | " \"total\": 1\n" + |
| | | " },\n" + |
| | | " \"response\": [\n" + |
| | | " {\n" + |
| | | " \"league\": {\n" + |
| | | " \"id\": 53,\n" + |
| | | " \"name\": \"Non League Div One - Isthmian South Central\",\n" + |
| | | " \"type\": \"League\",\n" + |
| | | " \"logo\": \"https://media-4.api-sports.io/football/leagues/53.png\"\n" + |
| | | " },\n" + |
| | | " \"country\": {\n" + |
| | | " \"name\": \"England\",\n" + |
| | | " \"code\": \"GB\",\n" + |
| | | " \"flag\": \"https://media-4.api-sports.io/flags/gb.svg\"\n" + |
| | | " },\n" + |
| | | " \"seasons\": [\n" + |
| | | " {\n" + |
| | | " \"year\": 2023,\n" + |
| | | " \"start\": \"2023-08-12\",\n" + |
| | | " \"end\": \"2024-04-27\",\n" + |
| | | " \"current\": true,\n" + |
| | | " \"coverage\": {\n" + |
| | | " \"fixtures\": {\n" + |
| | | " \"events\": false,\n" + |
| | | " \"lineups\": false,\n" + |
| | | " \"statistics_fixtures\": false,\n" + |
| | | " \"statistics_players\": false\n" + |
| | | " },\n" + |
| | | " \"standings\": true,\n" + |
| | | " \"players\": true,\n" + |
| | | " \"top_scorers\": true,\n" + |
| | | " \"top_assists\": true,\n" + |
| | | " \"top_cards\": true,\n" + |
| | | " \"injuries\": false,\n" + |
| | | " \"predictions\": true,\n" + |
| | | " \"odds\": false\n" + |
| | | " }\n" + |
| | | " }\n" + |
| | | " ]\n" + |
| | | " }\n" + |
| | | " ]\n" + |
| | | "}\n"; |
| | | |
| | | JSONObject parseObj = JSONUtil.parseObj(json); |
| | | Object response = parseObj.get("response"); |
| | | JSONArray jsonArray = JSONUtil.parseArray(response); |
| | | if(CollUtil.isNotEmpty(jsonArray)){ |
| | | for(Object list : jsonArray){ |
| | | JSONObject parseObj1 = JSONUtil.parseObj(list); |
| | | Object leagueObj = parseObj1.get("league"); |
| | | JSONObject parseObjLeague = JSONUtil.parseObj(leagueObj); |
| | | JSONObject leagueStr = JSONUtil.parseObj(parseObjLeague); |
| | | System.out.println(leagueStr); |
| | | int id = (int)leagueStr.get("id"); |
| | | String type = (String)leagueStr.get("type"); |
| | | String name = (String)leagueStr.get("name"); |
| | | String logo = (String)leagueStr.get("logo"); |
| | | System.out.println(id); |
| | | System.out.println(type); |
| | | System.out.println(name); |
| | | System.out.println(logo); |
| | | |
| | | |
| | | } |
| | | } |
| | | System.out.println(jsonArray); |
| | | } |
| | | |
| | | |
| | | // @ApiOperation(value = "头部数据", notes = "头部数据") |
| | | // @GetMapping(value = "/totalIncome") |