Showing
9 changed files
with
117 additions
and
106 deletions
developImg/3_Image.PNG
0 → 100644
249 KB
graph/newbackground.png
0 → 100644
1.18 MB
public/images/newbackground.png
0 → 100644
1.18 MB
1 | var express = require('express'); | 1 | var express = require('express'); |
2 | var router = express.Router(); | 2 | var router = express.Router(); |
3 | -var db = require('../lib/db'); | 3 | +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) => { |
11 | - | ||
12 | - // 렌더링 변수 | ||
13 | - var time = new Array(); // 타임스탬프 | ||
14 | - var ptArr = new Array(); // 현재 온도 | ||
15 | - var wsArr = new Array(); // 풍속 | ||
16 | - var rainArr = new Array(); // 강우량 | ||
17 | - var probArr = new Array(); // 사망 확률 | ||
18 | - var dataLen = 0; // 데이터 개수 | ||
19 | - var empty = 0; // 초기값 유뮤, 0 : 자료 있음, 1 : 자료 없음 | ||
20 | - var sql = ""; // 쿼리 | ||
21 | - var count = 0; | ||
22 | - const name = req.params.name; | ||
23 | - const birth = req.params.birth; | ||
24 | 11 | ||
25 | - // 이전 10분간 데이터 찾기 | 12 | + // 렌더링 변수 |
26 | - sql = "SELECT * FROM weatherInfo WHERE time >= DATE_FORMAT(DATE_ADD(now(), INTERVAL -20 MINUTE), '%Y-%m-%d %H:%i:%s')"; | 13 | + var time = new Array(); // 타임스탬프 |
27 | - db.query(sql, function(err, rows, fields){ | 14 | + var ptArr = new Array(); // 현재 온도 |
28 | - if(err) | 15 | + var wsArr = new Array(); // 풍속 |
29 | - { | 16 | + var rainArr = new Array(); // 강우량 |
30 | - console.log(err); | 17 | + var probArr = new Array(); // 사망 확률 |
31 | - } | 18 | + var dataLen = 0; // 데이터 개수 |
32 | - else | 19 | + var empty = 0; // 초기값 유뮤, 0 : 자료 있음, 1 : 자료 없음 |
33 | - { | 20 | + var sql = ""; // 쿼리 |
34 | - if (rows.length == 0) | 21 | + var count = 0; |
35 | - { | 22 | + const name = req.params.name; |
36 | - empty = 1; | 23 | + const birth = req.params.birth; |
37 | - } | 24 | + //const address = req.params.address; |
38 | - else | 25 | + //////////////////////////////////////// |
39 | - { | 26 | + var deathArr = new Array(); |
40 | - for(var i = rows.length - 1; i >= 0; i--) | 27 | + var mhurtArr = new Array(); |
41 | - { | 28 | + var lhurtArr = new Array(); |
42 | - probArr.unshift(rows[i].prob); | 29 | + var occurArr = new Array(); |
43 | - time.unshift(rows[i].time); | 30 | + //////////////////////////////////////// |
44 | - ptArr.unshift(rows[i].temperature); | ||
45 | - wsArr.unshift(rows[i].wind); | ||
46 | - rainArr.unshift(rows[i].rain); | ||
47 | - count = count + 1; | ||
48 | 31 | ||
49 | - if (count == 10){ | 32 | + |
50 | - break; | 33 | + // 이전 10분간 데이터 찾기 |
51 | - } | 34 | + sql = "SELECT * FROM apisInfo WHERE time >= DATE_FORMAT(DATE_ADD(now(), INTERVAL -20 MINUTE), '%Y-%m-%d %H:%i:%s')"; |
35 | + db.query(sql, function (err, rows, fields) { | ||
36 | + if (err) { | ||
37 | + console.log(err); | ||
52 | } | 38 | } |
53 | - } | 39 | + else { |
40 | + if (rows.length == 0) { | ||
41 | + empty = 1; | ||
42 | + } | ||
43 | + else { | ||
44 | + for (var i = rows.length - 1; i >= 0; i--) { | ||
45 | + probArr.unshift(rows[i].prob); | ||
46 | + time.unshift(rows[i].time); | ||
47 | + ptArr.unshift(rows[i].temperature); | ||
48 | + wsArr.unshift(rows[i].wind); | ||
49 | + rainArr.unshift(rows[i].rain); | ||
50 | + //// | ||
51 | + deathArr.unshift(rows[i].tdeath); | ||
52 | + mhurtArr.unshift(rows[i].mhurt); | ||
53 | + lhurtArr.unshift(rows[i].lhurt); | ||
54 | + occurArr.unshift(rows[i].occurence); | ||
55 | + count = count + 1; | ||
56 | + | ||
57 | + if (count == 10) { | ||
58 | + break; | ||
59 | + } | ||
60 | + } | ||
61 | + } | ||
54 | 62 | ||
55 | - dataLen = probArr.length; | 63 | + dataLen = probArr.length; |
56 | - res.render('index', { | 64 | + res.render('index', { |
57 | - empty, | 65 | + empty, |
58 | - time, | 66 | + time, |
59 | - ptArr, | 67 | + ptArr, |
60 | - wsArr, | 68 | + wsArr, |
61 | - rainArr, | 69 | + rainArr, |
62 | - probArr, | 70 | + probArr, |
63 | - dataLen, | 71 | + dataLen, |
64 | - name, | 72 | + name, |
65 | - birth | 73 | + birth, |
66 | - }); | 74 | + deathArr, |
67 | - } | 75 | + mhurtArr, |
68 | - }); | 76 | + lhurtArr, |
69 | -} ) | 77 | + occurArr |
70 | -router.get('/', function(req, res, next) { | 78 | + }); |
71 | - res.render( 'main' ); | 79 | + } |
80 | + }); | ||
81 | +}) | ||
82 | +router.get('/', function (req, res, next) { | ||
83 | + res.render('main'); | ||
72 | }); | 84 | }); |
73 | 85 | ||
74 | module.exports = router; | 86 | module.exports = router; | ... | ... |
views/index - 복사본.ejs
deleted
100644 → 0
This diff is collapsed. Click to expand it.
1 | <!-- <!DOCTYPE html> | 1 | <!-- <!DOCTYPE html> |
2 | <html> | 2 | <html> |
3 | - | ||
4 | <head> | 3 | <head> |
5 | <!-- font --> | 4 | <!-- font --> |
6 | <link href="https://fonts.googleapis.com/css?family=Nanum+Brush+Script&subset=korean" rel="stylesheet" /> | 5 | <link href="https://fonts.googleapis.com/css?family=Nanum+Brush+Script&subset=korean" rel="stylesheet" /> |
... | @@ -39,7 +38,7 @@ | ... | @@ -39,7 +38,7 @@ |
39 | <script src="modules/exporting.js"></script> | 38 | <script src="modules/exporting.js"></script> |
40 | <script src="modules/export-data.js"></script> | 39 | <script src="modules/export-data.js"></script> |
41 | 40 | ||
42 | - <img src="images/background.jpg" alt="" style="z-index:-1; min-width: 100%; min-height: 100%"> | 41 | + <img src="images/newbackground.png" alt="" style="z-index:-1; min-width: 100%; min-height: 100%"> |
43 | 42 | ||
44 | <div id="banner"> | 43 | <div id="banner"> |
45 | <div id="container1" style="width:1260px; height: 400px; margin: 0 auto;"></div> | 44 | <div id="container1" style="width:1260px; height: 400px; margin: 0 auto;"></div> | ... | ... |
... | @@ -24,48 +24,48 @@ | ... | @@ -24,48 +24,48 @@ |
24 | <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script> | 24 | <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script> |
25 | 25 | ||
26 | <style type="text/css"> | 26 | <style type="text/css"> |
27 | - html, | 27 | + html, |
28 | - { | 28 | + { |
29 | - margin: 0; | 29 | + margin: 0; |
30 | - padding: 0; | 30 | + padding: 0; |
31 | - } | 31 | + } |
32 | - | 32 | + |
33 | - body { | 33 | + body { |
34 | - margin: 0; | 34 | + margin: 0; |
35 | - padding: 0; | 35 | + padding: 0; |
36 | - | 36 | + |
37 | - /* background-image: url('background.jpg'); | 37 | + /* background-image: url('newbackground.png'); |
38 | - background-repeat: no-repeat; | 38 | + background-repeat: no-repeat; |
39 | - background-size: cover; */ | 39 | + background-size: cover; */ |
40 | - /* background: linear-gradient( to bottom, #fbc2eb, #a6c1ee ); */ | 40 | + /* background: linear-gradient( to bottom, #fbc2eb, #a6c1ee ); */ |
41 | - } | 41 | + } |
42 | - | 42 | + |
43 | - h1 { | 43 | + h1 { |
44 | - color: white; | 44 | + color: white; |
45 | - font-family: 'Nanum Brush Script', cursive; | 45 | + font-family: 'Nanum Brush Script', cursive; |
46 | - } | 46 | + } |
47 | - | 47 | + |
48 | - label { | 48 | + label { |
49 | - color: white; | 49 | + color: white; |
50 | - font-size: 20px; | 50 | + font-size: 20px; |
51 | - font-family: 'Yeon Sung', cursive; | 51 | + font-family: 'Yeon Sung', cursive; |
52 | - } | 52 | + } |
53 | - | 53 | + |
54 | - #banner { | 54 | + #banner { |
55 | - position: absolute; | 55 | + position: absolute; |
56 | - top: 0; | 56 | + top: 0; |
57 | - width: 100%; | 57 | + width: 100%; |
58 | - } | 58 | + } |
59 | - | 59 | + |
60 | - #footer { | 60 | + #footer { |
61 | - position: absolute; | 61 | + position: absolute; |
62 | - bottom: 0; | 62 | + bottom: 0; |
63 | - width: 100%; | 63 | + width: 100%; |
64 | - height: 50px; | 64 | + height: 50px; |
65 | - text-align: center; | 65 | + text-align: center; |
66 | - font-family: 'Yeon Sung', cursive; | 66 | + font-family: 'Yeon Sung', cursive; |
67 | - color: white; | 67 | + color: white; |
68 | - } | 68 | + } |
69 | </style> | 69 | </style> |
70 | 70 | ||
71 | </head> | 71 | </head> | ... | ... |
views/newbackground.png
0 → 100644
1.18 MB
... | @@ -21,7 +21,7 @@ | ... | @@ -21,7 +21,7 @@ |
21 | 21 | ||
22 | /* background: linear-gradient( to bottom, #65799B, rgb(38, 14, 41) ); */ | 22 | /* background: linear-gradient( to bottom, #65799B, rgb(38, 14, 41) ); */ |
23 | /* background-color:#65799B; */ | 23 | /* background-color:#65799B; */ |
24 | - /* background-image: url("2.jpg"); | 24 | + /* background-image: url("newbackground.png"); |
25 | background-repeat: no-repeat; | 25 | background-repeat: no-repeat; |
26 | background-size: cover; */ | 26 | background-size: cover; */ |
27 | } | 27 | } |
... | @@ -38,7 +38,7 @@ | ... | @@ -38,7 +38,7 @@ |
38 | <script src="highcharts.js"></script> | 38 | <script src="highcharts.js"></script> |
39 | <script src="modules/exporting.js"></script> | 39 | <script src="modules/exporting.js"></script> |
40 | <script src="modules/export-data.js"></script> | 40 | <script src="modules/export-data.js"></script> |
41 | - <img src="images/background.jpg" alt="" style="z-index:-1; min-width: 100%; min-height: 100%"> | 41 | + <img src="images/newbackground.png" alt="" style="z-index:-1; min-width: 100%; min-height: 100%"> |
42 | 42 | ||
43 | <div id="banner"> | 43 | <div id="banner"> |
44 | <div id="container1" style="width:1260px; height: 400px; margin: 0 auto"></div> | 44 | <div id="container1" style="width:1260px; height: 400px; margin: 0 auto"></div> | ... | ... |
-
Please register or login to post a comment