Showing
1 changed file
with
4 additions
and
26 deletions
... | @@ -27,39 +27,17 @@ app.get("/inf/result",(req,res)=>{ | ... | @@ -27,39 +27,17 @@ app.get("/inf/result",(req,res)=>{ |
27 | headers:{Authorization: key} | 27 | headers:{Authorization: key} |
28 | }; | 28 | }; |
29 | 29 | ||
30 | + | ||
30 | request.get(options, function(error, response, body){ | 31 | request.get(options, function(error, response, body){ |
31 | if (!error && response.statusCode == 200) { | 32 | if (!error && response.statusCode == 200) { |
32 | var jsbody=JSON.parse(body); | 33 | var jsbody=JSON.parse(body); |
33 | var option2={ | 34 | var option2={ |
34 | - url: "https://api.nexon.co.kr/kart/v1.0/users/"+jsbody.accessId+"/matches?start_date=&end_date= &offset=0&limit=1&match_types=", | 35 | + url: "https://api.nexon.co.kr/kart/v1.0/users/"+jsbody.accessId+"/matches?start_date=&end_date= &offset=0&limit=10&match_types=", |
35 | headers:{Authorization: key} | 36 | headers:{Authorization: key} |
36 | }; | 37 | }; |
37 | - request.get(option2, function(error, response, body){ | 38 | + request.get(option2, function(error, response, body){ |
38 | var match=JSON.parse(body); | 39 | var match=JSON.parse(body); |
39 | - var tId=match.matches[0].matches[0].trackId; | 40 | + res.render('inf_search_result',{name: jsbody.name, level: jsbody.level,body:JSON.stringify(match)}); |
40 | - var kartId=match.matches[0].matches[0].player.kart; | ||
41 | - var mrank=match.matches[0].matches[0].player.matchRank; | ||
42 | - //한화라고 검색하면 아직 오류존재 | ||
43 | - var players=match.matches[0].matches[0].playerCount; | ||
44 | - var stime=new Date(match.matches[0].matches[0].startTime.split('T')[0]+" "+match.matches[0].matches[0].startTime.split('T')[1]); | ||
45 | - var etime=new Date(match.matches[0].matches[0].endTime.split('T')[0]+" "+match.matches[0].matches[0].endTime.split('T')[1]); | ||
46 | - var diff=etime-stime | ||
47 | - var minute= Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60)); | ||
48 | - var second = Math.floor((diff % (1000 * 60)) / 1000); | ||
49 | - var diff_time=minute + " : " + second; | ||
50 | - if(mrank=="99"){ | ||
51 | - mrank="retire"; | ||
52 | - diff_time="retire"; | ||
53 | - } | ||
54 | - var ranking=mrank+" / "+players | ||
55 | - | ||
56 | - if (!error && response.statusCode == 200) { | ||
57 | - res.render('inf_search_result', {name: jsbody.name, level: jsbody.level, trackId: tId, kart:kartId,rank:ranking,time: diff_time}); | ||
58 | - } | ||
59 | - else{ | ||
60 | - res.status(response.statusCode).end(); | ||
61 | - console.log('error = ' + response.statusCode); | ||
62 | - } | ||
63 | }); | 41 | }); |
64 | } else { | 42 | } else { |
65 | res.status(response.statusCode).end(); | 43 | res.status(response.statusCode).end(); | ... | ... |
-
Please register or login to post a comment