|
|
@@ -0,0 +1,25 @@
|
|
|
+package cn.com.oa.controller;
|
|
|
+
|
|
|
+import cn.com.v2.common.domain.AjaxResult;
|
|
|
+import cn.hutool.http.HttpRequest;
|
|
|
+import cn.hutool.http.HttpResponse;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取天气
|
|
|
+ *
|
|
|
+ * @author: wangpx
|
|
|
+ * @date: 2025-02-12 10:40
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/api/common")
|
|
|
+public class CommonController {
|
|
|
+
|
|
|
+ @GetMapping("/weather")
|
|
|
+ public AjaxResult getWeather() {
|
|
|
+ HttpResponse response = HttpRequest.get("https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/25%2C119?unitGroup=metric&elements=datetime%2Ctemp%2Cpreciptype&include=current&key=PA6TZ5RK5NS48644CHCKX6FGK&contentType=json").execute();
|
|
|
+ return AjaxResult.successData(200, response.body()).put("msg","获取成功");
|
|
|
+ }
|
|
|
+}
|