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-01 21:22:38 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c6a5da654627fe9c2d92693faf59f3aec3b89a6d
c6a5da65
1 parent
d1781e46
Modify list error
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 @
c6a5da6
...
...
@@ -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 @
c6a5da6
<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