김성욱

Add question6, 7

...@@ -240,6 +240,88 @@ apiRouter.post('/question5', (req, res) => { ...@@ -240,6 +240,88 @@ apiRouter.post('/question5', (req, res) => {
240 res.status(200).send(responseBody); 240 res.status(200).send(responseBody);
241 }); 241 });
242 242
243 +apiRouter.post('/question6', (req, res) => {
244 + var userId = req.body.userRequest.user.id;
245 + var mesg = req.body.userRequest.utterance;
246 + console.log('[q2:user message] ', mesg);
247 + var mbti = '';
248 + if (mesg == "네") {
249 + mbti = 'E';
250 + } else if (mesg == "아니오") {
251 + mbti = 'I';
252 + }
253 + userDB[userId][0] += mbti;
254 + console.log(userDB[userId]);
255 + const responseBody = {
256 + version: "2.0",
257 + template: {
258 + outputs: [
259 + {
260 + simpleText: {
261 + text: '종종 인간 실존에 대한 이유를 생각합니다.'
262 + }
263 + }
264 + ],
265 + quickReplies: [
266 + {
267 + action: "block",
268 + label: "네",
269 + message: "네",
270 + blockId: "6297b133f591aa190554a260"
271 + },
272 + {
273 + action: "block",
274 + label: "아니오",
275 + message: "아니오",
276 + blockId: "6297b133f591aa190554a260"
277 + }
278 + ]
279 + }
280 + }
281 + res.status(200).send(responseBody);
282 +});
283 +
284 +apiRouter.post('/question7', (req, res) => {
285 + var userId = req.body.userRequest.user.id;
286 + var mesg = req.body.userRequest.utterance;
287 + console.log('[q2:user message] ', mesg);
288 + var mbti = '';
289 + if (mesg == "네") {
290 + mbti = 'N';
291 + } else if (mesg == "아니오") {
292 + mbti = 'S';
293 + }
294 + userDB[userId][1] += mbti;
295 + console.log(userDB[userId]);
296 + const responseBody = {
297 + version: "2.0",
298 + template: {
299 + outputs: [
300 + {
301 + simpleText: {
302 + text: '어떤 일에서 성과를 냈을 때 “고생했어”보다 “잘했어”라는 말이 더 좋습니다.'
303 + }
304 + }
305 + ],
306 + quickReplies: [
307 + {
308 + action: "block",
309 + label: "네",
310 + message: "네",
311 + blockId: "6297b3505ceed96c38544a0a"
312 + },
313 + {
314 + action: "block",
315 + label: "아니오",
316 + message: "아니오",
317 + blockId: "6297b3505ceed96c38544a0a"
318 + }
319 + ]
320 + }
321 + }
322 + res.status(200).send(responseBody);
323 +});
324 +
243 app.listen((process.env.PORT || 3000), function() { 325 app.listen((process.env.PORT || 3000), function() {
244 console.log('Example skill server listening on port 3000!'); 326 console.log('Example skill server listening on port 3000!');
245 }); 327 });
...\ No newline at end of file ...\ No newline at end of file
......