Toggle navigation
Toggle navigation
This project
Loading...
Sign in
백승욱
/
movie-reco-chatbot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
백승욱
2022-06-06 11:42:53 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ff7d5207e491930f4a1d07bfee3a0c040f1dd542
ff7d5207
1 parent
d74dc929
Add print movie code
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
22 deletions
DailyBoxOfficeList.js
DailyBoxOfficeList.js
View file @
ff7d520
...
...
@@ -10,18 +10,18 @@ const KOFIC_KEY = config.KOFIC_KEY;
//=============================================================
// 어제 기준 영화 순위(1위 ~ 5위) 출력
exports
.
ShowYesterdayRank
=
function
(
replyToken
)
{
exports
.
ShowYesterdayRank
=
function
(
replyToken
)
{
var
yesterday
=
exports
.
GetYesterday
();
request
.
get
(
{
url
:
BOXOFFICE_URL
+
`?key=
${
KOFIC_KEY
}
&targetDt=
${
yesterday
}
`
,
json
:
true
},(
error
,
response
,
body
)
=>
{
if
(
!
error
&&
response
.
statusCode
==
200
)
{
url
:
BOXOFFICE_URL
+
`?key=
${
KOFIC_KEY
}
&targetDt=
${
yesterday
}
`
,
json
:
true
},
(
error
,
response
,
body
)
=>
{
if
(
!
error
&&
response
.
statusCode
==
200
)
{
console
.
log
(
body
.
boxOfficeResult
);
var
movieName
=
[];
movieName
[
0
]
=
body
.
boxOfficeResult
.
dailyBoxOfficeList
[
0
].
movieNm
;
movieName
[
1
]
=
body
.
boxOfficeResult
.
dailyBoxOfficeList
[
1
].
movieNm
;
...
...
@@ -43,6 +43,13 @@ exports.ShowYesterdayRank = function(replyToken) {
movieAudiAcc
[
3
]
=
exports
.
numberWithCommas
(
body
.
boxOfficeResult
.
dailyBoxOfficeList
[
3
].
audiAcc
);
movieAudiAcc
[
4
]
=
exports
.
numberWithCommas
(
body
.
boxOfficeResult
.
dailyBoxOfficeList
[
4
].
audiAcc
);
var
movieCode
=
[];
movieCode
[
0
]
=
body
.
boxOfficeResult
.
dailyBoxOfficeList
[
0
].
movieCd
;
movieCode
[
1
]
=
body
.
boxOfficeResult
.
dailyBoxOfficeList
[
1
].
movieCd
;
movieCode
[
2
]
=
body
.
boxOfficeResult
.
dailyBoxOfficeList
[
2
].
movieCd
;
movieCode
[
3
]
=
body
.
boxOfficeResult
.
dailyBoxOfficeList
[
3
].
movieCd
;
movieCode
[
4
]
=
body
.
boxOfficeResult
.
dailyBoxOfficeList
[
4
].
movieCd
;
request
.
post
(
{
url
:
LINE_URL
,
...
...
@@ -50,20 +57,20 @@ exports.ShowYesterdayRank = function(replyToken) {
'Authorization'
:
`Bearer
${
TOKEN
}
`
},
json
:
{
"replyToken"
:
replyToken
,
"messages"
:[
"replyToken"
:
replyToken
,
"messages"
:
[
{
"type"
:
"text"
,
"text"
:
`[1위]\n영화제목 :
${
movieName
[
0
]}
\n개봉일 :
${
movieOpenDt
[
0
]}
\n누적 관객 수 :
${
movieAudiAcc
[
0
]}
명\n\n`
+
`[2위]\n영화제목 :
${
movieName
[
1
]}
\n개봉일 :
${
movieOpenDt
[
1
]}
\n누적 관객 수 :
${
movieAudiAcc
[
1
]}
명\n\n`
+
`[3위]\n영화제목 :
${
movieName
[
2
]}
\n개봉일 :
${
movieOpenDt
[
2
]}
\n누적 관객 수 :
${
movieAudiAcc
[
2
]}
명\n\n`
+
`[4위]\n영화제목 :
${
movieName
[
3
]}
\n개봉일 :
${
movieOpenDt
[
3
]}
\n누적 관객 수 :
${
movieAudiAcc
[
3
]}
명\n\n`
+
`[5위]\n영화제목 :
${
movieName
[
4
]}
\n개봉일 :
${
movieOpenDt
[
4
]}
\n누적 관객 수 :
${
movieAudiAcc
[
4
]}
명\n\n
`
"type"
:
"text"
,
"text"
:
`[1위]\n영화제목 :
${
movieName
[
0
]}
\n개봉일 :
${
movieOpenDt
[
0
]}
\n누적 관객 수 :
${
movieAudiAcc
[
0
]}
명\n영화코드 :
${
movieCode
[
0
]}
\n\n`
+
`[2위]\n영화제목 :
${
movieName
[
1
]}
\n개봉일 :
${
movieOpenDt
[
1
]}
\n누적 관객 수 :
${
movieAudiAcc
[
1
]}
명\n영화코드 :
${
movieCode
[
1
]}
\n\n`
+
`[3위]\n영화제목 :
${
movieName
[
2
]}
\n개봉일 :
${
movieOpenDt
[
2
]}
\n누적 관객 수 :
${
movieAudiAcc
[
2
]}
명\n영화코드 :
${
movieCode
[
2
]}
\n\n`
+
`[4위]\n영화제목 :
${
movieName
[
3
]}
\n개봉일 :
${
movieOpenDt
[
3
]}
\n누적 관객 수 :
${
movieAudiAcc
[
3
]}
명\n영화코드 :
${
movieCode
[
3
]}
\n\n`
+
`[5위]\n영화제목 :
${
movieName
[
4
]}
\n개봉일 :
${
movieOpenDt
[
4
]}
\n누적 관객 수 :
${
movieAudiAcc
[
4
]}
명\n영화코드 :
${
movieCode
[
4
]}
`
}
]
}
},(
error
,
response
,
body
)
=>
{
},
(
error
,
response
,
body
)
=>
{
console
.
log
(
body
)
});
}
...
...
@@ -72,20 +79,20 @@ exports.ShowYesterdayRank = function(replyToken) {
// 어제 날짜를 YYYYMMDD 형식(type: string)으로 반환하는 함수
exports
.
GetYesterday
=
function
()
{
exports
.
GetYesterday
=
function
()
{
var
today
=
new
Date
();
var
yesterday
=
new
Date
(
today
.
setDate
(
today
.
getDate
()
-
1
));
var
year
=
yesterday
.
getFullYear
();
var
month
=
(
'0'
+
(
yesterday
.
getMonth
()
+
1
)).
slice
(
-
2
);
var
day
=
(
'0'
+
yesterday
.
getDate
()).
slice
(
-
2
);
return
(
year
+
month
+
day
);
}
}
// 숫자 사이에 콤마(,) 찍고 반환하는 함수(입력, 출력 모두 문자열)
exports
.
numberWithCommas
=
function
(
x
)
{
exports
.
numberWithCommas
=
function
(
x
)
{
return
x
.
toString
().
replace
(
/
\B(?=(\d{3})
+
(?!\d))
/g
,
","
);
}
...
...
Please
register
or
login
to post a comment