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-02 01:33:58 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
eb4b95b8c3f77bced9335cf7cee38a984095ac0b
eb4b95b8
1 parent
a23da85c
Rename the function and update the function
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
MovieList.js
MovieList.js
View file @
eb4b95b
...
...
@@ -25,21 +25,17 @@ app.post('/hook', function (req, res) {
console
.
log
(
'[request source] '
,
eventObj
.
source
);
console
.
log
(
'[request message]'
,
eventObj
.
message
);
trans
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
);
movielist
(
eventObj
.
replyToken
,
eventObj
.
message
.
text
);
res
.
sendStatus
(
200
);
});
// message insert: Inquiry start opening year,Inquiry end opening year
// ex) 2019,2020
function
trans
(
replyToken
,
message
)
{
var
my_message
,
copied_message
;
copied_message
=
message
my_message
=
copied_message
.
split
(
','
);
function
movielist
(
replyToken
,
message
)
{
var
encodedMessage
=
encodeURI
(
message
);
request
.
get
(
{
url
:
KOFIC_URL
+
`?key=
${
config
.
KOFIC_KEY
}
&
openStartDt=
${
my_message
[
0
]}
&openEndDt=
${
my_message
[
1
]}
}`
,
url
:
KOFIC_URL
+
`?key=
${
config
.
KOFIC_KEY
}
&
movieNm=
${
encodedMessage
}
`
,
json
:
true
},(
error
,
response
,
body
)
=>
{
if
(
!
error
&&
response
.
statusCode
==
200
)
{
...
...
@@ -48,13 +44,14 @@ function trans(replyToken, message) {
for
(
let
i
=
0
;
i
<
body
.
movieListResult
.
movieList
.
length
;
i
++
){
movieNm
=
body
.
movieListResult
.
movieList
[
i
].
movieNm
;
prdtYear
=
body
.
movieListResult
.
movieList
[
i
].
prdtYear
;
movieCd
=
body
.
movieListResult
.
movieList
[
i
].
movieCd
;
if
(
body
.
movieListResult
.
movieList
[
i
].
directors
.
length
===
0
){
directors
=
"감독정보없음"
}
else
{
directors
=
body
.
movieListResult
.
movieList
[
i
].
directors
[
0
].
peopleNm
;
}
result
+=
'제목: '
+
movieNm
+
`(
${
prdtYear
}
)`
+
'\n'
+
'감독: '
+
directors
+
'\n'
;
result
+=
'제목: '
+
movieNm
+
`(
${
prdtYear
}
)`
+
'\n'
+
'감독: '
+
directors
+
'\n'
+
'영화코드: '
+
movieCd
+
'\n'
;
}
request
.
post
(
{
...
...
Please
register
or
login
to post a comment