Ubuntu

terminate is updated and apikey, token are deleted

Showing 1 changed file with 22 additions and 4 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 TOKEN = 'femdVKgBP5AnhQ8aW6Q7I/wQeC2sPoTovRQiaVSMXnbGztImhOtK7q303LV3OFdua9c618XN6cyWVeh5CqL/ItLavtPYbO64FAX8GJZwcS2HpPPFRBmlqZbchKlKAB6NSb1+QZKzOPwMurZpv7wBwQdB04t89/1O/w1cDnyilFU=' 4 +const TOKEN = ''
5 -const Question_URL = 'https://inspct.career.go.kr/openapi/test/questions?apikey=8f65744f11f9b7e8fc2b7c28617e9d09&q=6' 5 +const Question_URL = 'https://inspct.career.go.kr/openapi/test/questions?apikey=&q=6'
6 const Result_URL = 'https://inspct.career.go.kr/openapi/test/report' 6 const Result_URL = 'https://inspct.career.go.kr/openapi/test/report'
7 const fs = require('fs'); 7 const fs = require('fs');
8 const path = require('path'); 8 const path = require('path');
...@@ -66,7 +66,7 @@ app.post('/hook', function (req, res) { ...@@ -66,7 +66,7 @@ app.post('/hook', function (req, res) {
66 request.post({ 66 request.post({
67 url:Result_URL, 67 url:Result_URL,
68 json:{ 68 json:{
69 - "apikey":"8f65744f11f9b7e8fc2b7c28617e9d09", 69 + "apikey":"",
70 "qestrnSeq":"6", 70 "qestrnSeq":"6",
71 "trgetSe":"100208", 71 "trgetSe":"100208",
72 "gender":"100323", 72 "gender":"100323",
...@@ -97,7 +97,7 @@ app.post('/hook', function (req, res) { ...@@ -97,7 +97,7 @@ app.post('/hook', function (req, res) {
97 }); 97 });
98 }); 98 });
99 99
100 - }else{ 100 + }else if (i>0){
101 request.get({ 101 request.get({
102 url:Question_URL 102 url:Question_URL
103 },function(err,res,body){ 103 },function(err,res,body){
...@@ -129,6 +129,24 @@ app.post('/hook', function (req, res) { ...@@ -129,6 +129,24 @@ app.post('/hook', function (req, res) {
129 }); 129 });
130 }); 130 });
131 } 131 }
132 + }else if (message.text=="종료") {
133 + request.post({
134 + url: TARGET_URL,
135 + headers: {
136 + 'Authorization': `Bearer ${TOKEN}`
137 + },
138 + json: {
139 + "replyToken":eventObj.replyToken,
140 + "messages":
141 + {
142 + "type":"text",
143 + "text":"검사를 종료합니다"
144 + }
145 + }
146 + },(error, response, body) => {
147 + console.log("terminated");
148 + i=-1;
149 + });
132 } 150 }
133 res.sendStatus(200); 151 res.sendStatus(200);
134 }); 152 });
......