DESKTOP-PC6TBNS\강환석씨

db insertion complete

...@@ -35,6 +35,7 @@ module.exports = (server, app) => { ...@@ -35,6 +35,7 @@ module.exports = (server, app) => {
35 let Ultra_Violet_index={}; 35 let Ultra_Violet_index={};
36 let sending_to_client_info={}; 36 let sending_to_client_info={};
37 let client_send={}; 37 let client_send={};
38 + let sql;
38 39
39 socket.on("connection", () => { 40 socket.on("connection", () => {
40 API_CALL = setInterval(() => { 41 API_CALL = setInterval(() => {
...@@ -77,13 +78,19 @@ module.exports = (server, app) => { ...@@ -77,13 +78,19 @@ module.exports = (server, app) => {
77 ); 78 );
78 79
79 client_send={ 80 client_send={
80 - rain : info.rain, 81 + time : info.time,
81 wind : info.windspd, 82 wind : info.windspd,
82 temperature : info.current_temperature, 83 temperature : info.current_temperature,
84 + rain : info.rain,
83 death : info.death_prob 85 death : info.death_prob
84 - } 86 + };
85 87
88 + //db에 저장
89 + sql="INSERT INTO weatherInfo (time,wind,temperature,rain,prob) VALUES (?,?,?,?,?)";
90 + db.query(sql,[client_send.time,client_send.wind,client_send.temperature,client_send.rain,client_send.death],(err,result)=>{
91 + if(err) console.log(err);
86 socket.emit("weatherInfo_minutely_send_to_client",client_send); // 클라이언트에게 정보 담아서 이벤트 발산 92 socket.emit("weatherInfo_minutely_send_to_client",client_send); // 클라이언트에게 정보 담아서 이벤트 발산
93 + })
87 }, 60 * 1000); //1분마다 호출 94 }, 60 * 1000); //1분마다 호출
88 }); 95 });
89 96
......