Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source-group1
/
animal-Info
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
Eunsu486
2021-05-25 15:46:18 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
f7dd71ef3d5a5e0a7954ef3f6712eeba342ffcc5
f7dd71ef
2 parents
d02379cb
47354b48
Merge branch 'eunsu' into 'master'
Modify category.js See merge request
!2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
26 deletions
routes/category.js
routes/category.js
View file @
f7dd71e
...
...
@@ -9,42 +9,34 @@ let ANIMAL_INFO_API_KEY = process.env.ANIMAL_API_KEY;
let
user_gu
;
let
user_latitude
;
let
user_longitude
;
user_gu
=
강북구
;
/*
http://api.kcisa.kr/openapi/service/rest/convergence2019/getConver03
?serviceKey=88dc66a7-9143-4af3-9f7b-098355b2c7f8&numOfRows=10&pageNo=1&keyword=동물병원
&where=강북구
System.out.println(Arrays.toString(hospitals));
*/
router
.
get
(
'/hospital'
,
function
(
req
,
res
)
{
let
institute_url
=
'http://api.kcisa.kr/openapi/service/rest/convergence2019/getConver03'
;
let
qs
=
`?KEY=
${
GYEONGI_API_KEY
}
&SIGUN_CD=
${
SIGUN_CODE
}
&Type=json`
;
let
qs
=
`?serviceKey=
${
ANIMAL_INFO_API_KEY
}
&numOfRows=10&pageNo=2&keyword=동물병원
&where=
${
user_gu
}
`
;
request
({
url
:
library
_url
+
qs
,
url
:
institute
_url
+
qs
,
method
:
'GET'
},
function
(
err
,
response
,
body
)
{
if
(
!
err
&&
res
.
statusCode
==
200
)
{
let
library
_result
=
JSON
.
parse
(
body
);
let
library
s
=
[];
for
(
let
i
=
0
;
i
<
library
_result
.
Tbggibllbrm
[
1
].
row
.
length
;
i
++
)
{
library
=
library
_result
.
Tbggibllbrm
[
1
].
row
[
i
];
let
hospital
_result
=
JSON
.
parse
(
body
);
let
hospital
s
=
[];
for
(
let
i
=
0
;
i
<
hospital
_result
.
Tbggibllbrm
[
1
].
row
.
length
;
i
++
)
{
library
=
hospital
_result
.
Tbggibllbrm
[
1
].
row
[
i
];
if
(
userArea
(
library
,
'REFINE_LOTNO_ADDR'
,
user_target
))
{
library
s
.
push
(
library
);
hospital
s
.
push
(
library
);
}
}
library_grade
=
evalGrade
(
library_A
,
0.5
,
librarys
.
length
);
request
({
url
:
institute_url
+
qs
,
method
:
'GET'
},
function
(
err
,
response
,
body
)
{
if
(
!
err
&&
res
.
statusCode
==
200
)
{
let
institute_result
=
JSON
.
parse
(
body
);
let
institutes
=
[];
for
(
let
i
=
0
;
i
<
institute_result
.
TninsttInstutM
[
1
].
row
.
length
;
i
++
)
{
institute
=
institute_result
.
TninsttInstutM
[
1
].
row
[
i
];
if
(
userArea
(
institute
,
'REFINE_LOTNO_ADDR'
,
user_target
))
{
institutes
.
push
(
institute
);
}
}
institute_grade
=
evalGrade
(
institute_A
,
institute_B
,
institutes
);
grade
=
avgGrade
(
library_grade
,
institute_grade
);
res
.
render
(
'result'
,
{
category
:
'school'
,
librarys
:
librarys
,
institutes
:
institutes
,
userLocation
:
userLocation
,
grade
:
grade
});
}
})
console
.
log
([
hospitals
[
1
]]);
}
})
});
\ No newline at end of file
...
...
Please
register
or
login
to post a comment