백승욱

Edit variables name

...@@ -3,9 +3,9 @@ var express = require('express'); ...@@ -3,9 +3,9 @@ var express = require('express');
3 const request = require('request'); 3 const request = require('request');
4 const config = require('./config.json'); 4 const config = require('./config.json');
5 //============================================================= 5 //=============================================================
6 -const LINE_URL = 'https://api.line.me/v2/bot/message/reply' 6 +const LINE_REPLY_URL = 'https://api.line.me/v2/bot/message/reply'
7 const TOKEN = config.TOKEN; 7 const TOKEN = config.TOKEN;
8 -const BOXOFFICE_URL = 'http://www.kobis.or.kr/kobisopenapi/webservice/rest/boxoffice/searchDailyBoxOfficeList.json' 8 +const KOFIC_URL = 'http://www.kobis.or.kr/kobisopenapi/webservice/rest'
9 const KOFIC_KEY = config.KOFIC_KEY; 9 const KOFIC_KEY = config.KOFIC_KEY;
10 //============================================================= 10 //=============================================================
11 11
...@@ -16,11 +16,10 @@ exports.ShowYesterdayRank = function (replyToken) { ...@@ -16,11 +16,10 @@ exports.ShowYesterdayRank = function (replyToken) {
16 16
17 request.get( 17 request.get(
18 { 18 {
19 - url: BOXOFFICE_URL + `?key=${KOFIC_KEY}&targetDt=${yesterday}`, 19 + url: KOFIC_URL + `/boxoffice/searchDailyBoxOfficeList.json?key=${KOFIC_KEY}&targetDt=${yesterday}`,
20 json: true 20 json: true
21 }, (error, response, body) => { 21 }, (error, response, body) => {
22 if (!error && response.statusCode == 200) { 22 if (!error && response.statusCode == 200) {
23 - console.log(body.boxOfficeResult);
24 23
25 var movieName = []; 24 var movieName = [];
26 movieName[0] = body.boxOfficeResult.dailyBoxOfficeList[0].movieNm; 25 movieName[0] = body.boxOfficeResult.dailyBoxOfficeList[0].movieNm;
...@@ -52,7 +51,7 @@ exports.ShowYesterdayRank = function (replyToken) { ...@@ -52,7 +51,7 @@ exports.ShowYesterdayRank = function (replyToken) {
52 51
53 request.post( 52 request.post(
54 { 53 {
55 - url: LINE_URL, 54 + url: LINE_REPLY_URL,
56 headers: { 55 headers: {
57 'Authorization': `Bearer ${TOKEN}` 56 'Authorization': `Bearer ${TOKEN}`
58 }, 57 },
...@@ -66,7 +65,8 @@ exports.ShowYesterdayRank = function (replyToken) { ...@@ -66,7 +65,8 @@ exports.ShowYesterdayRank = function (replyToken) {
66 `[2위]\n영화제목 : ${movieName[1]}\n개봉일 : ${movieOpenDt[1]}\n누적 관객 수 : ${movieAudiAcc[1]}명\n영화코드 : ${movieCode[1]}\n\n` + 65 `[2위]\n영화제목 : ${movieName[1]}\n개봉일 : ${movieOpenDt[1]}\n누적 관객 수 : ${movieAudiAcc[1]}명\n영화코드 : ${movieCode[1]}\n\n` +
67 `[3위]\n영화제목 : ${movieName[2]}\n개봉일 : ${movieOpenDt[2]}\n누적 관객 수 : ${movieAudiAcc[2]}명\n영화코드 : ${movieCode[2]}\n\n` + 66 `[3위]\n영화제목 : ${movieName[2]}\n개봉일 : ${movieOpenDt[2]}\n누적 관객 수 : ${movieAudiAcc[2]}명\n영화코드 : ${movieCode[2]}\n\n` +
68 `[4위]\n영화제목 : ${movieName[3]}\n개봉일 : ${movieOpenDt[3]}\n누적 관객 수 : ${movieAudiAcc[3]}명\n영화코드 : ${movieCode[3]}\n\n` + 67 `[4위]\n영화제목 : ${movieName[3]}\n개봉일 : ${movieOpenDt[3]}\n누적 관객 수 : ${movieAudiAcc[3]}명\n영화코드 : ${movieCode[3]}\n\n` +
69 - `[5위]\n영화제목 : ${movieName[4]}\n개봉일 : ${movieOpenDt[4]}\n누적 관객 수 : ${movieAudiAcc[4]}명\n영화코드 : ${movieCode[4]}` 68 + `[5위]\n영화제목 : ${movieName[4]}\n개봉일 : ${movieOpenDt[4]}\n누적 관객 수 : ${movieAudiAcc[4]}명\n영화코드 : ${movieCode[4]}\n\n` +
69 + `영화 상세 정보를 조회하시려면, 영화코드를 입력해주세요.`
70 } 70 }
71 ] 71 ]
72 } 72 }
......