최현영

Highway congest function fixed..

......@@ -187,12 +187,6 @@ function inputroadnumber(typetext){
}
function pushmsg(eventObj, roadnumberstring, roadnumberstringLength){
for(var i = 0; i < 5; i++){
if(roadnumberstringLength == count + i){
raodnumberstringlength[count + i] = "";
}
}
request.post(
{
url: TARGET_URL,
......@@ -245,7 +239,7 @@ app.post('/hook', function (req, res) {
var eventObj = req.body.events[0];
var source = eventObj.source;
var message = eventObj.message;
var isnext = false;
var isnext;
// request log
console.log('======================', new Date() ,'======================');
console.log('[request]', req.body);
......@@ -322,8 +316,10 @@ app.post('/hook', function (req, res) {
}
isnext = nexttext(message.text);
if(isnext = true){
if(isnext == true){
pushmsg(eventObj, roadnumberstring, roadnumberstringLength);
console.log(roadnumberstring);
console.log(roadnumberstringLength);
}
res.sendStatus(200);
......@@ -753,6 +749,11 @@ function roadcongest(eventObj, msg){
var iscount = 0;
console.log(number);
count = 0;
console.log(count);
roadnumberstringLength = 0;
roadnumberstring = new Array();
console.log(roadnumberstring);
if(number.length == 1){ //노선번호가 한자수일 경우, 노선을 찾을 때 두자리 혹은 세자리 번호와 겹칠 수 있으므로.
number = "00" + number;
}
......@@ -764,12 +765,19 @@ function roadcongest(eventObj, msg){
if(jsonForcongest.list[i].routeNo.indexOf(number) >= 0){
roadnumberstring[iscount] = ("# 노선이름: " + jsonForcongest.list[i].routeName + ", 정체구간: " + jsonForcongest.list[i].conzoneName + ', 기점종점방향: ' + jsonForcongest.list[i].updownTypeCode + ', 교통량: ' + jsonForcongest.list[i].trafficAmout + ', 평균속도: ' + jsonForcongest.list[i].speed);
}
iscount += 1;
}
}
roadnumberstringLength = roadnumberstring.length;
if(roadnumberstringLength != 0){
iscount = (roadnumberstringLength % 5);
for(var i = 0; i < (5-iscount); i++ ){
roadnumberstring[roadnumberstringLength + i] = "Out of range";
}
}
if(iscount == 0){
if(roadnumberstringLength == 0){
var Notfoundroadnumberstring = "검색하신 노선에서 발견된 정체구간은 없습니다.";
request.post(
{
......