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:59:18 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
cb913d7e802e5c6ef05daca38d72f3a5b9692a55
cb913d7e
1 parent
60de6d4d
Add refreshing and Fix bug
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
13 deletions
Chatbot/app.js
Chatbot/app.js
View file @
cb913d7
...
...
@@ -141,8 +141,9 @@ app.post('/hook', asyncHandler(async (req, res, next) => {
//날짜 확인 및 날짜, 장소에 대해 상영중인 영화 리스트 가져오기
if
(
moment
(
message
.
text
,
"YYYYMMDD"
,
true
).
isValid
()
&&
MEGA_flag
==
3
)
{
MEGA_date
=
parseInt
(
message
.
text
);
let
today
=
GettingToday
();
//오늘 이후인지 확인하기 위해 날짜 가져옴
//console.log(MEGA_date, MEGA_TheaterLocation);
if
(
MEGA_date
&&
MEGA_TheaterLocationCode
)
{
if
(
today
<=
MEGA_date
&&
MEGA_date
&&
MEGA_TheaterLocationCode
)
{
const
text1
=
"현재상영작을 가져오는 중입니다."
;
const
text2
=
"잠시만 기다려주세요."
;
PushMessage
(
text1
,
text2
);
...
...
@@ -190,15 +191,15 @@ app.post('/hook', asyncHandler(async (req, res, next) => {
PushMessage
(
PlayingMovie
,
"바로 링크가 보내집니다."
);
MEGA_title
=
MEGA_PlayingMovieList
[
Object
.
keys
(
MEGA_PlayingMovieList
)[
0
]];
setTimeout
(
function
()
{
const
final_URL
=
"https://www.megabox.co.kr/booking?rpstMovieNo="
+
MEGA_title
+
"&brchNo1="
+
MEGA_TheaterLocationCode
+
'&playDe='
+
MEGA_date
;
cons
ole
.
log
(
final_URL
)
Push
Message
(
final_URL
,
"링크를 누르면 예매창으로 바로 이동합니다."
);
},
1000
);
setTimeout
(
function
()
{
initFlag
=
false
;
MEGA_flag
=
-
1
;
MEGA_PlayingMovieList
=
[]
;
PushSingleMessage
(
"원하시는 브랜드의 번호를 입력해주세요.\n1: CGV\n2: LotteCinema\n3: Megabox\n언제든 브랜드를 바꾸고 싶으시다면 '브랜드'를 입력해주세요."
);
const
PC_
final_URL
=
"https://www.megabox.co.kr/booking?rpstMovieNo="
+
MEGA_title
+
"&brchNo1="
+
MEGA_TheaterLocationCode
+
'&playDe='
+
MEGA_date
;
cons
t
Smartphone_final_URL
=
"https://m.megabox.co.kr/booking/movie?movieNo="
+
MEGA_title
+
"&brchNo1="
+
MEGA_TheaterLocationCode
+
'&playDe='
+
MEGA_date
;
Push
URLMessage
(
PC_final_URL
,
Smartphone_final_URL
);
setTimeout
(
function
()
{
initFlag
=
false
;
MEGA_flag
=
-
1
;
MEGA_PlayingMovieList
=
[]
;
PushSingleMessage
(
"원하시는 브랜드의 번호를 입력해주세요.\n1: CGV\n2: LotteCinema\n3: Megabox\n언제든 브랜드를 바꾸고 싶으시다면 '브랜드'를 입력해주세요."
)
;
},
1000
);
},
1000
);
}
else
{
let
index
=
0
;
...
...
@@ -213,9 +214,10 @@ app.post('/hook', asyncHandler(async (req, res, next) => {
}
else
if
(
MEGA_flag
==
5
)
{
const
index
=
parseInt
(
message
.
text
)
-
1
;
MEGA_title
=
MEGA_PlayingMovieList
[
Object
.
keys
(
MEGA_PlayingMovieList
)[
index
]];
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
,
"링크를 누르면 예매창으로 바로 이동합니다."
);
const
PC_final_URL
=
"https://www.megabox.co.kr/booking?rpstMovieNo="
+
MEGA_title
+
"&brchNo1="
+
MEGA_TheaterLocationCode
+
'&playDe='
+
MEGA_date
;
const
Smartphone_final_URL
=
"https://m.megabox.co.kr/booking/movie?movieNo="
+
MEGA_title
+
"&brchNo1="
+
MEGA_TheaterLocationCode
+
'&playDe='
+
MEGA_date
;
console
.
log
(
PC_final_URL
,
Smartphone_final_URL
);
PushURLMessage
(
PC_final_URL
,
Smartphone_final_URL
);
MEGA_PlayingMovieList
=
[];
//영화 리스트 초기화
MegaboxKakaoResultTheater
=
[];
GetMegaboxKakaoMapURL
(
MEGA_TheaterLocation
);
...
...
@@ -250,6 +252,24 @@ try {
console
.
log
(
'[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.'
);
console
.
log
(
error
);
}
//오늘 날짜 구하기
function
GettingToday
(){
var
today
=
new
Date
();
var
year
=
today
.
getFullYear
();
var
month
=
(
'0'
+
(
today
.
getMonth
()
+
1
)).
slice
(
-
2
);
var
day
=
(
'0'
+
today
.
getDate
()).
slice
(
-
2
);
var
dateString
=
year
+
month
+
day
;
var
dateInt
=
parseInt
(
dateString
);
console
.
log
(
dateInt
);
return
dateInt
;
}
//24시간마다 데이터 초기화
var
dayInMilliseconds
=
1000
*
60
*
60
*
24
;
setInterval
(
function
()
{
megabox
.
init
();
console
.
log
(
"success"
)
},
dayInMilliseconds
);
//Megabox - Kakao API로 영화관 위치 찾기
GetMegaboxKakaoMapURL
=
async
(
LOCATE
)
=>
{
let
KAKAOOPTION
=
{
url
:
"https://dapi.kakao.com/v2/local/search/keyword"
,
...
...
@@ -357,4 +377,28 @@ function PushSingleMessage(text1) {//push single message
},
(
error
,
response
,
body
)
=>
{
console
.
log
(
body
)
});
}
function
PushURLMessage
(
pcurl
,
smartphoneurl
)
{
//push single message
request
.
post
(
{
url
:
PUSH_TARGET_URL
,
headers
:
{
'Authorization'
:
`Bearer
${
TOKEN
}
`
},
json
:
{
"to"
:
`
${
USER_ID
}
`
,
"messages"
:
[
{
"type"
:
"text"
,
"text"
:
"pc버전 url입니다\n\n"
+
pcurl
},
{
"type"
:
"text"
,
"text"
:
"mobile버전 url입니다\n\n"
+
smartphoneurl
}
]
}
},
(
error
,
response
,
body
)
=>
{
console
.
log
(
body
)
});
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment