<?php
if(!defined('IN_CRONLITE'))exit();
@header('Content-Type: text/html; charset=UTF-8');

$scriptpath=str_replace('\\','/',$_SERVER['SCRIPT_NAME']);
$scriptpath = substr($scriptpath, 0, strrpos($scriptpath, '/'));
$scriptpath = substr($scriptpath, 0, strrpos($scriptpath, '/'));
$siteurl = (is_https() ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$scriptpath.'/';

// 检查数据库版本
if($islogin==1 && basename($_SERVER['SCRIPT_NAME'])!='login.php' && basename($_SERVER['SCRIPT_NAME'])!='cx-update.php'){
    include 'version.config.php';
    $stmt = $DB->query("SELECT v FROM pre_config WHERE k='db_version'");
    $row = $stmt->fetch();
    if(!$row || $row['v'] < $current_db_version){
        echo '<div class="db-update-overlay" style="position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.7);z-index:99999;">
            <div style="position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background:#fff;padding:20px;border-radius:5px;text-align:center;">
                <h3>系统提示</h3>
                <p>检测到数据库不是最新版本，请立即更新！</p>
                <a href="./cx-update.php" class="btn btn-primary">点击更新数据库</a>
            </div>
        </div>';
    }
}

$admin_cdnpublic = 1;
if($admin_cdnpublic==1){
	$cdnpublic = '//lib.baomitu.com/';
}elseif($admin_cdnpublic==2){
	$cdnpublic = 'https://cdn.bootcdn.net/ajax/libs/';
}elseif($admin_cdnpublic==4){
	$cdnpublic = '//s1.pstatp.com/cdn/expire-1-M/';
}else{
	$cdnpublic = '//cdn.staticfile.org/';
}
?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <meta charset="utf-8"/>
  <meta name="renderer" content="webkit"/>
  <meta name="force-rendering" content="webkit"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <title><?php echo $title ?></title>
  <link href="<?php echo $cdnpublic?>twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet"/>
  <link href="<?php echo $cdnpublic?>font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
  <link rel="stylesheet" href="../assets/appui/css/main.css">
  <link rel="stylesheet" href="../assets/appui/css/themes.css">
  <link id="theme-link" rel="stylesheet" href="<?php echo $_COOKIE['optionThemeColor']?$_COOKIE['optionThemeColor']:'../assets/appui/css/themes/flat-2.4.css';?>">
  <script src="<?php echo $cdnpublic?>jquery/2.1.4/jquery.min.js"></script>
  <script src="<?php echo $cdnpublic?>twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
  <script src="../assets/appui/js/plugins.js"></script>
  <script src="../assets/appui/js/app2.js"></script>
  <!--[if lt IE 9]>
    <script src="<?php echo $cdnpublic?>html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="<?php echo $cdnpublic?>respond.js/1.4.2/respond.min.js"></script>
  <![endif]-->
</head>
<body>
<!-- 授权遮罩层 -->
<style>
.auth-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0,0,0,0.8) !important;
    z-index: 999999 !important;
    display: none;
}
.auth-box {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: #fff !important;
    padding: 20px !important;
    border-radius: 5px !important;
    width: 300px !important;
    text-align: center !important;
}
.auth-box h3 {
    margin-bottom: 20px !important;
    color: #333 !important;
}
.auth-box .auth-info {
    margin-bottom: 15px !important;
    color: #666 !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
}
.auth-box .auth-price {
    color: #ff6b6b !important;
    font-weight: bold !important;
    font-size: 16px !important;
}
.auth-box input {
    width: 100% !important;
    padding: 10px !important;
    margin-bottom: 15px !important;
    border: 1px solid #ddd !important;
    border-radius: 3px !important;
}
.auth-box button {
    background: #1abc9c !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 3px !important;
    cursor: pointer !important;
    margin: 0 5px !important;
}
.auth-box button:hover {
    background: #16a085 !important;
}
.auth-box .buy-btn {
    background: #ff6b6b !important;
}
.auth-box .buy-btn:hover {
    background: #ff5252 !important;
}
</style>

<div class="auth-overlay" id="authOverlay" style="display:none" oncontextmenu="return false" onselectstart="return false">
    <div class="auth-box">
        <h3>系统授权</h3>
        <div class="auth-info">
            授权价格：<span class="auth-price">10元/月</span><br>
            联系QQ：<span class="auth-contact">2495630854</span>
        </div>
        <input type="text" id="authCode" placeholder="请输入授权码" autocomplete="off">
        <button onclick="submitAuthCode()">提交授权</button>
        <button class="buy-btn" onclick="window.open('https://7t.ink')">购买授权</button>
    </div>
</div>

<script>
// 防止遮罩层被移除
setInterval(function() {
    if (!document.getElementById('authOverlay')) {
        location.reload();
    }
}, 100);

// 禁用右键菜单
document.oncontextmenu = function() {
    return false;
};

// 禁用F12
document.onkeydown = function(e) {
    if (e.keyCode === 123 || (e.ctrlKey && e.shiftKey && e.keyCode === 73)) {
        return false;
    }
};

function submitAuthCode() {
    var authCode = document.getElementById('authCode').value;
    if(!authCode) {
        alert('请输入授权码');
        return;
    }
    
    // 显示加载提示
    var loadingHtml = '<div class="loading-overlay" style="position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);z-index:10000;display:flex;justify-content:center;align-items:center;"><div style="background:#fff;padding:20px;border-radius:5px;"><i class="fa fa-spinner fa-spin"></i> 正在提交...</div></div>';
    $('body').append(loadingHtml);
    
    $.ajax({
        type: 'POST',
        url: 'cx-ajax.php?act=checkAuth',
        data: {
            domain: window.location.hostname,
            auth_key: authCode
        },
        dataType: 'json',
        success: function(data) {
            // 移除加载提示
            $('.loading-overlay').remove();
            
            if(data.code == 200) {
                // 更新缓存
                localStorage.setItem('auth_cache', JSON.stringify({
                    timestamp: new Date().getTime(),
                    data: data
                }));
                
                alert('授权成功！');
                setTimeout(function(){
                    location.reload();
                }, 1000);
            } else {
                alert(data.message || '授权失败');
            }
        },
        error: function() {
            // 移除加载提示
            $('.loading-overlay').remove();
            alert('请求失败，请重试');
        }
    });
}

// 检查授权状态并显示遮罩层
function checkAndShowAuth() {
    // 如果是登录页面,跳过授权检查
    if(window.location.pathname.indexOf('login.php') > -1) {
        return;
    }
    
    // 先从localStorage中获取缓存
    var cachedData = localStorage.getItem('auth_cache');
    var now = new Date().getTime();
    
    if (cachedData) {
        try {
            cachedData = JSON.parse(cachedData);
            // 检查缓存是否在10分钟内
            if (now - cachedData.timestamp < 600000) { // 10分钟 = 600000毫秒
                // 使用缓存数据
                if(cachedData.data.code != 200) {
                    document.getElementById('authOverlay').style.display = 'block';
                }
                return;
            }
        } catch(e) {
            console.error('缓存数据解析错误:', e);
        }
    }
    
    // 如果没有缓存或缓存已过期，则发送请求
    $.ajax({
        type: 'POST',
        url: 'cx-ajax.php?act=checkAuth',
        data: {
            domain: window.location.hostname
        },
        dataType: 'json',
        success: function(data) {
            // 保存到缓存
            localStorage.setItem('auth_cache', JSON.stringify({
                timestamp: now,
                data: data
            }));
            
            if(data.code != 200) {
                document.getElementById('authOverlay').style.display = 'block';
            }
        },
        error: function() {
            console.error('检查授权状态失败');
        }
    });
}

// 调试信息功能
function debugAuth() {
    $.ajax({
        type: 'GET',
        url: 'cx-ajax.php?act=debug&type=auth',
        dataType: 'json',
        success: function(data) {
            // 在新窗口中显示调试信息
            var debugWindow = window.open('', '_blank');
            debugWindow.document.write('<html><head><title>授权调试信息</title><style>body{font-family:monospace;white-space:pre;padding:20px;}</style></head><body>' + JSON.stringify(data, null, 2) + '</body></html>');
            debugWindow.document.close();
        },
        error: function() {
            alert('获取调试信息失败');
        }
    });
}

// 页面加载完成后检查授权
$(document).ready(function(){
    checkAndShowAuth();
    
    // 添加回车键提交功能
    $('#authCode').keypress(function(e) {
        if(e.which == 13) {
            submitAuthCode();
        }
    });
});
</script>

