由于业务需要开发了微信域名检测,运营小伙伴反应链接多了,一个一个检测很麻烦!作为一名程序猿熊熊燃气,批量检测比单个检测更方便,则技术层面也更有难度,开发过程中判断循环太烧脑,时间原因就用html编程写,分享给大家!
api对接组件
代码语言:javascript复制<div class="panel" style="background:#0f8ee7">
<div class="panel_inner">
<div class="promo">
<!--标题 -->
<h2 style="color:#fff">微信域名批量检测</h2>
</div>
<div class="form1">
<!--输入框,可自己调节大小 -->
<textarea class="main-textarea" placeholder="请输入需要检测的链接,一行一个" type="text" id="text" name="text" value="" size="20" style="height:360px;width:100%"></textarea>
<!--提交 -->
<button type="button" id="btn-tcn" class="main-button" onclick="wxcheck_form()">批量检测</button>
</div>
<!--输出结果 -->
<div id="result_panel"></div>
</div>
</div>
js调用
代码语言:javascript复制<script src="http://juhecdn.oss-cn-hangzhou.aliyuncs.com/jquery/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="http://yunapposs.oss-cn-hangzhou.aliyuncs.com/static/web/layer3/layer.js" charset="utf-8"></script>
页面操作和调用返回
趴取的接口,免费撸的接口,代码已做适配
代码语言:javascript复制接口地址: http://api.new.urlzt.com/api/vx
请求方式: GET/POST
请求示例: http://api.new.urlzt.com/api/qq?token=Token值(后台生成获取,后台地址:https://dwz.cn/TzLUYNU2)&url=www.urlzt.com
<script>
var notice_msg = '微信域名检测';
var api_host = 'http://api.new.urlzt.com/api/vx';
function wxcheck_form(){
$("#result_panel").hide();
var url_longs = $("#text").val();
if(!url_longs) {
alert('输入格式不正确!');
return false;
}
$.post(api_host "/" "wxcheck/web_panel", {url_longs:url_longs},function(result){
$('#result_panel').html(result);
$("#result_panel").show();
wxcheck_handdle();
});
return false;
}
function wxcheck_handdle() {
var wxcheck_api_url = 'http://api.new.urlzt.com/api/vx?token=Token值(后台生成获取)&url=';//检测接口,后台地址:https://dwz.cn/TzLUYNU2
var em = $("*[data='-']:eq(0)");
if(em.length>0) {
em.attr('data','loading');
em.html('<img src="https://tigimg-1252093452.image.myzijiebao.com/2020/04/22/i15fEBcCzV7lpvOjyLfX.gif" />');
$.get(wxcheck_api_url em.attr('url-long'),function(result){
if(result.indexOf('正常')>-1) {
em.html('<span class="opt-result-ok" style="color:green;">域名正常</span>');
wxcheck_handdle();
} else if(result.indexOf('被封')>-1) {
em.html('<span class="opt-result-fail">域名被封</span>');
wxcheck_handdle();
} else if(result.indexOf('异常,查看原因')>-1) {
em.html('<span class="opt-result-fail">接口到期,点击:<a href="http://www.urlzt.com">www.urlzt.com</a>查看原因</span>');
wxcheck_handdle();
} else {
em.html('<span class="opt-result-fail">' result '</span>');
wxcheck_handdle();
}
});
}
}
</script>
完整html代码
代码语言:javascript复制<!DOCTYPE html>
<html>
<head>
<title>微信域名批量检测</title>
<meta name="keywords" content="{{=it.site.widgets.seo_keywords}}">
<meta name="description" content="{{=it.site.widgets.seo_description}}" >
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="applicable-device" content="pc,mobile">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="baidu-site-verification" content="{{=it.site.widgets.baidutj_verification}}">
<link rel="shortcut icon" href="{{=it.site.widgets.favicon}}">
<link type="text/css" rel="stylesheet" href="http://templ1.oss-cn-hangzhou.aliyuncs.com/ailu/ailu_style_wxcheck.css" media="all" />
<link rel="stylesheet" type="text/css" href="https://templ1.oss-cn-hangzhou.aliyuncs.com/ailu/ailu_base.css">
<link rel="stylesheet" type="text/css" href="http://templ1.oss-cn-hangzhou.aliyuncs.com/ailu/ailu_style.css">
</head>
<body>
<!--api对接组件 -->
<div class="panel" style="background:#0f8ee7">
<div class="panel_inner">
<div class="promo">
<!--标题 -->
<h2 style="color:#fff">微信域名批量检测</h2>
</div>
<div class="form1">
<!--输入框,可自己调节大小 -->
<textarea class="main-textarea" placeholder="请输入需要检测的链接,一行一个" type="text" id="text" name="text" value="" size="20" style="height:360px;width:100%"></textarea>
<!--提交 -->
<button type="button" id="btn-tcn" class="main-button" onclick="wxcheck_form()">批量检测</button>
</div>
<!--输出结果 -->
<div id="result_panel"></div>
</div>
</div>
<script src="http://juhecdn.oss-cn-hangzhou.aliyuncs.com/jquery/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="http://yunapposs.oss-cn-hangzhou.aliyuncs.com/static/web/layer3/layer.js" charset="utf-8"></script>
<script>
var notice_msg = '微信域名检测';
var api_host = 'http://api.new.urlzt.com/api/vx';
function wxcheck_form(){
$("#result_panel").hide();
var url_longs = $("#text").val();
if(!url_longs) {
alert('输入格式不正确!');
return false;
}
$.post(api_host "/" "wxcheck/web_panel", {url_longs:url_longs},function(result){
$('#result_panel').html(result);
$("#result_panel").show();
wxcheck_handdle();
});
return false;
}
function wxcheck_handdle() {
var wxcheck_api_url = 'http://api.new.urlzt.com/api/vx?token=Token值(后台生成获取)&url=';//检测接口,后台地址:https://dwz.cn/TzLUYNU2
var em = $("*[data='-']:eq(0)");
if(em.length>0) {
em.attr('data','loading');
em.html('<img src="https://tigimg-1252093452.image.myzijiebao.com/2020/04/22/i15fEBcCzV7lpvOjyLfX.gif" />');
$.get(wxcheck_api_url em.attr('url-long'),function(result){
if(result.indexOf('正常')>-1) {
em.html('<span class="opt-result-ok" style="color:green;">域名正常</span>');
wxcheck_handdle();
} else if(result.indexOf('被封')>-1) {
em.html('<span class="opt-result-fail">域名被封</span>');
wxcheck_handdle();
} else if(result.indexOf('异常,查看原因')>-1) {
em.html('<span class="opt-result-fail">接口到期,点击:<a href="http://www.urlzt.com">www.urlzt.com</a>查看原因</span>');
wxcheck_handdle();
} else {
em.html('<span class="opt-result-fail">' result '</span>');
wxcheck_handdle();
}
});
}
}
</script>
</body>
</html>
效果图