<?php
/**
 * Author：晴天 QQ：1186258278
 * Creation：2020/3/22 23:01
 * Filename：management.php
 * 店铺管理
 */
$title = '我的店铺';
include 'header.php';
if ($conf['userleague'] <> 1) show_msg('警告', '当前商城未开启用户加盟权限！', 2);
if ($USERDATA['grade'] < $conf['userleaguegrade']) show_msg('警告', '您当前的等级无法开通店铺,请先去提升等级！', 2, 'grade.php');
$template_arr = for_dir("../template/");
$data_arr = config::common_unserialize($USERDATA['configuration']);
if ($data_arr == false) $data_arr = $conf;
$count_1 = $DB->count("SELECT count(*) FROM `sky_journal` WHERE  (`name` = '货币提成' or `name` = '余额提成') AND `uid` = '{$USERDATA['id']}' ");
$count_2 = $DB->count("SELECT count(*) FROM `sky_journal` WHERE  (`name` = '货币提成' or `name` = '余额提成') AND `uid` = '{$USERDATA['id']}' AND `date` >= '$times' ");
$count_3 = $DB->count("SELECT sum(count) FROM `sky_journal` WHERE  (`name` = '货币提成') AND `uid` = '{$USERDATA['id']}' ");
$count_4 = $DB->count("SELECT sum(count) FROM `sky_journal` WHERE  (`name` = '货币提成') AND `uid` = '{$USERDATA['id']}' AND `date` >= '$times' ");
$count_5 = $DB->count("SELECT sum(count) FROM `sky_journal` WHERE  (`name` = '余额提成' or `name` = '升级提成' ) AND `uid` = '{$USERDATA['id']}' ");
$count_6 = $DB->count("SELECT sum(count) FROM `sky_journal` WHERE  (`name` = '余额提成' or `name` = '升级提成') AND `uid` = '{$USERDATA['id']}' AND `date` >= '$times' ");
$count_7 = $DB->count("SELECT count(*) FROM `sky_user` WHERE `superior` = '{$USERDATA['id']}' ");
$count_7 = ($count_7 == 0 ? 0 : $count_7);
?>
<div class="row">
    <div class="col-lg-6 col-md-6 col-sm-6 col-xl-6" style="width: 50%;">
        <div class="card widget-flat" id="data1">
            <div class="card-body">
                <div class="float-right" style="width: 30px;height: 30px">
                    <i class="layui-icon layui-icon-rmb widget-icon" style="background-color: #FF7043;color: white"></i>
                </div>
                <h5 class="text-muted font-weight-normal mt-0">
                    累计余额提成</h5>
                <h5 class="mt-3 mb-0" style="font-weight: 300"><?= round(($count_5 == 0 ? 0 : $count_5), 2) ?>元</h5>
            </div>
        </div>
    </div>
    <div class="col-lg-6 col-md-6 col-sm-6 col-xl-6" style="width: 50%;">
        <div class="card widget-flat" id="data1">
            <div class="card-body">
                <div class="float-right" style="width: 30px;height: 30px">
                    <i class="layui-icon layui-icon-rmb widget-icon" style="background-color: #9575CD;color: white"></i>
                </div>
                <h5 class="text-muted font-weight-normal mt-0">
                    累计<?= $conf['currency'] ?>提成</h5>
                <h5 class="mt-3 mb-0"
                    style="font-weight: 300"><?= round(($count_3 == 0 ? 0 : $count_3), 0) . $conf['currency'] ?></h5>
            </div>
        </div>
    </div>

    <div class="col-lg-6 col-md-6 col-sm-6 col-xl-3" style="width: 50%;">
        <div class="card widget-flat" id="data1">
            <div class="card-body">
                <div class="float-right" style="width: 30px;height: 30px">
                    <i class="layui-icon layui-icon-rmb widget-icon" style="background-color: #FF7043;color: white"></i>
                </div>
                <h5 class="text-muted font-weight-normal mt-0">
                    今日余额提成</h5>
                <h5 class="mt-3 mb-0" style="font-weight: 300"><?= round(($count_6 == 0 ? 0 : $count_6), 2) ?>元</h5>
            </div>
        </div>
    </div>
    <div class="col-lg-6 col-md-6 col-sm-6 col-xl-3" style="width: 50%;">
        <div class="card widget-flat" id="data1">
            <div class="card-body">
                <div class="float-right" style="width: 30px;height: 30px">
                    <i class="layui-icon layui-icon-rmb widget-icon" style="background-color: #FFC107;color: white"></i>
                </div>
                <h5 class="text-muted font-weight-normal mt-0">
                    今日<?= $conf['currency'] ?>提成</h5>
                <h5 class="mt-3 mb-0"
                    style="font-weight: 300"><?= round(($count_4 == 0 ? 0 : $count_4), 0) . $conf['currency'] ?></h5>
            </div>
        </div>
    </div>
    <div class="col-lg-6 col-md-6 col-sm-6 col-xl-3" style="width: 50%;">
        <div class="card widget-flat" id="data1">
            <div class="card-body">
                <div class="float-right" style="width: 30px;height: 30px">
                    <i class="layui-icon layui-icon-cart-simple widget-icon"
                       style="background-color: #7C4DFF;color: white;"></i>
                </div>
                <h5 class="text-muted font-weight-normal mt-0">
                    累计订单</h5>
                <h5 class="mt-3 mb-0" style="font-weight: 300"><?= ($count_1 == 0 ? 0 : $count_1) ?>条</h5>
            </div>
        </div>
    </div>
    <div class="col-lg-6 col-md-6 col-sm-6 col-xl-3" style="width: 50%;">
        <div class="card widget-flat" id="data1">
            <div class="card-body">
                <div class="float-right" style="width: 30px;height: 30px">
                    <i class="layui-icon layui-icon-cart-simple widget-icon"
                       style="background-color: #43A047;color: white"></i>
                </div>
                <h5 class="text-muted font-weight-normal mt-0">
                    今日订单</h5>
                <h5 class="mt-3 mb-0" style="font-weight: 300"><?= ($count_2 == 0 ? 0 : $count_2) ?>条</h5>
            </div>
        </div>
    </div>
    <div class="col-xl-12">
        <div class="card">
            <div class="card-header bg-info text-white">
                店铺域名 - 域名绑定后修改价格为<?= $conf['userdomainsetmoney'] ?>元
            </div>
            <div class="card-body">
                <form class="form-horizontal layui-form">
                    <input type="hidden" name="type" value="domain">
                    <?php if ($conf['userdomaintype'] == 1) { ?>
                        <div class="form-group mb-3">
                            <label for="example-input-normal" style="font-weight: 500">域名主体（如www.<font
                                        color="red">baidu.com</font>，<font
                                        color="red">baidu.com</font> 则是域名主体）</label>
                            <select class="custom-select mt-3" lay-search name="domain">
                                <?php
                                $arr_domain = explode(',', $conf['userdomain']);
                                $user_domain = explode('.', $USERDATA['domain']);
                                $pr = $user_domain[0];
                                unset($user_domain[0]);
                                $hz = implode('.', $user_domain);
                                if ($arr_domain == '') {
                                    echo ' <option>站长未设置域名主体,无法完成绑定！</option>';
                                } else {
                                    echo ' <option></option>';
                                }
                                foreach ($arr_domain as $value) {
                                    echo ' <option value="' . $value . '" ' . ($hz == $value ? 'selected' : '') . '>' . $value . '</option>';
                                } ?>
                            </select>
                        </div>
                        <div class="form-group mb-3">
                            <label for="example-input-normal" style="font-weight: 500">域名前缀（如<font
                                        color="red">www</font>.baidu.com，<font
                                        color="red">www</font> 则是域名前缀）</label>
                            <input type="text" name="prefix" class="form-control" value="<?= $pr ?>"
                                   placeholder="不可将<?= implode('和', explode(',', $conf['userdomainretain'])) ?>作为域名前缀">
                        </div>
                        <blockquote class="site-text layui-elem-quote mb-3">
                            <?= $USERDATA['domain'] == '' ? '当前未绑定域名,初次绑定免费！' : '当前已绑定域名：' . $USERDATA['domain'] . ',修改收取' . $conf['userdomainsetmoney'] . '元服务费<hr>你的店铺域名：<span id="domain"><a href="' . is_https(false) . $USERDATA['domain'] . '" target="_blank">' . $USERDATA['domain'] . '</a></span><hr>
成功绑定店铺域名后怎么赚钱呢 <a href="javascript:rule()">查看</a><hr>当前您共有' . $count_7 . '个下级用户！只要下级等级比你低，通过你邀请进来的用户也会成为你下级哦！，快去<a href="activity.php" target="_blank">邀请</a>新用户成为你的下级吧！' ?>
                        </blockquote>
                    <?php } else { ?>
                        <div class="form-group mb-3">
                            <label for="example-input-normal" style="font-weight: 500">域名小尾巴（如www.baidu.com?t=<font
                                        color="red">xxx</font>，<font
                                        color="red">xxx</font> 就是你的域名小尾巴）</label>
                            <input type="text" name="prefix" class="form-control" value="<?= $USERDATA['domain'] ?>"
                                   placeholder="不可将<?= implode('和', explode(',', $conf['userdomainretain'])) ?>作为域名小尾巴">
                        </div>
                        <blockquote class="site-text layui-elem-quote mb-3">
                            <?= $USERDATA['domain'] == '' ? '当前未绑定域名小尾巴,初次绑定免费！' : '当前已绑定域名小尾巴：' . $USERDATA['domain'] . ',修改收取' . $conf['userdomainsetmoney'] . '元服务费<hr>你的店铺域名：<span id="domain"><a href="' . is_https(false) . href() . '?t=' . $USERDATA['domain'] . '" target="_blank">' . is_https(false) . href() . '?t=' . $USERDATA['domain'] . '</a></span><hr>
成功绑定店铺域名后怎么赚钱呢 <a href="javascript:rule()">查看</a><hr>当前您共有' . $count_7 . '个下级用户！只要下级等级比你低，通过你邀请进来的用户也会成为你下级哦！，快去<a href="activity.php" target="_blank">邀请</a>新用户成为你的下级吧！' ?>
                        </blockquote>
                    <?php } ?>
                    <button type="submit" lay-submit lay-filter="configuration_save"
                            class="btn btn-block btn-xs btn-outline-info">绑定域名
                    </button>
                </form>
            </div>
        </div>
    </div>
    <div class="col-xl-12">
        <div class="card">
            <div class="card-header bg-danger text-white">
                店铺装修
            </div>
            <div class="card-body">
                <form class="form-horizontal layui-form">
                    <input type="hidden" name="type" value="template">
                    <div class="form-group mb-2">
                        <label for="example-input-normal" style="font-weight: 500">首页模板（PC端）</label>
                        <select class="custom-select mt-3" lay-search name="template">
                            <?php
                            foreach ($template_arr as $v) {
                                echo '<option ';
                                echo ($data_arr['template'] == '' ? $conf['template'] : $data_arr['template']) == $v ? 'selected' : null;
                                echo ' value="' . $v . '">' . $v . '</option>';
                            }
                            ?>
                        </select>
                    </div>
                    <div class="form-group mb-2">
                        <label for="example-input-normal" style="font-weight: 500">首页模板（手机端）</label>
                        <select class="custom-select mt-3" lay-search name="template_m">
                            <?php
                            foreach ($template_arr as $v) {
                                echo '<option ';
                                echo ($data_arr['template_m'] == '' ? $conf['template_m'] : $data_arr['template_m']) == $v ? 'selected' : null;
                                echo ' value="' . $v . '">' . $v . '</option>';
                            }
                            ?>
                        </select>
                    </div>
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">背景图片</label>
                        <select class="custom-select mt-3" lay-search name="background">
                            <option
                                <?= ($data_arr['background'] == '' ? $conf['background'] : $data_arr['background']) == 1 ? 'selected' : '' ?>
                                value="1">每日必应背景(快)
                            </option>
                            <option
                                <?= ($data_arr['background'] == '' ? $conf['background'] : $data_arr['background']) == 2 ? 'selected' : '' ?>
                                value="2">随机必应背景(慢)
                            </option>
                            <option
                                <?= ($data_arr['background'] == '' ? $conf['background'] : $data_arr['background']) == 3 ? 'selected' : '' ?>
                                value="3">二次元背景图(慢)
                            </option>
                            <option
                                <?= ($data_arr['background'] == '' ? $conf['background'] : $data_arr['background']) == 4 ? 'selected' : '' ?>
                                value="4">模板默认背景(快)
                            </option>
                        </select>
                    </div>
                    <div class="form-group mb-2">
                        <label for="example-input-normal">首页banner(轮播图)</label>
                        <div class="input-group">
                                     <span class="btn btn-xs btn-outline-primary mr-1"
                                           style="cursor: pointer" onclick="template.add()">添加</span>
                            <span class="btn btn-xs btn-outline-success"
                                  onclick="template.QuickEdit()"
                                  style="cursor: pointer;margin-left: 1em">快速编辑</span>
                            <div class="banner"
                                 data-img="<?= ($data_arr['banner'] == '' ? $conf['banner'] : $data_arr['banner']) ?>">
                            </div>
                        </div>
                    </div>
                    <style>
                        .banner {
                            width: 100%;
                            min-height: 12em
                        }

                        .banner img {
                            width: 10em;
                            height: 10em;
                            margin: 1em;
                            box-shadow: 3px 3px 16px #eee;
                            border-radius: 0.5em;
                        }
                    </style>
                    <button type="submit" lay-submit lay-filter="configuration_save"
                            class="btn btn-block btn-xs btn-outline-success">保存设置
                    </button>
                </form>
            </div>
        </div>
    </div>
    <div class="col-xl-12">
        <div class="card">
            <div class="card-header bg-success text-white">
                基础设置
            </div>
            <div class="card-body">
                <form class="form-horizontal layui-form">
                    <input type="hidden" name="type" value="webset">
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">网站名称</label>
                        <input type="text" name="sitename" lay-verify="required"
                               class="form-control"
                               value="<?= ($data_arr['sitename'] == '' ? $conf['sitename'] : $data_arr['sitename']) ?>"
                               placeholder="请输入站点名称">
                    </div>
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">网站关键词</label>
                        <input type="text" name="keywords" lay-verify="required"
                               class="form-control"
                               value="<?= ($data_arr['keywords'] == '' ? $conf['keywords'] : $data_arr['keywords']) ?>"
                               placeholder="请输入站点名称">
                    </div>
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">网站描述语</label>
                        <input type="text" name="description" lay-verify="required"
                               class="form-control"
                               value="<?= ($data_arr['description'] == '' ? $conf['description'] : $data_arr['description']) ?>"
                               placeholder="请输入站点名称">
                    </div>
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">客服QQ</label>
                        <input type="text" name="kfqq" lay-verify="required"
                               class="form-control"
                               value="<?= ($data_arr['kfqq'] == '' ? $conf['kfqq'] : $data_arr['kfqq']) ?>"
                               placeholder="请输入客服QQ">
                    </div>
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">官方群链接</label>
                        <input type="text" name="Communication" lay-verify="required" class="form-control"
                               value="<?= ($data_arr['Communication'] == '' ? $conf['Communication'] : $data_arr['Communication']) ?>"
                               placeholder="请输入官方群链接">
                    </div>
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">代付款分享语句 <font color="red">可用参数：[url]
                                = 付款链接</font></label>
                        <input type="text" name="share_url" lay-verify="required"
                               class="form-control"
                               value="<?= ($data_arr['share_url'] == '' ? $conf['share_url'] : $data_arr['share_url']) ?>"
                               placeholder="[url] = 付款链接">
                    </div>
                    <button type="submit" lay-submit lay-filter="configuration_save"
                            class="btn btn-block btn-xs btn-outline-success">保存设置
                    </button>
                </form>
            </div>
        </div>
    </div>
    <div class="col-xl-12">
        <div class="card">
            <div class="card-header bg-primary text-white">
                公告配置
            </div>
            <div class="card-body">
                <div class="form-horizontal layui-form">
                    <input type="hidden" name="type" value="notice">
                    <div class="form-group mb-3" style="">
                        <label for="example-input-normal"
                               style="position: relative;bottom: 0;left: 0">首页顶部公告</label>
                        <textarea class="form-control" name="notice_top" id="notice_top" rows="4"
                                  placeholder="请输入首页顶部公告内容"><?= htmlspecialchars_decode(base64_decode(($data_arr['notice_top'] == '' ? $conf['notice_top'] : $data_arr['notice_top']))) ?></textarea>
                    </div>

                    <div class="form-group mb-3" style="">
                        <label for="example-input-normal"
                               style="position: relative;bottom: 0;left: 0">首页查单公告</label>
                        <textarea class="form-control" name="notice_check" id="notice_check" rows="4"
                                  placeholder="请输入首页顶部公告内容"><?= htmlspecialchars_decode(base64_decode(($data_arr['notice_check'] == '' ? $conf['notice_check'] : $data_arr['notice_check']))) ?></textarea>
                    </div>
                    <div class="form-group mb-3" style="">
                        <label for="example-input-normal"
                               style="position: relative;bottom: 0;left: 0">全局底部公告</label>
                        <textarea class="form-control" name="notice_bottom" id="notice_bottom" rows="4"
                                  placeholder="请输入全局底部公告内容"><?= htmlspecialchars_decode(base64_decode(($data_arr['notice_bottom'] == '' ? $conf['notice_bottom'] : $data_arr['notice_bottom']))) ?></textarea>
                    </div>
                    <button type="submit" lay-submit lay-filter="configuration_save"
                            class="btn btn-block btn-xs btn-outline-success">保存设置
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>
<?php
include 'bottom.php';
?>
<link href="<?= $cdnpublic ?>summernote/0.8.12/summernote.css" rel="stylesheet">
<script src="<?= $cdnpublic ?>summernote/0.8.12/summernote.min.js"></script>
<script src="<?= $cdnpublic ?>summernote/0.8.12/lang/summernote-zh-CN.min.js"></script>
<script>
    $(document).ready(function () {
        $('#notice_top').summernote({
            lang: 'zh-CN',
            placeholder: '请输入首页顶部公告信息',
            minHeight: 200,
            callbacks: {
                onImageUpload: function (files, editor, $editable) {
                    UploadFiles(files, 'notice_top');
                }
            },
        });
        $('#notice_check').summernote({
            lang: 'zh-CN',
            placeholder: '请输入查单界面公告信息',
            minHeight: 200,
            callbacks: {
                onImageUpload: function (files, editor, $editable) {
                    UploadFiles(files, 'notice_check');
                }
            },
        });
        $('#notice_bottom').summernote({
            lang: 'zh-CN',
            placeholder: '请输入全局底部公告信息',
            minHeight: 200,
            callbacks: {
                onImageUpload: function (files, editor, $editable) {
                    UploadFiles(files, 'notice_bottom');
                }
            },
        });

        function UploadFiles(files, id) {
            var imageData = new FormData();
            $.each(files, function (key, val) {
                imageData.append("imageData" + key, val);
            });
            $.ajax({
                data: imageData,
                type: "POST",
                url: "ajax.php?act=image_content",
                cache: false,
                contentType: false,
                processData: false,
                success: function (imageUrl) {
                    if (imageUrl.code == 1) {
                        var content = '';
                        $.each(imageUrl['SrcArr'], function (key, val) {
                            $('#' + id).summernote('editor.insertImage', val['src']);
                            content += '图片：<font color=red>' + val['name'] + '</font>大小为：<font color=red>' + val['size'] + '</font><br>';
                        });
                        layer.alert(content + '<hr>Ps:图片可一次上传多张！', {title: imageUrl.msg});
                    } else layer.msg(imageUrl.msg);
                },
                error: function () {
                    layer.msg('图片上传接口异常，上传失败！');
                }
            })
        }
    });
    layui.use('form', function () {
        var form = layui.form;

        form.on('submit(configuration_save)', function (data) {
            if (data.field['type'] == 'notice') {
                data.field['notice_top'] = $('#notice_top').summernote('code');
                data.field['notice_check'] = $('#notice_check').summernote('code');
                data.field['notice_bottom'] = $('#notice_bottom').summernote('code');
            }
            layer.alert('是否要执行当前操作？', {
                icon: 3, btn: ['确定', '取消'], btn1: function (layero, index) {
                    var index = layer.msg('数据保存中,请稍后...', {icon: 16, time: 999999});
                    if (data.field['type'] == 'template') {
                        var banner = $(".banner").attr('data-img');
                        data.field['banner'] = banner;
                    }

                    $.post('ajax.php?act=configuration_save', data.field, function (res) {
                        if (res.code == 1) {
                            layer.close(index);
                            layer.alert(res.msg, {
                                btn1: function (layero, index) {
                                    location.reload();
                                }
                            });
                        } else {
                            layer.close(index);
                            layer.alert(res.msg, {
                                btn1: function (layero, index) {
                                    location.reload();
                                }
                            });
                        }
                    });
                }
            });
            return false;
        })
    });
    var template = {
        ls: function () {
            var images = $(".banner").attr('data-img');
            var content = images.split('|');
            contents = '';
            $.each(content, function (key, val) {
                img_arr = val.split('*');
                contents += '<a href="' + img_arr[1] + '" target="_blank" ><img src="' + img_arr[0] + '"  /></a>';
            });
            $(".banner").html(contents);
        },
        add: function () {
            var content = '<a  class="btn btn-xs btn-outline-success mr-2" id="upload" >上传图片到本地服务器</a><hr>' +
                '<div class="layui-form layui-form-pane">\n' +
                '                    <div class="layui-form-item">\n' +
                '                        <label class="layui-form-label">图片地址</label>\n' +
                '                        <div class="layui-input-block" pane>\n' +
                '                            <input type="text" name="image" value="" placeholder="请填写图片地址！" autocomplete="off"\n' +
                '                                   class="layui-input">\n' +
                '                        </div>\n' +
                '                    </div>' +
                '                    <div class="layui-form-item">\n' +
                '                        <label class="layui-form-label">跳转链接</label>\n' +
                '                        <div class="layui-input-block" pane>\n' +
                '                            <input type="text" name="url" value="" placeholder="请填写的跳转链接" autocomplete="off"\n' +
                '                                   class="layui-input">\n' +
                '                        </div>\n' +
                '                    </div>' +
                '</div>';
            var ix = layer.open({
                title: '快速添加首页轮播图',
                content: content,
                btn: ['插入', '取消'],
                btn1: function (layero, index) {
                    var image = $("input[name='image']").val();
                    var url = $("input[name='url']").val();
                    if (image == '' || url == '') {
                        alert('请填写完整！');
                        return false;
                    } else {
                        var images = $(".banner").attr('data-img');
                        var imas = image + '*' + url;
                        if (images == '') {
                            $(".banner").attr('data-img', imas);
                        } else {
                            $(".banner").attr('data-img', images + '|' + imas);
                        }
                        template.ls();
                        layer.close(ix);
                    }

                }, success: function (layero, index) {
                    layui.use(['upload', 'form'], function () {
                        var upload = layui.upload;
                        var uploadInst = upload.render({
                            elem: '#upload' //绑定元素
                            , url: 'ajax.php?act=image_up' //上传接口
                            , accept: 'images'
                            , acceptMime: 'image/*'
                            , exts: 'jpg|png|gif|bmp|jpeg'
                            , done: function (res, index, upload) {
                                $("input[name='image']").val(res.src);
                            }
                            , error: function () {
                                layer.msg('图片上传失败!')
                            }
                        });
                    });
                }
            });
        },
        QuickEdit: function () {
            var images = $(".banner").attr('data-img');
            var content = images.split('|');
            var content = content.join("\n");
            layer.prompt({
                formType: 2,
                value: content,
                title: '一行一条规则,[*]分割跳转链接！',
                maxlength: 99999999999,
                area: ['350px', '350px'] //自定义文本域宽高
            }, function (value, index, elem) {
                var content = value.split("\n");
                var content = content.join('|');
                $(".banner").attr('data-img', content);
                template.ls();
                layer.close(index);
            });
        }
    };
    template.ls();

    function rule() {
        layer.alert('' +
            '<span class="font-15 text-success">1、商品提成规则：</span><br>若想要赚到提成,必须让其他用户在你店铺域名内下单，购买商品！<br>并且要是购买商品的用户等级和你一样，或者比你的等级还要高，你就赚不到任何提成了<br>还有就是，如果你的商品购买价格和用户购买商品的价格一样，中间无差价，自然也就无法赚到任何提成了<br>所以只要你等级够高，提成他就越多，这里的提成赚的就是和其他用户之间购买商品的差价！' +
            <?php if($conf['usergradecost'] == 1){ ?>'<br><span class="font-15 text-success">2、下级升级提成规则：</span><br><font color=red>第一种规则</font>：在你店铺用户后台提升等级的时候，没有绑定其他上级，上级就是你，他升级花费的金额全部归你！<br><font color=red>第二种规则</font>：这个用户上级已经绑定了，并且不是你，但是他又跑到你的网站来提升等级了，这种情况下，你还是可以获得提成奖励！只不过是和他的上级一人一半对分！' +
            '<br><font color=red>第三种规则</font>：这个提升等级的用户是从主站注册的，并且没有任何上级，直接跑到你加盟站提升等级，这种情况下，他的升级提成也全部是属于你的！' +<?php } ?>
            '', {btn: false, title: false})
    }

    $.ajax({
        type: "POST",
        url: "ajax.php?act=prevent",
        dataType: "json",
        success: function (data) {
            $("#domain").html('<a href="' + data.msg + '" target="_blank">' + data.msg + '</a>');
        },
        error: function () {
            layer.alert('加载失败！');
        }
    });
</script>