Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김명주
/
kartrider
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
김명주
2021-11-16 21:55:11 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d351bda21f77874c48a8949653584d5ad03c2a13
d351bda2
1 parent
d8aa078f
Update search result
modify design
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
25 deletions
inf_search.js
inf_search.js
View file @
d351bda
...
...
@@ -27,39 +27,17 @@ app.get("/inf/result",(req,res)=>{
headers
:{
Authorization
:
key
}
};
request
.
get
(
options
,
function
(
error
,
response
,
body
){
if
(
!
error
&&
response
.
statusCode
==
200
)
{
var
jsbody
=
JSON
.
parse
(
body
);
var
option2
=
{
url
:
"https://api.nexon.co.kr/kart/v1.0/users/"
+
jsbody
.
accessId
+
"/matches?start_date=&end_date= &offset=0&limit=1&match_types="
,
url
:
"https://api.nexon.co.kr/kart/v1.0/users/"
+
jsbody
.
accessId
+
"/matches?start_date=&end_date= &offset=0&limit=1
0
&match_types="
,
headers
:{
Authorization
:
key
}
};
request
.
get
(
option2
,
function
(
error
,
response
,
body
){
var
match
=
JSON
.
parse
(
body
);
var
tId
=
match
.
matches
[
0
].
matches
[
0
].
trackId
;
var
kartId
=
match
.
matches
[
0
].
matches
[
0
].
player
.
kart
;
var
mrank
=
match
.
matches
[
0
].
matches
[
0
].
player
.
matchRank
;
//한화라고 검색하면 아직 오류존재
var
players
=
match
.
matches
[
0
].
matches
[
0
].
playerCount
;
var
stime
=
new
Date
(
match
.
matches
[
0
].
matches
[
0
].
startTime
.
split
(
'T'
)[
0
]
+
" "
+
match
.
matches
[
0
].
matches
[
0
].
startTime
.
split
(
'T'
)[
1
]);
var
etime
=
new
Date
(
match
.
matches
[
0
].
matches
[
0
].
endTime
.
split
(
'T'
)[
0
]
+
" "
+
match
.
matches
[
0
].
matches
[
0
].
endTime
.
split
(
'T'
)[
1
]);
var
diff
=
etime
-
stime
var
minute
=
Math
.
floor
((
diff
%
(
1000
*
60
*
60
))
/
(
1000
*
60
));
var
second
=
Math
.
floor
((
diff
%
(
1000
*
60
))
/
1000
);
var
diff_time
=
minute
+
" : "
+
second
;
if
(
mrank
==
"99"
){
mrank
=
"retire"
;
diff_time
=
"retire"
;
}
var
ranking
=
mrank
+
" / "
+
players
if
(
!
error
&&
response
.
statusCode
==
200
)
{
res
.
render
(
'inf_search_result'
,
{
name
:
jsbody
.
name
,
level
:
jsbody
.
level
,
trackId
:
tId
,
kart
:
kartId
,
rank
:
ranking
,
time
:
diff_time
});
}
else
{
res
.
status
(
response
.
statusCode
).
end
();
console
.
log
(
'error = '
+
response
.
statusCode
);
}
res
.
render
(
'inf_search_result'
,{
name
:
jsbody
.
name
,
level
:
jsbody
.
level
,
body
:
JSON
.
stringify
(
match
)});
});
}
else
{
res
.
status
(
response
.
statusCode
).
end
();
...
...
Please
register
or
login
to post a comment