Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ShinSeungMin
/
Multiplex_Ticketing_Platform
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
ShinSeungMin
2022-06-08 00:49:08 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
60de6d4dc4957868f747432ba954483a9fe1f104
60de6d4d
1 parent
14679f9e
Add KakaoAPI feature
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
5 deletions
Chatbot/app.js
Chatbot/package-lock.json
Chatbot/package.json
Chatbot/app.js
View file @
60de6d4
...
...
@@ -17,9 +17,11 @@ var app = express();
app
.
use
(
bodyParser
.
json
());
/////////////////////////////////////////////////
// commit 할때 지워야 할것들
const
USER_ID
=
''
const
TOKEN
=
''
const
domain
=
""
const
USER_ID
=
''
;
const
TOKEN
=
''
;
const
domain
=
''
;
const
KAKAO_KEY
=
''
;
/////////////////////////////////////////////////
let
MEGA_date
;
let
MEGA_TheaterLocation
;
...
...
@@ -31,6 +33,7 @@ let initFlag = false; //브랜드 선택 flag
let
MEGA_flag
=
-
1
;
//메가박스 인지 확인하는 flag
let
MEGA_count
;
//메가박스에서 영화관 판단하는 count
let
MEGA_AbleLocationList
=
[];
//메가박스에서 영화관 이름 매치하는 것 저장하는 list
let
MegaboxKakaoResultTheater
=
[];
exports
.
MEGA_PlayingMovieURL
=
MEGA_PlayingMovieURL
;
////////////////////////////////////////////////
//처음 영화관을 가져오는 것까지 대략 30초가 걸림 => 30초 기다리고 메세지 전송
...
...
@@ -213,15 +216,24 @@ app.post('/hook', asyncHandler(async (req, res, next) => {
const
final_URL
=
"https://www.megabox.co.kr/booking?rpstMovieNo="
+
MEGA_title
+
"&brchNo1="
+
MEGA_TheaterLocationCode
+
'&playDe='
+
MEGA_date
;
console
.
log
(
final_URL
);
PushMessage
(
final_URL
,
"링크를 누르면 예매창으로 바로 이동합니다."
);
MEGA_PlayingMovieList
=
[];
//영화 리스트 초기화
MegaboxKakaoResultTheater
=
[];
GetMegaboxKakaoMapURL
(
MEGA_TheaterLocation
);
setTimeout
(
function
()
{
MEGA_PlayingMovieList
=
[];
console
.
log
(
MegaboxKakaoResultTheater
[
0
]);
let
MegaboxKakaoResultTheaterNAME
=
MegaboxKakaoResultTheater
[
0
][
'theater_name'
];
let
MegaboxKakaoResultTheaterURL
=
MegaboxKakaoResultTheater
[
0
][
'theater_url'
];
console
.
log
(
MegaboxKakaoResultTheaterNAME
,
MegaboxKakaoResultTheaterURL
);
PushMessage
(
MegaboxKakaoResultTheaterURL
,
"카카오맵으로 검색한 "
+
MegaboxKakaoResultTheaterNAME
+
"의 위치입니다."
);
setTimeout
(
function
()
{
//EGA_PlayingMovieList = [];
initFlag
=
false
;
MEGA_flag
=
-
1
;
PushSingleMessage
(
"원하시는 브랜드의 번호를 입력해주세요.\n1: CGV\n2: LotteCinema\n3: Megabox\n언제든 브랜드를 바꾸고 싶으시다면 '브랜드'를 입력해주세요."
);
},
1000
);
},
2000
);
}
}
res
.
sendStatus
(
200
);
}))
//});
...
...
@@ -238,6 +250,45 @@ try {
console
.
log
(
'[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.'
);
console
.
log
(
error
);
}
GetMegaboxKakaoMapURL
=
async
(
LOCATE
)
=>
{
let
KAKAOOPTION
=
{
url
:
"https://dapi.kakao.com/v2/local/search/keyword"
,
method
:
"GET"
,
headers
:
{
'Authorization'
:
`KakaoAK
${
KAKAO_KEY
}
`
// commit 할때 지워야 할것
},
qs
:
{
'query'
:
'메가박스 '
+
LOCATE
,
// 메가박스 영화관이름
//'category_group_code' : 'CT1',
'size'
:
5
},
encoding
:
'UTF-8'
};
let
selectable_theaters
=
[];
request
(
KAKAOOPTION
,
function
(
err
,
res
,
body
)
{
info_list
=
JSON
.
parse
(
body
).
documents
;
if
(
!
err
&&
res
.
statusCode
==
200
)
{
info_list
.
forEach
(
info
=>
{
//console.log(info.category_name);
if
(
info
.
category_name
.
endsWith
(
"메가박스"
))
{
const
theater_info
=
{
"theater_name"
:
info
.
place_name
,
"theater_url"
:
info
.
place_url
};
//console.log(theater_info);
//return theater_info;
selectable_theaters
.
push
(
theater_info
);
}
});
}
console
.
log
(
selectable_theaters
);
MegaboxKakaoResultTheater
=
selectable_theaters
;
return
;
});
}
//메세지 전송하는 function 모음
function
SendMessage
(
eventObj
,
text1
,
text2
=
""
)
{
//reply message
request
.
post
(
...
...
Chatbot/package-lock.json
0 → 100644
View file @
60de6d4
This diff could not be displayed because it is too large.
Chatbot/package.json
View file @
60de6d4
...
...
@@ -16,7 +16,9 @@
"chromedriver"
:
"^101.0.0"
,
"express"
:
"^4.18.1"
,
"express-async-handler"
:
"^1.2.0"
,
"moment"
:
"^2.29.3"
,
"puppeteer"
:
"^14.1.1"
,
"request"
:
"^2.88.2"
,
"selenium-webdriver"
:
"^4.1.2"
}
}
...
...
Please
register
or
login
to post a comment