박찬수

commit all

......@@ -19,7 +19,7 @@ function GetGameSchedule(teamID, leagueID, season, eventObj){
}
// 입력: 리그ID, 시즌(*필수) 반환: 팀 순위
function GetLeagueStanding(leagueID, season){
function GetLeagueStanding(leagueID, season, callbackFunc){
var request = require("request");
var options = {
method: 'GET',
......@@ -33,19 +33,16 @@ function GetLeagueStanding(leagueID, season){
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
let jsonBody = JSON.parse(body);
console.log(jsonBody);
console.log(jsonBody.response[0]);
console.log(jsonBody.response[0].league);
for(var i = 0; i < 20; i++){
console.log(jsonBody.response[0].league.standings[0][i].rank + "|" + jsonBody.response[0].league.standings[0][i].team.name);
}
callbackFunc(body);
});
}
exports.LeagueStanding = function(leagueID, callbackFunc){
GetLeagueStanding(leagueID, 2021, callbackFunc);
}
// 입력: 리그ID(*필수), 시즌(*필수), 반환: (선수) 득점 순위
function GetTopScorer(leagueID, season){
function GetTopScorer(leagueID, season, callbackFunc){
var request = require("request");
var options = {
method: 'GET',
......@@ -59,11 +56,16 @@ function GetTopScorer(leagueID, season){
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
callbackFunc(body);
});
}
exports.TopScorer = function(leagueID, callbackFunc){
GetTopScorer(leagueID, 2021, callbackFunc);
}
// 입력: 리그ID(*필수), 시즌(*필수), 반환: 도움 순위
function GetTopAssist(leagueID, season){
function GetTopAssist(leagueID, season, callbackFunc){
var request = require("request");
var options = {
method: 'GET',
......@@ -77,9 +79,14 @@ function GetTopAssist(leagueID, season){
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
callbackFunc(body)
});
}
exports.TopAssist = function(leagueID, callbackFunc){
GetTopAssist(leagueID, 2021, callbackFunc);
}
// 입력: 팀ID, 반환: 경기 일정
function GetGameSchedule_teamname(teamID){
var request = require("request");
......@@ -132,4 +139,7 @@ function GetTeamStanding(teamID, season){
if (error) throw new Error(error);
console.log(body);
});
}
\ No newline at end of file
}
......
......@@ -170,7 +170,20 @@ function SelectLeague(inputNum){
}
function SelectLeagueInfo(inputNum){
return 'You Selected ' + inputNum.toString();
let returnMsg = "잘 못 고르겼습니다. 다시 골라주세요."
switch(inputNum){
case 1: // 팀 순위
break;
case 2: // 득점 순위
break;
case 3: // 도움 순위
break;
case 4: // 처음으로
break;
default:
break;
}
return returnMsg;
}
function SelectTeamInfo(inputNum){
......
......@@ -14,7 +14,7 @@ const bodyParser = require('body-parser');
const { post } = require('request');
const req = require('express/lib/request');
function transMsg(replyMsg){
function transMsg(replyMsg, callbackFunc){
var language = "ko";
request.post(
......@@ -31,10 +31,9 @@ function transMsg(replyMsg){
if(!error && response.statusCode == 200) {
let transMessage = body.message.result.translatedText;
console.log(transMessage);
return transMessage;
callbackFunc(transMessage);
}
});
return replyMsg;
}
function transMsg_toEn(replyMsg, callbackFunc){
......@@ -64,7 +63,7 @@ exports.TranslateKRtoEN = function(transMsg, callbackFunc){
transMsg_toEn(transMsg, callbackFunc);
}
exports.TranslateENtoKR = function(transMsg){
return transMsg(transMsg);
exports.TranslateENtoKR = function(transMsg, callbackFunc){
transMsg(transMsg, callbackFunc);
}
......