Showing
1 changed file
with
0 additions
and
139 deletions
... | @@ -14,37 +14,7 @@ app.use(bodyParser.urlencoded({ | ... | @@ -14,37 +14,7 @@ app.use(bodyParser.urlencoded({ |
14 | app.use('/api', apiRouter); | 14 | app.use('/api', apiRouter); |
15 | 15 | ||
16 | let userDB = new Array(); | 16 | let userDB = new Array(); |
17 | -let mbtiper = new Array(); | ||
18 | 17 | ||
19 | -apiRouter.post('/test', (req, res) => { | ||
20 | - const responseBody = { | ||
21 | - version: "2.0", | ||
22 | - template: { | ||
23 | - outputs: [ | ||
24 | - { | ||
25 | - simpleText: { | ||
26 | - text: 'MBTI 테스트 question8-14\n시작하려면 시작하기 버튼을 눌러주세요!' | ||
27 | - } | ||
28 | - } | ||
29 | - ], | ||
30 | - quickReplies: [ | ||
31 | - { | ||
32 | - action: "block", | ||
33 | - label: "시작하기", | ||
34 | - message: "시작하기", | ||
35 | - blockId: "62977ff05ceed96c385449b9" | ||
36 | - }, | ||
37 | - { | ||
38 | - action: "block", | ||
39 | - label: "나중에 하기", | ||
40 | - message: "나중에 하기", | ||
41 | - blockId: "6297861be7a0253c7662ccb8" | ||
42 | - } | ||
43 | - ] | ||
44 | - } | ||
45 | - } | ||
46 | - res.status(200).send(responseBody); | ||
47 | -}); | ||
48 | 18 | ||
49 | apiRouter.post('/question8', (req, res) => { | 19 | apiRouter.post('/question8', (req, res) => { |
50 | var userId = req.body.userRequest.user.id; | 20 | var userId = req.body.userRequest.user.id; |
... | @@ -325,116 +295,7 @@ apiRouter.post('/question14', (req, res) => { | ... | @@ -325,116 +295,7 @@ apiRouter.post('/question14', (req, res) => { |
325 | res.status(200).send(responseBody); | 295 | res.status(200).send(responseBody); |
326 | }); | 296 | }); |
327 | 297 | ||
328 | -apiRouter.post('/result', (req, res) => { | ||
329 | - var mesg = req.body.userRequest.utterance; | ||
330 | - var userId = req.body.userRequest.user.id; | ||
331 | - mbtiper = ['','','','','','','','']; | ||
332 | - var mbti = ''; | ||
333 | - if (mesg == "네"){ | ||
334 | - mbti = 'N'; | ||
335 | - } | ||
336 | - else if (mesg == "아니오") { | ||
337 | - mbti = 'S'; | ||
338 | - } | ||
339 | - userDB[userId][1] += mbti; | ||
340 | - var e = 0; | ||
341 | - var n = 0; | ||
342 | - var f = 0; | ||
343 | - var j = 0; | ||
344 | - for(i=0; i<2; i++){ | ||
345 | - if(userDB[userId][0][i] == "E"){ | ||
346 | - e++; | ||
347 | - } | ||
348 | - } | ||
349 | - for(i=0; i<2; i++){ | ||
350 | - if(userDB[userId][1][i] == "N"){ | ||
351 | - n++; | ||
352 | - } | ||
353 | - } | ||
354 | - for(i=0; i<1; i++){ | ||
355 | - if(userDB[userId][2][i] == "F"){ | ||
356 | - f++; | ||
357 | - } | ||
358 | - } | ||
359 | - for(i=0; i<2; i++){ | ||
360 | - if(userDB[userId][3][i] == "J"){ | ||
361 | - j++; | ||
362 | - } | ||
363 | - } | ||
364 | - var i = 2-e; | ||
365 | - var s = 2-n; | ||
366 | - var t = 1-f; | ||
367 | - var p = 2-j; | ||
368 | - mbtiper[0] += 20 * e; | ||
369 | - mbtiper[1] += 20 * i; | ||
370 | - mbtiper[2] += 20 * n; | ||
371 | - mbtiper[3] += 20 * s; | ||
372 | - mbtiper[4] += 20 * t; | ||
373 | - mbtiper[5] += 20 * f; | ||
374 | - mbtiper[6] += 20 * j; | ||
375 | - mbtiper[7] += 20 * p; | ||
376 | - if(mbtiper[0]>mbtiper[1]){ | ||
377 | - userDB[userId][4] += 'E'; | ||
378 | - } else { | ||
379 | - userDB[userId][4] += 'I'; | ||
380 | - } | ||
381 | - if(mbtiper[2]>mbtiper[3]){ | ||
382 | - userDB[userId][4] += 'N'; | ||
383 | - } else { | ||
384 | - userDB[userId][4] += 'S'; | ||
385 | - } | ||
386 | - if(mbtiper[4]>mbtiper[5]){ | ||
387 | - userDB[userId][4] += 'T'; | ||
388 | - } else { | ||
389 | - userDB[userId][4] += 'F'; | ||
390 | - } | ||
391 | - if(mbtiper[6]>mbtiper[7]){ | ||
392 | - userDB[userId][4] += 'J'; | ||
393 | - } else { | ||
394 | - userDB[userId][4] += 'P'; | ||
395 | - } | ||
396 | - const responseBody = { | ||
397 | - version: "2.0", | ||
398 | - template: { | ||
399 | - outputs: [ | ||
400 | - { | ||
401 | - simpleText: { | ||
402 | - text: "당신의 MBTI는 : "+userDB[userId][4] | ||
403 | - } | ||
404 | - } | ||
405 | - ], | ||
406 | - quickReplies: [{ | ||
407 | - action: "block", | ||
408 | - label: "MBTI 테스트 다시하기", | ||
409 | - message: "MBTI 테스트 다시하기", | ||
410 | - blockId : "62977ff05ceed96c385449b9" | ||
411 | - }, | ||
412 | - { | ||
413 | - action: "block", | ||
414 | - label: "결과 상세보기", | ||
415 | - message: "결과 상세보기", | ||
416 | - blockId: "62987b78e7a0253c7662dcd9" | ||
417 | - }] | ||
418 | - } | ||
419 | - } | ||
420 | - res.status(200).send(responseBody); | ||
421 | - }); | ||
422 | 298 | ||
423 | -apiRouter.post('/percent', (req, res) => { | ||
424 | - const responseBody = { | ||
425 | - version: "2.0", | ||
426 | - template: { | ||
427 | - outputs: [ | ||
428 | - { | ||
429 | - simpleText: { | ||
430 | - text: 'E: '+mbtiper[0]+'%\nI: '+mbtiper[1]+'%\nN: '+mbtiper[2]+'%\nS: '+mbtiper[3]+'%\nT: '+mbtiper[4]+'%\nF: '+mbtiper[5]+'%\nJ: '+mbtiper[6]+'%\nP: '+mbtiper[7]+'%' | ||
431 | - } | ||
432 | - } | ||
433 | - ] | ||
434 | - } | ||
435 | - } | ||
436 | - res.status(200).send(responseBody); | ||
437 | - }); | ||
438 | app.listen((process.env.PORT || 3000), function() { | 299 | app.listen((process.env.PORT || 3000), function() { |
439 | console.log('Example skill server listening on port 3000!'); | 300 | console.log('Example skill server listening on port 3000!'); |
440 | }); | 301 | }); |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment