김주희

Merge branch 'design' to 'master'

var express = require('express');
var router = express.Router();
var db = require('../lib/db');
var db = require('../lib/db_total');
/* GET home page. */
router.post('/starting' , (req,res) => {
res.redirect(`/name/${req.body.name}/birth/${req.body.birth}`);
})
router.get('/name/:name/birth/:birth', (req,res) => {
router.get('/name/:name/birth/:birth', (req, res) => {
// 렌더링 변수
var time = new Array(); // 타임스탬프
......@@ -21,32 +21,40 @@ router.get('/name/:name/birth/:birth', (req,res) => {
var count = 0;
const name = req.params.name;
const birth = req.params.birth;
//const address = req.params.address;
////////////////////////////////////////
var deathArr = new Array();
var mhurtArr = new Array();
var lhurtArr = new Array();
var occurArr = new Array();
////////////////////////////////////////
// 이전 10분간 데이터 찾기
sql = "SELECT * FROM weatherInfo WHERE time >= DATE_FORMAT(DATE_ADD(now(), INTERVAL -20 MINUTE), '%Y-%m-%d %H:%i:%s')";
db.query(sql, function(err, rows, fields){
if(err)
{
sql = "SELECT * FROM apisInfo WHERE time >= DATE_FORMAT(DATE_ADD(now(), INTERVAL -20 MINUTE), '%Y-%m-%d %H:%i:%s')";
db.query(sql, function (err, rows, fields) {
if (err) {
console.log(err);
}
else
{
if (rows.length == 0)
{
else {
if (rows.length == 0) {
empty = 1;
}
else
{
for(var i = rows.length - 1; i >= 0; i--)
{
else {
for (var i = rows.length - 1; i >= 0; i--) {
probArr.unshift(rows[i].prob);
time.unshift(rows[i].time);
ptArr.unshift(rows[i].temperature);
wsArr.unshift(rows[i].wind);
rainArr.unshift(rows[i].rain);
////
deathArr.unshift(rows[i].tdeath);
mhurtArr.unshift(rows[i].mhurt);
lhurtArr.unshift(rows[i].lhurt);
occurArr.unshift(rows[i].occurence);
count = count + 1;
if (count == 10){
if (count == 10) {
break;
}
}
......@@ -62,13 +70,17 @@ router.get('/name/:name/birth/:birth', (req,res) => {
probArr,
dataLen,
name,
birth
birth,
deathArr,
mhurtArr,
lhurtArr,
occurArr
});
}
});
} )
router.get('/', function(req, res, next) {
res.render( 'main' );
})
router.get('/', function (req, res, next) {
res.render('main');
});
module.exports = router;
......
This diff is collapsed. Click to expand it.
<!-- <!DOCTYPE html>
<html>
<head>
<!-- font -->
<link href="https://fonts.googleapis.com/css?family=Nanum+Brush+Script&amp;subset=korean" rel="stylesheet" />
......@@ -39,7 +38,7 @@
<script src="modules/exporting.js"></script>
<script src="modules/export-data.js"></script>
<img src="images/background.jpg" alt="" style="z-index:-1; min-width: 100%; min-height: 100%">
<img src="images/newbackground.png" alt="" style="z-index:-1; min-width: 100%; min-height: 100%">
<div id="banner">
<div id="container1" style="width:1260px; height: 400px; margin: 0 auto;"></div>
......
......@@ -34,7 +34,7 @@
margin: 0;
padding: 0;
/* background-image: url('background.jpg');
/* background-image: url('newbackground.png');
background-repeat: no-repeat;
background-size: cover; */
/* background: linear-gradient( to bottom, #fbc2eb, #a6c1ee ); */
......
......@@ -21,7 +21,7 @@
/* background: linear-gradient( to bottom, #65799B, rgb(38, 14, 41) ); */
/* background-color:#65799B; */
/* background-image: url("2.jpg");
/* background-image: url("newbackground.png");
background-repeat: no-repeat;
background-size: cover; */
}
......@@ -38,7 +38,7 @@
<script src="highcharts.js"></script>
<script src="modules/exporting.js"></script>
<script src="modules/export-data.js"></script>
<img src="images/background.jpg" alt="" style="z-index:-1; min-width: 100%; min-height: 100%">
<img src="images/newbackground.png" alt="" style="z-index:-1; min-width: 100%; min-height: 100%">
<div id="banner">
<div id="container1" style="width:1260px; height: 400px; margin: 0 auto"></div>
......