<?php
/**
 * 多功能面板
 */
$title = '网站维护面板';
include "header.php";

?>
<div class="row">
    <div class="col-xl-12">
        <div class="card">
            <div class="card-body">
                <div class="row">
                    <div class="col-md-12">
                        <h3 class="mb-3 header-title text-success"><?= $title ?></h3>
                        <p class="text-muted font-14">此界面的多个功能按钮可以更好的协助您使用本程序！<span
                                    class="text-danger">数据无价，请谨慎操作！</span></p>
                        <div class="button-list">
                            <button type="button" onclick="maintain.ajax(this.innerHTML,1)"
                                    class="btn btn-outline-primary btn-rounded">版本升级数据遗漏检测(升级后异常点这个)
                            </button>
                            <button type="button" onclick="maintain.ajax(this.innerHTML,2)"
                                    class="btn btn-outline-secondary btn-rounded">整站数据库异常检测(杂七杂八的异常点这个)
                            </button>
                            <button type="button" onclick="maintain.ajax(this.innerHTML,3)"
                                    class="btn btn-outline-success btn-rounded">清除所有商品
                            </button>
                            <button type="button" onclick="maintain.ajax(this.innerHTML,4)"
                                    class="btn btn-outline-warning btn-rounded">清除所有订单
                            </button>
                            <button type="button" onclick="maintain.ajax(this.innerHTML,5)"
                                    class="btn btn-outline-info btn-rounded">清除所有商品分类(清空商品)
                            </button>
                            <button type="button" onclick="maintain.ajax(this.innerHTML,6)"
                                    class="btn btn-outline-dark btn-rounded">清除所有交易记录
                            </button>
                            <button type="button" onclick="maintain.ajax(this.innerHTML,7)"
                                    class="btn btn-outline-success btn-rounded">清除所有用户日志
                            </button>
                            <button type="button" onclick="maintain.ajax(this.innerHTML,8)"
                                    class="btn btn-outline-warning btn-rounded">清除30天前的订单
                            </button>
                            <button type="button" onclick="maintain.ajax(this.innerHTML,9)"
                                    class="btn btn-outline-info btn-rounded">清除所有用户信息
                            </button>
                            <button type="button" onclick="maintain.ajax(this.innerHTML,10)"
                                    class="btn btn-outline-secondary btn-rounded">清除今日所有商品购买限制（库存恢复）
                            </button>
                            <button type="button" onclick="maintain.ajax(this.innerHTML,11)"
                                    class="btn btn-outline-danger btn-rounded">重新开始(清空所有旧数据,变成新站)
                            </button>

                            <button type="button" onclick="maintain.ajax(this.innerHTML,12)"
                                    class="btn btn-outline-primary btn-rounded">清空所有网站用户积分
                            </button>
                            <button type="button" onclick="maintain.ajax(this.innerHTML,13)"
                                    class="btn btn-outline-warning btn-rounded">清空所有网站用户余额
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<?php include "bottom.php"; ?>

<script>
    var maintain = {
        ajax: function (t, i) {
            layer.alert('是否要执行' + t + '？', {
                icon: 3, btn: ['确定', '取消'], btn1: function (layero, index) {
                    var index = layer.msg('执行中,请稍后...', {icon: 16, time: 999999});
                    $.post('ajax.php?act=maintain', {id: i}, function (res) {
                        if (res.code == 1) {
                            layer.close(index);
                            layer.alert(res.msg, {
                                title: '执行结果如下',
                                btn1: function (layero, index) {
                                    location.reload();
                                }
                            });
                        } else {
                            layer.close(index);
                            layer.alert(res.msg, {
                                btn1: function (layero, index) {
                                    location.reload();
                                }
                            });
                        }
                    });
                }
            });
        }
    }
</script>


