api.html 60.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <title>附近人</title>

        <!-- Bootstrap Core CSS -->
        <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

        <!-- Plugin CSS -->
        <link href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
        <script src="https://cdn.staticfile.org/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->

        <style type="text/css">
            body {
                padding-top: 70px; margin-bottom: 15px;
                -webkit-font-smoothing: antialiased;
                -moz-osx-font-smoothing: grayscale;
                font-family: "Roboto", "SF Pro SC", "SF Pro Display", "SF Pro Icons", "PingFang SC", BlinkMacSystemFont, -apple-system, "Segoe UI", "Microsoft Yahei", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
                font-weight: 400;
            }
            h2        { font-size: 1.2em; }
            hr        { margin-top: 10px; }
            .tab-pane { padding-top: 10px; }
            .mt0      { margin-top: 0px; }
            .footer   { font-size: 12px; color: #666; }
            .docs-list .label    { display: inline-block; min-width: 65px; padding: 0.3em 0.6em 0.3em; }
            .string   { color: green; }
            .number   { color: darkorange; }
            .boolean  { color: blue; }
            .null     { color: magenta; }
            .key      { color: red; }
            .popover  { max-width: 400px; max-height: 400px; overflow-y: auto;}
            .list-group.panel > .list-group-item {
            }
            .list-group-item:last-child {
                border-radius:0;
            }
            h4.panel-title a {
                font-weight:normal;
                font-size:14px;
            }
            h4.panel-title a .text-muted {
                font-size:12px;
                font-weight:normal;
                font-family: 'Verdana';
            }
            #sidebar {
                width: 220px;
                position: fixed;
                margin-left: -240px;
                overflow-y:auto;
            }
            #sidebar > .list-group {
                margin-bottom:0;
            }
            #sidebar > .list-group > a{
                text-indent:0;
            }
            #sidebar .child > a .tag{
                position: absolute;
                right: 10px;
                top: 11px;
            }
            #sidebar .child > a .pull-right{
                margin-left:3px;
            }
            #sidebar .child {
                border:1px solid #ddd;
                border-bottom:none;
            }
            #sidebar .child:last-child {
                border-bottom:1px solid #ddd;
            }
            #sidebar .child > a {
                border:0;
                min-height: 40px;
            }
            #sidebar .list-group a.current {
                background:#f5f5f5;
            }
            @media (max-width: 1620px){
                #sidebar {
                    margin:0;
                }
                #accordion {
                    padding-left:235px;
                }
            }
            @media (max-width: 768px){
                #sidebar {
                    display: none;
                }
                #accordion {
                    padding-left:0px;
                }
            }
            .label-primary {
                background-color: #248aff;
            }
            .docs-list .panel .panel-body .table {
                margin-bottom: 0;
            }

        </style>
    </head>
    <body>
        <!-- Fixed navbar -->
        <div class="navbar navbar-default navbar-fixed-top" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="./" target="_blank">附近人</a>
                </div>
                <div class="navbar-collapse collapse">
                    <form class="navbar-form navbar-right">
                        <div class="form-group">
                            Token:
                        </div>
                        <div class="form-group">
                            <input type="text" class="form-control input-sm" data-toggle="tooltip" title="Token在会员注册或登录后都会返回,WEB端同时存在于Cookie中" placeholder="token" id="token" />
                        </div>
                        <div class="form-group">
                            Apiurl:
                        </div>
                        <div class="form-group">
                            <input id="apiUrl" type="text" class="form-control input-sm" data-toggle="tooltip" title="API接口URL" placeholder="https://api.mydomain.com" value="" />
                        </div>
                        <div class="form-group">
                            <button type="button" class="btn btn-success btn-sm" data-toggle="tooltip" title="点击保存后Token和Api url都将保存在本地Localstorage中" id="save_data">
                                <span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>
                            </button>
                        </div>
                    </form>
                </div><!--/.nav-collapse -->
            </div>
        </div>

        <div class="container">
            <!-- menu -->
            <div id="sidebar">
                <div class="list-group panel">
                                        <a href="#首页接口" class="list-group-item" data-toggle="collapse" data-parent="#sidebar">首页接口  <i class="fa fa-caret-down"></i></a>
                    <div class="child collapse" id="首页接口">
                                                <a href="javascript:;" data-id="0" class="list-group-item">首页                            <span class="tag">
                                                            </span>
                        </a>
                                                <a href="javascript:;" data-id="1" class="list-group-item">获取城市列表                            <span class="tag">
                                                            </span>
                        </a>
                                                <a href="javascript:;" data-id="2" class="list-group-item">计算距离                            <span class="tag">
                                                            </span>
                        </a>
                                                <a href="javascript:;" data-id="3" class="list-group-item">[正方形4个点]                            <span class="tag">
                                                            </span>
                        </a>
                                            </div>
                                    </div>
            </div>
            <div class="panel-group docs-list" id="accordion">
                                <h2>首页接口</h2>
                <hr>
                                <div class="panel panel-default">
                    <div class="panel-heading" id="heading-0">
                        <h4 class="panel-title">
                            <span class="label label-success">GET</span>
                            <a data-toggle="collapse" data-parent="#accordion0" href="#collapseOne0"> 首页 <span class="text-muted">/api/index/index</span></a>
                        </h4>
                    </div>
                    <div id="collapseOne0" class="panel-collapse collapse">
                        <div class="panel-body">

                            <!-- Nav tabs -->
                            <ul class="nav nav-tabs" id="doctab0">
                                <li class="active"><a href="#info0" data-toggle="tab">基础信息</a></li>
                                <li><a href="#sandbox0" data-toggle="tab">在线测试</a></li>
                                <li><a href="#sample0" data-toggle="tab">返回示例</a></li>
                            </ul>

                            <!-- Tab panes -->
                            <div class="tab-content">

                                <div class="tab-pane active" id="info0">
                                    <div class="well">
                                        首页                                    </div>
                                    <div class="panel panel-default">
                                        <div class="panel-heading"><strong>权限</strong></div>
                                        <div class="panel-body">
                                            <table class="table table-hover">
                                                <tbody>
                                                <tr>
                                                    <td>登录</td>
                                                    <td></td>
                                                </tr>
                                                <tr>
                                                    <td>鉴权</td>
                                                    <td></td>
                                                </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="panel panel-default">
                                        <div class="panel-heading"><strong>Headers</strong></div>
                                        <div class="panel-body">

                                                                                    </div>
                                    </div>
                                    <div class="panel panel-default">
                                        <div class="panel-heading"><strong>参数</strong></div>
                                        <div class="panel-body">
                                                                                        <table class="table table-hover">
                                                <thead>
                                                    <tr>
                                                        <th>名称</th>
                                                        <th>类型</th>
                                                        <th>必选</th>
                                                        <th>描述</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                                                                        <tr>
                                                        <td>lng</td>
                                                        <td>integer</td>
                                                        <td></td>
                                                        <td>经度</td>
                                                    </tr>
                                                                                                        <tr>
                                                        <td>lat</td>
                                                        <td>integer</td>
                                                        <td></td>
                                                        <td>纬度</td>
                                                    </tr>
                                                                                                        <tr>
                                                        <td>radius</td>
                                                        <td>integer</td>
                                                        <td></td>
                                                        <td>半径[单位米]</td>
                                                    </tr>
                                                                                                    </tbody>
                                            </table>
                                                                                    </div>
                                    </div>
                                    <div class="panel panel-default">
                                        <div class="panel-heading"><strong>正文</strong></div>
                                        <div class="panel-body">
</div>
                                    </div>
                                </div><!-- #info -->

                                <div class="tab-pane" id="sandbox0">
                                    <div class="row">
                                        <div class="col-md-12">
                                                                                        <div class="panel panel-default">
                                                <div class="panel-heading"><strong>参数</strong>
                                                <div class="pull-right">
                                                    <a href="javascript:" class="btn btn-xs btn-info btn-append">追加</a>
                                                </div>
                                                </div>
                                                <div class="panel-body">
                                                    <form enctype="application/x-www-form-urlencoded" role="form" action="/api/index/index" method="get" name="form0" id="form0">
                                                                                                                <div class="form-group">
                                                            <label class="control-label" for="lng">lng</label>
                                                            <input type="integer" class="form-control input-sm" id="lng" required placeholder="经度" name="lng">
                                                        </div>
                                                                                                                <div class="form-group">
                                                            <label class="control-label" for="lat">lat</label>
                                                            <input type="integer" class="form-control input-sm" id="lat" required placeholder="纬度" name="lat">
                                                        </div>
                                                                                                                <div class="form-group">
                                                            <label class="control-label" for="radius">radius</label>
                                                            <input type="integer" class="form-control input-sm" id="radius" required placeholder="半径[单位米]" name="radius">
                                                        </div>
                                                                                                                <div class="form-group form-group-submit">
                                                            <button type="submit" class="btn btn-success send" rel="0">提交</button>
                                                            <button type="reset" class="btn btn-info" rel="0">重置</button>
                                                        </div>
                                                    </form>
                                                </div>
                                            </div>
                                            <div class="panel panel-default">
                                                <div class="panel-heading"><strong>响应输出</strong></div>
                                                <div class="panel-body">
                                                    <div class="row">
                                                        <div class="col-md-12" style="overflow-x:auto">
                                                            <pre id="response_headers0"></pre>
                                                            <pre id="response0"></pre>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="panel panel-default">
                                                <div class="panel-heading"><strong>返回参数</strong></div>
                                                <div class="panel-body">

                                                                                                    </div>
                                            </div>
                                        </div>
                                    </div>
                                </div><!-- #sandbox -->

                                <div class="tab-pane" id="sample0">
                                    <div class="row">
                                        <div class="col-md-12">
                                            <pre id="sample_response0">{
    "code":1,
    "msg":"返回成功"
    "data": [
    {
    "id": "用户id",
    "name": "用户姓名",
    "avatar": "用户头像",
    "grade": "性别",
    "age": "年龄",
    "lng": "经度",
    "lat": "纬度",
    "address": "详细地址",
    "createtime": "创建时间",
    "updatetime": "更新时间",
    "distance": "距离我多远"
    },
    ]
    }</pre>
                                        </div>
                                    </div>
                                </div><!-- #sample -->

                            </div><!-- .tab-content -->
                        </div>
                    </div>
                </div>
                                <div class="panel panel-default">
                    <div class="panel-heading" id="heading-1">
                        <h4 class="panel-title">
                            <span class="label label-success">GET</span>
                            <a data-toggle="collapse" data-parent="#accordion1" href="#collapseOne1"> 获取城市列表 <span class="text-muted">/api/index/getCity</span></a>
                        </h4>
                    </div>
                    <div id="collapseOne1" class="panel-collapse collapse">
                        <div class="panel-body">

                            <!-- Nav tabs -->
                            <ul class="nav nav-tabs" id="doctab1">
                                <li class="active"><a href="#info1" data-toggle="tab">基础信息</a></li>
                                <li><a href="#sandbox1" data-toggle="tab">在线测试</a></li>
                                <li><a href="#sample1" data-toggle="tab">返回示例</a></li>
                            </ul>

                            <!-- Tab panes -->
                            <div class="tab-content">

                                <div class="tab-pane active" id="info1">
                                    <div class="well">
                                        获取城市列表                                    </div>
                                    <div class="panel panel-default">
                                        <div class="panel-heading"><strong>权限</strong></div>
                                        <div class="panel-body">
                                            <table class="table table-hover">
                                                <tbody>
                                                <tr>
                                                    <td>登录</td>
                                                    <td></td>
                                                </tr>
                                                <tr>
                                                    <td>鉴权</td>
                                                    <td></td>
                                                </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="panel panel-default">
                                        <div class="panel-heading"><strong>Headers</strong></div>
                                        <div class="panel-body">

                                                                                    </div>
                                    </div>
                                    <div class="panel panel-default">
                                        <div class="panel-heading"><strong>参数</strong></div>
                                        <div class="panel-body">

                                                                                    </div>
                                    </div>
                                    <div class="panel panel-default">
                                        <div class="panel-heading"><strong>正文</strong></div>
                                        <div class="panel-body">
</div>
                                    </div>
                                </div><!-- #info -->

                                <div class="tab-pane" id="sandbox1">
                                    <div class="row">
                                        <div class="col-md-12">
                                                                                        <div class="panel panel-default">
                                                <div class="panel-heading"><strong>参数</strong>
                                                <div class="pull-right">
                                                    <a href="javascript:" class="btn btn-xs btn-info btn-append">追加</a>
                                                </div>
                                                </div>
                                                <div class="panel-body">
                                                    <form enctype="application/x-www-form-urlencoded" role="form" action="/api/index/getCity" method="get" name="form1" id="form1">
                                                                                                                <div class="form-group">

                                                        </div>
                                                                                                                <div class="form-group form-group-submit">
                                                            <button type="submit" class="btn btn-success send" rel="1">提交</button>
                                                            <button type="reset" class="btn btn-info" rel="1">重置</button>
                                                        </div>
                                                    </form>
                                                </div>
                                            </div>
                                            <div class="panel panel-default">
                                                <div class="panel-heading"><strong>响应输出</strong></div>
                                                <div class="panel-body">
                                                    <div class="row">
                                                        <div class="col-md-12" style="overflow-x:auto">
                                                            <pre id="response_headers1"></pre>
                                                            <pre id="response1"></pre>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="panel panel-default">
                                                <div class="panel-heading"><strong>返回参数</strong></div>
                                                <div class="panel-body">

                                                                                                    </div>
                                            </div>
                                        </div>
                                    </div>
                                </div><!-- #sandbox -->

                                <div class="tab-pane" id="sample1">
                                    <div class="row">
                                        <div class="col-md-12">
                                            <pre id="sample_response1"></pre>
                                        </div>
                                    </div>
                                </div><!-- #sample -->

                            </div><!-- .tab-content -->
                        </div>
                    </div>
                </div>
                                <div class="panel panel-default">
                    <div class="panel-heading" id="heading-2">
                        <h4 class="panel-title">
                            <span class="label label-success">GET</span>
                            <a data-toggle="collapse" data-parent="#accordion2" href="#collapseOne2"> 计算距离 <span class="text-muted">/api/index/test2</span></a>
                        </h4>
                    </div>
                    <div id="collapseOne2" class="panel-collapse collapse">
                        <div class="panel-body">

                            <!-- Nav tabs -->
                            <ul class="nav nav-tabs" id="doctab2">
                                <li class="active"><a href="#info2" data-toggle="tab">基础信息</a></li>
                                <li><a href="#sandbox2" data-toggle="tab">在线测试</a></li>
                                <li><a href="#sample2" data-toggle="tab">返回示例</a></li>
                            </ul>

                            <!-- Tab panes -->
                            <div class="tab-content">

                                <div class="tab-pane active" id="info2">
                                    <div class="well">
                                        计算距离                                    </div>
                                    <div class="panel panel-default">
                                        <div class="panel-heading"><strong>权限</strong></div>
                                        <div class="panel-body">
                                            <table class="table table-hover">
                                                <tbody>
                                                <tr>
                                                    <td>登录</td>
                                                    <td></td>
                                                </tr>
                                                <tr>
                                                    <td>鉴权</td>
                                                    <td></td>
                                                </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="panel panel-default">
                                        <div class="panel-heading"><strong>Headers</strong></div>
                                        <div class="panel-body">

                                                                                    </div>
                                    </div>
                                    <div class="panel panel-default">
                                        <div class="panel-heading"><strong>参数</strong></div>
                                        <div class="panel-body">
                                                                                        <table class="table table-hover">
                                                <thead>
                                                    <tr>
                                                        <th>名称</th>
                                                        <th>类型</th>
                                                        <th>必选</th>
                                                        <th>描述</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                                                                        <tr>
                                                        <td>lng1</td>
                                                        <td>integer</td>
                                                        <td></td>
                                                        <td>经度1</td>
                                                    </tr>
                                                                                                        <tr>
                                                        <td>lat1</td>
                                                        <td>integer</td>
                                                        <td></td>
                                                        <td>纬度1</td>
                                                    </tr>
                                                                                                        <tr>
                                                        <td>lng2</td>
                                                        <td>integer</td>
                                                        <td></td>
                                                        <td>经度2</td>
                                                    </tr>
                                                                                                        <tr>
                                                        <td>lat2</td>
                                                        <td>integer</td>
                                                        <td></td>
                                                        <td>纬度2</td>
                                                    </tr>
                                                                                                    </tbody>
                                            </table>
                                                                                    </div>
                                    </div>
                                    <div class="panel panel-default">
                                        <div class="panel-heading"><strong>正文</strong></div>
                                        <div class="panel-body">
</div>
                                    </div>
                                </div><!-- #info -->

                                <div class="tab-pane" id="sandbox2">
                                    <div class="row">
                                        <div class="col-md-12">
                                                                                        <div class="panel panel-default">
                                                <div class="panel-heading"><strong>参数</strong>
                                                <div class="pull-right">
                                                    <a href="javascript:" class="btn btn-xs btn-info btn-append">追加</a>
                                                </div>
                                                </div>
                                                <div class="panel-body">
                                                    <form enctype="application/x-www-form-urlencoded" role="form" action="/api/index/test2" method="get" name="form2" id="form2">
                                                                                                                <div class="form-group">
                                                            <label class="control-label" for="lng1">lng1</label>
                                                            <input type="integer" class="form-control input-sm" id="lng1" required placeholder="经度1" name="lng1">
                                                        </div>
                                                                                                                <div class="form-group">
                                                            <label class="control-label" for="lat1">lat1</label>
                                                            <input type="integer" class="form-control input-sm" id="lat1" required placeholder="纬度1" name="lat1">
                                                        </div>
                                                                                                                <div class="form-group">
                                                            <label class="control-label" for="lng2">lng2</label>
                                                            <input type="integer" class="form-control input-sm" id="lng2" required placeholder="经度2" name="lng2">
                                                        </div>
                                                                                                                <div class="form-group">
                                                            <label class="control-label" for="lat2">lat2</label>
                                                            <input type="integer" class="form-control input-sm" id="lat2" required placeholder="纬度2" name="lat2">
                                                        </div>
                                                                                                                <div class="form-group form-group-submit">
                                                            <button type="submit" class="btn btn-success send" rel="2">提交</button>
                                                            <button type="reset" class="btn btn-info" rel="2">重置</button>
                                                        </div>
                                                    </form>
                                                </div>
                                            </div>
                                            <div class="panel panel-default">
                                                <div class="panel-heading"><strong>响应输出</strong></div>
                                                <div class="panel-body">
                                                    <div class="row">
                                                        <div class="col-md-12" style="overflow-x:auto">
                                                            <pre id="response_headers2"></pre>
                                                            <pre id="response2"></pre>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="panel panel-default">
                                                <div class="panel-heading"><strong>返回参数</strong></div>
                                                <div class="panel-body">

                                                                                                    </div>
                                            </div>
                                        </div>
                                    </div>
                                </div><!-- #sandbox -->

                                <div class="tab-pane" id="sample2">
                                    <div class="row">
                                        <div class="col-md-12">
                                            <pre id="sample_response2"></pre>
                                        </div>
                                    </div>
                                </div><!-- #sample -->

                            </div><!-- .tab-content -->
                        </div>
                    </div>
                </div>
                                <div class="panel panel-default">
                    <div class="panel-heading" id="heading-3">
                        <h4 class="panel-title">
                            <span class="label label-success">GET</span>
                            <a data-toggle="collapse" data-parent="#accordion3" href="#collapseOne3"> [正方形4个点] <span class="text-muted">/api/index/test4</span></a>
                        </h4>
                    </div>
                    <div id="collapseOne3" class="panel-collapse collapse">
                        <div class="panel-body">

                            <!-- Nav tabs -->
                            <ul class="nav nav-tabs" id="doctab3">
                                <li class="active"><a href="#info3" data-toggle="tab">基础信息</a></li>
                                <li><a href="#sandbox3" data-toggle="tab">在线测试</a></li>
                                <li><a href="#sample3" data-toggle="tab">返回示例</a></li>
                            </ul>

                            <!-- Tab panes -->
                            <div class="tab-content">

                                <div class="tab-pane active" id="info3">
                                    <div class="well">
                                        [正方形4个点]                                    </div>
                                    <div class="panel panel-default">
                                        <div class="panel-heading"><strong>权限</strong></div>
                                        <div class="panel-body">
                                            <table class="table table-hover">
                                                <tbody>
                                                <tr>
                                                    <td>登录</td>
                                                    <td></td>
                                                </tr>
                                                <tr>
                                                    <td>鉴权</td>
                                                    <td></td>
                                                </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="panel panel-default">
                                        <div class="panel-heading"><strong>Headers</strong></div>
                                        <div class="panel-body">

                                                                                    </div>
                                    </div>
                                    <div class="panel panel-default">
                                        <div class="panel-heading"><strong>参数</strong></div>
                                        <div class="panel-body">
                                                                                        <table class="table table-hover">
                                                <thead>
                                                    <tr>
                                                        <th>名称</th>
                                                        <th>类型</th>
                                                        <th>必选</th>
                                                        <th>描述</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                                                                        <tr>
                                                        <td>lng</td>
                                                        <td>integer</td>
                                                        <td></td>
                                                        <td>经度</td>
                                                    </tr>
                                                                                                        <tr>
                                                        <td>lat</td>
                                                        <td>integer</td>
                                                        <td></td>
                                                        <td>纬度</td>
                                                    </tr>
                                                                                                        <tr>
                                                        <td>radius</td>
                                                        <td>integer</td>
                                                        <td></td>
                                                        <td>半径[单位千米]</td>
                                                    </tr>
                                                                                                    </tbody>
                                            </table>
                                                                                    </div>
                                    </div>
                                    <div class="panel panel-default">
                                        <div class="panel-heading"><strong>正文</strong></div>
                                        <div class="panel-body">
</div>
                                    </div>
                                </div><!-- #info -->

                                <div class="tab-pane" id="sandbox3">
                                    <div class="row">
                                        <div class="col-md-12">
                                                                                        <div class="panel panel-default">
                                                <div class="panel-heading"><strong>参数</strong>
                                                <div class="pull-right">
                                                    <a href="javascript:" class="btn btn-xs btn-info btn-append">追加</a>
                                                </div>
                                                </div>
                                                <div class="panel-body">
                                                    <form enctype="application/x-www-form-urlencoded" role="form" action="/api/index/test4" method="get" name="form3" id="form3">
                                                                                                                <div class="form-group">
                                                            <label class="control-label" for="lng">lng</label>
                                                            <input type="integer" class="form-control input-sm" id="lng" required placeholder="经度" name="lng">
                                                        </div>
                                                                                                                <div class="form-group">
                                                            <label class="control-label" for="lat">lat</label>
                                                            <input type="integer" class="form-control input-sm" id="lat" required placeholder="纬度" name="lat">
                                                        </div>
                                                                                                                <div class="form-group">
                                                            <label class="control-label" for="radius">radius</label>
                                                            <input type="integer" class="form-control input-sm" id="radius" required placeholder="半径[单位千米]" name="radius">
                                                        </div>
                                                                                                                <div class="form-group form-group-submit">
                                                            <button type="submit" class="btn btn-success send" rel="3">提交</button>
                                                            <button type="reset" class="btn btn-info" rel="3">重置</button>
                                                        </div>
                                                    </form>
                                                </div>
                                            </div>
                                            <div class="panel panel-default">
                                                <div class="panel-heading"><strong>响应输出</strong></div>
                                                <div class="panel-body">
                                                    <div class="row">
                                                        <div class="col-md-12" style="overflow-x:auto">
                                                            <pre id="response_headers3"></pre>
                                                            <pre id="response3"></pre>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="panel panel-default">
                                                <div class="panel-heading"><strong>返回参数</strong></div>
                                                <div class="panel-body">

                                                                                                    </div>
                                            </div>
                                        </div>
                                    </div>
                                </div><!-- #sandbox -->

                                <div class="tab-pane" id="sample3">
                                    <div class="row">
                                        <div class="col-md-12">
                                            <pre id="sample_response3"></pre>
                                        </div>
                                    </div>
                                </div><!-- #sample -->

                            </div><!-- .tab-content -->
                        </div>
                    </div>
                </div>
                            </div>

            <hr>

            <div class="row mt0 footer">
                <div class="col-md-6" align="left">

                </div>
                <div class="col-md-6" align="right">
                    Generated on 2023-04-26 17:13:46 <a href="./" target="_blank">附近人</a>
                </div>
            </div>

        </div> <!-- /container -->

        <!-- jQuery -->
        <script src="https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>

        <!-- Bootstrap Core JavaScript -->
        <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>

        <script type="text/javascript">
            function syntaxHighlight(json) {
                if (typeof json != 'string') {
                    json = JSON.stringify(json, undefined, 2);
                }
                json = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
                return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
                    var cls = 'number';
                    if (/^"/.test(match)) {
                        if (/:$/.test(match)) {
                            cls = 'key';
                        } else {
                            cls = 'string';
                        }
                    } else if (/true|false/.test(match)) {
                        cls = 'boolean';
                    } else if (/null/.test(match)) {
                        cls = 'null';
                    }
                    return '<span class="' + cls + '">' + match + '</span>';
                });
            }

            function prepareStr(str) {
                try {
                    return syntaxHighlight(JSON.stringify(JSON.parse(str.replace(/'/g, '"')), null, 2));
                } catch (e) {
                    return str;
                }
            }
            var storage = (function () {
                var uid = new Date;
                var storage;
                var result;
                try {
                    (storage = window.localStorage).setItem(uid, uid);
                    result = storage.getItem(uid) == uid;
                    storage.removeItem(uid);
                    return result && storage;
                } catch (exception) {
                }
            }());

            $.fn.serializeObject = function ()
            {
                var o = {};
                var a = this.serializeArray();
                $.each(a, function () {
                    if (!this.value) {
                        return;
                    }
                    if (o[this.name] !== undefined) {
                        if (!o[this.name].push) {
                            o[this.name] = [o[this.name]];
                        }
                        o[this.name].push(this.value || '');
                    } else {
                        o[this.name] = this.value || '';
                    }
                });
                return o;
            };

            $(document).ready(function () {

                if (storage) {
                    storage.getItem('token') && $('#token').val(storage.getItem('token'));
                    storage.getItem('apiUrl') && $('#apiUrl').val(storage.getItem('apiUrl'));
                }

                $('[data-toggle="tooltip"]').tooltip({
                    placement: 'bottom'
                });

                $(window).on("resize", function(){
                    $("#sidebar").css("max-height", $(window).height()-80);
                });

                $(window).trigger("resize");

                $(document).on("click", "#sidebar .list-group > .list-group-item", function(){
                    $("#sidebar .list-group > .list-group-item").removeClass("current");
                    $(this).addClass("current");
                });
                $(document).on("click", "#sidebar .child a", function(){
                    var heading = $("#heading-"+$(this).data("id"));
                    if(!heading.next().hasClass("in")){
                        $("a", heading).trigger("click");
                    }
                    $("html,body").animate({scrollTop:heading.offset().top-70});
                });

                $('code[id^=response]').hide();

                $.each($('pre[id^=sample_response],pre[id^=sample_post_body]'), function () {
                    if ($(this).html() == 'NA') {
                        return;
                    }
                    var str = prepareStr($(this).html());
                    $(this).html(str);
                });

                $("[data-toggle=popover]").popover({placement: 'right'});

                $('[data-toggle=popover]').on('shown.bs.popover', function () {
                    var $sample = $(this).parent().find(".popover-content"),
                            str = $(this).data('content');
                    if (typeof str == "undefined" || str === "") {
                        return;
                    }
                    var str = prepareStr(str);
                    $sample.html('<pre>' + str + '</pre>');
                });

                $(document).on('click', '#save_data', function (e) {
                    if (storage) {
                        storage.setItem('token', $('#token').val());
                        storage.setItem('apiUrl', $('#apiUrl').val());
                    } else {
                        alert('Your browser does not support local storage');
                    }
                });
                $(document).on('click', '.btn-append', function (e) {
                    $($("#appendtpl").html()).insertBefore($(this).closest(".panel").find(".form-group-submit"));
                    return false;
                });
                $(document).on('click', '.btn-remove', function (e) {
                    $(this).closest(".form-group").remove();
                    return false;
                });
                $(document).on('keyup', '.input-custom-name', function (e) {
                    $(this).closest(".row").find(".input-custom-value").attr("name", $(this).val());
                    return false;
                });

                $(document).on('click', '.send', function (e) {
                    e.preventDefault();
                    var form = $(this).closest('form');
                    //added /g to get all the matched params instead of only first
                    var matchedParamsInRoute = $(form).attr('action').match(/[^{]+(?=\})/g);
                    var theId = $(this).attr('rel');
                    //keep a copy of action attribute in order to modify the copy
                    //instead of the initial attribute
                    var url = $(form).attr('action');
                    var method = $(form).prop('method').toLowerCase() || 'get';

                    var formData = new FormData();

                    $(form).find('input').each(function (i, input) {
                        if ($(input).attr('type').toLowerCase() == 'file') {
                            formData.append($(input).attr('name'), $(input)[0].files[0]);
                            method = 'post';
                        } else {
                            formData.append($(input).attr('name'), $(input).val())
                        }
                    });

                    var index, key, value;

                    if (matchedParamsInRoute) {
                        var params = {};
                        formData.forEach(function(value, key){
                            params[key] = value;
                        });
                        for (index = 0; index < matchedParamsInRoute.length; ++index) {
                            try {
                                key = matchedParamsInRoute[index];
                                value = params[key];
                                if (typeof value == "undefined")
                                    value = "";
                                url = url.replace("\{" + key + "\}", value);
                                formData.delete(key);
                            } catch (err) {
                                console.log(err);
                            }
                        }
                    }

                    var headers = {};

                    var token = $('#token').val();
                    if (token.length > 0) {
                        headers['token'] = token;
                    }

                    $("#sandbox" + theId + " .headers input[type=text]").each(function () {
                        val = $(this).val();
                        if (val.length > 0) {
                            headers[$(this).prop('name')] = val;
                        }
                    });

                    $.ajax({
                        url: $('#apiUrl').val() + url,
                        data: method == 'get' ? $(form).serialize() : formData,
                        type: method,
                        dataType: 'json',
                        contentType: false,
                        processData: false,
                        headers: headers,
                        xhrFields: {
                            withCredentials: true
                        },
                        success: function (data, textStatus, xhr) {
                            if (typeof data === 'object') {
                                var str = JSON.stringify(data, null, 2);
                                $('#response' + theId).html(syntaxHighlight(str));
                            } else {
                                $('#response' + theId).html(data || '');
                            }
                            $('#response_headers' + theId).html('HTTP ' + xhr.status + ' ' + xhr.statusText + '<br/><br/>' + xhr.getAllResponseHeaders());
                            $('#response' + theId).show();
                        },
                        error: function (xhr, textStatus, error) {
                            try {
                                var str = JSON.stringify($.parseJSON(xhr.responseText), null, 2);
                            } catch (e) {
                                var str = xhr.responseText;
                            }
                            $('#response_headers' + theId).html('HTTP ' + xhr.status + ' ' + xhr.statusText + '<br/><br/>' + xhr.getAllResponseHeaders());
                            $('#response' + theId).html(syntaxHighlight(str));
                            $('#response' + theId).show();
                        }
                    });
                    return false;
                });
            });
        </script>
        <script type="text/html" id="appendtpl">
            <div class="form-group">
                <label class="control-label">自定义</label>
                <div class="row">
                    <div class="col-xs-4">
                        <input type="text" class="form-control input-sm input-custom-name" placeholder="名称">
                    </div>
                    <div class="col-xs-6">
                        <input type="text" class="form-control input-sm input-custom-value" placeholder="值">
                    </div>
                    <div class="col-xs-2 text-center">
                        <a href="javascript:" class="btn btn-sm btn-danger btn-remove">删除</a>
                    </div>
                </div>
            </div>
        </script>
    </body>
</html>