Files
phalapi-pro/public/docs/App.IP.GetInfo.html
2022-03-21 11:16:38 +08:00

628 lines
23 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<style>
.hljs,.ui.attached:not(.message)+.ui.attached.segment:not(.top){
background:#fff!important;
}
body{
background:#F0F2F5!important;
}
.ui.message:last-child{
box-shadow: none;
height:217px;
background:rgba(255,255,255,1);
box-shadow:0px 0px 30px 0px rgba(0,0,0,0.05);
border-radius:10px;
}
.ui.message>:first-child{
border: none;
}
.ui.segment{
background:none!important;
padding: 0!important;
}
.ui.floating.message{
box-shadow: none!important;
background: none;
}
.ui.raised.segment{
box-shadow: none!important;
}
.ui.message p{
margin-bottom: 0!important;
opacity: 1!important;
}
.newDesc__link{
font-size:16px;
font-family:PingFangSC-Medium,PingFang SC;
font-weight:500;
color:rgba(51,51,51,1);
margin-bottom: 10px;
}
.newDesc__desc{
font-size:14px;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
color:rgba(102,102,102,1);
}
.ui.ordered.steps{
margin-top: 30px;
width: 100%;
height:90px;
background:rgba(250,250,250,1);
border-radius:10px;
border:1px solid rgba(233,233,233,1);
overflow: hidden;
}
/* 头标题 */
.newDescTitle{
height:101px;
background:rgba(255,255,255,1);
box-shadow:0px 0px 30px 0px rgba(0,0,0,0.05);
border-radius:10px;
display: flex;
align-items: center;
}
.newDescTitle__box{
padding: 0 30px;
}
.newDescTitle__box__nav{
font-size:14px;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
color:rgba(153,153,153,1);
}
.newDescTitle__box__t{
font-size:20px!important;
font-family:PingFangSC-Semibold,PingFang SC!important;
font-weight:600!important;
color:rgba(51,51,51,1)!important;
margin-top: 15px!important;
}
/* biaoge */
.ui.steps .step:after, .ui.ordered.steps .step.completed:before{
display: none!important;
}
.ui.steps .step .description{
font-size:14px!important;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
color:rgba(102,102,102,1)!important;
margin-bottom: 4px;
text-align: center;
}
.ui.steps .step .title{
font-size:18px!important;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400!important;
color:rgba(51,51,51,1)!important;
text-align: center;
}
/* biaoge e */
/* 接口参数 */
.parameter, .parameterName, .testing, .clientCode, .errorList{
padding-bottom: 20px;
background:rgba(255,255,255,1);
box-shadow:0px 0px 30px 0px rgba(0,0,0,0.05);
border-radius:10px;
margin-bottom: 20px;
}
.clientCode{
margin-bottom: 0px;
padding-bottom: 0px;
}
.parameter__title, .parameterName__title, .testing__title, .clientCode__title, .errorList__title{
padding: 0 30px;
height: 55px;
display: flex;
align-items: center;
border-bottom: 1px solid #E9E9E9;
}
.parameter__title p, .parameterName__title p, .testing__title p, .clientCode__title p, .errorList__title p{
font-size:16px;
font-family:PingFangSC-Medium,PingFang SC;
font-weight:500;
color:rgba(51,51,51,1);
}
.ui.red.table, .ui.green.table{
border-top: none!important;
margin-top: 20px!important;
border-bottom: none;
border-left: none;
border-right: none;
padding: 0 32px;
}
.ui.table:last-child tbody tr td,.ui.table:last-child thead tr th, .ui.green.table thead tr th, .ui.green.table tbody tr td{
border: none;
height: 53px;
}
.ui.table:last-child tbody tr,.ui.table:last-child thead tr, .ui.green.table thead tr th, .ui.green.table tbody tr td{
border-bottom: 1px solid #E9E9E9;
}
.ui.table:last-child thead tr th, .ui.green.table thead tr th{
font-size:14px;
font-family:PingFangSC-Medium,PingFang SC;
font-weight:500;
border-bottom: 1px solid #E9E9E9;
color:rgba(51,51,51,1);
}
.ui.table:last-child tbody tr td{
font-size:14px;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
color:rgba(102,102,102,1);
border-bottom: 1px solid #E9E9E9;
}
.signRed{
width:7px;
height:7px;
background:rgba(245,34,45,1);
display: inline-block;
border-radius: 50%;
margin-right: 7px;
}
.signGreen{
width:7px;
height:7px;
background:rgba(82,196,26,1);
display: inline-block;
border-radius: 50%;
margin-right: 7px;
}
/* 接口参数 e */
/* 客户示例 */
.ui.tab.active{
margin-top: 0!important;
box-shadow: none;
margin-bottom: 20px;
border: none;
padding-bottom: 20px!important;
}
pre{
margin-top: 0px;
}
/* 底部时间 */
.generatedTime{
display: flex;
height: 80px;
align-items: center;
justify-content: center!important;
}
.generatedTime small{
font-size:12px;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
color:rgba(153,153,153,1);
}
</style>
<!DOCTYPE html>
<html lang="en">
<!--
_____ _ _ _ _____
| __ \ | | | | /\ (_) | __ \
| |__) || |__ __ _ | | / \ _ __ _ | |__) |_ __ ___
| ___/ | '_ \ / _` || | / /\ \ | '_ \ | | | ___/| '__|/ _ \
| | | | | || (_| || | / ____ \ | |_) || | | | | | | (_) |
|_| |_| |_| \__,_||_|/_/ \_\| .__/ |_| |_| |_| \___/
| |
|_|
-->
<head>
<meta charset="utf-8">
<title> 获取IP地址归属信息接口 - App.IP.GetInfo - 接口大师 - 在线接口文档</title>
<link rel="stylesheet" href="https://cdn.bootcss.com/semantic-ui/2.2.2/semantic.min.css">
<link rel="stylesheet" href="https://cdn.bootcss.com/semantic-ui/2.2.2/components/table.min.css">
<link rel="stylesheet" href="https://cdn.bootcss.com/semantic-ui/2.2.2/components/container.min.css">
<link rel="stylesheet" href="https://cdn.bootcss.com/semantic-ui/2.2.2/components/message.min.css">
<link rel="stylesheet" href="https://cdn.bootcss.com/semantic-ui/2.2.2/components/label.min.css">
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
<script src="/static/jquery.min.js"></script>
<script src="/static/jquery.cookie.min.js"></script>
</head>
<body>
<style>
.ui.fixed.menu{
height:70px;
background:linear-gradient(170deg,rgba(250,195,83,1) 0%,rgba(249,169,67,1) 100%);
box-shadow:0px 0px 40px 0px rgba(0,0,0,0.05);
}
.ui.message>:last-child{
display: flex;
justify-content: space-between;
width: 100%!important;
}
.ui.menu>.container, .ui.menu>.grid{
width:100%;
padding: 0 24px;
}
.ui.menu .item:before{
width:0px;
}
.contentList__logo{
width: 18%;
display: flex;
justify-content: center;
align-items: center;
}
.contentList__nav{
margin-left: 10%;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
.nav__index{
position: relative;
}
.contentList__nav a{
height: 100%;
font-size:20px;
font-family:PingFangSC-Medium,PingFang SC;
font-weight:500;
color:rgba(51,51,51,1)!important;
padding-right: 0!important;
padding-left: 0!important;
margin-left: 20px;
margin-right: 20px;
/* transition: 2s; */
/* transform: 1s; */
}
/* .contentList__nav__i{
position: absolute;
bottom: 0;
display: none;
transition: .5s;
height: 5px;
width: 100px;
background: #333;
border-radius: 8px;
} */
.contentList__nav a:hover{
border-bottom: 5px solid #333;
}
/* .contentList__nav a:hover +.contentList__nav__i{
display: block;
} */
.ui.inverted.menu .dropdown.item:hover, .ui.inverted.menu .link.item:hover, .ui.inverted.menu a.item:hover, .ui.link.inverted.menu .item:hover{
background: none;
color: #333;
}
.ui.inverted.menu .active.item{
background: none!important;
color: #333!important;
}
.ui.inverted.menu .active.item:hover{
color: #333!important;
}
.logo{
object-fit: contain;
}
.register{
padding-right: 0!important;
}
</style>
<div class="ui fixed inverted menu black">
<div class="ui container contentList">
<div class="contentList__logo">
<a href="/docs.php" class="header item">
<img class="logo" alt="pro" src="/favicon.ico">
接口大师 </a>
</div>
<div class="contentList__nav">
<!-- <div class="contentList__nav__index">
<a href="/" class="item" class="nav__index">首页</a>
<span class="contentList__nav__i"></span>
</div> -->
<a href="/" class="item" class="nav__index">首页</a>
<a href="/docs.php" class="item">OpenAPI</a>
<a href="/platform" class="item">开放平台</a>
<a href="/wiki/" target="_blank" class="item">技术文档</a>
<a href="/admin/" target="_blank" class="item">管理后台</a>
</div>
<div class="right menu">
<div class="ui dropdown item" style="color: #333;">
语言 <i class="dropdown icon"></i>
<div class="menu">
<a class="item" href="/docs.php?language=zh_cn" >简体中文</a>
<a class="item" href="/docs.php?language=en" >English</a>
</div>
</div>
</div>
<!-- 欢迎/注册 -->
<div class="item register">
<div class="ui blue button"><a style="color:#fff;" href="/platform" target="_blank">登录</a></div>
&nbsp;
<div class="ui green button"><a style="color:#fff;" href="/platform" target="_blank"><i class="user icon"></i>注册</a></div>
</div>
</div>
</div>
<div class="row"></div>
<div class="ui text container" style="max-width: none !important;padding-top: 70px;">
<div class="ui floating message">
<div class="ui raised segment">
<!-- <span class="ui red ribbon label">
#接口文档 </span> -->
<div class="newDescTitle">
<div class="newDescTitle__box">
<p class="newDescTitle__box__nav">接口大师 / OpenAPI / <span style="color:#333;"> 获取IP地址归属信息接口</span> </p>
<p class="ui header newDescTitle__box__t">
获取IP地址归属信息接口 </p>
</div>
</div>
<div class="ui message newDesc">
<p class="newDesc__link">接口地址http://localhost/public/api/app.php?s=App.IP.GetInfo</p>
<p class="newDesc__desc">接口描述: 根据IP地址获取归属信息定位用户所在城市</p>
<div class="ui ordered steps">
<div class="completed step">
<div class="content">
<div class="description">HTTP/HTTPS</div>
<div class="title">请求协议</div>
</div>
</div>
<div class="completed step">
<div class="content">
<div class="description">GET/POST</div>
<div class="title">请求方式</div>
</div>
</div>
<div class="completed step">
<div class="content">
<div class="description">UTF-8</div>
<div class="title">编码格式</div>
</div>
</div>
<div class="completed step">
<div class="content">
<div class="description">JSON</div>
<div class="title">返回格式</div>
</div>
</div>
</div>
</div>
</div>
<!-- 接口参数 -->
<div class="parameter">
<div class="parameter__title">
<p>接口参数</p>
</div>
<table class="ui red celled striped table" >
<thead>
<tr><th>参数名字</th><th>类型</th><th>是否必须</th><th>默认值</th><th>其他</th><th>说明</th></tr>
</thead>
<tbody>
<tr><td>access_token</td><td>字符串</td><td><span class="signGreen"></span><font color="#52C41A">可选</font></td><td></td><td></td><td>访问令牌仅当开启签名验证时需要传递生成令牌可使用App.Auth.ApplyToken接口</td></tr>
<tr><td>ip</td><td>字符串</td><td><span class="signGreen"></span><font color="#52C41A">可选</font></td><td>-</td><td></td><td>IP地址不传时自动取客户端IP地址示例192.168.0.1</td></tr>
</tbody>
</table>
</div>
<!-- 参数名字 -->
<div class="parameterName">
<div class="parameterName__title">
<p>返回字段</p>
</div>
<table class="ui green celled striped table" >
<thead>
<tr><th>返回结果</th><th>类型</th><th>说明</th></tr>
</thead>
<tbody>
<tr><td>ret</td><td>整型</td><td>状态码200表示成功4xx表示客户端非法请求5xx表示服务器错误</td></tr>
<tr><td>data</td><td>对象或混合类型</td><td>业务数据,由各自接口指定,通常为对象</td></tr>
<tr><td>data.info</td><td>对象</td><td>IP信息没有时为null</td></tr><tr><td>data.info.ip</td><td>字符串</td><td>当前IP地址</td></tr><tr><td>data.info.country</td><td>字符串</td><td>Ip地址的所在国家</td></tr><tr><td>data.info.province</td><td>字符串</td><td>Ip地址的所在地区</td></tr><tr><td>data.info.city</td><td>字符串</td><td>Ip地址的所在城市</td></tr><tr><td>data.info.isp</td><td>字符串</td><td>Ip地址的所在服务商</td></tr><tr><td>data.info.area</td><td>字符串</td><td>所在地址</td></tr> <tr><td>msg</td><td>字符串</td><td>提示信息,失败时的错误提示</td></tr>
</tbody>
</table>
</div>
<!-- 在线测试 -->
<div class="testing">
<div class="testing__title">
<p>在线测试 &nbsp;&nbsp;</p>
</div>
<table class="ui green celled striped table" >
<thead>
<tr><th width="25%">参数</th><th width="10%">是否必须</th><th width="65%"></th></tr>
</thead>
<tbody id="params">
<tr>
<td>service</td>
<td><span class="signRed"></span><font color="red">必须</font></td>
<td><div class="ui fluid input disabled"><input name="service" data-source="get" value="App.IP.GetInfo" style="width:100%;" class="C_input" /></div></td>
</tr>
<tr>
<td>access_token</td>
<td><span class="signGreen"></span><font color="#52C41A">可选</font></td>
<td><div class="ui fluid input"><input name="access_token" id="access_token_ipt_id" value="" data-source="" placeholder="访问令牌仅当开启签名验证时需要传递生成令牌可使用App.Auth.ApplyToken接口" style="width:100%;" class="C_input" type="text" /> </div></td>
</tr> <tr>
<td>ip</td>
<td><span class="signGreen"></span><font color="#52C41A">可选</font></td>
<td><div class="ui fluid input"><input name="ip" id="ip_ipt_id" value="" data-source="" placeholder="IP地址不传时自动取客户端IP地址示例192.168.0.1" style="width:100%;" class="C_input" type="text" /> </div></td>
</tr> </tbody>
</table>
<div class="ui fluid action input">
<input placeholder="请求的接口链接" type="text" name="request_url" value="http://localhost/public/api/app.php" >
<button class="ui button green" id="submit" >请求当前接口</button>
</div>
</div>
<div style="display: flex;align-items:center;">
<!--<select name="request_type" style="font-size: 14px; padding: 2px;">
<option value="POST">POST</option>
<option value="GET">GET</option>
</select>-->
</div>
<div class="ui message blue" id="json_output">
</div>
<div class="ui message blue" id="json_output_api_result" style="overflow: auto;">
</div>
<div class="clientCode">
<div class="clientCode__title">
<p>客户端请求示例</p>
</div>
</div>
<div class="ui tab segment active" data-tab="json">
<div class="ui top attached tabular menu">
<a class="active item" data-tab="datatabjson">HTTP通用示例</a>
</div>
<div class="ui bottom attached active tab segment" data-tab="datatabjson"><pre><code>{
&quot;ret&quot;: 200,
&quot;data&quot;: {
&quot;info&quot;: {
&quot;ip&quot;: &quot;61.147.110.191&quot;,
&quot;country&quot;: &quot;中国&quot;,
&quot;province&quot;: &quot;江苏&quot;,
&quot;city&quot;: &quot;扬州市&quot;,
&quot;county&quot;: &quot;&quot;,
&quot;isp&quot;: &quot;电信&quot;,
&quot;area&quot;: &quot;中国江苏扬州市IDC机房&quot;
}
},
&quot;msg&quot;: &quot;&quot;
}</code></pre></div>
</div>
<!-- 代码高亮 -->
<!--
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js"></script>
-->
<link rel="stylesheet" href="./static/highlight.min.css">
<script src="./static/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<div class="errorList">
<div class="errorList__title">
<p id="ret_code_list_id">错误列表</p>
</div>
<table class="ui red celled striped table" >
<thead>
<tr><th>错误状态码</th><th>错误描述信息</th>
</thead>
<tbody><tr><td>400</td><td>表示客户端参数错误</td></tr><tr><td>404</td><td>表示接口服务不存在</td></tr><tr><td>500</td><td>表示服务端内部错误</td></tr> </tbody>
</table>
</div>
<!--
<div class="ui blue message">
<strong>温馨提示:</strong> 此接口文档根据接口代码和注释实时自动生成,帮助文档请见<a href="http://docs.phalapi.net/#/v2.0/api-docs" target="_blank">PhalApi 2.x 开发文档</a>。
</div>
-->
<p class="generatedTime"><small>本文档生成时间2021-03-25 15:10:55</small></p>
</div>
</div>
<script src="https://cdn.bootcss.com/semantic-ui/2.2.2/semantic.min.js" ></script>
<script src="https://cdn.bootcss.com/semantic-ui/2.2.2/components/tab.js"></script>
<script type="text/javascript">
$(function(){
$("#json_output").hide();
$("#json_output_api_result").hide();
$("#submit").on("click",function(){
$("#json_output").html('<div class="ui active inverted dimmer"><div class="ui text loader">接口请求中……</div></div>');
$("#json_output").show();
$("#json_output_api_result").html('');
var data = getData();
var url_arr = $("input[name=request_url]").val().split('?');
var url = url_arr.shift();
var param = url_arr.join('?');
param = param.length > 0 ? param + '&' + data.param : data.param;
url = url + '?' + param;
$.ajax({
url: url,
type:'post',
data:data.data,
cache: false,
processData: false,
contentType: false,
success:function(res,status,xhr){
var statu = xhr.status + ' ' + xhr.statusText;
var header = xhr.getAllResponseHeaders();
var json_text = JSON.stringify(res, null, 4); // 缩进4个空格
$("#json_output").html('<pre>' + statu + '<br />' + header + '</pre>');
$("#json_output").show();
if (hljs) {
// var hightLightCode = hljs.highlightAuto(json_text);
var hightLightCode = hljs.highlight('json', json_text);
json_text = hightLightCode.value;
}
$("#json_output_api_result").html('<pre><code>' + json_text + '</code></pre>');
$("#json_output_api_result").show();
},
error:function(error){
$("#json_output").html('接口请求失败:' + error);
}
})
})
fillHistoryData();
//checkLastestVersion();
// 选项卡
$('.tabular.menu .item').tab();
$('.ui.dropdown').dropdown({
// you can use any ui transition
transition: 'drop'
});
})
function getData() {
var data = new FormData();
var param = [];
$("td input").each(function(index,e) {
if ($.trim(e.value)){
if (e.type != 'file'){
if ($(e).data('source') == 'get') {
param.push(e.name + '=' + e.value);
} else {
data.append(e.name, e.value);
}
if (e.name != "service") $.cookie(e.name, e.value, {expires: 30});
} else{
var files = e.files;
if (files.length == 1){
data.append(e.name, files[0]);
} else{
for (var i = 0; i < files.length; i++) {
data.append(e.name + '[]', files[i]);
}
}
}
}
});
param = param.join('&');
return {param:param, data:data};
}
// 填充历史数据
function fillHistoryData() {
$("td input").each(function(index,e) {
var cookie_value = $.cookie(e.name);
if (e.name != "service" && cookie_value !== undefined) {
e.value = cookie_value;
}
});
}
</script>