Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김건희
/
OSSW_Weather_Briefing
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
Seokjin
2022-06-09 00:38:50 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b6bbed104c582bee250b48714957aba905afb433
b6bbed10
1 parent
cc906e0a
[UPDATE]weather/tommorrow
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
weather_briefing/server/server.js
weather_briefing/server/test.js
weather_briefing/server/server.js
View file @
b6bbed1
...
...
@@ -106,6 +106,8 @@ if(today.getDate()<10){
base
=
CurDay
+
"0"
+
(
today
.
getDate
()
-
1
).
toString
();
tommorow
=
CurDay
+
"0"
+
(
today
.
getDate
()
+
1
).
toString
();
CurDay
+=
"0"
+
today
.
getDate
().
toString
();
}
else
{
...
...
@@ -150,7 +152,7 @@ app.post('/api/weather',(req,res)=>{
queryParams
+=
'&'
+
encodeURIComponent
(
'numOfRows'
)
+
'='
+
encodeURIComponent
(
'1000'
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'dataType'
)
+
'='
+
encodeURIComponent
(
'JSON'
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'base_date'
)
+
'='
+
encodeURIComponent
(
base
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'base_time'
)
+
'='
+
encodeURIComponent
(
'23
00
'
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'base_time'
)
+
'='
+
encodeURIComponent
(
'23
59
'
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'nx'
)
+
'='
+
encodeURIComponent
(
nx
);
/*nx*/
queryParams
+=
'&'
+
encodeURIComponent
(
'ny'
)
+
'='
+
encodeURIComponent
(
ny
);
/*ny*/
request
({
...
...
@@ -204,11 +206,12 @@ app.post('/api/tommorrow',(req,res)=>{
var
url
=
'http://apis.data.go.kr/1360000/VilageFcstInfoService_2.0/getVilageFcst'
;
const
nx
=
req
.
body
.
dotX
;
const
ny
=
req
.
body
.
dotY
;
queryParams
+=
'&'
+
encodeURIComponent
(
'pageNo'
)
+
'='
+
encodeURIComponent
(
'1'
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'numOfRows'
)
+
'='
+
encodeURIComponent
(
'1000'
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'dataType'
)
+
'='
+
encodeURIComponent
(
'JSON'
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'base_date'
)
+
'='
+
encodeURIComponent
(
CurDay
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'base_time'
)
+
'='
+
encodeURIComponent
(
'
0200
'
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'base_date'
)
+
'='
+
encodeURIComponent
(
base
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'base_time'
)
+
'='
+
encodeURIComponent
(
'
2359
'
);
/* */
queryParams
+=
'&'
+
encodeURIComponent
(
'nx'
)
+
'='
+
encodeURIComponent
(
nx
);
/*nx*/
queryParams
+=
'&'
+
encodeURIComponent
(
'ny'
)
+
'='
+
encodeURIComponent
(
ny
);
/*ny*/
request
({
...
...
@@ -219,6 +222,7 @@ app.post('/api/tommorrow',(req,res)=>{
let
item
=
ex
.
response
.
body
.
items
.
item
;
let
i
=
0
;
let
a
=
[];
//, a4=[], a5=[], a6=[], a7=[], a8=[], a9=[], a10=[], a11=[], a12=[], a13=[], a14=[], a15=[], a16=[], a17=[], a18=[], a19=[], a20=[], a21=[], a22=[], a23=[];
while
(
item
[
i
].
fcstDate
==
tommorow
||
item
[
i
].
fcstDate
==
CurDay
){
if
((
item
[
i
].
category
==
'POP'
||
item
[
i
].
category
==
'TMP'
)
&&
item
[
i
].
fcstDate
==
tommorow
){
a
.
push
(
item
[
i
]);
...
...
weather_briefing/server/test.js
0 → 100644
View file @
b6bbed1
let
today
=
new
Date
();
console
.
log
(
typeof
(
today
.
getHours
()));
\ No newline at end of file
Please
register
or
login
to post a comment