Ubuntu

update

Showing 1 changed file with 7 additions and 5 deletions
...@@ -7,17 +7,17 @@ const Result_URL = 'https://inspct.career.go.kr/openapi/test/report' ...@@ -7,17 +7,17 @@ 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');
9 const HTTPS = require('https'); 9 const HTTPS = require('https');
10 -const domain = "www.ahhhhhhhh.tk" 10 +const domain = "www.skdhkfkdy.tk"
11 const sslport = 23023; 11 const sslport = 23023;
12 const bodyParser = require('body-parser'); 12 const bodyParser = require('body-parser');
13 const { stringify } = require('querystring'); 13 const { stringify } = require('querystring');
14 const { ADDRGETNETWORKPARAMS } = require('dns'); 14 const { ADDRGETNETWORKPARAMS } = require('dns');
15 var app = express(); 15 var app = express();
16 app.use(bodyParser.json()); 16 app.use(bodyParser.json());
17 -var ans_sheet="", i, question, answer, contents, result; 17 +var ans_sheet="", i, question, answer, contents, result, eventObj, message, timestamp;
18 app.post('/hook', function (req, res) { 18 app.post('/hook', function (req, res) {
19 - var eventObj = req.body.events[0]; 19 + eventObj = req.body.events[0];
20 - var message = eventObj.message; 20 + message = eventObj.message;
21 console.log('======================', new Date() ,'======================'); 21 console.log('======================', new Date() ,'======================');
22 console.log('[request]', req.body); 22 console.log('[request]', req.body);
23 console.log('[request source] ', eventObj.source); 23 console.log('[request source] ', eventObj.source);
...@@ -25,6 +25,7 @@ app.post('/hook', function (req, res) { ...@@ -25,6 +25,7 @@ app.post('/hook', function (req, res) {
25 if (message.text=="시작"){ 25 if (message.text=="시작"){
26 i=0; 26 i=0;
27 ans_sheet=""; 27 ans_sheet="";
28 + timestamp=eventObj.timestamp;
28 request.get({ 29 request.get({
29 url:Question_URL 30 url:Question_URL
30 },function(err,res,body){ 31 },function(err,res,body){
...@@ -40,6 +41,7 @@ app.post('/hook', function (req, res) { ...@@ -40,6 +41,7 @@ app.post('/hook', function (req, res) {
40 json: { 41 json: {
41 "replyToken":eventObj.replyToken, 42 "replyToken":eventObj.replyToken,
42 "messages":[{ 43 "messages":[{
44 +
43 "type":"text", 45 "type":"text",
44 "text":"직업가치관검사를 시작합니다(28문항)" 46 "text":"직업가치관검사를 시작합니다(28문항)"
45 },{ 47 },{
...@@ -72,7 +74,7 @@ app.post('/hook', function (req, res) { ...@@ -72,7 +74,7 @@ app.post('/hook', function (req, res) {
72 "gender":"100323", 74 "gender":"100323",
73 "school":"경희대학교", 75 "school":"경희대학교",
74 "grade":"2", 76 "grade":"2",
75 - "startDtm":1550466291034, 77 + "startDtm":timestamp,
76 "answers":ans_sheet 78 "answers":ans_sheet
77 } 79 }
78 },(err,res,body)=>{ 80 },(err,res,body)=>{
......