김윤지

Merge branch 'master' into 'master'

데이터 전송 안되는것 수정, 그래프 추가

데이터 전송 안되는것 수정, 그래프 추가

See merge request !8
...@@ -39,6 +39,7 @@ build/Release ...@@ -39,6 +39,7 @@ build/Release
39 # Dependency directories 39 # Dependency directories
40 node_modules/ 40 node_modules/
41 jspm_packages/ 41 jspm_packages/
42 +keys/
42 # TypeScript v1 declaration files 43 # TypeScript v1 declaration files
43 typings/ 44 typings/
44 45
......
1 -module.exports = {
2 - key: "aaaa"
3 -}
4 -//개인 Server Key 받아서 사용해야함, Browser key 안됨
...\ No newline at end of file ...\ No newline at end of file
1 -module.exports = {
2 - key: "aaaa"
3 -}
1 -module.exports = {
2 - host: 'localhost',
3 - user: 'root',
4 - password: 'Serrmica0!',
5 - database: 'db_option_total'
6 -}
...\ No newline at end of file ...\ No newline at end of file
...@@ -4,8 +4,8 @@ const secret_key_traffic = require('../keys/api_option_traffic').key; ...@@ -4,8 +4,8 @@ const secret_key_traffic = require('../keys/api_option_traffic').key;
4 4
5 const requesting = require('request'); 5 const requesting = require('request');
6 6
7 -const lat = "37.54922931758";//"37.239795"; //weather 위도 7 +const lat = "37.54922931758"; //weather 위도
8 -const lon = "126.913415969472";//"127.083240"; //weather 경도 8 +const lon = "126.913415969472"; //weather 경도
9 const sido_num = "11"; //traffic 법정동 시도 코드 9 const sido_num = "11"; //traffic 법정동 시도 코드
10 const gugun_num = "440"; //traffic 법정동 시군구 코드 - 합정동 일대 10 const gugun_num = "440"; //traffic 법정동 시군구 코드 - 합정동 일대
11 const search_year = "2018074"; //traffic 검색을 원하는 연도 11 const search_year = "2018074"; //traffic 검색을 원하는 연도
...@@ -42,17 +42,18 @@ module.exports = (server, app) => { ...@@ -42,17 +42,18 @@ module.exports = (server, app) => {
42 json: true 42 json: true
43 }, 43 },
44 //api에게 응답 받았을때 실행되는 callback function 44 //api에게 응답 받았을때 실행되는 callback function
45 - function (err, api_res, api_body) { 45 + function (err1, api_res1, api_body1) {
46 //err 존재시 promise reject 호출 46 //err 존재시 promise reject 호출
47 - if (err) reject(err); 47 + if (err1) reject(err1);
48 48
49 // api의 response이 있을경우 promise resolve 호출 49 // api의 response이 있을경우 promise resolve 호출
50 - if (api_res) { 50 + if (api_res1) {
51 console.log("calling weather api"); 51 console.log("calling weather api");
52 - resolve(api_body); 52 + resolve(api_body1);
53 } 53 }
54 }); 54 });
55 - }) 55 +
56 + }) //Promise
56 } 57 }
57 58
58 59
...@@ -63,12 +64,6 @@ module.exports = (server, app) => { ...@@ -63,12 +64,6 @@ module.exports = (server, app) => {
63 requesting.get({ 64 requesting.get({
64 // api를 요청할 주소 -- 시크릿키,위도,경도 입력 65 // api를 요청할 주소 -- 시크릿키,위도,경도 입력
65 url: `http://apis.data.go.kr/B552061/${cate1}/${cate2}?ServiceKey=${secret_key_traffic}&searchYearCd=${search_year}&siDo=${sido_num}&guGun=${gugun_num}&type=json&numOfRows=1&pageNo=1`, 66 url: `http://apis.data.go.kr/B552061/${cate1}/${cate2}?ServiceKey=${secret_key_traffic}&searchYearCd=${search_year}&siDo=${sido_num}&guGun=${gugun_num}&type=json&numOfRows=1&pageNo=1`,
66 - //나중에 삭제 http://apis.data.go.kr/B552061/frequentzoneLg/getRestFrequentzoneLg?ServiceKey=XOLqI9tY4gVCdk1i2BoOM3EYmSUYqt8WlXUfIDSfD4RnNBrFwwthbNAtGOxoskP540JbUAzcnuABsydoE2U2dA%3D%3D&searchYearCd=2017&siDo=11&guGun=200&type=json&numOfRows=10&pageNo=1
67 - //나중에 삭제 http://apis.data.go.kr/B552061/frequentzoneLg/getRestFrequentzoneLg?ServiceKey=XOLqI9tY4gVCdk1i2BoOM3EYmSUYqt8WlXUfIDSfD4RnNBrFwwthbNAtGOxoskP540JbUAzcnuABsydoE2U2dA%3D%3D&searchYearCd=2018074&siDo=11&guGun=440&type=json&numOfRows=10&pageNo=1
68 - //sido = 11 gugun = 440 (마포구 합정동, 도화동, 도화동)
69 - //cate1 = frequentzoneLg
70 - //cate2 = getRestFrequentzoneLg
71 - //xml: true
72 json: true 67 json: true
73 }, 68 },
74 //api에게 응답 받았을때 실행되는 callback function 69 //api에게 응답 받았을때 실행되는 callback function
...@@ -82,20 +77,26 @@ module.exports = (server, app) => { ...@@ -82,20 +77,26 @@ module.exports = (server, app) => {
82 resolve(api_body); 77 resolve(api_body);
83 } 78 }
84 }); 79 });
85 - }) 80 + }) //Promise
86 } 81 }
87 82
88 const API_bundle = async () => { 83 const API_bundle = async () => {
89 -
90 try { 84 try {
85 + var order = 0;
86 + while (order < 2) {
87 + switch (order) {
88 + case 0:
89 + console.log("APIWait - WAITING FOR ALL API");
91 Current_Weather = await req_API("current", "minutely"); //현재날씨 (분별) //when, what 90 Current_Weather = await req_API("current", "minutely"); //현재날씨 (분별) //when, what
92 Sensible_T = await req_API("index", "wct"); //체감온도 91 Sensible_T = await req_API("index", "wct"); //체감온도
93 Heat_index = await req_API("index", "heat"); //열지수 92 Heat_index = await req_API("index", "heat"); //열지수
94 Discomport_index = await req_API("index", "th"); //불쾌지수 93 Discomport_index = await req_API("index", "th"); //불쾌지수
95 Ultra_Violet_index = await req_API("index", "uv"); //자외선지수 94 Ultra_Violet_index = await req_API("index", "uv"); //자외선지수
96 -
97 Current_TrafficAcc = await req_API_traffic("frequentzoneLg", "getRestFrequentzoneLg"); //cate1, cate2 95 Current_TrafficAcc = await req_API_traffic("frequentzoneLg", "getRestFrequentzoneLg"); //cate1, cate2
98 - 96 + order = 1;
97 + break;
98 + case 1:
99 + console.log("APIDataProcess - CALLING INFO");
99 info = { 100 info = {
100 heat: Heat_index.weather.wIndex.heatIndex[0].current.index, //열지수 101 heat: Heat_index.weather.wIndex.heatIndex[0].current.index, //열지수
101 sensible_temperature: Sensible_T.weather.wIndex.wctIndex[0].current.index, //체감온도 102 sensible_temperature: Sensible_T.weather.wIndex.wctIndex[0].current.index, //체감온도
...@@ -180,6 +181,13 @@ module.exports = (server, app) => { ...@@ -180,6 +181,13 @@ module.exports = (server, app) => {
180 db_total.query(sql, [client_send.time, client_send.wind, client_send.temperature, client_send.rain, client_send.death, client_send.trafficdeath, client_send.mhurt, client_send.lhurt, client_send.occurence], (err, result) => { 181 db_total.query(sql, [client_send.time, client_send.wind, client_send.temperature, client_send.rain, client_send.death, client_send.trafficdeath, client_send.mhurt, client_send.lhurt, client_send.occurence], (err, result) => {
181 if (err) console.log(err); 182 if (err) console.log(err);
182 }) 183 })
184 + order = 2;
185 + break;
186 + default:
187 + order = 3;
188 + break;
189 + }//switch
190 + }; //while
183 191
184 } catch (err) { //promise err or try err catch 192 } catch (err) { //promise err or try err catch
185 console.log("================Error Occured !!================\n", err); 193 console.log("================Error Occured !!================\n", err);
......
...@@ -4,7 +4,7 @@ var db = require('../lib/db_total'); ...@@ -4,7 +4,7 @@ var db = require('../lib/db_total');
4 4
5 /* GET home page. */ 5 /* GET home page. */
6 6
7 -router.post('/starting' , (req,res) => { 7 +router.post('/starting', (req, res) => {
8 res.redirect(`/name/${req.body.name}/birth/${req.body.birth}`); 8 res.redirect(`/name/${req.body.name}/birth/${req.body.birth}`);
9 }) 9 })
10 router.get('/name/:name/birth/:birth', (req, res) => { 10 router.get('/name/:name/birth/:birth', (req, res) => {
...@@ -23,10 +23,10 @@ router.get('/name/:name/birth/:birth', (req, res) => { ...@@ -23,10 +23,10 @@ router.get('/name/:name/birth/:birth', (req, res) => {
23 const birth = req.params.birth; 23 const birth = req.params.birth;
24 //const address = req.params.address; 24 //const address = req.params.address;
25 //////////////////////////////////////// 25 ////////////////////////////////////////
26 - var deathArr = new Array(); 26 + var tdeathArr = new Array(); //사망자수
27 - var mhurtArr = new Array(); 27 + var mhurtArr = new Array(); //중상자수
28 - var lhurtArr = new Array(); 28 + var lhurtArr = new Array(); //경상자수
29 - var occurArr = new Array(); 29 + var occurArr = new Array(); //총 발생수
30 //////////////////////////////////////// 30 ////////////////////////////////////////
31 31
32 32
...@@ -48,7 +48,7 @@ router.get('/name/:name/birth/:birth', (req, res) => { ...@@ -48,7 +48,7 @@ router.get('/name/:name/birth/:birth', (req, res) => {
48 wsArr.unshift(rows[i].wind); 48 wsArr.unshift(rows[i].wind);
49 rainArr.unshift(rows[i].rain); 49 rainArr.unshift(rows[i].rain);
50 //// 50 ////
51 - deathArr.unshift(rows[i].tdeath); 51 + tdeathArr.unshift(rows[i].tdeath);
52 mhurtArr.unshift(rows[i].mhurt); 52 mhurtArr.unshift(rows[i].mhurt);
53 lhurtArr.unshift(rows[i].lhurt); 53 lhurtArr.unshift(rows[i].lhurt);
54 occurArr.unshift(rows[i].occurence); 54 occurArr.unshift(rows[i].occurence);
...@@ -71,7 +71,7 @@ router.get('/name/:name/birth/:birth', (req, res) => { ...@@ -71,7 +71,7 @@ router.get('/name/:name/birth/:birth', (req, res) => {
71 dataLen, 71 dataLen,
72 name, 72 name,
73 birth, 73 birth,
74 - deathArr, 74 + tdeathArr,
75 mhurtArr, 75 mhurtArr,
76 lhurtArr, 76 lhurtArr,
77 occurArr 77 occurArr
......
This diff is collapsed. Click to expand it.
1 -<!DOCTYPE <!DOCTYPE html> 1 +<!DOCTYPE
2 +
3 +<!DOCTYPE html>
2 <html> 4 <html>
3 5
4 -<head> 6 + <head>
5 <meta charset="utf-8" /> 7 <meta charset="utf-8" />
6 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 8 <meta http-equiv="X-UA-Compatible" content="IE=edge">
7 <title>Page Title</title> 9 <title>Page Title</title>
...@@ -9,7 +11,7 @@ ...@@ -9,7 +11,7 @@
9 <!-- font --> 11 <!-- font -->
10 <link href="https://fonts.googleapis.com/css?family=Nanum+Brush+Script&amp;subset=korean" rel="stylesheet"> 12 <link href="https://fonts.googleapis.com/css?family=Nanum+Brush+Script&amp;subset=korean" rel="stylesheet">
11 <link href="https://fonts.googleapis.com/css?family=Yeon+Sung&amp;subset=korean" rel="stylesheet"> 13 <link href="https://fonts.googleapis.com/css?family=Yeon+Sung&amp;subset=korean" rel="stylesheet">
12 - 14 + <link href="https://fonts.googleapis.com/css?family=Do+Hyeon&display=swap" rel="stylesheet">
13 <meta name="viewport" content="width=device-width, initial-scale=1"> 15 <meta name="viewport" content="width=device-width, initial-scale=1">
14 <link rel="stylesheet" type="text/css" media="screen" href="main.css" /> 16 <link rel="stylesheet" type="text/css" media="screen" href="main.css" />
15 <script src="main.js"></script> 17 <script src="main.js"></script>
...@@ -42,13 +44,14 @@ ...@@ -42,13 +44,14 @@
42 44
43 h1 { 45 h1 {
44 color: white; 46 color: white;
45 - font-family: 'Nanum Brush Script', cursive; 47 + font-family: 'Do Hyeon', sans-serif;
48 + //font-family: 'Nanum Brush Script', cursive;
46 } 49 }
47 50
48 label { 51 label {
49 color: white; 52 color: white;
50 font-size: 20px; 53 font-size: 20px;
51 - font-family: 'Yeon Sung', cursive; 54 + font-family: 'Do Hyeon', sans-serif;
52 } 55 }
53 56
54 #banner { 57 #banner {
...@@ -63,37 +66,41 @@ ...@@ -63,37 +66,41 @@
63 width: 100%; 66 width: 100%;
64 height: 50px; 67 height: 50px;
65 text-align: center; 68 text-align: center;
66 - font-family: 'Yeon Sung', cursive; 69 + font-family: 'Do Hyeon', sans-serif;
67 color: white; 70 color: white;
68 } 71 }
69 </style> 72 </style>
70 73
71 -</head> 74 + </head>
72 75
73 -<body> 76 + <body>
74 - <img src="images/background.jpg" alt="" style="z-index:-1; min-width: 100%; min-height: 100%"> 77 + <img src="images/newbackground.png" alt="" style="z-index:-1; min-width: 100%; min-height: 100%">
75 <div id="banner"> 78 <div id="banner">
76 <div style="width:100%; text-align: center; padding-top:170px;"> 79 <div style="width:100%; text-align: center; padding-top:170px;">
77 <h1 style="font-size:90px;">당신이 지금 죽을 확률은?</h1> 80 <h1 style="font-size:90px;">당신이 지금 죽을 확률은?</h1>
78 </div> 81 </div>
79 - <br><br><br> 82 + <br>
83 + <br>
84 + <br>
80 <div style="width:100%; text-align: center;"> 85 <div style="width:100%; text-align: center;">
81 <form action="/starting" method="post"> 86 <form action="/starting" method="post">
82 <div class="form-inline"> 87 <div class="form-inline">
83 <label>이름</label> 88 <label>이름</label>
84 - <input type="text" name="name" class="form-control" placeholder="김철수" style="width:200px;"> 89 + <input type="text" name="name" class="form-control" placeholder="조인화" style="width:200px;">
85 &nbsp &nbsp&nbsp&nbsp 90 &nbsp &nbsp&nbsp&nbsp
86 <label>생년월일</label> 91 <label>생년월일</label>
87 - <input type="text" name="birth" class="form-control" placeholder="971009" style="width:200px;"> 92 + <input type="text" name="birth" class="form-control" placeholder="991025" style="width:200px;">
88 - <br><br><br> 93 + <br>
89 - <input type="submit" value="시작하기" class="btn btn-default" style="font-family: 'Yeon Sung', cursive; width:100px;font-weight: bold; font-size: 18px; background-color: white;"> 94 + <br>
95 + <br>
96 + <input type="submit" value="시작하기" class="btn btn-default" style="font-family: 'Do Hyeon', sans-serif; width:100px;font-weight: bold; font-size: 18px; background-color: white;">
90 </div> 97 </div>
91 </form> 98 </form>
92 </div> 99 </div>
93 100
94 </div> 101 </div>
95 102
96 - <div id="footer">오픈소스SW개발 조민지 강환석 배희수</div> 103 + <div id="footer">오픈소스SW개발 김주희 김윤지 조인화</div>
97 -</body> 104 + </body>
98 105
99 </html> 106 </html>
...\ No newline at end of file ...\ No newline at end of file
......