Showing
1 changed file
with
40 additions
and
135 deletions
| ... | @@ -41,164 +41,69 @@ apiRouter.post('/sayHello', function(req, res) { | ... | @@ -41,164 +41,69 @@ apiRouter.post('/sayHello', function(req, res) { |
| 41 | res.status(200).send(responseBody); | 41 | res.status(200).send(responseBody); |
| 42 | }); | 42 | }); |
| 43 | 43 | ||
| 44 | -apiRouter.post('/question1', (req, res) => { | 44 | +apiRouter.post('/test', (req, res) => { |
| 45 | - var userId = req.body.userRequest.user.id; | ||
| 46 | - var mesg = req.body.userRequest; | ||
| 47 | - console.log('[q1:user message] ', mesg); | ||
| 48 | - userDB[userId] = ''; | ||
| 49 | - console.log(userDB[userId]); | ||
| 50 | - const responseBody = { | ||
| 51 | - version: "2.0", | ||
| 52 | - template: { | ||
| 53 | - outputs: [ | ||
| 54 | - { | ||
| 55 | - simpleText: { | ||
| 56 | - text: '사람들과 어울리는 것을 좋아하시나요?' | ||
| 57 | - } | ||
| 58 | - } | ||
| 59 | - ], | ||
| 60 | - quickReplies: [ | ||
| 61 | - { | ||
| 62 | - action: "block", | ||
| 63 | - label: "네", | ||
| 64 | - message: "네", | ||
| 65 | - blockId: "628e8cb07bd2fd433357f878" | ||
| 66 | - }, | ||
| 67 | - { | ||
| 68 | - action: "block", | ||
| 69 | - label: "아니오", | ||
| 70 | - message: "아니오", | ||
| 71 | - blockId: "628e8cb07bd2fd433357f878" | ||
| 72 | - } | ||
| 73 | - ] | ||
| 74 | - } | ||
| 75 | - } | ||
| 76 | - res.status(200).send(responseBody); | ||
| 77 | -}); | ||
| 78 | - | ||
| 79 | -apiRouter.post('/question2', (req, res) => { | ||
| 80 | - var userId = req.body.userRequest.user.id; | ||
| 81 | - var mesg = req.body.userRequest.utterance; | ||
| 82 | - console.log('[q2:user message] ', mesg); | ||
| 83 | - var mbti = ''; | ||
| 84 | - if (mesg == "네") { | ||
| 85 | - mbti = 'E'; | ||
| 86 | - } else if (mesg == "아니오") { | ||
| 87 | - mbti = 'I'; | ||
| 88 | - } | ||
| 89 | - userDB[userId] += mbti; | ||
| 90 | - console.log(userDB[userId]); | ||
| 91 | const responseBody = { | 45 | const responseBody = { |
| 92 | - version: "2.0", | 46 | + version: "2.0", |
| 93 | - template: { | 47 | + template: { |
| 94 | - outputs: [ | 48 | + outputs: [ |
| 95 | - { | 49 | + { |
| 96 | - simpleText: { | 50 | + simpleText: { |
| 97 | - text: '평소 깻잎논쟁에 1시간 이상을 생각해봤다.' | 51 | + text: '재밌는 MBTI 테스트' |
| 98 | - } | 52 | + } |
| 99 | - } | 53 | + } |
| 100 | - ], | 54 | + ], |
| 101 | - quickReplies: [ | 55 | + quickReplies: [ |
| 102 | - { | 56 | + { |
| 103 | - action: "block", | 57 | + action: "block", |
| 104 | - label: "네", | 58 | + label: "할래!", |
| 105 | - message: "네", | 59 | + message: "할래!", |
| 106 | - blockId: "628d239d93b31d5b60ab6c29" | 60 | + blockId: "6294c3ecf591aa1905548230" |
| 107 | - }, | 61 | + }, |
| 108 | - { | 62 | + { |
| 109 | - action: "block", | 63 | + action: "block", |
| 110 | - label: "아니오", | 64 | + label: "안 할래", |
| 111 | - message: "아니오", | 65 | + message: "안 할래", |
| 112 | - blockId: "628d239d93b31d5b60ab6c29" | 66 | + blockId: "628b7ef293b31d5b60ab4b29" |
| 113 | - } | 67 | + } |
| 114 | - ] | 68 | + ] |
| 115 | - } | 69 | + } |
| 116 | - } | 70 | + } |
| 117 | - res.status(200).send(responseBody); | 71 | + res.status(200).send(responseBody); |
| 118 | }); | 72 | }); |
| 119 | 73 | ||
| 120 | -apiRouter.post('/question3', function(req, res) { | 74 | +apiRouter.post('/question15', (req, res) => { |
| 121 | var userId = req.body.userRequest.user.id; | 75 | var userId = req.body.userRequest.user.id; |
| 122 | - var mesg = req.body.userRequest.utterance; | 76 | + var mesg = req.body.userRequest; |
| 123 | - console.log('[q3:user message] ', mesg); | 77 | + userDB[userId] = ['','','','',''];//new Array(5); |
| 124 | - var mbti = ''; | ||
| 125 | - if (mesg == '네') { | ||
| 126 | - mbti = 'N'; | ||
| 127 | - } else if (mesg == '아니오') { | ||
| 128 | - mbti = 'S'; | ||
| 129 | - } | ||
| 130 | - userDB[userId] += mbti; | ||
| 131 | - console.log(userDB[userId]); | ||
| 132 | const responseBody = { | 78 | const responseBody = { |
| 133 | version: "2.0", | 79 | version: "2.0", |
| 134 | template: { | 80 | template: { |
| 135 | outputs: [ | 81 | outputs: [ |
| 136 | { | 82 | { |
| 137 | - "simpleText": { | 83 | + simpleText: { |
| 138 | - "text": "다음과 같은 상황에서 어떻게 대답하겠습니까?\n 친구: 나 기분 안 좋아서 옷 샀어" | 84 | + text: '친구: 우울해서 아이패드 샀어' |
| 139 | } | 85 | } |
| 140 | } | 86 | } |
| 141 | ], | 87 | ], |
| 142 | quickReplies: [ | 88 | quickReplies: [ |
| 143 | { | 89 | { |
| 144 | action: "block", | 90 | action: "block", |
| 145 | - label: "왜 기분 안 좋아?", | 91 | + label: "왜ㅠㅠ무슨일 있었어?", |
| 146 | - message: "왜 기분 안 좋아?", | 92 | + message: "왜ㅠㅠ무슨일 있었어?", |
| 147 | - blockId: "6290630451c40d32c6d8e71f" | 93 | + blockId: "6294c467e7a0253c7662acac" |
| 148 | }, | 94 | }, |
| 149 | { | 95 | { |
| 150 | action: "block", | 96 | action: "block", |
| 151 | - label: "무슨 옷 샀어?", | 97 | + label: "어떤 기종샀어?", |
| 152 | - message: "무슨 옷 샀어?", | 98 | + message: "어떤 기종샀어?", |
| 153 | - blockId: "6290630451c40d32c6d8e71f" | 99 | + blockId: "6294c467e7a0253c7662acac" |
| 154 | } | 100 | } |
| 155 | ] | 101 | ] |
| 156 | } | 102 | } |
| 157 | - }; | 103 | + } |
| 158 | res.status(200).send(responseBody); | 104 | res.status(200).send(responseBody); |
| 159 | }); | 105 | }); |
| 160 | 106 | ||
| 161 | -apiRouter.post('/question4', (req, res) => { | ||
| 162 | - var userId = req.body.userRequest.user.id; | ||
| 163 | - var mesg = req.body.userRequest.utterance; | ||
| 164 | - console.log('[q4:user message] ', mesg); | ||
| 165 | - var mbti = ''; | ||
| 166 | - if (mesg == "왜 기분 안 좋아?") { | ||
| 167 | - mbti = 'F'; | ||
| 168 | - } else if (mesg == "무슨 옷 샀어?") { | ||
| 169 | - mbti = 'T'; | ||
| 170 | - } | ||
| 171 | - userDB[userId] += mbti; | ||
| 172 | - console.log(userDB[userId]); | ||
| 173 | - const responseBody = { | ||
| 174 | - version: "2.0", | ||
| 175 | - template: { | ||
| 176 | - outputs: [ | ||
| 177 | - { | ||
| 178 | - simpleText: { | ||
| 179 | - text: "그날 할 일에 대해 계획을 미리 세우시나요?" | ||
| 180 | - } | ||
| 181 | - } | ||
| 182 | - ], | ||
| 183 | - quickReplies: [ | ||
| 184 | - { | ||
| 185 | - action: "block", | ||
| 186 | - label: "네", | ||
| 187 | - message: "네", | ||
| 188 | - blockId: "6293885b7bd2fd4333583df0" | ||
| 189 | - }, | ||
| 190 | - { | ||
| 191 | - action: "block", | ||
| 192 | - label: "아니오", | ||
| 193 | - message: "아니오", | ||
| 194 | - blockId: "6293885b7bd2fd4333583df0" | ||
| 195 | - } | ||
| 196 | - ] | ||
| 197 | - } | ||
| 198 | - } | ||
| 199 | - res.status(200).send(responseBody); | ||
| 200 | -}); | ||
| 201 | - | ||
| 202 | apiRouter.post('/result', (req, res) => { | 107 | apiRouter.post('/result', (req, res) => { |
| 203 | var userId = req.body.userRequest.user.id; | 108 | var userId = req.body.userRequest.user.id; |
| 204 | var mesg = req.body.userRequest.utterance; | 109 | var mesg = req.body.userRequest.utterance; |
| ... | @@ -225,7 +130,7 @@ apiRouter.post('/result', (req, res) => { | ... | @@ -225,7 +130,7 @@ apiRouter.post('/result', (req, res) => { |
| 225 | action: "block", | 130 | action: "block", |
| 226 | label: "MBTI 테스트 다시하기", | 131 | label: "MBTI 테스트 다시하기", |
| 227 | message: "MBTI 테스트 다시하기", | 132 | message: "MBTI 테스트 다시하기", |
| 228 | - blockId : "628b8005055a574d7df54466" | 133 | + blockId : "628b7ef293b31d5b60ab4b29" //to question 1 |
| 229 | }] | 134 | }] |
| 230 | } | 135 | } |
| 231 | } | 136 | } | ... | ... |
-
Please register or login to post a comment