김성욱

Modify conflict code

Showing 1 changed file with 252 additions and 259 deletions
...@@ -5,7 +5,6 @@ const bodyParser = require('body-parser'); ...@@ -5,7 +5,6 @@ const bodyParser = require('body-parser');
5 5
6 const apiRouter = express.Router(); 6 const apiRouter = express.Router();
7 7
8 -
9 app.use(bodyParser.json()); 8 app.use(bodyParser.json());
10 app.use(bodyParser.urlencoded({ 9 app.use(bodyParser.urlencoded({
11 extended: true 10 extended: true
...@@ -14,11 +13,7 @@ app.use(bodyParser.urlencoded({ ...@@ -14,11 +13,7 @@ app.use(bodyParser.urlencoded({
14 app.use('/api', apiRouter); 13 app.use('/api', apiRouter);
15 14
16 let userDB = new Array(); 15 let userDB = new Array();
17 -let mbtiper = new Array();
18 16
19 -<<<<<<< HEAD
20 -apiRouter.post('/test', (req, res) => {
21 -=======
22 apiRouter.post('/sayHello', function(req, res) { 17 apiRouter.post('/sayHello', function(req, res) {
23 const responseBody = { 18 const responseBody = {
24 version: "2.0", 19 version: "2.0",
...@@ -52,35 +47,19 @@ apiRouter.post('/question1', (req, res) => { ...@@ -52,35 +47,19 @@ apiRouter.post('/question1', (req, res) => {
52 console.log('[q1:user message] ', mesg); 47 console.log('[q1:user message] ', mesg);
53 userDB[userId] = ['','','','','']; 48 userDB[userId] = ['','','','',''];
54 console.log(userDB[userId]); 49 console.log(userDB[userId]);
55 ->>>>>>> 9cc768840e30632a42343600db176f035dc0ebf9
56 const responseBody = { 50 const responseBody = {
57 version: "2.0", 51 version: "2.0",
58 template: { 52 template: {
59 outputs: [ 53 outputs: [
60 { 54 {
61 simpleText: { 55 simpleText: {
62 -<<<<<<< HEAD
63 - text: 'MBTI 테스트 question8-14\n시작하려면 시작하기 버튼을 눌러주세요!'
64 -=======
65 text: '금방 새로운 직장 사람들과 어울리기 시작합니다.' 56 text: '금방 새로운 직장 사람들과 어울리기 시작합니다.'
66 ->>>>>>> 9cc768840e30632a42343600db176f035dc0ebf9
67 } 57 }
68 } 58 }
69 ], 59 ],
70 quickReplies: [ 60 quickReplies: [
71 { 61 {
72 action: "block", 62 action: "block",
73 -<<<<<<< HEAD
74 - label: "시작하기",
75 - message: "시작하기",
76 - blockId: "62977ff05ceed96c385449b9"
77 - },
78 - {
79 - action: "block",
80 - label: "나중에 하기",
81 - message: "나중에 하기",
82 - blockId: "6297861be7a0253c7662ccb8"
83 -=======
84 label: "네", 63 label: "네",
85 message: "네", 64 message: "네",
86 blockId: "6297b11ae7a0253c7662ccea" 65 blockId: "6297b11ae7a0253c7662ccea"
...@@ -90,7 +69,6 @@ apiRouter.post('/question1', (req, res) => { ...@@ -90,7 +69,6 @@ apiRouter.post('/question1', (req, res) => {
90 label: "아니오", 69 label: "아니오",
91 message: "아니오", 70 message: "아니오",
92 blockId: "6297b11ae7a0253c7662ccea" 71 blockId: "6297b11ae7a0253c7662ccea"
93 ->>>>>>> 9cc768840e30632a42343600db176f035dc0ebf9
94 } 72 }
95 ] 73 ]
96 } 74 }
...@@ -98,13 +76,6 @@ apiRouter.post('/question1', (req, res) => { ...@@ -98,13 +76,6 @@ apiRouter.post('/question1', (req, res) => {
98 res.status(200).send(responseBody); 76 res.status(200).send(responseBody);
99 }); 77 });
100 78
101 -<<<<<<< HEAD
102 -apiRouter.post('/question8', (req, res) => {
103 - var userId = req.body.userRequest.user.id;
104 - userDB[userId] = ['','','','',''];
105 - console.log(userDB);
106 - const responseBody = {
107 -=======
108 apiRouter.post('/question2', (req, res) => { 79 apiRouter.post('/question2', (req, res) => {
109 var userId = req.body.userRequest.user.id; 80 var userId = req.body.userRequest.user.id;
110 var mesg = req.body.userRequest.utterance; 81 var mesg = req.body.userRequest.utterance;
...@@ -118,34 +89,18 @@ apiRouter.post('/question2', (req, res) => { ...@@ -118,34 +89,18 @@ apiRouter.post('/question2', (req, res) => {
118 userDB[userId][0] += mbti; 89 userDB[userId][0] += mbti;
119 console.log(userDB[userId]); 90 console.log(userDB[userId]);
120 const responseBody = { 91 const responseBody = {
121 ->>>>>>> 9cc768840e30632a42343600db176f035dc0ebf9
122 version: "2.0", 92 version: "2.0",
123 template: { 93 template: {
124 outputs: [ 94 outputs: [
125 { 95 {
126 simpleText: { 96 simpleText: {
127 -<<<<<<< HEAD
128 - text: '[question8]\n여행 계획을 어떻게 세우시나요?'
129 -=======
130 text: '평소 깻잎논쟁에 대해 1시간 이상을 생각해 보는 편입니다.' 97 text: '평소 깻잎논쟁에 대해 1시간 이상을 생각해 보는 편입니다.'
131 ->>>>>>> 9cc768840e30632a42343600db176f035dc0ebf9
132 } 98 }
133 } 99 }
134 ], 100 ],
135 quickReplies: [ 101 quickReplies: [
136 { 102 {
137 action: "block", 103 action: "block",
138 -<<<<<<< HEAD
139 - label: "테마만 정한다(ex.맛집 방문하는 날, 사진 찍는 날)",
140 - message: "테마만 정한다(ex.맛집 방문하는 날, 사진 찍는 날)",
141 - blockId: "629780e9e7a0253c7662cca6"
142 - },
143 - {
144 - action: "block",
145 - label: "시간과 장소를 자세하게 정한다",
146 - message: "시간과 장소를 자세하게 정한다",
147 - blockId: "629780e9e7a0253c7662cca6"
148 -=======
149 label: "네", 104 label: "네",
150 message: "네", 105 message: "네",
151 blockId: "6297b122ab89e678ee86b331" 106 blockId: "6297b122ab89e678ee86b331"
...@@ -155,7 +110,6 @@ apiRouter.post('/question2', (req, res) => { ...@@ -155,7 +110,6 @@ apiRouter.post('/question2', (req, res) => {
155 label: "아니오", 110 label: "아니오",
156 message: "아니오", 111 message: "아니오",
157 blockId: "6297b122ab89e678ee86b331" 112 blockId: "6297b122ab89e678ee86b331"
158 ->>>>>>> 9cc768840e30632a42343600db176f035dc0ebf9
159 } 113 }
160 ] 114 ]
161 } 115 }
...@@ -163,20 +117,6 @@ apiRouter.post('/question2', (req, res) => { ...@@ -163,20 +117,6 @@ apiRouter.post('/question2', (req, res) => {
163 res.status(200).send(responseBody); 117 res.status(200).send(responseBody);
164 }); 118 });
165 119
166 -<<<<<<< HEAD
167 -apiRouter.post('/question9', (req, res) => {
168 - var mesg = req.body.userRequest.utterance;
169 - var userId = req.body.userRequest.user.id;
170 - var mbti = '';
171 - if (mesg == "테마만 정한다(ex.맛집 방문하는 날, 사진 찍는 날)"){
172 - mbti = 'P';
173 - }
174 - else if (mesg == "시간과 장소를 자세하게 정한다") {
175 - mbti = 'J';
176 - }
177 - userDB[userId][3] += mbti;
178 - console.log(userDB);
179 -=======
180 apiRouter.post('/question3', function(req, res) { 120 apiRouter.post('/question3', function(req, res) {
181 var userId = req.body.userRequest.user.id; 121 var userId = req.body.userRequest.user.id;
182 var mesg = req.body.userRequest.utterance; 122 var mesg = req.body.userRequest.utterance;
...@@ -230,34 +170,28 @@ apiRouter.post('/question4', (req, res) => { ...@@ -230,34 +170,28 @@ apiRouter.post('/question4', (req, res) => {
230 } 170 }
231 userDB[userId][2] += mbti; 171 userDB[userId][2] += mbti;
232 console.log(userDB[userId]); 172 console.log(userDB[userId]);
233 ->>>>>>> 9cc768840e30632a42343600db176f035dc0ebf9
234 const responseBody = { 173 const responseBody = {
235 version: "2.0", 174 version: "2.0",
236 template: { 175 template: {
237 outputs: [ 176 outputs: [
238 { 177 {
239 simpleText: { 178 simpleText: {
240 -<<<<<<< HEAD
241 - text: '[question9]\n재미있는 책이나 비디오 게임이 사교 모임보다 더 낫습니다.'
242 -=======
243 text: "주의깊게 미리 계획하기 보다는 즉흥적으로 움직입니다." 179 text: "주의깊게 미리 계획하기 보다는 즉흥적으로 움직입니다."
244 ->>>>>>> 9cc768840e30632a42343600db176f035dc0ebf9
245 } 180 }
246 } 181 }
247 ], 182 ],
248 quickReplies: [ 183 quickReplies: [
249 -<<<<<<< HEAD
250 { 184 {
251 action: "block", 185 action: "block",
252 label: "네", 186 label: "네",
253 message: "네", 187 message: "네",
254 - blockId: "629780f4ab89e678ee86b2de" 188 + blockId: "6297b12be7a0253c7662ccec"
255 }, 189 },
256 { 190 {
257 action: "block", 191 action: "block",
258 label: "아니오", 192 label: "아니오",
259 message: "아니오", 193 message: "아니오",
260 - blockId: "629780f4ab89e678ee86b2de" 194 + blockId: "6297b12be7a0253c7662ccec"
261 } 195 }
262 ] 196 ]
263 } 197 }
...@@ -265,25 +199,25 @@ apiRouter.post('/question4', (req, res) => { ...@@ -265,25 +199,25 @@ apiRouter.post('/question4', (req, res) => {
265 res.status(200).send(responseBody); 199 res.status(200).send(responseBody);
266 }); 200 });
267 201
268 -apiRouter.post('/question10', (req, res) => { 202 +apiRouter.post('/question5', (req, res) => {
269 - var mesg = req.body.userRequest.utterance;
270 var userId = req.body.userRequest.user.id; 203 var userId = req.body.userRequest.user.id;
204 + var mesg = req.body.userRequest;
205 + console.log('[q1:user message] ', mesg);
271 var mbti = ''; 206 var mbti = '';
272 - if (mesg == "네"){ 207 + if (mesg == "네") {
273 - mbti = 'I'; 208 + mbti = 'P';
274 - } 209 + } else if (mesg == "아니오") {
275 - else if (mesg == "아니오") { 210 + mbti = 'J';
276 - mbti = 'E';
277 } 211 }
278 - userDB[userId][0] += mbti; 212 + userDB[userId][3] += mbti;
279 - console.log(userDB); 213 + console.log(userDB[userId]);
280 const responseBody = { 214 const responseBody = {
281 version: "2.0", 215 version: "2.0",
282 template: { 216 template: {
283 outputs: [ 217 outputs: [
284 { 218 {
285 simpleText: { 219 simpleText: {
286 - text: '[question10]\n본인이 창의적이기보다 현실적인 사람이라고 생각합니다.' 220 + text: '주목받는 것을 좋아합니다.'
287 } 221 }
288 } 222 }
289 ], 223 ],
...@@ -292,13 +226,13 @@ apiRouter.post('/question10', (req, res) => { ...@@ -292,13 +226,13 @@ apiRouter.post('/question10', (req, res) => {
292 action: "block", 226 action: "block",
293 label: "네", 227 label: "네",
294 message: "네", 228 message: "네",
295 - blockId: "629781015ceed96c385449c8" 229 + blockId: "6297b130e7a0253c7662ccee"
296 }, 230 },
297 { 231 {
298 action: "block", 232 action: "block",
299 label: "아니오", 233 label: "아니오",
300 message: "아니오", 234 message: "아니오",
301 - blockId: "629781015ceed96c385449c8" 235 + blockId: "6297b130e7a0253c7662ccee"
302 } 236 }
303 ] 237 ]
304 } 238 }
...@@ -306,25 +240,25 @@ apiRouter.post('/question10', (req, res) => { ...@@ -306,25 +240,25 @@ apiRouter.post('/question10', (req, res) => {
306 res.status(200).send(responseBody); 240 res.status(200).send(responseBody);
307 }); 241 });
308 242
309 -apiRouter.post('/question11', (req, res) => { 243 +apiRouter.post('/question6', (req, res) => {
310 - var mesg = req.body.userRequest.utterance;
311 var userId = req.body.userRequest.user.id; 244 var userId = req.body.userRequest.user.id;
245 + var mesg = req.body.userRequest.utterance;
246 + console.log('[q2:user message] ', mesg);
312 var mbti = ''; 247 var mbti = '';
313 - if (mesg == "네"){ 248 + if (mesg == "네") {
314 - mbti = 'S'; 249 + mbti = 'E';
315 - } 250 + } else if (mesg == "아니오") {
316 - else if (mesg == "아니오") { 251 + mbti = 'I';
317 - mbti = 'N';
318 } 252 }
319 - userDB[userId][1] += mbti; 253 + userDB[userId][0] += mbti;
320 - console.log(userDB); 254 + console.log(userDB[userId]);
321 const responseBody = { 255 const responseBody = {
322 version: "2.0", 256 version: "2.0",
323 template: { 257 template: {
324 outputs: [ 258 outputs: [
325 { 259 {
326 simpleText: { 260 simpleText: {
327 - text: '[question11]\n팀플을 하는 경우, 충실하지만 실적을 못 내는 팀원을 제명하기 어려워합니다.' 261 + text: '종종 인간 실존에 대한 이유를 생각합니다.'
328 } 262 }
329 } 263 }
330 ], 264 ],
...@@ -333,13 +267,13 @@ apiRouter.post('/question11', (req, res) => { ...@@ -333,13 +267,13 @@ apiRouter.post('/question11', (req, res) => {
333 action: "block", 267 action: "block",
334 label: "네", 268 label: "네",
335 message: "네", 269 message: "네",
336 - blockId: "6297810fe7a0253c7662cca8" 270 + blockId: "6297b133f591aa190554a260"
337 }, 271 },
338 { 272 {
339 action: "block", 273 action: "block",
340 label: "아니오", 274 label: "아니오",
341 message: "아니오", 275 message: "아니오",
342 - blockId: "6297810fe7a0253c7662cca8" 276 + blockId: "6297b133f591aa190554a260"
343 } 277 }
344 ] 278 ]
345 } 279 }
...@@ -347,25 +281,25 @@ apiRouter.post('/question11', (req, res) => { ...@@ -347,25 +281,25 @@ apiRouter.post('/question11', (req, res) => {
347 res.status(200).send(responseBody); 281 res.status(200).send(responseBody);
348 }); 282 });
349 283
350 -apiRouter.post('/question12', (req, res) => { 284 +apiRouter.post('/question7', (req, res) => {
351 - var mesg = req.body.userRequest.utterance;
352 var userId = req.body.userRequest.user.id; 285 var userId = req.body.userRequest.user.id;
286 + var mesg = req.body.userRequest.utterance;
287 + console.log('[q2:user message] ', mesg);
353 var mbti = ''; 288 var mbti = '';
354 - if (mesg == "네"){ 289 + if (mesg == "네") {
355 - mbti = 'F'; 290 + mbti = 'N';
356 - } 291 + } else if (mesg == "아니오") {
357 - else if (mesg == "아니오") { 292 + mbti = 'S';
358 - mbti = 'T';
359 } 293 }
360 - userDB[userId][2] += mbti; 294 + userDB[userId][1] += mbti;
361 - console.log(userDB); 295 + console.log(userDB[userId]);
362 const responseBody = { 296 const responseBody = {
363 version: "2.0", 297 version: "2.0",
364 template: { 298 template: {
365 outputs: [ 299 outputs: [
366 { 300 {
367 simpleText: { 301 simpleText: {
368 - text: '[question12]\n집과 업무 환경이 잘 정돈되어 있습니다.' 302 + text: '어떤 일에서 성과를 냈을 때 “고생했어”보다 “잘했어”라는 말이 더 좋습니다.'
369 } 303 }
370 } 304 }
371 ], 305 ],
...@@ -374,13 +308,13 @@ apiRouter.post('/question12', (req, res) => { ...@@ -374,13 +308,13 @@ apiRouter.post('/question12', (req, res) => {
374 action: "block", 308 action: "block",
375 label: "네", 309 label: "네",
376 message: "네", 310 message: "네",
377 - blockId: "6297811bf591aa190554a22e" 311 + blockId: "6297b3505ceed96c38544a0a"
378 }, 312 },
379 { 313 {
380 action: "block", 314 action: "block",
381 label: "아니오", 315 label: "아니오",
382 message: "아니오", 316 message: "아니오",
383 - blockId: "6297811bf591aa190554a22e" 317 + blockId: "6297b3505ceed96c38544a0a"
384 } 318 }
385 ] 319 ]
386 } 320 }
...@@ -388,16 +322,49 @@ apiRouter.post('/question12', (req, res) => { ...@@ -388,16 +322,49 @@ apiRouter.post('/question12', (req, res) => {
388 res.status(200).send(responseBody); 322 res.status(200).send(responseBody);
389 }); 323 });
390 324
391 -apiRouter.post('/question13', (req, res) => { 325 +apiRouter.post('/question8', (req, res) => {
326 + var userId = req.body.userRequest.user.id;
327 + userDB[userId] = ['','','','',''];
328 + console.log(userDB);
329 + const responseBody = {
330 + version: "2.0",
331 + template: {
332 + outputs: [
333 + {
334 + simpleText: {
335 + text: '[question8]\n여행 계획을 어떻게 세우시나요?'
336 + }
337 + }
338 + ],
339 + quickReplies: [
340 + {
341 + action: "block",
342 + label: "테마만 정한다(ex.맛집 방문하는 날, 사진 찍는 날)",
343 + message: "테마만 정한다(ex.맛집 방문하는 날, 사진 찍는 날)",
344 + blockId: "629780e9e7a0253c7662cca6"
345 + },
346 + {
347 + action: "block",
348 + label: "시간과 장소를 자세하게 정한다",
349 + message: "시간과 장소를 자세하게 정한다",
350 + blockId: "629780e9e7a0253c7662cca6"
351 + }
352 + ]
353 + }
354 + }
355 + res.status(200).send(responseBody);
356 + });
357 +
358 + apiRouter.post('/question9', (req, res) => {
392 var mesg = req.body.userRequest.utterance; 359 var mesg = req.body.userRequest.utterance;
393 var userId = req.body.userRequest.user.id; 360 var userId = req.body.userRequest.user.id;
394 var mbti = ''; 361 var mbti = '';
395 - if (mesg == "네"){ 362 + if (mesg == "테마만 정한다(ex.맛집 방문하는 날, 사진 찍는 날)"){
396 - mbti = 'J';
397 - }
398 - else if (mesg == "아니오") {
399 mbti = 'P'; 363 mbti = 'P';
400 } 364 }
365 + else if (mesg == "시간과 장소를 자세하게 정한다") {
366 + mbti = 'J';
367 + }
401 userDB[userId][3] += mbti; 368 userDB[userId][3] += mbti;
402 console.log(userDB); 369 console.log(userDB);
403 const responseBody = { 370 const responseBody = {
...@@ -406,7 +373,7 @@ apiRouter.post('/question13', (req, res) => { ...@@ -406,7 +373,7 @@ apiRouter.post('/question13', (req, res) => {
406 outputs: [ 373 outputs: [
407 { 374 {
408 simpleText: { 375 simpleText: {
409 - text: '[question13]\n친구 관계가 좁고 깊은 편입니다.' 376 + text: '[question9]\n재미있는 책이나 비디오 게임이 사교 모임보다 더 낫습니다.'
410 } 377 }
411 } 378 }
412 ], 379 ],
...@@ -415,21 +382,21 @@ apiRouter.post('/question13', (req, res) => { ...@@ -415,21 +382,21 @@ apiRouter.post('/question13', (req, res) => {
415 action: "block", 382 action: "block",
416 label: "네", 383 label: "네",
417 message: "네", 384 message: "네",
418 - blockId: "62978127ab89e678ee86b2e2" 385 + blockId: "629780f4ab89e678ee86b2de"
419 }, 386 },
420 { 387 {
421 action: "block", 388 action: "block",
422 label: "아니오", 389 label: "아니오",
423 message: "아니오", 390 message: "아니오",
424 - blockId: "62978127ab89e678ee86b2e2" 391 + blockId: "629780f4ab89e678ee86b2de"
425 } 392 }
426 ] 393 ]
427 } 394 }
428 } 395 }
429 res.status(200).send(responseBody); 396 res.status(200).send(responseBody);
430 -}); 397 + });
431 398
432 -apiRouter.post('/question14', (req, res) => { 399 + apiRouter.post('/question10', (req, res) => {
433 var mesg = req.body.userRequest.utterance; 400 var mesg = req.body.userRequest.utterance;
434 var userId = req.body.userRequest.user.id; 401 var userId = req.body.userRequest.user.id;
435 var mbti = ''; 402 var mbti = '';
...@@ -447,7 +414,7 @@ apiRouter.post('/question14', (req, res) => { ...@@ -447,7 +414,7 @@ apiRouter.post('/question14', (req, res) => {
447 outputs: [ 414 outputs: [
448 { 415 {
449 simpleText: { 416 simpleText: {
450 - text: '[question14]\n공부하기 싫을 때 공부는 왜 해야 하는 것인지 고민에 빠질 때가 있습니다.' 417 + text: '[question10]\n본인이 창의적이기보다 현실적인 사람이라고 생각합니다.'
451 } 418 }
452 } 419 }
453 ], 420 ],
...@@ -456,54 +423,39 @@ apiRouter.post('/question14', (req, res) => { ...@@ -456,54 +423,39 @@ apiRouter.post('/question14', (req, res) => {
456 action: "block", 423 action: "block",
457 label: "네", 424 label: "네",
458 message: "네", 425 message: "네",
459 - blockId: "62979c9ce7a0253c7662ccd4" 426 + blockId: "629781015ceed96c385449c8"
460 - },
461 - {
462 - action: "block",
463 - label: "아니오",
464 - message: "아니오",
465 - blockId: "62979c9ce7a0253c7662ccd4"
466 - }
467 - ]
468 -=======
469 - {
470 - action: "block",
471 - label: "네",
472 - message: "네",
473 - blockId: "6297b12be7a0253c7662ccec"
474 }, 427 },
475 { 428 {
476 action: "block", 429 action: "block",
477 label: "아니오", 430 label: "아니오",
478 message: "아니오", 431 message: "아니오",
479 - blockId: "6297b12be7a0253c7662ccec" 432 + blockId: "629781015ceed96c385449c8"
480 } 433 }
481 ] 434 ]
482 ->>>>>>> 9cc768840e30632a42343600db176f035dc0ebf9
483 } 435 }
484 } 436 }
485 res.status(200).send(responseBody); 437 res.status(200).send(responseBody);
486 -}); 438 + });
487 439
488 -apiRouter.post('/question5', (req, res) => { 440 + apiRouter.post('/question11', (req, res) => {
441 + var mesg = req.body.userRequest.utterance;
489 var userId = req.body.userRequest.user.id; 442 var userId = req.body.userRequest.user.id;
490 - var mesg = req.body.userRequest;
491 - console.log('[q1:user message] ', mesg);
492 var mbti = ''; 443 var mbti = '';
493 - if (mesg == "네") { 444 + if (mesg == "네"){
494 - mbti = 'P'; 445 + mbti = 'S';
495 - } else if (mesg == "아니오") {
496 - mbti = 'J';
497 } 446 }
498 - userDB[userId][3] += mbti; 447 + else if (mesg == "아니오") {
499 - console.log(userDB[userId]); 448 + mbti = 'N';
449 + }
450 + userDB[userId][1] += mbti;
451 + console.log(userDB);
500 const responseBody = { 452 const responseBody = {
501 version: "2.0", 453 version: "2.0",
502 template: { 454 template: {
503 outputs: [ 455 outputs: [
504 { 456 {
505 simpleText: { 457 simpleText: {
506 - text: '주목받는 것을 좋아합니다.' 458 + text: '[question11]\n팀플을 하는 경우, 충실하지만 실적을 못 내는 팀원을 제명하기 어려워합니다.'
507 } 459 }
508 } 460 }
509 ], 461 ],
...@@ -512,39 +464,39 @@ apiRouter.post('/question5', (req, res) => { ...@@ -512,39 +464,39 @@ apiRouter.post('/question5', (req, res) => {
512 action: "block", 464 action: "block",
513 label: "네", 465 label: "네",
514 message: "네", 466 message: "네",
515 - blockId: "6297b130e7a0253c7662ccee" 467 + blockId: "6297810fe7a0253c7662cca8"
516 }, 468 },
517 { 469 {
518 action: "block", 470 action: "block",
519 label: "아니오", 471 label: "아니오",
520 message: "아니오", 472 message: "아니오",
521 - blockId: "6297b130e7a0253c7662ccee" 473 + blockId: "6297810fe7a0253c7662cca8"
522 } 474 }
523 ] 475 ]
524 } 476 }
525 } 477 }
526 res.status(200).send(responseBody); 478 res.status(200).send(responseBody);
527 -}); 479 + });
528 480
529 -apiRouter.post('/question6', (req, res) => { 481 + apiRouter.post('/question12', (req, res) => {
530 - var userId = req.body.userRequest.user.id;
531 var mesg = req.body.userRequest.utterance; 482 var mesg = req.body.userRequest.utterance;
532 - console.log('[q2:user message] ', mesg); 483 + var userId = req.body.userRequest.user.id;
533 var mbti = ''; 484 var mbti = '';
534 - if (mesg == "네") { 485 + if (mesg == "네"){
535 - mbti = 'E'; 486 + mbti = 'F';
536 - } else if (mesg == "아니오") {
537 - mbti = 'I';
538 } 487 }
539 - userDB[userId][0] += mbti; 488 + else if (mesg == "아니오") {
540 - console.log(userDB[userId]); 489 + mbti = 'T';
490 + }
491 + userDB[userId][2] += mbti;
492 + console.log(userDB);
541 const responseBody = { 493 const responseBody = {
542 version: "2.0", 494 version: "2.0",
543 template: { 495 template: {
544 outputs: [ 496 outputs: [
545 { 497 {
546 simpleText: { 498 simpleText: {
547 - text: '종종 인간 실존에 대한 이유를 생각합니다.' 499 + text: '[question12]\n집과 업무 환경이 잘 정돈되어 있습니다.'
548 } 500 }
549 } 501 }
550 ], 502 ],
...@@ -553,39 +505,39 @@ apiRouter.post('/question6', (req, res) => { ...@@ -553,39 +505,39 @@ apiRouter.post('/question6', (req, res) => {
553 action: "block", 505 action: "block",
554 label: "네", 506 label: "네",
555 message: "네", 507 message: "네",
556 - blockId: "6297b133f591aa190554a260" 508 + blockId: "6297811bf591aa190554a22e"
557 }, 509 },
558 { 510 {
559 action: "block", 511 action: "block",
560 label: "아니오", 512 label: "아니오",
561 message: "아니오", 513 message: "아니오",
562 - blockId: "6297b133f591aa190554a260" 514 + blockId: "6297811bf591aa190554a22e"
563 } 515 }
564 ] 516 ]
565 } 517 }
566 } 518 }
567 res.status(200).send(responseBody); 519 res.status(200).send(responseBody);
568 -}); 520 + });
569 521
570 -apiRouter.post('/question7', (req, res) => { 522 + apiRouter.post('/question13', (req, res) => {
571 - var userId = req.body.userRequest.user.id;
572 var mesg = req.body.userRequest.utterance; 523 var mesg = req.body.userRequest.utterance;
573 - console.log('[q2:user message] ', mesg); 524 + var userId = req.body.userRequest.user.id;
574 var mbti = ''; 525 var mbti = '';
575 - if (mesg == "네") { 526 + if (mesg == "네"){
576 - mbti = 'N'; 527 + mbti = 'J';
577 - } else if (mesg == "아니오") {
578 - mbti = 'S';
579 } 528 }
580 - userDB[userId][1] += mbti; 529 + else if (mesg == "아니오") {
581 - console.log(userDB[userId]); 530 + mbti = 'P';
531 + }
532 + userDB[userId][3] += mbti;
533 + console.log(userDB);
582 const responseBody = { 534 const responseBody = {
583 version: "2.0", 535 version: "2.0",
584 template: { 536 template: {
585 outputs: [ 537 outputs: [
586 { 538 {
587 simpleText: { 539 simpleText: {
588 - text: '어떤 일에서 성과를 냈을 때 “고생했어”보다 “잘했어”라는 말이 더 좋습니다.' 540 + text: '[question13]\n친구 관계가 좁고 깊은 편입니다.'
589 } 541 }
590 } 542 }
591 ], 543 ],
...@@ -594,132 +546,63 @@ apiRouter.post('/question7', (req, res) => { ...@@ -594,132 +546,63 @@ apiRouter.post('/question7', (req, res) => {
594 action: "block", 546 action: "block",
595 label: "네", 547 label: "네",
596 message: "네", 548 message: "네",
597 - blockId: "6297b3505ceed96c38544a0a" 549 + blockId: "62978127ab89e678ee86b2e2"
598 }, 550 },
599 { 551 {
600 action: "block", 552 action: "block",
601 label: "아니오", 553 label: "아니오",
602 message: "아니오", 554 message: "아니오",
603 - blockId: "6297b3505ceed96c38544a0a" 555 + blockId: "62978127ab89e678ee86b2e2"
604 } 556 }
605 ] 557 ]
606 } 558 }
607 } 559 }
608 res.status(200).send(responseBody); 560 res.status(200).send(responseBody);
609 -}); 561 + });
610 562
611 -apiRouter.post('/result', (req, res) => { 563 + apiRouter.post('/question14', (req, res) => {
612 var mesg = req.body.userRequest.utterance; 564 var mesg = req.body.userRequest.utterance;
613 var userId = req.body.userRequest.user.id; 565 var userId = req.body.userRequest.user.id;
614 -<<<<<<< HEAD
615 - mbtiper = ['','','','','','','',''];
616 var mbti = ''; 566 var mbti = '';
617 if (mesg == "네"){ 567 if (mesg == "네"){
618 - mbti = 'N'; 568 + mbti = 'I';
619 } 569 }
620 else if (mesg == "아니오") { 570 else if (mesg == "아니오") {
621 - mbti = 'S'; 571 + mbti = 'E';
622 - }
623 - userDB[userId][1] += mbti;
624 - var e = 0;
625 - var n = 0;
626 - var f = 0;
627 - var j = 0;
628 - for(i=0; i<2; i++){
629 - if(userDB[userId][0][i] == "E"){
630 - e++;
631 - }
632 - }
633 - for(i=0; i<2; i++){
634 - if(userDB[userId][1][i] == "N"){
635 - n++;
636 - }
637 - }
638 - for(i=0; i<1; i++){
639 - if(userDB[userId][2][i] == "F"){
640 - f++;
641 - }
642 - }
643 - for(i=0; i<2; i++){
644 - if(userDB[userId][3][i] == "J"){
645 - j++;
646 - }
647 - }
648 - var i = 2-e;
649 - var s = 2-n;
650 - var t = 1-f;
651 - var p = 2-j;
652 - mbtiper[0] += 20 * e;
653 - mbtiper[1] += 20 * i;
654 - mbtiper[2] += 20 * n;
655 - mbtiper[3] += 20 * s;
656 - mbtiper[4] += 20 * t;
657 - mbtiper[5] += 20 * f;
658 - mbtiper[6] += 20 * j;
659 - mbtiper[7] += 20 * p;
660 - if(mbtiper[0]>mbtiper[1]){
661 - userDB[userId][4] += 'E';
662 - } else {
663 - userDB[userId][4] += 'I';
664 - }
665 - if(mbtiper[2]>mbtiper[3]){
666 - userDB[userId][4] += 'N';
667 - } else {
668 - userDB[userId][4] += 'S';
669 - }
670 - if(mbtiper[4]>mbtiper[5]){
671 - userDB[userId][4] += 'T';
672 - } else {
673 - userDB[userId][4] += 'F';
674 - }
675 - if(mbtiper[6]>mbtiper[7]){
676 - userDB[userId][4] += 'J';
677 - } else {
678 - userDB[userId][4] += 'P';
679 } 572 }
573 + userDB[userId][0] += mbti;
574 + console.log(userDB);
680 const responseBody = { 575 const responseBody = {
681 version: "2.0", 576 version: "2.0",
682 template: { 577 template: {
683 outputs: [ 578 outputs: [
684 { 579 {
685 simpleText: { 580 simpleText: {
686 - text: "당신의 MBTI는 : "+userDB[userId][4] 581 + text: '[question14]\n공부하기 싫을 때 공부는 왜 해야 하는 것인지 고민에 빠질 때가 있습니다.'
687 } 582 }
688 } 583 }
689 ], 584 ],
690 - quickReplies: [{ 585 + quickReplies: [
586 + {
691 action: "block", 587 action: "block",
692 - label: "MBTI 테스트 다시하기", 588 + label: "네",
693 - message: "MBTI 테스트 다시하기", 589 + message: "네",
694 - blockId : "62977ff05ceed96c385449b9" 590 + blockId: "62979c9ce7a0253c7662ccd4"
695 }, 591 },
696 { 592 {
697 action: "block", 593 action: "block",
698 - label: "결과 상세보기", 594 + label: "아니오",
699 - message: "결과 상세보기", 595 + message: "아니오",
700 - blockId: "62987b78e7a0253c7662dcd9" 596 + blockId: "62979c9ce7a0253c7662ccd4"
701 - }]
702 - }
703 - }
704 - res.status(200).send(responseBody);
705 - });
706 -
707 -apiRouter.post('/percent', (req, res) => {
708 - const responseBody = {
709 - version: "2.0",
710 - template: {
711 - outputs: [
712 - {
713 - simpleText: {
714 - 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]+'%'
715 - }
716 } 597 }
717 ] 598 ]
718 } 599 }
719 } 600 }
720 res.status(200).send(responseBody); 601 res.status(200).send(responseBody);
721 }); 602 });
722 -======= 603 +
604 +apiRouter.post('/result', (req, res) => {
605 + var userId = req.body.userRequest.user.id;
723 var mesg = req.body.userRequest.utterance; 606 var mesg = req.body.userRequest.utterance;
724 console.log('[result:user message] ', mesg); 607 console.log('[result:user message] ', mesg);
725 var mbti = ''; 608 var mbti = '';
...@@ -890,7 +773,117 @@ function result(Array){ ...@@ -890,7 +773,117 @@ function result(Array){
890 Array[4]+='J'; 773 Array[4]+='J';
891 } 774 }
892 775
893 ->>>>>>> 9cc768840e30632a42343600db176f035dc0ebf9 776 +apiRouter.post('/result', (req, res) => {
777 + var mesg = req.body.userRequest.utterance;
778 + var userId = req.body.userRequest.user.id;
779 + mbtiper = ['','','','','','','',''];
780 + var mbti = '';
781 + if (mesg == "네"){
782 + mbti = 'N';
783 + }
784 + else if (mesg == "아니오") {
785 + mbti = 'S';
786 + }
787 + userDB[userId][1] += mbti;
788 + var e = 0;
789 + var n = 0;
790 + var f = 0;
791 + var j = 0;
792 + for(i=0; i<2; i++){
793 + if(userDB[userId][0][i] == "E"){
794 + e++;
795 + }
796 + }
797 + for(i=0; i<2; i++){
798 + if(userDB[userId][1][i] == "N"){
799 + n++;
800 + }
801 + }
802 + for(i=0; i<1; i++){
803 + if(userDB[userId][2][i] == "F"){
804 + f++;
805 + }
806 + }
807 + for(i=0; i<2; i++){
808 + if(userDB[userId][3][i] == "J"){
809 + j++;
810 + }
811 + }
812 + var i = 2-e;
813 + var s = 2-n;
814 + var t = 1-f;
815 + var p = 2-j;
816 + mbtiper[0] += 20 * e;
817 + mbtiper[1] += 20 * i;
818 + mbtiper[2] += 20 * n;
819 + mbtiper[3] += 20 * s;
820 + mbtiper[4] += 20 * t;
821 + mbtiper[5] += 20 * f;
822 + mbtiper[6] += 20 * j;
823 + mbtiper[7] += 20 * p;
824 + if(mbtiper[0]>mbtiper[1]){
825 + userDB[userId][4] += 'E';
826 + } else {
827 + userDB[userId][4] += 'I';
828 + }
829 + if(mbtiper[2]>mbtiper[3]){
830 + userDB[userId][4] += 'N';
831 + } else {
832 + userDB[userId][4] += 'S';
833 + }
834 + if(mbtiper[4]>mbtiper[5]){
835 + userDB[userId][4] += 'T';
836 + } else {
837 + userDB[userId][4] += 'F';
838 + }
839 + if(mbtiper[6]>mbtiper[7]){
840 + userDB[userId][4] += 'J';
841 + } else {
842 + userDB[userId][4] += 'P';
843 + }
844 + const responseBody = {
845 + version: "2.0",
846 + template: {
847 + outputs: [
848 + {
849 + simpleText: {
850 + text: "당신의 MBTI는 : "+userDB[userId][4]
851 + }
852 + }
853 + ],
854 + quickReplies: [{
855 + action: "block",
856 + label: "MBTI 테스트 다시하기",
857 + message: "MBTI 테스트 다시하기",
858 + blockId : "62977ff05ceed96c385449b9"
859 + },
860 + {
861 + action: "block",
862 + label: "결과 상세보기",
863 + message: "결과 상세보기",
864 + blockId: "62987b78e7a0253c7662dcd9"
865 + }]
866 + }
867 + }
868 + res.status(200).send(responseBody);
869 + });
870 +
871 +apiRouter.post('/percent', (req, res) => {
872 + const responseBody = {
873 + version: "2.0",
874 + template: {
875 + outputs: [
876 + {
877 + simpleText: {
878 + 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]+'%'
879 + }
880 + }
881 + ]
882 + }
883 + }
884 + res.status(200).send(responseBody);
885 + });
886 +
894 app.listen((process.env.PORT || 3000), function() { 887 app.listen((process.env.PORT || 3000), function() {
895 console.log('Example skill server listening on port 3000!'); 888 console.log('Example skill server listening on port 3000!');
896 }); 889 });
...\ No newline at end of file ...\ No newline at end of file
......