API接口
主用:https://www.sapi.run/hero/select.php
备用:https://api.xxoo.team/hero/getHeroInfo.php
参数: hero:英雄名字 type:aqq、awx、iqq、iwx
示例:
https://www.sapi.run/hero/select.php?hero=孙悟空&type=aqq
https://api.xxoo.team/hero/getHeroInfo.php?hero=孙悟空&type=aqq
返回结果:
{ "code": 200, "data": { "uid": "167", "name": "孙悟空", "alias": "齐天大圣-孙悟空", "platform": "安卓-扣扣区", "photo": "https://game.gtimg.cn/images/yxzj/img201606/heroimg/167/167.jpg", "area": "牧野区", "areaPower": "3846", "city": "潮州市", "cityPower": "5227", "province": "澳门", "provincePower": "6792", "guobiao": "9944", "stamp": "1683497755", "updatetime": "2023/05/08 06:15:55" }, "msg": "若无杀父之仇 请勿攻击本站", "docs": "https://byepy1ypxo.k.topthink.com/@king" }
JS查询方法
HTML代码:
<input name="yxname" class="form-control" placeholder="请输入要查询的英雄全称,如:露娜,凯" id="yxname"> <select class="form-control" id="seltname"> <option value="aqq">安卓QQ</option> <option value="awx">安卓VX</option> <option value="iqq">苹果QQ</option> <option value="ix">苹果VX</option> </select> <button onClick="Startquery()" class="btn btn-danger btn-lg">开始查询</button>
js代码:
<script type="text/javascript"> function Startquery() { var yxname = document.getElementById("yxname").value; //获取需要查询的英雄名称 var myselect = document.getElementById("seltname"); var index = myselect.selectedIndex; var dqname = myselect.options[index].value; //获取到的大区名称 if (yxname.length == 0) { alert("请输入需要查询的英雄名称") } else { $.getJSON("https://api.xxoo.team/hero/getHeroInfo.php?hero=" + yxname + "&type=" + dqname, function(data, status) { //console.log(data.data) //var newdata = data.data $("#platform").append(data.data.platform+"<br/>") $("#province").append(data.data.province+"<br/>") $("#provincePower").append(data.data.provincePower+"<br/>") $("#city").append(data.data.city+"<br/>") $("#cityPower").append(data.data.cityPower+"<br/>") $("#area").append(data.data.area+"<br/>") $("#areaPower").append(data.data.areaPower+"<br/>") $("#imgId").attr('src',data.data.photo) $("#yxbiao").html(data.data.alias+" - "+data.data.name) }) } } </script>