function ZdcNearShop(){ this.type = 'ZdcNearShop'; this.result = false; this.text_data = null; } ZdcNearShop.prototype.getResult = function(){ return this.result; } ZdcNearShop.prototype.abort = function(){ if( this.httpReq ){ this.httpReq.abort(); } } ZdcNearShop.prototype.search = function(opts, callback){ var owner = this; //var enc = ZDC_ENC; var enc = "EUC"; var target_url = "http://127.0.0.1/cgi/nkyoten.cgi"; var prm = ''; prm += '&key=53nQ2P9tlg4vBGnAjvBvnAqf9FmgbPB5idj5SdXuomA4fhEzTErxAzTjrxpzThngszFIlgrnFDng0z46oRAL0ungdzFblg3nFengVz57oRuLTE'; prm += '&cid='+opts.cid; prm += '&opt=yamato01'; prm += '&pos='+opts.startPos; prm += '&cnt='+opts.maxCount; prm += '&enc='+enc; prm += '&lat='+opts.lat; prm += '&lon='+opts.lon; prm += '&latlon='+opts.latlon; prm += '&jkn='+opts.jkn; prm += '&rad='+opts.radius; prm += '&knsu='+opts.limitCount; prm += '&exkid='+opts.exceptKid; prm += '&hour=1'; prm += '&cust='+opts.cust; prm += '&exarea='+opts.exarea; prm += '&polycol='+opts.polycol; var request_url = target_url+'?'+prm; this.httpReq = new ZdcEmapHttpRequest('EUC', 'EUC'); this.httpReq.request(request_url, function(reference_text,status){ var result = new ZdcNearShopResult(reference_text, status); result.type = owner.type; result.options = opts; owner.result = result; ZDC.trigger(owner, "end", result); if( callback != null ){ // mod 2013/04/15 H.Osamoto [ // callback(result); // mod 2015/09/30 Y.Uesugi [ if (result.hitCount == 0 || result.hitCount < opts.minCount) { //if (result.hitCount == 0) { // mod 2015/09/30 Y.Uesugi [ if (opts.researchCount != "") { var target_url = "http://127.0.0.1/cgi/nkyoten.cgi"; var prm = ''; prm += '&key=53nQ2P9tlg4vBGnAjvBvnAqf9FmgbPB5idj5SdXuomA4fhEzTErxAzTjrxpzThngszFIlgrnFDng0z46oRAL0ungdzFblg3nFengVz57oRuLTE'; prm += '&cid='+opts.cid; prm += '&opt=yamato01'; prm += '&pos='+opts.startPos; prm += '&cnt='+opts.researchCount; prm += '&enc='+enc; prm += '&lat='+opts.lat; prm += '&lon='+opts.lon; prm += '&latlon='+opts.latlon; prm += '&jkn='+opts.jkn; prm += '&rad=10000000'; prm += '&knsu='+opts.researchCount; prm += '&exkid='+opts.exceptKid; prm += '&hour=1'; prm += '&cust='+opts.cust; prm += '&exarea='+opts.exarea; prm += '&polycol='+opts.polycol; var request_url = target_url+'?'+prm; this.httpReq = new ZdcEmapHttpRequest('EUC', 'EUC'); this.httpReq.request(request_url, function(reference_text,status){ var result = new ZdcNearShopResult(reference_text, status); result.type = owner.type; result.options = opts; // add 2016/01/27 H.Yasunaga search時の再検索のフラグ追加 [ result.researched = "1"; // add 2016/01/27 H.Yasunaga ] owner.result = result; ZDC.trigger(owner, "end", result); if( callback != null ){ callback(result); } }, opts.timeout); } else { callback(result); } } else { callback(result); } // mod 2013/04/15 H.Osamoto ] } }, opts.timeout); } function ZdcNearShopOptions(frewd){ //default値 this.cid = '99999999'; this.startPos = 1; this.minCount = 0; this.maxCount = 30; this.lat = ''; this.lon = ''; this.latlon = ''; this.jkn = ''; this.limitCount = 100; //指定件数 this.radius = 50000; //半径 this.timeout = 60000; this.pointFlg = '2'; //暫定対応: default: 2 (ZDC ms) this.exceptKid = ''; //除外する拠点 this.cust = ''; this.researchCount = ''; this.exarea = ''; this.polycol = ''; } function ZdcNearShopResult(text_data, status){ if( text_data == null ){ ZdcSetErrorStatus.call(this, '', status); return; } //header var res = new Array(); //res = text_data.split(ZDC_HTTP_DMT[ZDC_ENC]); res = text_data.split('\n'); var header = res.shift(); var cols = header.split('\t'); var retcd = cols[0]; var cnt = parseFloat(cols[1]); var hitcnt = parseFloat(cols[2]); var rest = ( retcd.charAt(3) == '0' && retcd.charAt(7) == '1' )? true : false; //Parameter Error Check if( retcd.charAt(3) == '1' ){ ZdcSetErrorStatus.call(this, retcd); return; } //record // add 2016/01/27 H.Yasunaga search時の再検索のフラグ追加 再検索した場合は"1"を設定 [ this.researched = ""; // add 2016/01/27 ] this.retCode = retcd; this.type = ''; this.status = status; this.recCount = cnt; this.hitCount = hitcnt; this.rest = rest; this.items = []; for(var i=0; i18) lvl = 0; var item = new ZdcNearShopItem(cols,lvl); this.items.push(item); } } function ZdcNearShopItem(cols,lvl){ this.id = cols[0]; this.lat = cols[1]; this.lon = cols[2]; this.icon = cols[3]; this.dist = cols[4]; this.nflg = cols[5]; this.name = cols[6]; this.addr = cols[7]; this.col_01 = cols[8]; this.col_02 = cols[9]; this.col_03 = cols[10]; this.col_04 = cols[11]; this.col_05 = cols[12]; this.col_06 = cols[13]; this.col_07 = cols[14]; this.col_08 = cols[15]; this.col_09 = cols[16]; this.col_10 = cols[17]; this.col_11 = cols[18]; this.col_12 = cols[19]; this.col_13 = cols[20]; this.col_14 = cols[21]; this.col_15 = cols[22]; this.col_16 = cols[23]; this.col_17 = cols[24]; this.col_18 = cols[25]; this.col_19 = cols[26]; this.col_20 = cols[27]; this.col_21 = cols[28]; this.col_22 = cols[29]; this.col_23 = cols[30]; this.col_24 = cols[31]; this.col_25 = cols[32]; this.col_26 = cols[33]; this.col_27 = cols[34]; this.col_28 = cols[35]; this.col_29 = cols[36]; this.col_30 = cols[37]; this.col_31 = cols[38]; this.col_32 = cols[39]; this.col_33 = cols[40]; this.col_34 = cols[41]; this.col_35 = cols[42]; this.col_36 = cols[43]; this.col_37 = cols[44]; this.col_38 = cols[45]; this.col_39 = cols[46]; this.col_40 = cols[47]; this.col_41 = cols[48]; this.col_42 = cols[49]; this.col_44 = cols[50]; this.col_45 = cols[51]; this.col_46 = cols[52]; this.col_47 = cols[53]; this.col_48 = cols[54]; this.col_49 = cols[55]; this.col_50 = cols[56]; this.col_52 = cols[57]; this.lvl = lvl; }