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
Suyeon Jung
2020-12-09 01:58:09 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c38d25abd1066670152ad07c77a498ce480c3f1d
c38d25ab
1 parent
2dbdf0ef
Modify userArea function
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
13 deletions
routes/category.js
routes/category.js
View file @
c38d25a
...
...
@@ -13,6 +13,8 @@ let user_dong;
let
userLocation
;
let
user_latitude
;
let
user_longitude
;
// 결과 중 사용자 근처인지 검사하기 위한 변수
let
user_target
;
let
sigun
=
[{
sigun_name
:
'가평군'
,
sigun_code
:
41820
...
...
@@ -158,9 +160,15 @@ router.post('/', function(req, res) {
user_gu
=
req
.
body
.
gu
;
user_dong
=
req
.
body
.
dong
;
userLocation
=
`
${
user_sigun
}
${
user_gu
}
${
user_dong
}
`
;
console
.
log
(
user_sigun
);
console
.
log
(
user_gu
);
console
.
log
(
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
);
let
KAKAO_API_KEY
=
process
.
env
.
KAKAO_APIKEY
;
let
kakaoOptions
=
{
url
:
'https://dapi.kakao.com/v2/local/search/address.json'
,
...
...
@@ -213,7 +221,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_
dong
))
{
if
(
userArea
(
store
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
console
.
log
(
'store'
,
store
);
stores
.
push
(
store
);
}
...
...
@@ -230,7 +238,7 @@ 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_
dong
))
{
if
(
fast_food_store
[
'BSN_STATE_NM'
]
!=
'폐업'
&&
userArea
(
fast_food_store
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
console
.
log
(
'fast_store_name'
,
fast_food_store
);
fast_food_stores
.
push
(
fast_food_store
);
}
...
...
@@ -259,7 +267,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_
dong
))
{
if
(
userArea
(
library
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
console
.
log
(
'library'
,
library
);
librarys
.
push
(
library
);
}
...
...
@@ -275,7 +283,7 @@ 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_
dong
))
{
if
(
userArea
(
institute
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
console
.
log
(
'institute'
,
institute
);
institutes
.
push
(
institute
);
}
...
...
@@ -302,7 +310,7 @@ 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_
dong
))
{
if
(
userArea
(
city_park
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
city_parks
.
push
(
city_park
);
}
}
...
...
@@ -375,7 +383,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_
dong
))
{
if
(
userArea
(
cctv
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
console
.
log
(
'cctv'
,
cctv
);
cctvs
.
push
(
cctv
);
}
...
...
@@ -390,7 +398,7 @@ 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_
dong
))
{
if
(
userArea
(
light
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
console
.
log
(
'light'
,
light
);
lights
.
push
(
light
);
}
...
...
@@ -418,7 +426,7 @@ router.get('/culture', function(req, res) {
for
(
let
i
=
0
;
i
<
movie_result
.
MovieTheater
[
1
].
row
.
length
;
i
++
)
{
movie
=
movie_result
.
MovieTheater
[
1
].
row
[
i
];
// 폐업인 지점 제외
if
(
!
movie
[
'BSN_STATE_NM'
].
includes
(
'폐업'
)
&&
userArea
(
movie
,
'REFINE_LOTNO_ADDR'
,
user_
dong
))
{
if
(
!
movie
[
'BSN_STATE_NM'
].
includes
(
'폐업'
)
&&
userArea
(
movie
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
console
.
log
(
'movie'
,
movie
);
movies
.
push
(
movie
);
}
...
...
@@ -443,7 +451,7 @@ 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_
dong
))
{
if
(
userArea
(
shop
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
console
.
log
(
'shop'
,
shop
);
shops
.
push
(
shop
);
}
...
...
@@ -468,7 +476,7 @@ 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_
dong
))
{
if
(
userArea
(
gym
,
'REFINE_LOTNO_ADDR'
,
user_
target
))
{
console
.
log
(
'gym'
,
gym
);
gyms
.
push
(
gym
);
}
...
...
Please
register
or
login
to post a comment