| | |
| | | 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; |
| | |
| | | } |
| | | 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){ |
| | | JSONObject parseObj1 = JSONUtil.parseObj(list); |
| | | |
| | | System.out.println(parseObj1); |
| | | } |
| | | } |
| | | 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); |
| | | |
| | | System.out.println(parseObj1); |
| | | } |
| | | } |
| | | System.out.println(jsonArray); |
| | | } |
| | | |
| | | |
| | | // @ApiOperation(value = "头部数据", notes = "头部数据") |
| | | // @GetMapping(value = "/totalIncome") |