Toggle navigation
Toggle navigation
This project
Loading...
Sign in
황성연
/
lolinfo.gg
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
황성연
2020-06-21 19:27:59 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c368d62f80de4087ea35bced78dbfeb489674d25
c368d62f
1 parent
2e099b53
예외 처리
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
13 deletions
lolinfo/router/mytest.js
lolinfo/router/mytest.js
View file @
c368d62
...
...
@@ -268,6 +268,8 @@ module.exports = function(app){
};
}
// 게임정보 불러오기
var
matchUrl
=
"https://kr.api.riotgames.com/lol/match/v4/matchlists/by-account/"
+
accountId
+
"?api_key="
+
apikey
;
request
(
matchUrl
,
function
(
error
,
response
,
body
)
{
var
match_json
=
JSON
.
parse
(
body
).
matches
;
...
...
@@ -276,9 +278,15 @@ module.exports = function(app){
var
match_gameId
=
new
Array
();
var
match_mychamp
=
new
Array
();
for
(
var
i
=
0
;
i
<
5
;
i
++
){
match_gameId
.
push
(
match_json
[
i
].
gameId
);
match_mychamp
.
push
(
match_json
[
i
].
champion
);
var
count
=
0
,
idx
=
0
;
while
(
count
<
5
){
// 420 : 5x5 솔로랭크, 440 : 5x5 자유랭크
if
(
match_json
[
idx
].
queue
==
420
||
match_json
[
idx
].
queue
==
440
){
match_gameId
.
push
(
match_json
[
idx
].
gameId
);
match_mychamp
.
push
(
match_json
[
idx
].
champion
);
count
++
;
}
idx
++
;
}
// teamId: 100 = Blue , teamId:200 = Red
...
...
@@ -347,8 +355,6 @@ module.exports = function(app){
"kda"
:
match1_kda
};
console
.
log
(
match1
);
var
match2Url
=
"https://kr.api.riotgames.com/lol/match/v4/matches/"
+
match_gameId
[
1
]
+
"?api_key="
+
apikey
;
request
(
match2Url
,
function
(
error
,
response
,
body
){
var
match2_json
=
JSON
.
parse
(
body
);
...
...
@@ -414,7 +420,6 @@ module.exports = function(app){
"kda"
:
match2_kda
};
console
.
log
(
match2
);
var
match3Url
=
"https://kr.api.riotgames.com/lol/match/v4/matches/"
+
match_gameId
[
2
]
+
"?api_key="
+
apikey
;
request
(
match3Url
,
function
(
error
,
response
,
body
){
...
...
@@ -481,7 +486,6 @@ module.exports = function(app){
"kda"
:
match3_kda
};
console
.
log
(
match3
);
var
match4Url
=
"https://kr.api.riotgames.com/lol/match/v4/matches/"
+
match_gameId
[
3
]
+
"?api_key="
+
apikey
;
request
(
match4Url
,
function
(
error
,
response
,
body
){
...
...
@@ -548,7 +552,6 @@ module.exports = function(app){
"kda"
:
match4_kda
};
console
.
log
(
match4
);
var
match5Url
=
"https://kr.api.riotgames.com/lol/match/v4/matches/"
+
match_gameId
[
4
]
+
"?api_key="
+
apikey
;
request
(
match5Url
,
function
(
error
,
response
,
body
){
...
...
@@ -615,10 +618,6 @@ module.exports = function(app){
"kda"
:
match5_kda
};
console
.
log
(
match5
);
var
summoner_info
=
{
"summoner_Name"
:
summoner
,
"summoner_tierimage"
:
img_tier
,
...
...
@@ -628,7 +627,7 @@ module.exports = function(app){
"summoner_wins"
:
wins
,
"summoner_losses"
:
losses
,
"summoner_winrate"
:
((
wins
/
(
wins
+
losses
))
*
100
).
toFixed
(
2
),
"summoner_carry"
:
(
win
/
losses
*
2
).
toFixed
(
2
)
"summoner_carry"
:
(
win
s
/
losses
*
2
).
toFixed
(
2
)
};
var
rotation_info
=
{
...
...
@@ -636,7 +635,19 @@ module.exports = function(app){
"rotation_image_newbie"
:
rotation_pic_newbie
};
var
total_info
=
{
"Summoner_info"
:
summoner_info
,
"Rotation_info"
:
rotation_info
,
"Spectator_flag"
:
flag
,
"Spectator"
:
spectator
,
"Match1"
:
match1
,
"Match2"
:
match2
,
"Match3"
:
match3
,
"Match4"
:
match4
,
"Match5"
:
match5
};
console
.
log
(
total_info
);
res
.
render
(
'index'
,
{
title
:
req
.
params
.
username
,
...
...
Please
register
or
login
to post a comment