初始化

master
法外狂徒张三 2024-09-03 22:36:06 +08:00
parent 93b176c279
commit 46cf10ff9a
1 changed files with 5 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import jakarta.servlet.http.HttpServletResponse;
import lombok.SneakyThrows;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -24,11 +25,12 @@ import java.util.stream.Collectors;
@RequestMapping("/third")
public class ThirdPartyController {
@SneakyThrows
@RequestMapping("/getAirQuality")
public void getAirQuality(@RequestParam String cityId, HttpServletResponse response) {
public void getAirQuality(@RequestParam String cityId, HttpServletResponse httpResponse) throws IOException {
String apiKey = "02ccc3ea04810432b45399ecb183195d";
String apiUrl = "http://apis.juhe.cn/fapigw/air/historyHours?key="+apiKey+"&cityId="+cityId;
response.sendRedirect(apiUrl);
httpResponse.getWriter().write(apiUrl);
httpResponse.getWriter().flush();
httpResponse.getWriter().close();
}
}