Showing
1 changed file
with
44 additions
and
44 deletions
1 | var express = require('express'); | 1 | var express = require('express'); |
2 | const request = require('request'); | 2 | const request = require('request'); |
3 | -const TARGET_URL = 'https://api.line.me/v2/bot/message/reply' | 3 | +const TARGET_URL = 'https://api.line.me/v2/bot/message/reply'; |
4 | const fs = require('fs'); | 4 | const fs = require('fs'); |
5 | const path = require('path'); | 5 | const path = require('path'); |
6 | const HTTPS = require('https'); | 6 | const HTTPS = require('https'); |
7 | const sslport = 23023; | 7 | const sslport = 23023; |
8 | -const MULTI_TARGET_URL = 'https://api.line.me/v2/bot/message/multicast' | 8 | +const MULTI_TARGET_URL = 'https://api.line.me/v2/bot/message/multicast'; |
9 | -const BROAD_TARGET_URL = 'https://api.line.me/v2/bot/message/broadcast' | 9 | +const BROAD_TARGET_URL = 'https://api.line.me/v2/bot/message/broadcast'; |
10 | 10 | ||
11 | const info = require('./info.js'); | 11 | const info = require('./info.js'); |
12 | 12 | ||
13 | -var spring = 0 | 13 | +var spring = 0; |
14 | -var summer = 0 | 14 | +var summer = 0; |
15 | -var fall = 0 | 15 | +var fall = 0; |
16 | -var winter = 0 | 16 | +var winter = 0; |
17 | 17 | ||
18 | -var warm = 0 | 18 | +var warm = 0; |
19 | -var cool = 0 | 19 | +var cool = 0; |
20 | 20 | ||
21 | -var warm_index = 0 | 21 | +var warm_index = 0; |
22 | -var cool_index = 0 | 22 | +var cool_index = 0; |
23 | -var skinIndex = 0 | 23 | +var skinIndex = 0; |
24 | 24 | ||
25 | -var i = 0 | 25 | +var i = 0; |
26 | -var j = -9 | 26 | +var j = -9; |
27 | 27 | ||
28 | -var QuestionCount = 9 | 28 | +var QuestionCount = 9; |
29 | var QuestionIndex | 29 | var QuestionIndex |
30 | - = 0 | 30 | + = 0; |
31 | -var count = 16 | 31 | +var count = 16; |
32 | var WarmOrCool = [warm, cool]; | 32 | var WarmOrCool = [warm, cool]; |
33 | -var season_color = [spring, summer, fall, winter] | 33 | +var season_color = [spring, summer, fall, winter]; |
34 | 34 | ||
35 | var Questions = [ | 35 | var Questions = [ |
36 | '나의 피부색은 (1)노란기 (2)붉은기가 돈다.', | 36 | '나의 피부색은 (1)노란기 (2)붉은기가 돈다.', |
... | @@ -42,7 +42,7 @@ var Questions = [ | ... | @@ -42,7 +42,7 @@ var Questions = [ |
42 | '나는 (1)아이보리 (2)새하얀 화이트가 더 잘 어울린다.', | 42 | '나는 (1)아이보리 (2)새하얀 화이트가 더 잘 어울린다.', |
43 | '나는 (1)브라운/카키 (2)핑크/블루 계열의 옷이 더 잘어울린다.', | 43 | '나는 (1)브라운/카키 (2)핑크/블루 계열의 옷이 더 잘어울린다.', |
44 | '햇빛에 노출되었을 경우 (1)갈색으로 탄다 (2)붉게 그을린다.', | 44 | '햇빛에 노출되었을 경우 (1)갈색으로 탄다 (2)붉게 그을린다.', |
45 | -] | 45 | +]; |
46 | 46 | ||
47 | var warm_files = [ | 47 | var warm_files = [ |
48 | 'https://personal-color-chatbot.s3.amazonaws.com/warm_carmel.png', | 48 | 'https://personal-color-chatbot.s3.amazonaws.com/warm_carmel.png', |
... | @@ -52,7 +52,7 @@ var warm_files = [ | ... | @@ -52,7 +52,7 @@ var warm_files = [ |
52 | 'https://personal-color-chatbot.s3.amazonaws.com/warm_purple.png', | 52 | 'https://personal-color-chatbot.s3.amazonaws.com/warm_purple.png', |
53 | 'https://personal-color-chatbot.s3.amazonaws.com/warm_softgreen.png', | 53 | 'https://personal-color-chatbot.s3.amazonaws.com/warm_softgreen.png', |
54 | 'https://personal-color-chatbot.s3.amazonaws.com/warm_yellow.jpg', | 54 | 'https://personal-color-chatbot.s3.amazonaws.com/warm_yellow.jpg', |
55 | -] | 55 | +]; |
56 | 56 | ||
57 | var cool_files = [ | 57 | var cool_files = [ |
58 | 'https://personal-color-chatbot.s3.amazonaws.com/cool_blue.png', | 58 | 'https://personal-color-chatbot.s3.amazonaws.com/cool_blue.png', |
... | @@ -62,7 +62,7 @@ var cool_files = [ | ... | @@ -62,7 +62,7 @@ var cool_files = [ |
62 | 'https://personal-color-chatbot.s3.amazonaws.com/cool_navy.png', | 62 | 'https://personal-color-chatbot.s3.amazonaws.com/cool_navy.png', |
63 | 'https://personal-color-chatbot.s3.amazonaws.com/cool_pink.png', | 63 | 'https://personal-color-chatbot.s3.amazonaws.com/cool_pink.png', |
64 | 'https://personal-color-chatbot.s3.amazonaws.com/cool_yellow.png', | 64 | 'https://personal-color-chatbot.s3.amazonaws.com/cool_yellow.png', |
65 | -] | 65 | +]; |
66 | 66 | ||
67 | 67 | ||
68 | const bodyParser = require('body-parser'); | 68 | const bodyParser = require('body-parser'); |
... | @@ -91,7 +91,7 @@ request.post( | ... | @@ -91,7 +91,7 @@ request.post( |
91 | ] | 91 | ] |
92 | } | 92 | } |
93 | }, (error, response, body) => { | 93 | }, (error, response, body) => { |
94 | - console.log(body) | 94 | + console.log(body); |
95 | }); | 95 | }); |
96 | 96 | ||
97 | 97 | ||
... | @@ -104,10 +104,10 @@ app.post('/hook', function (req, res) { | ... | @@ -104,10 +104,10 @@ app.post('/hook', function (req, res) { |
104 | var source = eventObj.source; | 104 | var source = eventObj.source; |
105 | var message = eventObj.message; | 105 | var message = eventObj.message; |
106 | 106 | ||
107 | - TestSkinType(eventObj.replyToken, eventObj.message.text) | 107 | + TestSkinType(eventObj.replyToken, eventObj.message.text); |
108 | - Color_Test(eventObj.replyToken, eventObj.message.text) | 108 | + Color_Test(eventObj.replyToken, eventObj.message.text); |
109 | 109 | ||
110 | - if (YourSkinTypeIs(warm, cool) == 0) Get_warmColor(eventObj.replyToken, eventObj.message.text); | 110 | + if (YourSkinTypeIs(warm, cool) === 0) Get_warmColor(eventObj.replyToken, eventObj.message.text); |
111 | else if (YourSkinTypeIs(warm, cool) == 1) Get_coolColor(eventObj.replyToken, eventObj.message.text); | 111 | else if (YourSkinTypeIs(warm, cool) == 1) Get_coolColor(eventObj.replyToken, eventObj.message.text); |
112 | 112 | ||
113 | res.sendStatus(200); | 113 | res.sendStatus(200); |
... | @@ -132,7 +132,7 @@ function TestSkinType(replyToken, message) { | ... | @@ -132,7 +132,7 @@ function TestSkinType(replyToken, message) { |
132 | ], | 132 | ], |
133 | } | 133 | } |
134 | }, (error, response, body) => { | 134 | }, (error, response, body) => { |
135 | - console.log(body) | 135 | + console.log(body); |
136 | }); | 136 | }); |
137 | } | 137 | } |
138 | } | 138 | } |
... | @@ -158,13 +158,13 @@ function Color_Test(replyToken, message) { | ... | @@ -158,13 +158,13 @@ function Color_Test(replyToken, message) { |
158 | ], | 158 | ], |
159 | } | 159 | } |
160 | }, (error, response, body) => { | 160 | }, (error, response, body) => { |
161 | - console.log(body) | 161 | + console.log(body); |
162 | }); | 162 | }); |
163 | 163 | ||
164 | 164 | ||
165 | } | 165 | } |
166 | if (QuestionCount <= 0) { | 166 | if (QuestionCount <= 0) { |
167 | - if (YourSkinTypeIs(warm, cool) == 0) { | 167 | + if (YourSkinTypeIs(warm, cool) === 0) { |
168 | request.post( | 168 | request.post( |
169 | { | 169 | { |
170 | url: TARGET_URL, | 170 | url: TARGET_URL, |
... | @@ -182,7 +182,7 @@ function Color_Test(replyToken, message) { | ... | @@ -182,7 +182,7 @@ function Color_Test(replyToken, message) { |
182 | ], | 182 | ], |
183 | } | 183 | } |
184 | }, (error, response, body) => { | 184 | }, (error, response, body) => { |
185 | - console.log(body) | 185 | + console.log(body); |
186 | }); | 186 | }); |
187 | } | 187 | } |
188 | else if (YourSkinTypeIs(warm, cool) == 1) { | 188 | else if (YourSkinTypeIs(warm, cool) == 1) { |
... | @@ -203,7 +203,7 @@ function Color_Test(replyToken, message) { | ... | @@ -203,7 +203,7 @@ function Color_Test(replyToken, message) { |
203 | ], | 203 | ], |
204 | } | 204 | } |
205 | }, (error, response, body) => { | 205 | }, (error, response, body) => { |
206 | - console.log(body) | 206 | + console.log(body); |
207 | }); | 207 | }); |
208 | } | 208 | } |
209 | 209 | ||
... | @@ -211,7 +211,7 @@ function Color_Test(replyToken, message) { | ... | @@ -211,7 +211,7 @@ function Color_Test(replyToken, message) { |
211 | 211 | ||
212 | 212 | ||
213 | } | 213 | } |
214 | - if (count == 0) { | 214 | + if (count === 0) { |
215 | request.post( | 215 | request.post( |
216 | { | 216 | { |
217 | url: TARGET_URL, | 217 | url: TARGET_URL, |
... | @@ -228,30 +228,30 @@ function Color_Test(replyToken, message) { | ... | @@ -228,30 +228,30 @@ function Color_Test(replyToken, message) { |
228 | ], | 228 | ], |
229 | } | 229 | } |
230 | }, (error, response, body) => { | 230 | }, (error, response, body) => { |
231 | - console.log(body) | 231 | + console.log(body); |
232 | }); | 232 | }); |
233 | } | 233 | } |
234 | if (message == "1") { | 234 | if (message == "1") { |
235 | - warm += 1 | 235 | + warm += 1; |
236 | } | 236 | } |
237 | else if (message == "2") { | 237 | else if (message == "2") { |
238 | - cool += 1 | 238 | + cool += 1; |
239 | } | 239 | } |
240 | if (QuestionCount < 0) { | 240 | if (QuestionCount < 0) { |
241 | - if (message == '1' && YourSkinTypeIs(warm, cool) == 0) spring += 1 | 241 | + if (message == '1' && YourSkinTypeIs(warm, cool) === 0) spring += 1; |
242 | - else if (message == '2' && YourSkinTypeIs(warm, cool) == 0) fall += 1 | 242 | + else if (message == '2' && YourSkinTypeIs(warm, cool) === 0) fall += 1; |
243 | - else if (message == '1' && YourSkinTypeIs(warm, cool) == 1) summer += 1 | 243 | + else if (message == '1' && YourSkinTypeIs(warm, cool) == 1) summer += 1; |
244 | - else if (message == '2' && YourSkinTypeIs(warm, cool) == 1) winter += 1 | 244 | + else if (message == '2' && YourSkinTypeIs(warm, cool) == 1) winter += 1; |
245 | } | 245 | } |
246 | 246 | ||
247 | - i += 1 | 247 | + i += 1; |
248 | - j += 1 | 248 | + j += 1; |
249 | QuestionCount -= 1; | 249 | QuestionCount -= 1; |
250 | - count -= 1 | 250 | + count -= 1; |
251 | 251 | ||
252 | YourSkinTypeIs(warm, cool); | 252 | YourSkinTypeIs(warm, cool); |
253 | 253 | ||
254 | - if (YourSkinTypeIs(warm, cool) == 0) { | 254 | + if (YourSkinTypeIs(warm, cool) === 0) { |
255 | YourWarmColorIs(spring, fall); | 255 | YourWarmColorIs(spring, fall); |
256 | } | 256 | } |
257 | else YourCoolColorIs(summer, winter); | 257 | else YourCoolColorIs(summer, winter); |
... | @@ -270,8 +270,8 @@ function YourSkinTypeIs(warm, cool) { | ... | @@ -270,8 +270,8 @@ function YourSkinTypeIs(warm, cool) { |
270 | 270 | ||
271 | 271 | ||
272 | function YourWarmColorIs(spring, fall) { | 272 | function YourWarmColorIs(spring, fall) { |
273 | - if (spring > fall) warm_index = 0 | 273 | + if (spring > fall) warm_index = 0; |
274 | - else warm_index = 1 | 274 | + else warm_index = 1; |
275 | 275 | ||
276 | return warm_index; | 276 | return warm_index; |
277 | } | 277 | } | ... | ... |
-
Please register or login to post a comment