Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2019-2-OpenSourceSW
/
Probability Death
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
배희수
2018-12-11 19:22:22 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a160005120d4fda628269263a57472d86c7ee2c5
a1600051
1 parent
567b8445
렌더링 오류 수정
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
17 deletions
routes/index.js
routes/index.js
View file @
a160005
...
...
@@ -19,22 +19,31 @@ router.get('/', function(req, res, next) {
// 이전 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
)
{
console
.
log
(
err
);
}
else
{
if
(
rows
.
length
==
0
)
{
empty
=
1
;
}
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
);
count
=
count
+
1
;
if
(
err
)
{
console
.
log
(
err
);
}
else
{
if
(
rows
.
length
==
0
)
{
empty
=
1
;
}
else
{
for
(
var
i
=
rows
.
length
-
1
;
i
>=
0
;
i
--
)
{
console
.
log
(
'kk'
);
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
);
count
=
count
+
1
;
if
(
count
==
10
){
break
;
if
(
count
==
10
){
break
;
}
}
}
...
...
@@ -49,8 +58,7 @@ router.get('/', function(req, res, next) {
dataLen
});
}
}
});
});
});
module
.
exports
=
router
;
...
...
Please
register
or
login
to post a comment