<?php
require 'conn/conn.php';
require 'conn/function.php';
$D_domain=splitx($_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"],"/api.php",0);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>自定义后缀 - <?php echo $C_title?></title>
    <meta name="description" content="<?php echo $C_description?>" />
    <meta name="keywords" content="<?php echo $C_keyword?>" />
    <link href="media/<?php echo $C_ico?>" rel="shortcut icon" />
	<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">  
	<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
	<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<style type="text/css">
		body{background: #f7f7f7;word-break:break-all;}
	</style>
</head>
<body>
<?php require 'wap_header.php';?>
<div style="padding: 10px">

            <div class="panel panel-info">
              <div class="panel-heading">1.生成短链</div>
              <div class="panel-body">
                <p><b>请求地址：</b><?php echo gethttp().$D_domain?>/api/</p>
                <p><b>请求方式：</b>GET <b>返回方式：</b>JSON</p>
                <p><table class="table">
                    <tr><th>请求参数</th><th>解释</th><th>类型</th><th>示例</th></tr>
                    <tr><td>method</td><td>请求方法</td><td>文本</td><td>add</td></tr>
                    <tr><td>key</td><td>会员key，从会员中心获取</td><td>文本</td><td>0cc175b9c0f1b6a831c399e269772661</td></tr>
                    <tr><td>url</td><td>原网址</td><td>文本</td><td>http://www.baidu.com</td></tr>
                    <tr><td>vip</td><td>短链是否永久，0：临时（<?php echo  $C_day?>天），1：永久</td><td>数字</td><td>1</td></tr>
                    <tr><td>domain</td><td><p>选择生成短链的域名</p><?php
                    if(strpos($C_dwzon,"-2")!==false){
                        echo "<p>0：".$_SERVER["HTTP_HOST"]."</p>";
                    }
                    $sql="select D_id,D_domain from sl_domain where D_show=1";
                    $result = mysqli_query($conn,  $sql);
                    if (mysqli_num_rows($result) > 0) {
                    while($row = mysqli_fetch_assoc($result)) {
                            echo "<p>".$row["D_id"]."：".$row["D_domain"]."</p>";
                        }
                    }

                    ?></td><td>数字</td><td>1</td></tr>
                </table></p>
                
                说明：（1）url传入前需要用urlencode转码（2）如果生成永久链接，请保证账户余额充足
                
                
                <p style="word-break:break-all;"><b>请求示例</b>：<br><?php echo gethttp().$D_domain?>/api/?method=add&key=0cc175b9c0f1b6a831c399e269772661&domain=1&vip=1&url=http%3a%2f%2fwww.baidu.com</p>
                <p><table class="table">
                  <tr><th>返回参数</th><th>解释</th><th>示例</th></tr>
                  <tr><td>code</td><td>返回码</td><td>success：成功，error：错误</td></tr>
                  <tr><td>id</td><td>短链编号</td><td>1</td></tr>
                  <tr><td>vip</td><td>短链是否永久，0：临时（<?php echo  $C_day?>天），1：永久</td><td>123</td></tr>
                  <tr><td>short</td><td>短链接</td><td><?php echo gethttp().$D_domain?>/s/d</td></tr>
                  <tr><td>long</td><td>原网址</td><td>http://www.baidu.com</td></tr>
                  <tr><td>time</td><td>短链接生成时间</td><td>2021-01-18 15:38:52</td></tr>
                </table></p>
                <p style="word-break:break-all;"><b>返回示例：</b><br>{"code":"success","id":"1","vip":"1","short":"<?php echo gethttp().$D_domain?>/s/d","long":"http://www.baidu.com","time":"2021-01-18 15:38:52"}</p>
                
              </div>
            </div>

            <div class="panel panel-info">
              <div class="panel-heading">2.获取短链列表</div>
              <div class="panel-body">
                <p><b>请求地址：</b><?php echo gethttp().$D_domain?>/api/</p>
                <p><b>请求方式：</b>GET <b>返回方式：</b>JSON</p>
                <p><table class="table">
                  <tr><th>请求参数</th><th>解释</th><th>示例</th></tr>
                  <tr><td>method</td><td>请求方法</td><td>list</td></tr>
                  <tr><td>key</td><td>会员key，从会员中心获取</td><td>0cc175b9c0f1b6a831c399e269772661</td></tr>

                </table></p>

                <p style="word-break:break-all;"><b>请求示例</b>：<br><?php echo gethttp().$D_domain?>/api/?method=list&key=0cc175b9c0f1b6a831c399e269772661</p>

                <p><table class="table">
                  <tr><th>返回参数</th><th>解释</th><th>示例</th></tr>
                  <tr><td>S_vip</td><td>短链是否永久，0：临时（<?php echo  $C_day?>天），1：永久</td><td>123</td></tr>
                  <tr><td>S_short</td><td>短链接</td><td><?php echo gethttp().$D_domain?>/s/d</td></tr>
                  <tr><td>S_url</td><td>原网址</td><td>http://www.baidu.com</td></tr>
                  <tr><td>S_time</td><td>短链接生成时间</td><td>2021-01-18 15:38:52</td></tr>
                </table></p>
                
                <p style="word-break:break-all;"><b>返回示例：</b><br>[{"S_vip":"1","S_short":"<?php echo gethttp().$D_domain?>/d","S_url":"http://www.baidu.com","S_time":"2021-01-18 15:38:52"},{"S_vip":"1","S_short":"<?php echo gethttp().$D_domain?>/e","S_url":"http://www.qq.com","S_time":"2021-01-18 15:38:52"}]</p>

              </div>
            </div>
</div>
</div>
<?php require 'wap_footer.php';?>
</body>
</html>