박찬수

commit all

...@@ -19,7 +19,7 @@ function GetGameSchedule(teamID, leagueID, season, eventObj){ ...@@ -19,7 +19,7 @@ function GetGameSchedule(teamID, leagueID, season, eventObj){
19 } 19 }
20 20
21 // 입력: 리그ID, 시즌(*필수) 반환: 팀 순위 21 // 입력: 리그ID, 시즌(*필수) 반환: 팀 순위
22 -function GetLeagueStanding(leagueID, season){ 22 +function GetLeagueStanding(leagueID, season, callbackFunc){
23 var request = require("request"); 23 var request = require("request");
24 var options = { 24 var options = {
25 method: 'GET', 25 method: 'GET',
...@@ -33,19 +33,16 @@ function GetLeagueStanding(leagueID, season){ ...@@ -33,19 +33,16 @@ function GetLeagueStanding(leagueID, season){
33 request(options, function (error, response, body) { 33 request(options, function (error, response, body) {
34 if (error) throw new Error(error); 34 if (error) throw new Error(error);
35 console.log(body); 35 console.log(body);
36 - let jsonBody = JSON.parse(body); 36 + callbackFunc(body);
37 - console.log(jsonBody);
38 - console.log(jsonBody.response[0]);
39 - console.log(jsonBody.response[0].league);
40 - for(var i = 0; i < 20; i++){
41 - console.log(jsonBody.response[0].league.standings[0][i].rank + "|" + jsonBody.response[0].league.standings[0][i].team.name);
42 - }
43 -
44 }); 37 });
45 } 38 }
46 39
40 +exports.LeagueStanding = function(leagueID, callbackFunc){
41 + GetLeagueStanding(leagueID, 2021, callbackFunc);
42 +}
43 +
47 // 입력: 리그ID(*필수), 시즌(*필수), 반환: (선수) 득점 순위 44 // 입력: 리그ID(*필수), 시즌(*필수), 반환: (선수) 득점 순위
48 -function GetTopScorer(leagueID, season){ 45 +function GetTopScorer(leagueID, season, callbackFunc){
49 var request = require("request"); 46 var request = require("request");
50 var options = { 47 var options = {
51 method: 'GET', 48 method: 'GET',
...@@ -59,11 +56,16 @@ function GetTopScorer(leagueID, season){ ...@@ -59,11 +56,16 @@ function GetTopScorer(leagueID, season){
59 request(options, function (error, response, body) { 56 request(options, function (error, response, body) {
60 if (error) throw new Error(error); 57 if (error) throw new Error(error);
61 console.log(body); 58 console.log(body);
59 + callbackFunc(body);
62 }); 60 });
63 } 61 }
64 62
63 +exports.TopScorer = function(leagueID, callbackFunc){
64 + GetTopScorer(leagueID, 2021, callbackFunc);
65 +}
66 +
65 // 입력: 리그ID(*필수), 시즌(*필수), 반환: 도움 순위 67 // 입력: 리그ID(*필수), 시즌(*필수), 반환: 도움 순위
66 -function GetTopAssist(leagueID, season){ 68 +function GetTopAssist(leagueID, season, callbackFunc){
67 var request = require("request"); 69 var request = require("request");
68 var options = { 70 var options = {
69 method: 'GET', 71 method: 'GET',
...@@ -77,9 +79,14 @@ function GetTopAssist(leagueID, season){ ...@@ -77,9 +79,14 @@ function GetTopAssist(leagueID, season){
77 request(options, function (error, response, body) { 79 request(options, function (error, response, body) {
78 if (error) throw new Error(error); 80 if (error) throw new Error(error);
79 console.log(body); 81 console.log(body);
82 + callbackFunc(body)
80 }); 83 });
81 } 84 }
82 85
86 +exports.TopAssist = function(leagueID, callbackFunc){
87 + GetTopAssist(leagueID, 2021, callbackFunc);
88 +}
89 +
83 // 입력: 팀ID, 반환: 경기 일정 90 // 입력: 팀ID, 반환: 경기 일정
84 function GetGameSchedule_teamname(teamID){ 91 function GetGameSchedule_teamname(teamID){
85 var request = require("request"); 92 var request = require("request");
...@@ -132,4 +139,7 @@ function GetTeamStanding(teamID, season){ ...@@ -132,4 +139,7 @@ function GetTeamStanding(teamID, season){
132 if (error) throw new Error(error); 139 if (error) throw new Error(error);
133 console.log(body); 140 console.log(body);
134 }); 141 });
135 -}
...\ No newline at end of file ...\ No newline at end of file
142 +}
143 +
144 +
145 +
......
...@@ -170,7 +170,20 @@ function SelectLeague(inputNum){ ...@@ -170,7 +170,20 @@ function SelectLeague(inputNum){
170 } 170 }
171 171
172 function SelectLeagueInfo(inputNum){ 172 function SelectLeagueInfo(inputNum){
173 - return 'You Selected ' + inputNum.toString(); 173 + let returnMsg = "잘 못 고르겼습니다. 다시 골라주세요."
174 + switch(inputNum){
175 + case 1: // 팀 순위
176 + break;
177 + case 2: // 득점 순위
178 + break;
179 + case 3: // 도움 순위
180 + break;
181 + case 4: // 처음으로
182 + break;
183 + default:
184 + break;
185 + }
186 + return returnMsg;
174 } 187 }
175 188
176 function SelectTeamInfo(inputNum){ 189 function SelectTeamInfo(inputNum){
......
...@@ -14,7 +14,7 @@ const bodyParser = require('body-parser'); ...@@ -14,7 +14,7 @@ const bodyParser = require('body-parser');
14 const { post } = require('request'); 14 const { post } = require('request');
15 const req = require('express/lib/request'); 15 const req = require('express/lib/request');
16 16
17 -function transMsg(replyMsg){ 17 +function transMsg(replyMsg, callbackFunc){
18 var language = "ko"; 18 var language = "ko";
19 19
20 request.post( 20 request.post(
...@@ -31,10 +31,9 @@ function transMsg(replyMsg){ ...@@ -31,10 +31,9 @@ function transMsg(replyMsg){
31 if(!error && response.statusCode == 200) { 31 if(!error && response.statusCode == 200) {
32 let transMessage = body.message.result.translatedText; 32 let transMessage = body.message.result.translatedText;
33 console.log(transMessage); 33 console.log(transMessage);
34 - return transMessage; 34 + callbackFunc(transMessage);
35 } 35 }
36 }); 36 });
37 - return replyMsg;
38 } 37 }
39 38
40 function transMsg_toEn(replyMsg, callbackFunc){ 39 function transMsg_toEn(replyMsg, callbackFunc){
...@@ -64,7 +63,7 @@ exports.TranslateKRtoEN = function(transMsg, callbackFunc){ ...@@ -64,7 +63,7 @@ exports.TranslateKRtoEN = function(transMsg, callbackFunc){
64 transMsg_toEn(transMsg, callbackFunc); 63 transMsg_toEn(transMsg, callbackFunc);
65 } 64 }
66 65
67 -exports.TranslateENtoKR = function(transMsg){ 66 +exports.TranslateENtoKR = function(transMsg, callbackFunc){
68 - return transMsg(transMsg); 67 + transMsg(transMsg, callbackFunc);
69 } 68 }
70 69
......