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 20:31:00 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e4d7b1602ca1b262bc0ba8243649a31b97effb92
e4d7b160
1 parent
2b32bbef
Modify transport query string(radius)
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
routes/category.js
routes/category.js
View file @
e4d7b16
...
...
@@ -33,6 +33,8 @@ let shop_A = 5;
let
shop_B
=
2
;
let
gym_A
=
20
;
let
gym_B
=
10
;
let
trans_A
=
2
;
let
trans_B
=
1
;
...
...
@@ -383,9 +385,8 @@ router.get('/transport', function(req, res) {
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
busCnt
=
0
;
let
subwayCnt
=
0
;
let
qs
=
`?lang=0&x=
${
user_latitude
}
&y=
${
user_longitude
}
&radius=2000&stationClass=2&apiKey=
${
ODSAY_API_KEY
}
`
;
request
({
url
:
bus_url
+
qs
,
...
...
@@ -393,14 +394,14 @@ router.get('/transport', function(req, res) {
},
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'
,
bus_result
);
let
busStations
=
[];
for
(
let
i
=
0
;
i
<
bus_result
.
result
.
station
.
length
;
i
++
)
{
station
=
bus_result
.
result
.
station
[
i
];
busStations
.
push
(
station
);
}
bus_grade
=
evalGrade
(
trans_A
,
trans_B
,
busStations
.
length
);
request
({
url
:
subway_url
+
qs
,
method
:
'GET'
...
...
@@ -412,9 +413,11 @@ router.get('/transport', function(req, res) {
station
=
subway_result
.
result
.
station
[
i
];
subwayStations
.
push
(
station
);
}
sub_grade
=
evalGrade
(
trans_A
,
trans_B
,
subwayStations
.
length
);
grade
=
avgGrade
(
bus_grade
,
sub_grade
);
console
.
log
(
busStations
);
console
.
log
(
'subwayStaions'
,
subwayStations
);
res
.
render
(
'result'
,
{
category
:
'transport'
,
busStations
:
busStations
,
subwayStations
:
subwayStations
,
userLocation
:
userLocation
,
grade
:
'A'
})
res
.
render
(
'result'
,
{
category
:
'transport'
,
busStations
:
busStations
,
subwayStations
:
subwayStations
,
userLocation
:
userLocation
,
grade
:
grade
})
}
})
...
...
Please
register
or
login
to post a comment