-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex
235 lines (216 loc) · 6.79 KB
/
index
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
const express = require("express");
const logger = require("morgan");
const bodyParser = require("body-parser");
const app = express();
const apiRouter = express.Router();
app.use(logger("dev", {}));
app.use(bodyParser.json());
app.use("/api", apiRouter);
app.listen(3000, function () {
console.log("Example skill server listening on port 3000!");
});
//
apiRouter.post("/sayHello", function (req, res) {
const responseBody = {
version: "2.0",
template: {
outputs: [
{
simpleText: {
text: "hello I'm Ryan",
},
},
],
},
};
res.status(200).send(responseBody);
});
apiRouter.post("/menu", function (req, res) {
console.log(req.body);
const responseBody = {
version: "2.0",
template: {
outputs: [
{
basicCard: {
title: "금주의 교직원 식당 식단표입니다",
description: "웹사이트에서 교직원식당 주간 메뉴를 클릭해주세요!",
buttons: [
{
action: "webLink",
label: "Link Button",
webLinkUrl:
"https://sejong.korea.ac.kr/campuslife/facilities/dining/weeklymenu",
},
],
},
},
],
},
};
res.status(200).send(responseBody);
});
apiRouter.post("/diagnosis", function (req, res) {
return res.send({
version: "2.0",
template: {
outputs: [
{
basicCard: {
title: "코로나-19 자가진단",
description: "COVID-19 Self-diagnosis",
thumbnail: {
imageUrl:
"https://pusyap.com/wp-content/uploads/2020/07/%EC%B2%B4%EC%98%A8%EC%B8%A1%EC%A0%95_%EC%BD%94%EB%A1%9C%EB%82%9819jpg.jpg",
},
buttons: [
{
action: "webLink",
label: "구글 링크 바로가기(Google from Link)",
webLinkUrl:
"https://docs.google.com/forms/d/e/1FAIpQLSf0oC7eK8KmBLXJfITgk7ZJN-aB2jUcN6aBUcaLNhgpJQGYlw/viewform",
},
{
action: "phone",
label: "선별진료소 전화하기(Call Emergence)",
phoneNumber: "044-860-1038",
},
],
},
},
],
},
});
});
apiRouter.post("/searchBook", function (req, res) {
return res.send({
version: "2.0",
template: {
outputs: [
{
basicCard: {
title: "학술정보원 도서검색",
description: "팝업창에서 도서를 검색해주세요",
thumbnail: {
imageUrl:
"https://lh3.googleusercontent.com/proxy/IO0N4d6B0rjRKjBPCYBSTnI09BojxaXw9R8IXGyo6ClnG9Zs3NDUUmWvdjuSx1AbjxDc4NBiaTqqR4SHLFYIo0cZHjL2DMscj1KmO51DldPBVntokqieuq5Rk3uUPw4iMtSu_QkVQ7o-Km5quzGh4qEFMQoH_7nT_qSsmmWeUliKwMuOc8DIUJgQ15JW5JNoyvuvK5_-Ib1WH4ETtjjmL5qjDtbzHbiT4ihoUuiR1_ZheVphEpAnnh2w7WklCM8dISFZDYwuDXfQZevUGgulWNRzj_cXt5zUl4MOanfFzCOqIUR8TxzQytVqlOk2WoYCaaP6ocwfIAKEK6NivqgwuMuZtg0OVyKHZhddN0bTC1lkkphWIP_9eGlFUA7Y5w",
},
buttons: [
{
action: "webLink",
label: "Link Button",
webLinkUrl: "https://libs.korea.ac.kr/",
},
],
},
},
],
},
});
});
apiRouter.post("/reserveSeat", function (req, res) {
return res.send({
version: "2.0",
template: {
outputs: [
{
basicCard: {
title: "학술정보원 열람실 예약",
description: "팝업창 로그인후 사용해주세요!",
thumbnail: {
imageUrl:
"https://lh3.googleusercontent.com/proxy/IO0N4d6B0rjRKjBPCYBSTnI09BojxaXw9R8IXGyo6ClnG9Zs3NDUUmWvdjuSx1AbjxDc4NBiaTqqR4SHLFYIo0cZHjL2DMscj1KmO51DldPBVntokqieuq5Rk3uUPw4iMtSu_QkVQ7o-Km5quzGh4qEFMQoH_7nT_qSsmmWeUliKwMuOc8DIUJgQ15JW5JNoyvuvK5_-Ib1WH4ETtjjmL5qjDtbzHbiT4ihoUuiR1_ZheVphEpAnnh2w7WklCM8dISFZDYwuDXfQZevUGgulWNRzj_cXt5zUl4MOanfFzCOqIUR8TxzQytVqlOk2WoYCaaP6ocwfIAKEK6NivqgwuMuZtg0OVyKHZhddN0bTC1lkkphWIP_9eGlFUA7Y5w",
},
buttons: [
{
action: "webLink",
label: "Link Button",
webLinkUrl: "http://libs.korea.ac.kr:81/",
},
],
},
},
],
},
});
});
apiRouter.post("/location", function (req, res) {
const userRequest = req.body.userRequest;
const blockId = userRequest.block.id;
src =
"//dapi.kakao.com/v2/maps/sdk.js?appkey=4fd6f502357b59ad93e1ef4fe9b139e9";
var staticMapContainer = document.getElementById("staticMap"), // 이미지 지도를 표시할 div
staticMapOption = {
center: new kakao.maps.LatLng(36.60918555652231, 127.28552189796417), // 이미지 지도의 중심좌표
level: 3, // 이미지 지도의 확대 레벨
};
// 이미지 지도를 표시할 div와 옵션으로 이미지 지도를 생성합니다
var staticMap = new kakao.maps.StaticMap(staticMapContainer, staticMapOption);
return res.send({
version: "2.0",
template: {
outputs: [
{
basicCard: {
title: "수업에 늦지않게 길찾기를 도와드릴게요!",
thumbnail: {
imageUrl: staticMap,
},
buttons: [
{
action: "webLink",
label: "클릭해서 바로 길 찾기",
webLinkUrl:
"https://map.kakao.com/link/map/농심국제관,36.60918555652231,127.28552189796417",
},
],
},
},
],
},
});
});
apiRouter.post("/restaurant", function (req, res) {
const userRequest = req.body.userRequest;
const blockId = userRequest.block.id;
return res.send({
version: "2.0",
template: {
outputs: [
{
basicCard: {
title: "학교 주변 맛집 정보를 보여드릴게요",
thumbnail: {
imageUrl:
"https://t1.daumcdn.net/thumb/R720x0.fpng/?fname=http://t1.daumcdn.net/brunch/service/user/9Kii/image/X1zWJ7b_Qlk7H96UIlwq99FrKN8.png",
},
buttons: [
{
action: "webLink",
label: "클릭해서 바로 맛집 찾기",
webLinkUrl: "https://map.kakao.com/link/search/고려대세종주변맛집",
},
],
},
},
],
},
});
});
app.post("/blockId", function (req, res) {
const userRequest = req.body.userRequest;
const blockId = userRequest.block.id;
return res.send({
version: "2.0",
template: {
outputs: [
{
basicCard: {
title: "블록ID 입니다",
description: blockId,
},
},
],
},
});
});