<?php if($islogin==1){?>
<!-- Start: Header -->
    <div id="page-wrapper">
        <div id="page-container" class="header-fixed-top sidebar-visible-lg-full enable-cookies">
<div id="sidebar-alt" tabindex="-1" aria-hidden="true">
<a href="javascript:void(0)" id="sidebar-alt-close" onclick="App.sidebar('toggle-sidebar-alt');"><i class="fa fa-times"></i></a>
<div class="slimScrollDiv" style="position: relative; overflow: hidden; width: auto; height: 888px;"><div id="sidebar-scroll-alt" style="overflow: hidden; width: auto; height: 888px;">
<div class="sidebar-content">
<div class="sidebar-section">
<style>
h4{font-family:"微软雅黑",Georgia,Serif;}
</style>
<h4 class="text-light">框架变色(New)</h4>
<br>
<ul class="sidebar-themes clearfix">
<li class="">
<a href="javascript:void(0)" class="themed-background-default" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/themes-2.2.css" data-theme-navbar="navbar-inverse" data-theme-sidebar="" data-original-title="">
<span class="section-side themed-background-dark-default"></span>
<span class="section-content"></span>
</a>
</li>
<li class="">
<a href="javascript:void(0)" class="themed-background-classy" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/classy-2.4.css" data-theme-navbar="navbar-inverse" data-theme-sidebar="" data-original-title="">
<span class="section-side themed-background-dark-classy"></span>
<span class="section-content"></span>
</a>
</li>
<li class="">
<a href="javascript:void(0)" class="themed-background-social" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/social-2.4.css" data-theme-navbar="navbar-inverse" data-theme-sidebar="" data-original-title="">
<span class="section-side themed-background-dark-social"></span>
<span class="section-content"></span>
</a>
</li>
<li class="">
<a href="javascript:void(0)" class="themed-background-flat" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/flat-2.4.css" data-theme-navbar="navbar-inverse" data-theme-sidebar="" data-original-title="">
<span class="section-side themed-background-dark-flat"></span>
<span class="section-content"></span>
</a>
</li>
<li class="">
<a href="javascript:void(0)" class="themed-background-amethyst" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/amethyst-2.4.css" data-theme-navbar="navbar-inverse" data-theme-sidebar="" data-original-title="">
<span class="section-side themed-background-dark-amethyst"></span>
<span class="section-content"></span>
</a>
</li>
<li class="">
<a href="javascript:void(0)" class="themed-background-creme" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/creme-2.4.css" data-theme-navbar="navbar-inverse" data-theme-sidebar="" data-original-title="">
<span class="section-side themed-background-dark-creme"></span>
<span class="section-content"></span>
</a>
</li>
<li class="">
<a href="javascript:void(0)" class="themed-background-passion" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/passion-2.4.css" data-theme-navbar="navbar-inverse" data-theme-sidebar="" data-original-title="">
<span class="section-side themed-background-dark-passion"></span>
<span class="section-content"></span>
</a>
<br>
</li>
<li>
<a href="javascript:void(0)" class="themed-background-classy" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/classy-2.4.css" data-theme-navbar="navbar-inverse" data-theme-sidebar="sidebar-light" data-original-title="">
<span class="section-side"></span>
<span class="section-content"></span>
</a>
</li>
<li>
<a href="javascript:void(0)" class="themed-background-social" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/social-2.4.css" data-theme-navbar="navbar-inverse" data-theme-sidebar="sidebar-light" data-original-title="">
<span class="section-side"></span>
<span class="section-content"></span>
</a>
</li>
<li>
<a href="javascript:void(0)" class="themed-background-flat" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/flat-2.4.css" data-theme-navbar="navbar-inverse" data-theme-sidebar="sidebar-light" data-original-title="">
<span class="section-side"></span>
<span class="section-content"></span>
</a>
</li>
<li>
<a href="javascript:void(0)" class="themed-background-amethyst" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/amethyst-2.4.css" data-theme-navbar="navbar-inverse" data-theme-sidebar="sidebar-light" data-original-title="">
<span class="section-side"></span>
<span class="section-content"></span>
</a>
</li>
<li>
<a href="javascript:void(0)" class="themed-background-creme" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/creme-2.4.css" data-theme-navbar="navbar-inverse" data-theme-sidebar="sidebar-light" data-original-title="">
<span class="section-side"></span>
<span class="section-content"></span>
</a>
</li>
<li>
<a href="javascript:void(0)" class="themed-background-passion" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/passion-2.4.css" data-theme-navbar="navbar-inverse" data-theme-sidebar="sidebar-light" data-original-title="">
<span class="section-side"></span>
<span class="section-content"></span>
</a>
</li>

<li class="">
<a href="javascript:void(0)" class="themed-background-classy" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/classy-2.4.css" data-theme-navbar="navbar-default" data-theme-sidebar="" data-original-title="">
<span class="section-header"></span>
<span class="section-side themed-background-dark-classy"></span>
<span class="section-content"></span>
</a>
<br>
</li>
<li class="">
<a href="javascript:void(0)" class="themed-background-social" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/social-2.4.css" data-theme-navbar="navbar-default" data-theme-sidebar="" data-original-title="">
<span class="section-header"></span>
<span class="section-side themed-background-dark-social"></span>
<span class="section-content"></span>
</a>
</li>
<li>
<a href="javascript:void(0)" class="themed-background-flat" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/flat-2.4.css" data-theme-navbar="navbar-default" data-theme-sidebar="" data-original-title="">
<span class="section-header"></span>
<span class="section-side themed-background-dark-flat"></span>
<span class="section-content"></span>
</a>
</li>
<li class="">
<a href="javascript:void(0)" class="themed-background-amethyst" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/amethyst-2.4.css" data-theme-navbar="navbar-default" data-theme-sidebar="" data-original-title="">
<span class="section-header"></span>
<span class="section-side themed-background-dark-amethyst"></span>
<span class="section-content"></span>
</a>
</li>
<li class="">
<a href="javascript:void(0)" class="themed-background-creme" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/creme-2.4.css" data-theme-navbar="navbar-default" data-theme-sidebar="" data-original-title="">
<span class="section-header"></span>
<span class="section-side themed-background-dark-creme"></span>
<span class="section-content"></span>
</a>
</li>
<li class="">
<a href="javascript:void(0)" class="themed-background-passion" data-toggle="tooltip" title="" data-theme="../assets/appui/css/themes/passion-2.4.css" data-theme-navbar="navbar-default" data-theme-sidebar="" data-original-title="">
<span class="section-header"></span>
<span class="section-side themed-background-dark-passion"></span>
<span class="section-content"></span>
</a>
</li>
</ul>
</div>
</div>
</div><div class="slimScrollBar" style="background: rgb(187, 187, 187); width: 3px; position: absolute; top: 0px; opacity: 0.4; display: none; border-radius: 7px; z-index: 99; right: 1px; height: 888px;"></div><div class="slimScrollRail" style="width: 3px; height: 100%; position: absolute; top: 0px; display: none; border-radius: 7px; background: rgb(51, 51, 51); opacity: 1; z-index: 90; right: 1px;"></div></div>
</div>
            <div id="sidebar">
                <div id="sidebar-brand" class="themed-background">
				<a href="./" class="sidebar-title">
                    <i class="fa fa-cube"></i> <span class="sidebar-nav-mini-hide">管理后台</span>
                </a>
				</div>
                <div id="sidebar-scroll">
                    <div class="sidebar-content">
                        <ul class="sidebar-nav">

<li>
	<a class="<?php echo basename($_SERVER['SCRIPT_NAME'])=='index.php'?'active':''?>" href="./">
		<i class="fa fa-home sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">系统概览</span>
	</a>
</li>

<li>
	<a class="<?php echo basename($_SERVER['SCRIPT_NAME'])=='dashboard.php'?'active':''?>" href="./dashboard.php">
		<i class="fa fa-dashboard sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">数据面板</span>
	</a>
</li>


<li>
	<a class="<?php echo checkIfActive('list,export')?>" href="./list.php">
		<i class="fa fa-list sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">订单管理</span>
	</a>
</li>

<li class="<?php echo checkIfActive('classlist,shoplist,shopedit,price,shoprank,cardlist,toollogs,parentclass')?>">
	<a href="javascript:void(0)" class="sidebar-nav-menu"><i class="fa fa-chevron-left sidebar-nav-indicator sidebar-nav-mini-hide"></i><i class="fa fa-shopping-cart sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">商品管理</span></a>
	<ul>
<li>
	<a class="<?php echo checkIfActive("parentclass") ?>" href="./parentclass.php">
		一级分类
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("classlist") ?>" href="./classlist.php">
		二级分类
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("shoplist,shopedit,shoprank") ?>" href="./shoplist.php">
		商品列表
	</a>
</li>

<li>
	<a class="<?php echo checkIfActive("price") ?>" href="./price.php">
		加价模板
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("toollogs") ?>" href="./toollogs.php">
		上架日志
	</a>
</li>
<?php if($conf['iskami']==1){?><li>
	<a class="<?php echo checkIfActive("cardlist") ?>" href="./cardlist.php">
		兑换卡密
	</a>
</li><?php }?>
	</ul>
</li>

<li class="<?php echo checkIfActive('fakalist,fakakms,mailcon')?>">
	<a href="javascript:void(0)" class="sidebar-nav-menu"><i class="fa fa-chevron-left sidebar-nav-indicator sidebar-nav-mini-hide"></i><i class="fa fa-th sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">发卡管理</span></a>
	<ul>
<li>
	<a class="<?php echo checkIfActive("fakalist") ?>" href="./fakalist.php">
		库存管理
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("fakakms") ?>" href="./fakakms.php?my=add">
		添加卡密
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("mailcon") ?>" href="./set.php?mod=mailcon">
		发信模板
	</a>
</li>
	</ul>
</li>
<li class="<?php echo checkIfActive('sitelist,mj,tixian,record,rank,userlist,message,workorder,siteprice,kmlist')?>">
	<a href="javascript:void(0)" class="sidebar-nav-menu"><i class="fa fa-chevron-left sidebar-nav-indicator sidebar-nav-mini-hide"></i><i class="fa fa-sitemap sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">分站管理</span></a>
	<ul>
<li>
	<a class="<?php echo checkIfActive("1,siteprice") ?>" href="./sitelist.php?mod=1">
		分站列表
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("mj") ?>" href="./sitelist.php?mod=mj">
		密价用户
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("workorder") ?>" href="./workorder.php">
		工单列表
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("userlist") ?>" href="./userlist.php">
		用户列表
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("record") ?>" href="./record.php">
		收支明细
	</a>
</li>
<?php if($conf['fenzhan_tixian']==1){?>
<li>
	<a class="<?php echo checkIfActive("tixian") ?>" href="./tixian.php">
		余额提现
	</a>
</li>
<?php }?>
<li>
	<a class="<?php echo checkIfActive("rank") ?>" href="./rank.php">
		分站排行
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("message") ?>" href="./message.php">
		站内通知
	</a>
</li>
	</ul>
</li>

<li>
	<a class="<?php echo checkIfActive('article,rewrite')?>" href="./article.php">
		<i class="fa fa-book sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">文章管理</span>
	</a>
</li>

<li class="<?php echo checkIfActive('shequlist,pricejk,log,clone,cloneset,shequ,orderjk,batchgoods,cx-synchronization')?>">
	<a href="javascript:void(0)" class="sidebar-nav-menu"><i class="fa fa-chevron-left sidebar-nav-indicator sidebar-nav-mini-hide"></i><i class="fa fa-cubes sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">对接设置</span></a>
	<ul>
<li>
	<a class="<?php echo checkIfActive("shequlist") ?>" href="./shequlist.php">
		对接站点管理
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("pricejk") ?>" href="./pricejk.php">
		价格监控
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("orderjk") ?>" href="./orderjk.php">
		订单状态监控
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("log") ?>" href="./log.php">
		对接日志
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("clone,cloneset") ?>" href="./clone.php">
		克隆站点
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("batchgoods") ?>" href="./batchgoods.php">
		批量对接商品
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("cx-synchronization") ?>" href="./cx-synchronization.php">
		自动同步设置
	</a>
</li>
	</ul>
</li>

<li class="<?php echo checkIfActive('site,gonggao,mail,pay,template,template2,upimg,upbgimg,clean,cleanbom,defend,proxy,copygg,mailtest,epay,captcha,fenzhan,cron,oauth,update')?>">
	<a href="javascript:void(0)" class="sidebar-nav-menu"><i class="fa fa-chevron-left sidebar-nav-indicator sidebar-nav-mini-hide"></i><i class="fa fa-cog sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">系统设置</span></a>
	<ul>
<li>
	<a class="<?php echo checkIfActive("site") ?>" href="./set.php?mod=site">
		网站信息配置
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("fenzhan") ?>" href="./set.php?mod=fenzhan">
		分站相关配置
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("gonggao,copygg") ?>" href="./set.php?mod=gonggao">
		网站公告配置
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("mail") ?>" href="./set.php?mod=mail">
		邮箱与提醒配置
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("pay,epay") ?>" href="./set.php?mod=pay">
		支付接口配置
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("template,template2") ?>" href="./set.php?mod=template">
		首页模板设置
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("oauth") ?>" href="./set.php?mod=oauth">
		快捷登录配置
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("captcha") ?>" href="./set.php?mod=captcha">
		验证与IP配置
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("upimg,upbgimg") ?>" href="./set.php?mod=upimg">
		Logo与背景设置
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("cron") ?>" href="./set.php?mod=cron">
		计划任务设置
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("clean") ?>" href="./clean.php">
		系统数据清理
    </a>
</li>
	</ul>
</li>



<li class="<?php echo checkIfActive('qiandao,invite,dwz,choujiang,invitelog,datamove,appCreate')?>">
	<a href="javascript:void(0)" class="sidebar-nav-menu"><i class="fa fa-chevron-left sidebar-nav-indicator sidebar-nav-mini-hide"></i><i class="fa fa-cogs sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">其它组件</span></a>
	<ul>
<li>
	<a class="<?php echo checkIfActive("qiandao") ?>" href="./set.php?mod=qiandao">
		每日签到设置
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("invite,invitelog") ?>" href="./set.php?mod=invite">
		推广链接设置
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("choujiang") ?>" href="./choujiang.php">
		抽奖商品设置
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("dwz") ?>" href="./set.php?mod=dwz">
		防红接口设置
	</a>
</li>

	</ul>
</li>

<li>
	<a class="<?php echo checkIfActive('account')?>" href="./account.php">
		<i class="fa fa-user-circle-o sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">员工管理</span>
	</a>
</li>
<li class="<?php echo checkIfActive('domain_landing,wall_guide')?>">
	<a href="javascript:void(0)" class="sidebar-nav-menu"><i class="fa fa-chevron-left sidebar-nav-indicator sidebar-nav-mini-hide"></i><i class="fa fa-cog sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">附加设置</span></a>
	<ul>
<li>
	<a class="<?php echo checkIfActive("domain_landing") ?>" href="./set.php?mod=domain_landing">
		域名落地页
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("wall_guide") ?>" href="./set.php?mod=wall_guide">
		防墙引导页
	</a>
</li>
	</ul>
</li>
<?php
                            $stockrows = $DB->getAll('SELECT `tid` FROM `pre_tools` WHERE `active` = 1 AND `close` = 0 AND `is_curl` = 4');
                            $count = 0;
                            foreach ($stockrows as $stockrow) {

                                $stockTotal = $DB->getColumn('SELECT count(`tid`) FROM `pre_faka` WHERE `orderid` = 0 AND `tid` = :tid', [
                                    ':tid' => $stockrow['tid'],
                                ]);

                                if ($stockTotal < 1) {
                                    $count++;
                                }
                            }
                            $count2 = $DB->getColumn("SELECT count(*) from pre_workorder WHERE status=0 or status=1");
                            $count3 = $DB->getColumn("SELECT count(*) from pre_tools where goods_sid != 0 and audit_status=0");
                            ?>
                            <li class="<?php echo checkIfActive('suplist,suptixian,suprecord,supshoplist,sup,supshoplist2')?>">
                                <a href="javascript:void(0)" class="sidebar-nav-menu"><i class="fa fa-chevron-left sidebar-nav-indicator sidebar-nav-mini-hide"></i><i class="fa fa-sitemap sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">供货管理</span> <span class="label label-danger"><?php echo $count3?></span></a>
                                <ul>
                                    <li>
                                        <a class="<?php echo checkIfActive("sup") ?>" href="./set.php?mod=sup">
                                            供货商相关配置
                                        </a>
                                    </li>
                                    <li>
                                        <a class="<?php echo checkIfActive("suplist,siteprice") ?>" href="./suplist.php">
                                            供货商列表
                                        </a>
                                    </li>
                                    <li>
                                        <a class="<?php echo checkIfActive("supshoplist2") ?>" href="./supshoplist2.php">
                                            商品列表
                                        </a>
                                    </li>
                                    <li>
                                        <a class="<?php echo checkIfActive("supshoplist") ?>" href="./supshoplist.php">
                                            审核商品 <span class="label label-danger"><?php echo $count3?></span>
                                        </a>
                                    </li>
                                    <li>
                                        <a class="<?php echo checkIfActive("suprecord") ?>" href="./suprecord.php">
                                            收支明细
                                        </a>
                                    </li>

                                    <li>
                                        <a class="<?php echo checkIfActive("suptixian") ?>" href="./suptixian.php">
                                            余额提现
                                        </a>
                                    </li>

                                    <!--                                    <li>-->
                                    <!--                                        <a class="--><?php //echo checkIfActive("workorder") ?><!--" href="./workorder.php">-->
                                    <!--                                            工单列表-->
                                    <!--                                        </a>-->
                                    <!--                                    </li>-->
                                    <!--                                    <li>-->
                                    <!--                                        <a class="--><?php //echo checkIfActive("message") ?><!--" href="./message.php">-->
                                    <!--                                            站内通知-->
                                    <!--                                        </a>-->
                                    <!--                                    </li>-->
                                </ul>
                            </li>
<li>
	<a class="<?php echo checkIfActive('stock_notice')?>" href="./stock_notice.php">
		<i class="fa fa-bullhorn sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">库存告急</span>
        <span class="label label-danger"><?php echo $count?></span>
	</a>
</li>
<li>
	<a class="<?php echo checkIfActive("workorder2") ?>" href="./workorder2.php">
		<i class="fa fa-bullhorn sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">网盘失效</span>
        <span class="label label-danger"><?php echo $count2?></span>
	</a>
</li>
                        </ul>
                    </div>
                </div>
                <div id="sidebar-extra-info" class="sidebar-content sidebar-nav-mini-hide">
<div class="progress progress-mini push-bit">
<div class="progress-bar progress-bar-primary" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"></div>
</div>
<div class="text-center">
<small><span id="year-copy">2024</span> © <a href="#"><?php echo $conf['sitename']?></a></small>
</div>
</div>
            </div>
            <div id="main-container">
                <header class="navbar navbar-inverse navbar-fixed-top">
 
<ul class="nav navbar-nav-custom">
 
<li>
<a href="javascript:void(0)" onclick="App.sidebar('toggle-sidebar');this.blur();">
<i class="fa fa-ellipsis-v fa-fw animation-fadeInRight" id="sidebar-toggle-mini"></i>
<i class="fa fa-bars fa-fw animation-fadeInRight" id="sidebar-toggle-full"></i>菜单
</a>
</li>
<li>
<a href="javascript:void(0)" onclick="javascript:history.go(-1);">
<i class="fa fa-reply fa-fw animation-fadeInRight"></i> 返回
</a>
</li>
 
</ul>
 
 
<ul class="nav navbar-nav-custom pull-right">
<li>
<a href="javascript:void(0)" onclick="App.sidebar('toggle-sidebar-alt');this.blur();">
<i class="fa fa-wrench sidebar-nav-icon"></i>
</a>
</li>
<li class="dropdown">
<a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">
<img src="<?php echo ($conf['kfqq'])?'//q2.qlogo.cn/headimg_dl?bs=qq&dst_uin='.$conf['kfqq'].'&src_uin='.$conf['kfqq'].'&fid='.$conf['kfqq'].'&spec=100&url_enc=0&referer=bu_interface&term_type=PC':'../assets/img/user.png'?>" alt="avatar">
</a>
<ul class="dropdown-menu dropdown-menu-right">
<li class="dropdown-header text-center">
<strong>管理员用户</strong>
</li>
<li>
<a href="set.php?mod=bind">
<i class="fa fa-qrcode fa-fw pull-right"></i>
扫码登录
</a>
</li>
</li>
<li>
<a href="set.php?mod=account">
<i class="fa fa-pencil-square fa-fw pull-right"></i>
密码修改
</a>
</li>
<li>
<a href="../">
<i class="fa fa-home fa-fw pull-right"></i>
网站首页
</a>
</li>
<li class="divider">
</li>
<li>
<li>
<a href="login.php?logout">
<i class="fa fa-power-off fa-fw pull-right"></i>
退出登录
</a>
</li>
</ul>
</li>
</ul>
</header>
<div id="page-content">
		<div id="myDiv"></div>
			<div class="main pjaxmain">
				<div class="content-header">
                        <div class="row">
                            <div class="col-xs-12">
                                <div class="header-section">
                                    <h1><?php echo $title ?></h1>
                                </div>
                            </div>
                        </div>
				</div>
<div class="row">
<?php }?>
