황성연

실시간 경기 데이터 매핑

...@@ -221,12 +221,12 @@ module.exports = function(app){ ...@@ -221,12 +221,12 @@ module.exports = function(app){
221 221
222 var spectatorUrl = "https://kr.api.riotgames.com/lol/spectator/v4/active-games/by-summoner/" + urlenconde(id) + "?api_key=" + apikey; 222 var spectatorUrl = "https://kr.api.riotgames.com/lol/spectator/v4/active-games/by-summoner/" + urlenconde(id) + "?api_key=" + apikey;
223 request(spectatorUrl,function(error,response,body) { 223 request(spectatorUrl,function(error,response,body) {
224 - var flag = true; 224 + var flag = true; // 실시간 경기 여부
225 225
226 if(response.statusCode != 200) 226 if(response.statusCode != 200)
227 flag = false; 227 flag = false;
228 228
229 - if(flag) { 229 + if(flag) { // 실시간 경기 진행중이면
230 var spectator_json = JSON.parse(body); 230 var spectator_json = JSON.parse(body);
231 console.log(spectator_json); 231 console.log(spectator_json);
232 var spec_bannedChamp = spectator_json.bannedChampions; 232 var spec_bannedChamp = spectator_json.bannedChampions;
...@@ -266,8 +266,15 @@ module.exports = function(app){ ...@@ -266,8 +266,15 @@ module.exports = function(app){
266 } 266 }
267 } 267 }
268 } 268 }
269 +
270 + var spectator = {
271 + "summonerName" : spec_summonerName,
272 + "selectedChamp_image" : spec_selectedChamp_image,
273 + "bannedChamp_image" : spec_bannedChamp_image,
274 + "spell_image" : spec_spell_image
275 + };
269 } 276 }
270 - 277 +
271 var matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matchlists/by-account/" + accountId + "?api_key=" + apikey; 278 var matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matchlists/by-account/" + accountId + "?api_key=" + apikey;
272 request(matchUrl,function(error,response,body) { 279 request(matchUrl,function(error,response,body) {
273 var match_json = JSON.parse(body).matches; 280 var match_json = JSON.parse(body).matches;
......