Showing
1 changed file
with
25 additions
and
17 deletions
... | @@ -19,22 +19,31 @@ router.get('/', function(req, res, next) { | ... | @@ -19,22 +19,31 @@ router.get('/', function(req, res, next) { |
19 | // 이전 10분간 데이터 찾기 | 19 | // 이전 10분간 데이터 찾기 |
20 | sql = "SELECT * FROM weatherInfo WHERE time >= DATE_FORMAT(DATE_ADD(now(), INTERVAL -20 MINUTE), '%Y-%m-%d %H:%i:%s')"; | 20 | sql = "SELECT * FROM weatherInfo WHERE time >= DATE_FORMAT(DATE_ADD(now(), INTERVAL -20 MINUTE), '%Y-%m-%d %H:%i:%s')"; |
21 | db.query(sql, function(err, rows, fields){ | 21 | db.query(sql, function(err, rows, fields){ |
22 | - if (err) { | 22 | + if(err) |
23 | - console.log(err); | 23 | + { |
24 | - } else { | 24 | + console.log(err); |
25 | - if (rows.length == 0) { | 25 | + } |
26 | - empty = 1; | 26 | + else |
27 | - } else { | 27 | + { |
28 | - for (var i = rows.length - 1; i >= 0; i--){ | 28 | + if (rows.length == 0) |
29 | - probArr.unshift(rows[i].prob); | 29 | + { |
30 | - time.unshift(rows[i].time); | 30 | + empty = 1; |
31 | - ptArr.unshift(rows[i].temperature); | 31 | + } |
32 | - wsArr.unshift(rows[i].wind); | 32 | + else |
33 | - rainArr.unshift(rows[i].rain); | 33 | + { |
34 | - count = count + 1; | 34 | + for(var i = rows.length - 1; i >= 0; i--) |
35 | + { | ||
36 | + console.log('kk'); | ||
37 | + probArr.unshift(rows[i].prob); | ||
38 | + time.unshift(rows[i].time); | ||
39 | + ptArr.unshift(rows[i].temperature); | ||
40 | + wsArr.unshift(rows[i].wind); | ||
41 | + rainArr.unshift(rows[i].rain); | ||
42 | + count = count + 1; | ||
35 | 43 | ||
36 | - if (count == 10){ | 44 | + if (count == 10){ |
37 | - break; | 45 | + break; |
46 | + } | ||
38 | } | 47 | } |
39 | } | 48 | } |
40 | 49 | ||
... | @@ -49,8 +58,7 @@ router.get('/', function(req, res, next) { | ... | @@ -49,8 +58,7 @@ router.get('/', function(req, res, next) { |
49 | dataLen | 58 | dataLen |
50 | }); | 59 | }); |
51 | } | 60 | } |
52 | - } | 61 | + }); |
53 | -}); | ||
54 | }); | 62 | }); |
55 | 63 | ||
56 | module.exports = router; | 64 | module.exports = router; | ... | ... |
-
Please register or login to post a comment