[後端] 修改天氣預報的api
This commit is contained in:
		
							parent
							
								
									aad4e8e0f4
								
							
						
					
					
						commit
						9f75864955
					
				@ -120,7 +120,7 @@ namespace BackendWorkerService.Quartz.Jobs
 | 
				
			|||||||
                        await task_Detail.InsertWorkTime("WeatherAPI", "api_weateher");
 | 
					                        await task_Detail.InsertWorkTime("WeatherAPI", "api_weateher");
 | 
				
			||||||
                        var client = new HttpClient();
 | 
					                        var client = new HttpClient();
 | 
				
			||||||
                        var DataNO = "F-D0047-061";
 | 
					                        var DataNO = "F-D0047-061";
 | 
				
			||||||
                        var UVUri = "https://opendata.cwb.gov.tw/api/v1/rest/datastore/F-D0047-061?Authorization=CWB-EA24220B-DDCC-4188-84E5-AD37A0E03F80&format=JSON&locationName=%E4%BF%A1%E7%BE%A9%E5%8D%80&elementName=Wx,PoP12h,T,RH";
 | 
					                        var UVUri = "https://opendata.cwa.gov.tw/api/v1/rest/datastore/F-D0047-061?Authorization=CWB-EA24220B-DDCC-4188-84E5-AD37A0E03F80&format=JSON&locationName=%E4%BF%A1%E7%BE%A9%E5%8D%80&elementName=Wx,PoP12h,T,RH";
 | 
				
			||||||
                        HttpResponseMessage response = client.GetAsync(UVUri).Result;
 | 
					                        HttpResponseMessage response = client.GetAsync(UVUri).Result;
 | 
				
			||||||
                        String jsonUVs = response.Content.ReadAsStringAsync().Result.ToString();
 | 
					                        String jsonUVs = response.Content.ReadAsStringAsync().Result.ToString();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -212,7 +212,7 @@ namespace BackendWorkerService.Quartz.Jobs
 | 
				
			|||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        await task_Detail.InsertWorkTime("WeatherAPI", "api_rain", null, new DateTime(DateTime.Now.AddDays(1).Year, DateTime.Now.AddDays(1).Month, DateTime.Now.AddDays(1).Day, 0, 25, 0));
 | 
					                        await task_Detail.InsertWorkTime("WeatherAPI", "api_rain", null, new DateTime(DateTime.Now.AddDays(1).Year, DateTime.Now.AddDays(1).Month, DateTime.Now.AddDays(1).Day, 0, 25, 0));
 | 
				
			||||||
                        WebClient mywebClient = new WebClient();
 | 
					                        WebClient mywebClient = new WebClient();
 | 
				
			||||||
                        mywebClient.DownloadFile("https://opendata.cwb.gov.tw/fileapi/v1/opendataapi/W-C0033-003?Authorization=CWB-EA24220B-DDCC-4188-84E5-AD37A0E03F80&downloadType=WEB&format=CAP", @"root/PowerfulRain.xml");
 | 
					                        mywebClient.DownloadFile("https://opendata.cwa.gov.tw/fileapi/v1/opendataapi/W-C0033-003?Authorization=CWB-EA24220B-DDCC-4188-84E5-AD37A0E03F80&downloadType=WEB&format=CAP", @"root/PowerfulRain.xml");
 | 
				
			||||||
                        XmlDocument doc = new XmlDocument();
 | 
					                        XmlDocument doc = new XmlDocument();
 | 
				
			||||||
                        doc.Load("root/PowerfulRain.xml");
 | 
					                        doc.Load("root/PowerfulRain.xml");
 | 
				
			||||||
                        var json = JsonConvert.SerializeXmlNode(doc);
 | 
					                        var json = JsonConvert.SerializeXmlNode(doc);
 | 
				
			||||||
@ -298,7 +298,7 @@ namespace BackendWorkerService.Quartz.Jobs
 | 
				
			|||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        await task_Detail.InsertWorkTime("WeatherAPI", "api_typhoon", null , new DateTime(DateTime.Now.AddDays(1).Year, DateTime.Now.AddDays(1).Month, DateTime.Now.AddDays(1).Day, 0, 25, 0));
 | 
					                        await task_Detail.InsertWorkTime("WeatherAPI", "api_typhoon", null , new DateTime(DateTime.Now.AddDays(1).Year, DateTime.Now.AddDays(1).Month, DateTime.Now.AddDays(1).Day, 0, 25, 0));
 | 
				
			||||||
                        WebClient mywebClient = new WebClient();
 | 
					                        WebClient mywebClient = new WebClient();
 | 
				
			||||||
                        mywebClient.DownloadFile("https://opendata.cwb.gov.tw/fileapi/v1/opendataapi/W-C0034-001?Authorization=CWB-EA24220B-DDCC-4188-84E5-AD37A0E03F80&downloadType=WEB&format=CAP", @"root/Typhoon.xml");
 | 
					                        mywebClient.DownloadFile("https://opendata.cwa.gov.tw/fileapi/v1/opendataapi/W-C0034-001?Authorization=CWB-EA24220B-DDCC-4188-84E5-AD37A0E03F80&downloadType=WEB&format=CAP", @"root/Typhoon.xml");
 | 
				
			||||||
                        XmlDocument doc = new XmlDocument();
 | 
					                        XmlDocument doc = new XmlDocument();
 | 
				
			||||||
                        doc.Load("root/Typhoon.xml");
 | 
					                        doc.Load("root/Typhoon.xml");
 | 
				
			||||||
                        var json = JsonConvert.SerializeXmlNode(doc);
 | 
					                        var json = JsonConvert.SerializeXmlNode(doc);
 | 
				
			||||||
@ -386,7 +386,7 @@ namespace BackendWorkerService.Quartz.Jobs
 | 
				
			|||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        await task_Detail.InsertWorkTime("WeatherAPI", "api_earthquake");
 | 
					                        await task_Detail.InsertWorkTime("WeatherAPI", "api_earthquake");
 | 
				
			||||||
                        var client = new HttpClient();
 | 
					                        var client = new HttpClient();
 | 
				
			||||||
                        var UVUri = "https://opendata.cwb.gov.tw/api/v1/rest/datastore/E-A0015-001?Authorization=CWB-EA24220B-DDCC-4188-84E5-AD37A0E03F80&format=JSON&areaName=%E8%87%BA%E5%8C%97%E5%B8%82";
 | 
					                        var UVUri = "https://opendata.cwa.gov.tw/api/v1/rest/datastore/E-A0015-001?Authorization=CWB-EA24220B-DDCC-4188-84E5-AD37A0E03F80&format=JSON&areaName=%E8%87%BA%E5%8C%97%E5%B8%82";
 | 
				
			||||||
                        HttpResponseMessage response = client.GetAsync(UVUri).Result;
 | 
					                        HttpResponseMessage response = client.GetAsync(UVUri).Result;
 | 
				
			||||||
                        String jsonUVs = response.Content.ReadAsStringAsync().Result.ToString();
 | 
					                        String jsonUVs = response.Content.ReadAsStringAsync().Result.ToString();
 | 
				
			||||||
                        var j = JsonConvert.DeserializeObject(jsonUVs);
 | 
					                        var j = JsonConvert.DeserializeObject(jsonUVs);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user