Toggle navigation
Toggle navigation
This project
Loading...
Sign in
zuzitsu
/
UR_Village
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
안지영
2020-12-09 02:16:42 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1995e091c8961f9ef2a1f0f6f59ff21d1c5f3296
1995e091
1 parent
c38d25ab
Modify result table css
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
142 additions
and
74 deletions
routes/category.js
views/result.ejs
views/results/culture.ejs
views/results/food.ejs
views/results/gym.ejs
views/results/park.ejs
views/results/safe.ejs
views/results/school.ejs
views/results/shop.ejs
views/results/transport.ejs
routes/category.js
View file @
1995e09
...
...
@@ -160,15 +160,9 @@ router.post('/', function(req, res) {
user_gu
=
req
.
body
.
gu
;
user_dong
=
req
.
body
.
dong
;
userLocation
=
`
${
user_sigun
}
${
user_gu
}
${
user_dong
}
`
;
if
(
user_gu
==
''
)
{
user_target
=
user_dong
;
}
else
{
user_target
=
user_gu
;
}
console
.
log
(
'user_sigun'
,
user_sigun
);
console
.
log
(
'user_gu'
,
user_gu
);
console
.
log
(
'user_dong'
,
user_dong
);
console
.
log
(
user_sigun
);
console
.
log
(
user_gu
);
console
.
log
(
user_dong
);
let
KAKAO_API_KEY
=
process
.
env
.
KAKAO_APIKEY
;
let
kakaoOptions
=
{
url
:
'https://dapi.kakao.com/v2/local/search/address.json'
,
...
...
@@ -195,8 +189,8 @@ router.post('/', function(req, res) {
var
result
=
JSON
.
parse
(
body
);
console
.
log
(
'result'
,
result
);
user_latitude
=
result
.
documents
[
0
].
address
.
x
;
user_lo
n
gitude
=
result
.
documents
[
0
].
address
.
y
;
console
.
log
(
'위도, 경도'
,
user_latitude
,
user_lo
n
gitude
);
user_logitude
=
result
.
documents
[
0
].
address
.
y
;
console
.
log
(
'위도, 경도'
,
user_latitude
,
user_logitude
);
}
})
res
.
render
(
'category'
,
{
userLocation
:
userLocation
});
...
...
@@ -221,7 +215,7 @@ router.get('/food', function(req, res) {
for
(
let
i
=
0
;
i
<
food_result
.
PlaceThatDoATasteyFoodSt
[
1
].
row
.
length
;
i
++
)
{
// 상호명, 음식명, 전화번호, 도로명주소(REFINE_ROADNM_ADDR), 지번 주소(REFINE_LOTNO_ADDR)
store
=
food_result
.
PlaceThatDoATasteyFoodSt
[
1
].
row
[
i
];
if
(
userArea
(
store
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
if
(
userArea
(
store
,
'REFINE_LOTNO_ADDR'
,
user_
dong
))
{
console
.
log
(
'store'
,
store
);
stores
.
push
(
store
);
}
...
...
@@ -238,12 +232,12 @@ router.get('/food', function(req, res) {
for
(
let
i
=
0
;
i
<
fast_food_result
.
Genrestrtfastfood
[
1
].
row
.
length
;
i
++
)
{
fast_food_store
=
fast_food_result
.
Genrestrtfastfood
[
1
].
row
[
i
];
// 폐업인 지점 제외
if
(
fast_food_store
[
'BSN_STATE_NM'
]
!=
'폐업'
&&
userArea
(
fast_food_store
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
if
(
fast_food_store
[
'BSN_STATE_NM'
]
!=
'폐업'
&&
userArea
(
fast_food_store
,
'REFINE_LOTNO_ADDR'
,
user_
dong
))
{
console
.
log
(
'fast_store_name'
,
fast_food_store
);
fast_food_stores
.
push
(
fast_food_store
);
}
}
res
.
render
(
'
result'
,
{
category
:
'food'
,
stores
:
stores
,
fast_food_stores
:
fast_food_stores
,
userLocation
:
userLocation
,
grade
:
'A'
});
res
.
render
(
'
food_result'
,
{
stores
:
stores
,
fast_food_stores
:
fast_food_stores
});
}
})
...
...
@@ -267,7 +261,7 @@ router.get('/school', function(req, res) {
let
librarys
=
[];
for
(
let
i
=
0
;
i
<
library_result
.
Tbggibllbrm
[
1
].
row
.
length
;
i
++
)
{
library
=
library_result
.
Tbggibllbrm
[
1
].
row
[
i
];
if
(
userArea
(
library
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
if
(
userArea
(
library
,
'REFINE_LOTNO_ADDR'
,
user_
dong
))
{
console
.
log
(
'library'
,
library
);
librarys
.
push
(
library
);
}
...
...
@@ -283,12 +277,12 @@ router.get('/school', function(req, res) {
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
))
{
if
(
userArea
(
institute
,
'REFINE_LOTNO_ADDR'
,
user_
dong
))
{
console
.
log
(
'institute'
,
institute
);
institutes
.
push
(
institute
);
}
}
res
.
render
(
'
result'
,
{
category
:
'school'
,
librarys
:
librarys
,
institutes
:
institutes
,
userLocation
:
userLocation
,
grade
:
'A'
});
res
.
render
(
'
school_result'
,
{
librarys
:
librarys
,
institutes
:
institutes
});
}
})
}
...
...
@@ -310,57 +304,66 @@ router.get('/park', function(req, res) {
let
city_parks
=
[];
for
(
let
i
=
0
;
i
<
city_park_result
.
CityPark
[
1
].
row
.
length
;
i
++
)
{
city_park
=
city_park_result
.
CityPark
[
1
].
row
[
i
];
if
(
userArea
(
city_park
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
if
(
userArea
(
city_park
,
'REFINE_LOTNO_ADDR'
,
user_
dong
))
{
city_parks
.
push
(
city_park
);
}
}
res
.
render
(
'
result'
,
{
category
:
'park'
,
city_parks
:
city_parks
,
userLocation
:
userLocation
,
grade
:
'A'
});
res
.
render
(
'
park_result'
,
{
city_parks
:
city_parks
});
}
// if (park_result.CityPark[0].head[1].RESULT.CODE == 'INFO-000') {
// cityparknum = park_result.CityPark[0].head[0].list_total_count;
// console.log(cityparknum + "개의 도시공원이 존재합니다.");
// res.send(String(cityparknum) + "개의 도시공원이 존재합니다.");
// } else {
// res.send("도시공원이 없습니다.");
// }
})
});
router
.
get
(
'/transport'
,
function
(
req
,
res
)
{
router
.
get
(
'/transport'
,
function
(
req
,
res
)
{
let
apikey
=
process
.
env
.
ODSAY_APIKEY
let
bus_url
=
'https://api.odsay.com/v1/api/pointSearch?'
;
let
subway_url
=
'https://api.odsay.com/v1/api/pointSearch?'
;
let
qs
=
`?lang=0&x=
${
user_latitude
}
&y=
${
user_longitude
}
&radius=1000&stationClass=2&apiKey=
${
ODSAY_API_KEY
}
`
;
let
bus_url
=
'https://api.odsay.com/v1/api/pointSearch?lang=0&x='
+
user_latitude
+
'&y='
+
user_logitude
+
'&radius=500&stationClass=1&apiKey='
+
apikey
;
let
subway_url
=
'https://api.odsay.com/v1/api/pointSearch?lang=0&x='
+
user_latitude
+
'&y='
+
user_logitude
+
'&radius=1000&stationClass=2&apiKey='
+
apikey
;
let
busCnt
=
0
;
let
subwayCnt
=
0
;
let
subwayCnt
=
0
;
console
.
log
(
bus_url
);
request
({
url
:
bus_url
+
qs
,
url
:
bus_url
,
method
:
'GET'
},
function
(
err
,
response
,
body
)
{
},
function
(
err
,
response
,
body
)
{
if
(
!
err
&&
res
.
statusCode
==
200
)
{
//console.log("inside");
let
bus_result
=
JSON
.
parse
(
body
);
//
console.log('bus_result', bus_result.result.station
);
//
console.log(bus_result
);
let
busStations
=
[];
console
.
log
(
bus_result
.
result
)
for
(
let
i
=
0
;
i
<
bus_result
.
result
.
station
.
length
;
i
++
)
{
station
=
bus_result
.
result
.
station
[
i
];
console
.
log
(
'station'
,
station
)
busStations
.
push
(
station
);
busCnt
=
bus_result
.
result
.
count
;
console
.
log
(
'in!'
);
for
(
var
i
=
0
;
i
<
busCnt
;
i
++
)
{
busStations
.
push
(
bus_result
.
result
.
station
[
i
].
stationName
);
}
console
.
log
(
'busStations'
,
busStations
);
console
.
log
(
busStations
);
request
({
url
:
subway_url
+
qs
,
url
:
subway_url
,
method
:
'GET'
},
function
(
err
,
response
,
body
)
{
},
function
(
err
,
response
,
body
)
{
if
(
!
err
&&
res
.
statusCode
==
200
)
{
let
subway_result
=
JSON
.
parse
(
body
);
let
subwayStations
=
[];
console
.
log
(
'subway_result'
,
subway_result
);
for
(
let
i
=
0
;
i
<
subway_result
.
result
.
station
.
length
;
i
++
)
{
station
=
subway_result
.
result
.
station
[
i
];
subwayStations
.
push
(
station
);
subwayCnt
=
subway_result
.
result
.
count
;
console
.
log
(
"지하철역 개수:"
+
subwayCnt
);
console
.
log
(
'in3!'
);
for
(
var
i
=
0
;
i
<
subwayCnt
;
i
++
)
{
console
.
log
(
subway_result
.
result
.
station
[
i
]);
subwayStations
.
push
(
subway_result
.
result
.
station
[
i
].
stationName
);
}
console
.
log
(
busStations
);
console
.
log
(
'subwayStaions'
,
subwayStations
);
res
.
render
(
'
result'
,
{
category
:
'transport'
,
busStations
:
busStations
,
subwayStations
:
subwayStations
,
userLocation
:
userLocation
,
grade
:
'A'
})
console
.
log
(
subwayStations
);
res
.
render
(
'
transport'
,{
busCnt
:
busCnt
,
busStations
:
busStations
,
subwayCnt
:
subwayCnt
,
subwayStations
:
subwayStations
,
total
:
busCnt
+
subwayCnt
})
}
})
...
...
@@ -368,6 +371,7 @@ router.get('/transport', function(req, res) {
})
});
router
.
get
(
'/safe'
,
function
(
req
,
res
)
{
let
cctv_url
=
'https://openapi.gg.go.kr/CCTV'
;
...
...
@@ -383,7 +387,7 @@ router.get('/safe', function(req, res) {
console
.
log
(
cctv_result
);
for
(
let
i
=
0
;
i
<
cctv_result
.
CCTV
[
1
].
row
.
length
;
i
++
)
{
cctv
=
cctv_result
.
CCTV
[
1
].
row
[
i
];
if
(
userArea
(
cctv
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
if
(
userArea
(
cctv
,
'REFINE_LOTNO_ADDR'
,
user_
dong
))
{
console
.
log
(
'cctv'
,
cctv
);
cctvs
.
push
(
cctv
);
}
...
...
@@ -398,12 +402,12 @@ router.get('/safe', function(req, res) {
console
.
log
(
light_result
);
for
(
let
i
=
0
;
i
<
light_result
.
SECRTLGT
[
1
].
row
.
length
;
i
++
)
{
light
=
light_result
.
SECRTLGT
[
1
].
row
[
i
];
if
(
userArea
(
light
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
if
(
userArea
(
light
,
'REFINE_LOTNO_ADDR'
,
user_
dong
))
{
console
.
log
(
'light'
,
light
);
lights
.
push
(
light
);
}
}
res
.
render
(
'
result'
,
{
category
:
'safe'
,
cctvs
:
cctvs
,
lights
:
lights
,
userLocation
:
userLocation
,
grade
:
'A'
});
res
.
render
(
'
safe_result'
,
{
cctvs
:
cctvs
,
lights
:
lights
});
}
})
}
...
...
@@ -412,26 +416,26 @@ router.get('/safe', function(req, res) {
});
router
.
get
(
'/culture'
,
function
(
req
,
res
)
{
//
영화관
let
movie_url
=
'https://openapi.gg.go.kr/MovieTheater
'
;
//
노래방
let
sing_url
=
'https://openapi.gg.go.kr/Songclub
'
;
let
qs
=
`?Type=json&KEY=
${
GYEONGI_API_KEY
}
&SIGUN_CD=
${
SIGUN_CODE
}
`
;
request
({
url
:
movie
_url
+
qs
,
url
:
sing
_url
+
qs
,
method
:
'GET'
},
function
(
err
,
response
,
body
)
{
if
(
!
err
&&
res
.
statusCode
==
200
)
{
let
movie
_result
=
JSON
.
parse
(
body
);
console
.
log
(
movie
_result
);
let
movie
s
=
[];
for
(
let
i
=
0
;
i
<
movie_result
.
MovieTheater
[
1
].
row
.
length
;
i
++
)
{
movie
=
movie_result
.
MovieTheater
[
1
].
row
[
i
];
let
sing
_result
=
JSON
.
parse
(
body
);
console
.
log
(
sing
_result
);
let
sing
s
=
[];
for
(
let
i
=
0
;
i
<
sing_result
.
Songclub
[
1
].
row
.
length
;
i
++
)
{
sing
=
sing_result
.
Songclub
[
1
].
row
[
i
];
// 폐업인 지점 제외
if
(
!
movie
[
'BSN_STATE_NM'
].
includes
(
'폐업'
)
&&
userArea
(
movie
,
'REFINE_LOTNO_ADDR'
,
user_target
))
{
console
.
log
(
'
movie'
,
movie
);
movies
.
push
(
movie
);
if
(
!
sing
[
'BSN_STATE_NM'
].
includes
(
'폐업'
)
&&
userArea
(
sing
,
'REFINE_LOTNO_ADDR'
,
user_dong
))
{
console
.
log
(
'
sing'
,
sing
);
sings
.
push
(
sing
);
}
}
res
.
render
(
'
result'
,
{
category
:
'culture'
,
movies
:
movies
,
userLocation
:
userLocation
,
grade
:
'A'
});
res
.
render
(
'
culture_result'
,
{
sings
:
sings
});
}
});
});
...
...
@@ -451,12 +455,12 @@ router.get('/shop', function(req, res) {
for
(
let
i
=
0
;
i
<
shop_result
.
MrktStoreM
[
1
].
row
.
length
;
i
++
)
{
shop
=
shop_result
.
MrktStoreM
[
1
].
row
[
i
];
// 폐업인 지점 제외
if
(
userArea
(
shop
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
if
(
userArea
(
shop
,
'REFINE_LOTNO_ADDR'
,
user_
dong
))
{
console
.
log
(
'shop'
,
shop
);
shops
.
push
(
shop
);
}
}
res
.
render
(
'
result'
,
{
category
:
'shop'
,
shops
:
shops
,
userLocation
:
userLocation
,
grade
:
'A'
});
res
.
render
(
'
shop_result'
,
{
shops
:
shops
});
}
})
...
...
@@ -476,12 +480,12 @@ router.get('/gym', function(req, res) {
for
(
let
i
=
0
;
i
<
gym_result
.
PhysicaFitnessTrainingPlace
[
1
].
row
.
length
;
i
++
)
{
gym
=
gym_result
.
PhysicaFitnessTrainingPlace
[
1
].
row
[
i
];
console
.
log
(
gym
);
if
(
userArea
(
gym
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
if
(
userArea
(
gym
,
'REFINE_LOTNO_ADDR'
,
user_
dong
))
{
console
.
log
(
'gym'
,
gym
);
gyms
.
push
(
gym
);
}
}
res
.
render
(
'
result'
,
{
category
:
'gym'
,
gyms
:
gyms
,
userLocation
:
userLocation
,
grade
:
'A'
});
res
.
render
(
'
gym_result'
,
{
gyms
:
gyms
});
}
})
});
...
...
views/result.ejs
View file @
1995e09
...
...
@@ -10,6 +10,70 @@
<link
rel=
'stylesheet'
href=
'/css/category.css'
>
<title>
📝 결과
</title>
<h1>
🥘 맛집 현황
</h1>
<table
class=
"table"
>
<thead
class=
"thead-dark"
>
<tr>
<th>
음식점명
</th>
<th>
전화번호
</th>
<th>
대표음식
</th>
<th>
도로명주소
</th>
</tr>
</thead>
<tbody>
<
%for (var i =0; i
<stores
.
length
;
i
++){%
>
<tr>
<td>
<
%=stores[i].RESTRT_NM%>
</td>
<td>
<
%=stores[i].TASTFDPLC_TELNO%>
</td>
<td>
<
%=stores[i].REPRSNT_FOOD_NM%>
</td>
<td>
<
%=stores[i].REFINE_ROADNM_ADDR%>
</td>
</tr>
<
%}%>
</tbody>
</table>
<h3>
총 맛집 개수 :
<
%=stores.length%>
</h3>
<h1>
🍔 패스트푸드점 현황
</h1>
<table
class=
"table"
>
<thead
class=
"thead-dark"
>
<tr>
<th>
사업장명
</th>
<th>
도로명주소
</th>
</tr>
</thead>
<tbody>
<
%for (var i =0; i
<fast
_food_stores
.
length
;
i
++){%
>
<tr>
<td>
<
%=fast_food_stores[i].BIZPLC_NM%>
</td>
<td>
<
%=fast_food_stores[i].REFINE_ROADNM_ADDR%>
</td>
</tr>
<
%}%>
</tbody>
</table>
<h3>
패스트푸드점 개수 :
<
%=fast_food_stores.length%>
</h3>
</head>
<body>
...
...
views/results/culture.ejs
View file @
1995e09
<h1>🎬 영화관 현황</h1>
<table class="table">
<thead>
<thead
class="thead-dark"
>
<th>사업장명</th>
<th>도로명주소</th>
</thead>
...
...
views/results/food.ejs
View file @
1995e09
<h1>
🥘 맛집 현황</h1>
<table class="table
">
<thead class="thead-dark
">
<thead>
<tr>
<th>음식점명</th>
...
...
@@ -39,7 +39,7 @@
<h1>🍔 패스트푸드점 현황 </h1>
<table class="table">
<thead>
<thead
class="thead-dark"
>
<tr>
<th>사업장명</th>
<th>도로명주소</th>
...
...
views/results/gym.ejs
View file @
1995e09
<h1>🏋️♂️ 운동시설 현황</h1>
<table class="table">
<thead>
<thead
class="thead-dark"
>
<tr>
<th>
사업장명
...
...
views/results/park.ejs
View file @
1995e09
<h1>🌳 도시공원 현황</h1>
<table class="table">
<thead>
<thead
class="thead-dark"
>
<tr>
<th>도시공원명</th>
<th>도로명주소</th>
...
...
views/results/safe.ejs
View file @
1995e09
<h1>📷 CCTV 현황</h1>
<table class="table">
<thead>
<thead
class="thead-dark"
>
<tr>
<th>도로명주소</th>
<th>카메라대수</th>
...
...
@@ -26,7 +26,7 @@
<h1>💡 보안등 현황</h1>
보안등 소재지 지번주소 :
<table class="table">
<thead>
<thead
class="thead-dark"
>
<tr>
<th>도로명주소</th>
<th>설치개수</th>
...
...
views/results/school.ejs
View file @
1995e09
...
...
@@ -2,7 +2,7 @@
<table class="table">
<thead>
<thead
class="thead-dark"
>
<tr>
<th>도서관명</th>
<th>도로명주소</th>
...
...
@@ -40,7 +40,7 @@
<h1>📒 학원 현황 </h1>
<table class="table">
<thead>
<thead
class="thead-dark"
>
<tr>
<th>시설명</th>
<th>교습과정명</th>
...
...
views/results/shop.ejs
View file @
1995e09
...
...
@@ -2,7 +2,7 @@
<table class="table">
<thead>
<thead
class="thead-dark"
>
<tr>
<th>시장명</th>
<th>도로명주소</th>
...
...
views/results/transport.ejs
View file @
1995e09
<h1>🚌 버스 현황</h1>
<table class="table">
<thead>
<thead
class="thead-dark"
>
<tr>
<th>버스정류장명</th>
<th>버스정류장ID</th>
...
...
@@ -30,7 +30,7 @@
<h1>🚆 지하철역 현황</h1>
<table class="table">
<thead>
<thead
class="thead-dark"
>
<tr>
<th>지하철역명</th>
<th>지하철역ID</th>
...
...
Please
register
or
login
to post a comment