<div class="container">
	<div class="row">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h2 class="text-center">查询信息</h2>
			</div>
			<div class="panel-body">
				<div class="method_select">
					  <ul class="nav nav-tabs" role="tablist">
						<li role="presentation" class="active">
							<a href="#listinput" aria-controls="listinput" role="tab" data-toggle="tab">查询url所在页面</a>
						</li>
						<li role="presentation">
							<a href="#emptyamp" aria-controls="emptyamp" role="tab" data-toggle="tab">查询AMP为空页面</a>
						</li>
					  </ul>
					  <div class="tab-content">
						<div role="tabpanel" class="tab-pane active" id="listinput">
							<div class="row" style="margin-top:10px;">
								<div class="col-md-9">
									<select name="destination" class="form-control" id="destination">
										<option value="">选择站点</option>
										<option value="gm">德语</option>
										<option value="ah">ah</option>
									</select>
								</div>
								<div class="col-md-9">
									<input type="text" id="errorurl" class="form-control" placeholder="请输入url"/>
								</div>
								<div class="col-md-6">
									<a href="#" id="searchurls" class="btn btn-info">查询页面</a>
								</div>
							</div>
							<div class="result_view">
								<div class="row">
									<h3 class="text-center">查询url所在页面列表</h3>
									<div class="container infodetails"></div>
								</div>
							</div>
						</div>
						
						<div role="tabpanel" class="tab-pane" id="emptyamp">
							<div class="row" style="margin-top:10px;">
								<div class="col-md-9">
									<select name="destination" class="form-control" id="destinationamp">
										<option value="">选择站点</option>
										<option value="gm">德语</option>
										<option value="ah">ah</option>
										<option value="cht">cht</option>
									</select>
								</div>
								
								<div class="col-md-6">
									<a href="#" id="searchempty" class="btn btn-info">查询页面</a>
								</div>
							</div>
							<div class="empty_result_view">
								<div class="row">
									<h3 class="text-center">查询amp为空页面列表</h3>
									<div class="container emptyinfodetails"></div>
								</div>
							</div>
						</div>
						
					  </div>
					  
				</div>
			</div>
		</div>
	</div>
</div>
<script>
$(function(){
	$('#searchurls').click(function(){
		var sitecode = $('#destination').val();
		var host = '';
		switch(sitecode){
			case 'ah':
				host = 'https://www.asiahighlights.com';
				break;
			case 'gm':
				host = 'https://chinarundreisen.com';
				break;	
		}
		var errorurl = $('#errorurl').val();
		var html = '';
		$.ajax({
				url:'/info.php/apps/searchinfo/index/search_error_urls',
				data:{sitecode:sitecode,errorurl:errorurl},
				success:function(json,status){
					var data = $.parseJSON(json);
					console.log(data);
					for(var i = 0;i<data.length;i++){
						html += '<div class="row">';
						html += '<div class="col-md-2"><p>'+i+'</p></div>';
						html += '<div class="col-md-18"><p>'+data[i].ic_url+'</p></div>';
						html += '<div class="col-md-4"><a target="_blank" href="'+host+data[i].ic_url+'">预览</a></div>';
						html += '</div>';
					}
					$('.infodetails').html(html);
				}
			});
	});
	
	$('#searchempty').click(function(){
		var sitecode = $('#destinationamp').val();
		var html = '';
		switch(sitecode){
			case 'ah':
				host = 'https://www.asiahighlights.com';
				break;
			case 'gm':
				host = 'https://chinarundreisen.com';
				break;
			case 'cht':
				host = 'https://www.chinahighlights.com';
				break;		
		}
		console.log(sitecode);
		
		$.ajax({
				url:'/info.php/apps/searchinfo/index/search_empty_amp',
				data:{sitecode:sitecode},
				success:function(json,status){
					var data = $.parseJSON(json);
					console.log(data);
					for(var i = 0;i<data.length;i++){
						html += '<div class="row">';
						html += '<div class="col-md-2"><p>'+i+'</p></div>';
						html += '<div class="col-md-18"><p>'+data[i].ic_url+'</p></div>';
						html += '<div class="col-md-4"><a target="_blank" href="'+host+data[i].ic_url+'">预览</a></div>';
						html += '</div>';
					}
					$('.emptyinfodetails').html(html);
				}
			});
	});
	
});
</script>
