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-06-03 01:44:49 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
2e84c1917658e7430de2abedd3cf91fadb674f99
2e84c191
2 parents
caa7f058
0a670d94
Merge branch 'master'
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
14 deletions
routes/category.js
views/results/park.ejs
routes/category.js
View file @
2e84c19
...
...
@@ -21,7 +21,7 @@ router.post('/', function (req, res) {
router
.
get
(
'/hospital'
,
function
(
req
,
res
)
{
//api
var
gu_select_encode
=
urlencode
(
gu_select
);
let
pet_url
=
`http://api.kcisa.kr/openapi/service/rest/convergence2019/getConver03?serviceKey=
${
ANIMAL_INFO_API_KEY
}
&numOfRows=
1
00&pageNo=1&keyword=%EB%8F%99%EB%AC%BC%EB%B3%91%EC%9B%90&where=
${
gu_select_encode
}
`
;
let
pet_url
=
`http://api.kcisa.kr/openapi/service/rest/convergence2019/getConver03?serviceKey=
${
ANIMAL_INFO_API_KEY
}
&numOfRows=
2
00&pageNo=1&keyword=%EB%8F%99%EB%AC%BC%EB%B3%91%EC%9B%90&where=
${
gu_select_encode
}
`
;
request
(
pet_url
,
function
(
err
,
response
,
body
)
{
if
(
err
)
{
console
.
log
(
`err =>
${
err
}
`
)
...
...
@@ -32,11 +32,20 @@ router.get('/hospital', function (req, res) {
var
result
=
convert
.
xml2json
(
body
,
{
compact
:
true
,
spaces
:
4
});
var
petJson
=
JSON
.
parse
(
result
)
var
itemList
=
petJson
.
response
.
body
.
items
;
var
numRows
=
itemList
.
item
.
length
;
//개수
for
(
i
=
0
;
i
<
numRows
;
i
++
)
{
var
numRows
=
petJson
.
response
.
body
.
totalCount
.
_text
;
//개수
if
(
numRows
==
1
)
{
// state 정상인 것만 추리기
if
(
itemList
.
item
[
i
].
state
.
_text
==
'정상'
)
{
hospital_list
.
push
(
itemList
.
item
[
i
]);
if
(
itemList
.
item
.
state
.
_text
==
'정상'
)
{
hospital_list
.
push
(
itemList
.
item
);
}
}
else
if
(
numRows
==
0
)
{
}
else
{
for
(
i
=
0
;
i
<
numRows
;
i
++
)
{
// state 정상인 것만 추리기
if
(
itemList
.
item
[
i
].
state
.
_text
==
'정상'
)
{
hospital_list
.
push
(
itemList
.
item
[
i
]);
}
}
}
//테스트용 console.log
...
...
@@ -56,7 +65,7 @@ router.get('/medicine', function (req, res) {
var
gu_select_encode
=
urlencode
(
gu_select
);
var
menu
=
'동물약국'
;
var
menu_encode
=
urlencode
(
menu
);
let
pet_url
=
`http://api.kcisa.kr/openapi/service/rest/convergence2019/getConver03?serviceKey=
${
ANIMAL_INFO_API_KEY
}
&numOfRows=
1
00&pageNo=1&keyword=
${
menu_encode
}
&where=
${
gu_select_encode
}
`
;
let
pet_url
=
`http://api.kcisa.kr/openapi/service/rest/convergence2019/getConver03?serviceKey=
${
ANIMAL_INFO_API_KEY
}
&numOfRows=
2
00&pageNo=1&keyword=
${
menu_encode
}
&where=
${
gu_select_encode
}
`
;
request
(
pet_url
,
function
(
err
,
response
,
body
)
{
if
(
err
)
{
console
.
log
(
`err =>
${
err
}
`
)
...
...
@@ -67,11 +76,20 @@ router.get('/medicine', function (req, res) {
var
result
=
convert
.
xml2json
(
body
,
{
compact
:
true
,
spaces
:
4
});
var
petJson
=
JSON
.
parse
(
result
)
var
itemList
=
petJson
.
response
.
body
.
items
;
var
numRows
=
itemList
.
item
.
length
;
//개수
for
(
i
=
0
;
i
<
numRows
;
i
++
)
{
var
numRows
=
petJson
.
response
.
body
.
totalCount
.
_text
;
//개수
if
(
numRows
==
1
)
{
// state 정상인 것만 추리기
if
(
itemList
.
item
[
i
].
state
.
_text
==
'정상'
)
{
category_list
.
push
(
itemList
.
item
[
i
]);
if
(
itemList
.
item
.
state
.
_text
==
'정상'
)
{
category_list
.
push
(
itemList
.
item
);
}
}
else
if
(
numRows
==
0
)
{
}
else
{
for
(
i
=
0
;
i
<
numRows
;
i
++
)
{
// state 정상인 것만 추리기
if
(
itemList
.
item
[
i
].
state
.
_text
==
'정상'
)
{
category_list
.
push
(
itemList
.
item
[
i
]);
}
}
}
//테스트용 console.log
...
...
@@ -91,7 +109,7 @@ router.get('/appliance', function (req, res) {
var
gu_select_encode
=
urlencode
(
gu_select
);
var
menu
=
'동물의료기기'
;
var
menu_encode
=
urlencode
(
menu
);
let
pet_url
=
`http://api.kcisa.kr/openapi/service/rest/convergence2019/getConver03?serviceKey=
${
ANIMAL_INFO_API_KEY
}
&numOfRows=
1
00&pageNo=1&keyword=
${
menu_encode
}
&where=
${
gu_select_encode
}
`
;
let
pet_url
=
`http://api.kcisa.kr/openapi/service/rest/convergence2019/getConver03?serviceKey=
${
ANIMAL_INFO_API_KEY
}
&numOfRows=
2
00&pageNo=1&keyword=
${
menu_encode
}
&where=
${
gu_select_encode
}
`
;
request
(
pet_url
,
function
(
err
,
response
,
body
)
{
if
(
err
)
{
console
.
log
(
`err =>
${
err
}
`
)
...
...
views/results/park.ejs
View file @
2e84c19
<h4>🌳
도시공원
현황</h4>
<h4>🌳
체육시설
현황</h4>
<table class="table">
<thead class="thead-dark">
<tr>
<th>
도시공원
명</th>
<th>
체육시설
명</th>
<th>도로명주소</th>
</tr>
</thead>
...
...
@@ -20,6 +20,6 @@
</tbody>
</table>
<p class="sum">총
도시공원
개수 :
<p class="sum">총
체육시설
개수 :
<%=appliance_list.length%>
</p>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment