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"; // del 2014/12/24 Le Dang Son //var target_url = "http://127.0.0.1/cgi/store_nearsearch.cgi"; // del 2014/12/24 Le Dang Son var target_url = "http://aws-strnavi-jppweb-in-alb/cgi/store_nearsearch.cgi"; // add 2014/12/24 Le Dang Son var prm = ''; prm += 'from=js'; var latlonPrm = ''; if(opts.latlon != ''){ var latlonPrms = opts.latlon.split(','); latlonPrm += '&nelat=' + latlonPrms[2]; latlonPrm += '&nelon=' + latlonPrms[3]; latlonPrm += '&swlat=' + latlonPrms[0]; latlonPrm += '&swlon=' + latlonPrms[1]; } //prm += '&key=71nQlP9jlg8vBYnAOvBynAQf9GmgIPBgidp5S1Xv85H6f7Qmi0rxUzTErxpzTxngvzFxlw0bF1lxN8JUlQAvDdoQcT6BoQNv6NoRvL0VngwzFJlwTbFMlhZ8JmlQ3vDPoQmT6AoQVv7DoRKLTz'; // del 2014/12/24 Le Dang Son prm += '&intid=EmapMlSsQ'; // add 2014/12/24 Le Dang Son prm += '&lang=' + 'en'; // add 2014/12/24 Le Dang Son prm += '&cid='+opts.cid; prm += '&opt=search'; prm += '&pos='+opts.startPos; prm += '&cnt='+opts.maxCount; //prm += '&enc='+enc; // del 2014/12/24 Le Dang Son prm += '&lat='+opts.lat; prm += '&lon='+opts.lon; //prm += '&latlon='+opts.latlon; // del 2014/12/24 Le Dang Son prm += latlonPrm; // add 2014/12/24 Le Dang Son //prm += '&jkn='+opts.jkn; // del 2014/12/24 Le Dang Son prm += '&filter='+opts.jkn; // add 2014/12/24 Le Dang Son //prm += '&rad=' + opts.radius; // del 2014/12/24 Le Dang Son prm += '&ewdist=' + opts.radius; // add 2014/12/24 Le Dang Son prm += '&sndist=' + opts.radius; // add 2014/12/24 Le Dang Son prm += '&knsu=' + opts.limitCount; prm += '&exkid=' + opts.exceptKid; // prm += '&hour=1'; // del 2014/12/24 Le Dang Son prm += '&pflg=1'; // add 2014/12/24 Le Dang Son // prm += '&cust='+opts.cust; // del 2014/12/24 Le Dang Son // prm += '&exarea='+opts.exarea; // del 2014/12/24 Le Dang Son // prm += '&polycol='+opts.polycol; // del 2014/12/24 Le Dang Son prm += '&cols='+opts.cols; 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); if (result.hitCount == 0) { if (opts.researchCount != "") { // var target_url = "http://127.0.0.1/cgi/store_nearsearch.cgi"; // del 2014/12/24 Le Dang Son var target_url = "http://aws-strnavi-jppweb-in-alb/cgi/store_nearsearch.cgi"; // add 2014/12/24 Le Dang Son var prm = ''; // prm += '&key=71nQlP9jlg8vBYnAOvBynAQf9GmgIPBgidp5S1Xv85H6f7Qmi0rxUzTErxpzTxngvzFxlw0bF1lxN8JUlQAvDdoQcT6BoQNv6NoRvL0VngwzFJlwTbFMlhZ8JmlQ3vDPoQmT6AoQVv7DoRKLTz'; // del 2014/12/24 Le Dang Son prm += '&intid=EmapMlSsQ'; // add 2014/12/24 Le Dang Son prm += '&lang=' + 'en'; // add 2014/12/24 Le Dang Son prm += '&cid='+opts.cid; prm += '&opt=search'; prm += '&pos='+opts.startPos; prm += '&cnt='+opts.researchCount; // prm += '&enc='+enc; // del 2014/12/24 Le Dang Son prm += '&lat='+opts.lat; prm += '&lon='+opts.lon; // prm += '&latlon='+opts.latlon; // del 2014/12/24 Le Dang Son prm += latlonPrm; // add 2014/12/24 Le Dang Son //prm += '&jkn='+opts.jkn; // del 2014/12/24 Le Dang Son prm += '&filter='+opts.jkn; // add 2014/12/24 Le Dang Son //prm += '&rad=1000000'; // del 2014/12/24 Le Dang Son prm += '&ewdist=1000000'; // add 2014/12/24 Le Dang Son prm += '&sndist=1000000'; // add 2014/12/24 Le Dang Son prm += '&knsu='+opts.researchCount; prm += '&exkid='+opts.exceptKid; //prm += '&hour=1'; // del 2014/12/24 Le Dang Son prm += '&pflg=1'; // add 2014/12/24 Le Dang Son //prm += '&cust='+opts.cust; // del 2014/12/24 Le Dang Son //prm += '&exarea='+opts.exarea; // del 2014/12/24 Le Dang Son //prm += '&polycol='+opts.polycol; // del 2014/12/24 Le Dang Son prm += '&cols='+opts.cols; 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 ){ 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.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 = ''; this.cols = ''; } function ZdcNearShopResult(text_data, status){ if( text_data == null ){ ZdcSetErrorStatus.call(this, '', status); return; } //header //var res = new Array(); // del 2014/12/24 Le Dang Son //res = text_data.split(ZDC_HTTP_DMT[ZDC_ENC]); // del 2014/12/24 Le Dang Son [ // 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]); // del 2014/12/24 Le Dang Son ] // add 2014/12/24 Le Dang Son [ var result = []; // del 2014/12/24 Le Dang Son result = eval('(' + text_data + ')'); var returnCode = result['return_code']; var recCount = result['rec_count']; var hitCount = result['hit_count']; // add 2014/12/24 Le Dang Son ] var rest = ( returnCode.charAt(3) == '0' && returnCode.charAt(7) == '1' )? true : false; //Parameter Error Check if( returnCode.charAt(3) == '1' ){ // ZdcSetErrorStatus.call(this, retcd); // del 2014/12/24 Le Dang Son ZdcSetErrorStatus.call(this, returnCode); // add 2014/12/24 Le Dang Son return; } //record // del 2014/12/24 Le Dang Son [ //this.retCode = retcd; //this.type = ''; //this.status = status; //this.recCount = cnt; //this.hitCount = hitcnt; // del 2014/12/24 Le Dang Son ] // add 2014/12/24 Le Dang Son [ this.retCode = returnCode; this.type = ''; this.status = status; this.recCount = recCount; this.hitCount = hitCount; // add 2014/12/24 Le Dang Son [ this.rest = rest; var cols; this.items = []; // del 2014/12/24 Le Dang Son [ for(var i = 0; i < recCount; i++){ /*cols = res[i].split('\t'); if( cols[0] == '' ){ continue; } // 拠点縮尺(PC) lvl = cols[cols.length-2]; if (!lvl || lvl < 1 || lvl >18) lvl = 0; var item = new ZdcNearShopItem(cols,lvl); this.items.push(item);*/ // del 2014/12/24 Le Dang Son cols = result['store_list'][i]; this.items.push(new ZdcNearShopItem(cols, null)); } // del 2014/12/24 Le Dang Son ] } function ZdcNearShopItem(cols,lvl){ var item={}; item.id = cols['store_id']; item.lat = cols['lat']; item.lon = cols['lon']; var icons = cols['icon_url'].split('icon_id='); item.icon = icons[icons.length - 1]; item.dist = cols['distance']; item.nflg = cols['new']=='1'; cols['content'].forEach(function(val, key){ eval("item."+val['col'].toLowerCase()+" = val['"+val['type'].toLowerCase()+"']"); //this[val['col'].toLowerCase()] = val[val['type'].toLowerCase()]; }); if(item.col_184 && ZdcEmapIconImg[item.col_184]) item.icon = item.col_184; return item; }