Showing
1 changed file
with
11 additions
and
5 deletions
... | @@ -8,12 +8,12 @@ const crwalCharacterCode = async function(nickname) { | ... | @@ -8,12 +8,12 @@ const crwalCharacterCode = async function(nickname) { |
8 | const regexResult = regex.exec(resp.data); | 8 | const regexResult = regex.exec(resp.data); |
9 | 9 | ||
10 | if (!regexResult) | 10 | if (!regexResult) |
11 | - return false; | 11 | + return -2; |
12 | 12 | ||
13 | return regexResult[1]; | 13 | return regexResult[1]; |
14 | } catch (error) { | 14 | } catch (error) { |
15 | console.log(error); | 15 | console.log(error); |
16 | - return false; | 16 | + return -1; |
17 | } | 17 | } |
18 | } | 18 | } |
19 | 19 | ||
... | @@ -391,7 +391,10 @@ module.exports = { | ... | @@ -391,7 +391,10 @@ module.exports = { |
391 | const nickname = req.query.nickname; | 391 | const nickname = req.query.nickname; |
392 | const characterCode = await crwalCharacterCode(req.query.nickname); | 392 | const characterCode = await crwalCharacterCode(req.query.nickname); |
393 | 393 | ||
394 | - if (!characterCode) { | 394 | + if (characterCode == -1) { |
395 | + res.status(500).send(); | ||
396 | + return; | ||
397 | + } else if (characterCode == -2) { | ||
395 | res.status(404).send(); | 398 | res.status(404).send(); |
396 | return; | 399 | return; |
397 | } | 400 | } |
... | @@ -429,7 +432,7 @@ module.exports = { | ... | @@ -429,7 +432,7 @@ module.exports = { |
429 | const efficiency = calculateEfficiency(stats, characterInfo.character.job, analysisEquipment.weapon); | 432 | const efficiency = calculateEfficiency(stats, characterInfo.character.job, analysisEquipment.weapon); |
430 | const buffEfficiency = calculateEfficiency(buffStats, characterInfo.character.job, analysisEquipment.weapon); | 433 | const buffEfficiency = calculateEfficiency(buffStats, characterInfo.character.job, analysisEquipment.weapon); |
431 | 434 | ||
432 | - res.send({ | 435 | + const result = { |
433 | info: characterInfo.character, | 436 | info: characterInfo.character, |
434 | analysis: { | 437 | analysis: { |
435 | default: { | 438 | default: { |
... | @@ -441,6 +444,9 @@ module.exports = { | ... | @@ -441,6 +444,9 @@ module.exports = { |
441 | efficiency: buffEfficiency | 444 | efficiency: buffEfficiency |
442 | } | 445 | } |
443 | } | 446 | } |
444 | - }); | 447 | + }; |
448 | + | ||
449 | + console.log(JSON.stringify(result)); | ||
450 | + res.send(result); | ||
445 | } | 451 | } |
446 | }; | 452 | }; |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment