<?php
// +----------------------------------------------------------------------
// | Quotes [未来可期]
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | Author: 微站网 www.btwcms.com 作者QQ：1617643
// +----------------------------------------------------------------------
// | Date: 2020年2月5日
// +----------------------------------------------------------------------
include 'header.php';

if($userrow['api_key'] == null) {
    $result = 1; //未购买分站
}else{
    $result =2;
}


?>
<?php if ($result == 1) { ?>
<!-- Page Content-->
<div class="page-content">

    <div class="container-fluid">
        <!-- Page-Title -->
        <div class="row">
            <div class="col-sm-12">
                <div class="page-title-box">
                    <div class="float-right">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item"><a href="javascript:void(0);">在线

                                    商城</a></li>
                            <li class="breadcrumb-item active">分站商城</li>
                        </ol>
                    </div>
                    <h4 class="page-title">在线商城</h4>
                </div><!--end page-title-box-->
            </div><!--end col-->
        </div>
        <!-- end page title end breadcrumb -->
        <div class="row">
            <div class="col-12">
                <div class="card">
                    <div class="card-body">
                        <div class="row">
                            <div class="col-lg-5">
                                <img

                                    src="https://btwcms.coding.net/p/static/d/static/git/raw/master/baota/img/level.jpg" alt=""

                                    class=" mx-auto  d-block"
                                    height="400">
                            </div><!--end col-->
                            <div class="col-lg-7 align-self-center">
                                <div class="single-pro-detail">
                                    <p class="mb-1">分站商城</p>
                                    <div class="custom-border mb-3"></div>
                                    <h3 class="pro-title">API版分站</h3>
                                    <ul class="list-inline mb-2 product-review">
                                        <li class="list-inline-item"><i class="mdi mdi-star text-warning"></i></li>
                                        <li class="list-inline-item"><i class="mdi mdi-star text-warning"></i></li>
                                        <li class="list-inline-item"><i class="mdi mdi-star text-warning"></i></li>
                                        <li class="list-inline-item"><i class="mdi mdi-star text-warning"></i></li>
                                        <li class="list-inline-item"><i class="mdi mdi-star-half text-warning"></i>
                                        </li>
                                        <li class="list-inline-item">4.5 (<?php echo rand

                                            (300, 1000) ?>人 点赞)</li>
                                    </ul>
                                    <h2 class="pro-price">￥<?php echo $conf

                                        ['level_price']?> <span><del>￥100.00</del></span><small
                                            class="text-danger font-weight-bold ml-2">

                                            优惠中</small></h2>
                                    <h6 class="text-muted font-13">API版分站特点 :</h6>
                                    <ul class="list-unstyled pro-features border-0">
                                        <li>API版分站完全独立</li>
                                        <li>可使用主机搭建的建站系统</li>
                                        <li>绑定域名不受限制</li>
                                        <li>独立的支付接口</li>
                                        <li>独立的用户管理</li>
                                        <li>独立的网站后台</li>
                                    </ul>


                                    <div class="quantity mt-3 ">
                                        
										<a href="http://level.btwcms.com/" target="_blank" class="btn btn-cart btn-sm waves-effect waves-light "><i
                                                            class="mdi mdi-magnify"></i> 演示
                                                </a>
												
										<button type="button" id="buyLevel"
                                                class="btn btn-primary text-white px-4 d-inline-block"><i
                                                class="mdi mdi-cart mr-2"></i>购买
                                        </button>
                                    </div>
                                </div>
                            </div><!--end col-->
                        </div><!--end row-->
                    </div><!--end card-body-->
                </div><!--end card-->
            </div><!--end col-->
        </div><!--end row-->

        <div class="row">
            <div class="col-12">
                <div class="card">
                    <div class="card-body">
                        <div class="row">
                            <div class="col-lg-3">
                                <div class="pro-order-box">
                                    <i class="mdi mdi-truck-fast text-success"></i>
                                    <h4 class="header-title">乐趣</h4>
                                    <p class="text-muted mb-0">
                                        API版分站完全独立,让用户体验自己做系统站长的乐趣
                                    </p>
                                </div>
                            </div><!--end col-->
                            <div class="col-lg-3">
                                <div class="pro-order-box">
                                    <i class="mdi mdi-refresh text-danger"></i>
                                    <h4 class="header-title">方便</h4>
                                    <p class="text-muted mb-0">
                                        能够使用主机搭建的独立建站系统.
                                    </p>
                                </div>
                            </div><!--end col-->
                            <div class="col-lg-3">
                                <div class="pro-order-box">
                                    <i class="mdi mdi-headset text-warning"></i>
                                    <h4 class="header-title">自由</h4>
                                    <p class="text-muted mb-0">
                                        绑定域名不受限制,可自由绑定分站域名
                                    </p>
                                </div>
                            </div><!--end col-->
                            <div class="col-lg-3">
                                <div class="pro-order-box mb-0">
                                    <i class="mdi mdi-wallet text-purple"></i>
                                    <h4 class="header-title">独立</h4>
                                    <p class="text-muted mb-0">
                                        独立的支付接口,独立的网站后台,独立的用户管理
                                    </p>
                                </div>
                            </div><!--end col-->
                        </div><!--end row-->
                    </div><!--end card-body-->
                </div><!--end card-->
            </div><!--end col-->
        </div><!--end row-->

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

    <?php } else { ?>


    <!-- Page Content-->
    <div class="page-content">

        <div class="container-fluid">
            <!-- Page-Title -->
            <div class="row">
                <div class="col-sm-12">
                    <div class="page-title-box">
                        <div class="float-right">
                            <ol class="breadcrumb">
                                <li class="breadcrumb-item"><a href="javascript:void(0);">

                                        分站商城</a></li>
                                <li class="breadcrumb-item active">我的分站</li>
                            </ol>
                        </div>
                        <h4 class="page-title">分站商城</h4>
                    </div><!--end page-title-box-->
                </div><!--end col-->
            </div>
            <!-- end page title end breadcrumb -->
            <div class="row">
                <div class="col-lg-12">
                    <div class="card">
                        <div class="card-body">
                            <div class="row">
                                <div class="col-12">
                                    <div class="wallet-bal-usd">
                                        <h4 class="wallet-title m-0">我的分站</h4>
                                        <span class="text-muted font-12">level</span>

                                    </div>
                                    <div class="text-right">
                                        <button class="btn btn-success btn-sm px-3"

                                                id="getLevelCodeZip">下载源码</button>
                                        <button class="btn btn-danger btn-sm px-3"

                                                type="button" id="useMethod">使用教程</button>
                                    </div>
                                </div>
                            </div>
                        </div><!--end card-body-->
                        <div class="card-body pt-0">
                            <ul class="list-group wallet-bal-crypto">
                                <li class="list-group-item align-items-center d-flex justify-content-between">
                                    <div class="media">
                                        <img src="../assets/images/coins/eth.png"

                                             class="mr-3 thumb-sm align-self-center rounded-circle" alt="...">
                                        <div class="media-body align-self-center">
                                            <div class="coin-bal">
                                                <h3 class="m-0">通信API</h3>
                                            </div>
                                        </div><!--end media body-->
                                    </div>
                                    <button class="btn btn-info btn-sm px-3"

                                            onclick="getMyKey()">点我查看</button>
                                </li>
                            </ul>
                        </div><!--end card-body-->
                    </div><!--end card-->
                </div><!--end col-->
            </div><!-- container -->


            <?php } ?>

            <?php
            include 'footer.php';
            ?>

            <script>
                $("#buyLevel").click(function () {
                    var index = layer.msg('数据加载中', {time: 9999999});
                    $.ajax({
                        type: "post",
                        url: "level.ajax.php?act=buyLevel",
                        dataType: "json",
                        data: {},
                        success: function (data) {
                            layer.close(index);
                            if (data.code == 1) {
                                layer.msg(data.msg, {icon: 1, time: 2000, shade: 0.4}, function ()

                                {
                                    location.href = data.url;
                                });
                            } else {
                                layer.msg(data.msg, {icon: 2, time: 2000, shade: 0.4});
                            }
                        },
                        error: function () {
                            layer.close(index);
                            layer.alert('网络连接错误！');
                        }
                    });
                });
                $("#getLevelCodeZip").click(function () {
                    $.ajax({
                        type: "post",
                        url: "level.ajax.php?act=getLevelCodeZip",
                        dataType: "json",
                        data: {},
                        success: function (data) {
                            if (data.code == 1) {
                                layer.msg(data.msg, {icon: 1, time: 800, shade: 0.4}, function () {
                                    location.href = data.url;
                                });
                            } else {
                                layer.msg(data.msg, {icon: 2, time: 2000, shade: 0.4});
                            }
                        },
                        error: function () {
                            layer.alert('网络连接错误！');
                        }
                    });
                });



                $("#useMethod").click(function () {
                    $.ajax({
                        type: "post",
                        url: "level.ajax.php?act=useMethod",
                        dataType: "json",
                        data: {},
                        success: function (data) {
                            if (data.code == 1) {
                                layer.open({
                                    type: 1
                                    ,
                                    title: false //不显示标题栏
                                    ,
                                    closeBtn: false
                                    ,
                                    area: '300px;'
                                    ,
                                    shade: 0.8
                                    ,
                                    id: 'LAY_layuipro' //设定一个id，防止重复弹出
                                    ,
                                    resize: false
                                    ,
                                    btn: ['关闭教程']
                                    ,
                                    btnAlign: 'c'
                                    ,
                                    moveType: 1 //拖拽模式，0或者1
                                    ,
                                    content: "<div style='padding: 50px; line-height: 22px;background-color: #393D49; color: #fff; font-weight: 300;'>" + data.data + "</div>"
                                    ,
                                    success: function (layero) {
                                    var btn = layero.find('.layui-layer-btn');
                                    btn.find('.layui-layer-btn0').attr({

                                    });
                                }
                            });
                            } else {
                                layer.msg(data.msg, {icon: 2, time: 2000, shade: 0.4});
                            }
                        },
                        error: function () {
                            layer.close(index);
                            layer.alert('网络连接错误！');
                        }
                    });


                })

                function getMyKey(){

                    var index = layer.msg('数据加载中', {time: 9999999});
                    $.ajax({
                        type: "post",
                        url: "level.ajax.php?act=getMyKey",
                        dataType: "json",
                        data: {},
                        success: function (data) {
                            layer.close(index);
                            if (data.code == 1) {
                                layer.open({
                                    type: 1
                                    ,
                                    title: false //不显示标题栏
                                    ,
                                    closeBtn: false
                                    ,
                                    area: '360px;'
                                    ,
                                    shade: 0.8
                                    ,
                                    id: 'LAY_layuipro' //设定一个id，防止重复弹出
                                    ,
                                    resize: false
                                    ,
                                    btn: ['关闭']
                                    ,
                                    btnAlign: 'c'
                                    ,
                                    moveType: 1 //拖拽模式，0或者1
                                    ,
                                    content: "<div style='padding: 60px; line-height: 22px;background-color: #393D49; color: #fff; font-weight: 300;'>" + data.data + "</div>"
                            });
                            } else {
                                layer.msg(data.msg, {icon: 2, time: 2000, shade: 0.4});
                            }
                        },
                        error: function () {
                            layer.close(index);
                            layer.alert('网络连接错误！');
                        }
                    });



                }
            </script>
