hxp
2024-12-16 d9f0fa4ad9e75d6944db5c381a5a0b6efee69423
10162 后台优化(增加充值分组统计)
2个文件已修改
1个文件已添加
149 ■■■■■ 已修改文件
Account/User.php 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
index.php 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
serverinfo/payovergroup.php 146 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Account/User.php
@@ -41,6 +41,7 @@
                    Permission::P_BugReport => array("Name" => \Lang\gettext("Bug反馈")),
                    Permission::P_Serverview => array("Name" => \Lang\gettext("本服总览")),
                    Permission::P_PayOverview => array("Name" => \Lang\gettext("充值总览")),
                    Permission::P_PayOvergroup => array("Name" => \Lang\gettext("充值分组")),
                    Permission::P_PayOrder => array("Name" => \Lang\gettext("充值订单")),
                    Permission::P_PayRank => array("Name" => \Lang\gettext("充值排行")),
                    Permission::P_CTGReportAll => array("Name" => \Lang\gettext("充值分析")),
@@ -229,6 +230,7 @@
    const P_BugReport = "P_BugReport";
    const P_Serverview = "P_Serverview";
    const P_PayOverview = "P_PayOverview";
    const P_PayOvergroup = "P_PayOvergroup";
    const P_PayOrder = "P_PayOrder";
    const P_PayRank = "P_PayRank";
    const P_CTGReportAll = "P_CTGReportAll";
index.php
@@ -55,6 +55,7 @@
        array(\User\Permission::P_BugReport, "serverinfo/BugReportMain.php", \Lang\gettext("Bug反馈")),
        array(\User\Permission::P_Serverview, "serverinfo/serverview.php", \Lang\gettext("本服总览")),
        array(\User\Permission::P_PayOverview, "serverinfo/payoverview.php", \Lang\gettext("充值总览")),
        array(\User\Permission::P_PayOvergroup, "serverinfo/payovergroup.php", \Lang\gettext("充值分组")),
        array(\User\Permission::P_PayOrder, "serverinfo/payorderlist.php", \Lang\gettext("充值订单")),
        array(\User\Permission::P_PayRank, "serverinfo/payrank.php", \Lang\gettext("充值排行")),
        array(\User\Permission::P_CTGReportAll, "serverinfo/ctgreportall.php", \Lang\gettext("充值分析")),
serverinfo/payovergroup.php
New file
@@ -0,0 +1,146 @@
<?php
include_once "/Common/Logging.php";
include_once "/Account/User.php";
include_once "/db/DBOper.php";
include_once "/db/DataMgr.php";
include_once "/language/lang.php";
\Logging\CreateLogging("payovergroup.php");
$Permission = \User\Permission::P_PayOverview;
$spid = $_SESSION['spid'];
$UserAccount = $_SESSION['UserAccount'];
$user = new \User\User($UserAccount);
if (!$user->HavePermission($Permission)) {
    exit;
}
CommFunc\GetConfig("ServerInfo", "CoupontypeGroup", $CoupontypeGroup);
$CoupontypeGroup = json_decode($CoupontypeGroup, true);
if (!isset($CoupontypeGroup)) {
    echo "分组专用,没有配置分组信息";
    exit;
}
\CommFunc\GetConfig("ServerInfo", "SpecialServerIDStart", $SpecialServerIDStart);
$SpecialServerIDStart = intval($SpecialServerIDStart);
if (!$SpecialServerIDStart || $SpecialServerIDStart <= 0) {
    echo "特殊公会区服专用,未配置SpecialServerIDStart";
    exit;
}
$startDate = array_key_exists("startDate", $_POST) ? $_POST["startDate"] : \CommFunc\CalcToStrDateTime("-7 days", "Y-m-d");
$endDate = array_key_exists("endDate", $_POST) ? $_POST["endDate"] : date("Y-m-d");
// 只显示成功的订单; 1-成功;2-失败
$match = array(
    "Channel" => $spid, "State" => 1, "ServerID" => array('$gte' => $SpecialServerIDStart),
    "PayTime" => array('$gte' => $startDate . " 00:00:00", '$lte' => $endDate . " 23:59:59")
);
$ret = \DBOper\Aggregate("PayOrder", array(
    array(
        '$match' => $match,
    ),
    array(
        '$group' => array(
            '_id' => array('ServerID' => '$ServerID', 'AccountID' => '$AccountID'),
            'total' => array('$sum' => '$OrderAmount'),
        ),
    ),
), $retInfo);
$payGroupInfo = array();
if (isset($retInfo)) {
    foreach ($retInfo as $info) {
        $_idInfo = $info["_id"];
        $AccountID = $_idInfo["AccountID"];
        $ServerID = $_idInfo["ServerID"];
        $accountPayTotal = $info["total"];
        $Coupontype = \DataMgr\GetCoupontypeGroup($spid, $AccountID, $ServerID);
        $GroupName = array_key_exists($Coupontype, $CoupontypeGroup) ? $CoupontypeGroup[$Coupontype] : "";
        if (!$payGroupInfo[$GroupName]) {
            $payGroupInfo[$GroupName] = array();
        }
        $groupInfo = $payGroupInfo[$GroupName];
        $groupInfo["payTotal"] = ($groupInfo["payTotal"] ? $groupInfo["payTotal"] : 0) + $accountPayTotal;
        $payGroupInfo[$GroupName] = $groupInfo;
    }
}
//显示表格字段配置 key-参数名,value-说明
$tableArray = array(
    "GroupName" => array(\Lang\gettext("分组"), "10%", "center"),
    "payTotal" => array(\Lang\gettext("总充值"), "10%", "center"),
);
?>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title><?php echo \Lang\gettext("充值分组"); ?></title>
    <link rel="stylesheet" type="text/css" href="/css/table.css">
    <link rel="stylesheet" type="text/css" href="/css/button.css">
</head>
<body>
    <center>
        <p><b><?php echo \Lang\gettext("充值分组"); ?></b></P>
    </center>
    <hr />
    <form method="post">
        <?php echo \Lang\gettext("查询时间"); ?>:
        <input type="text" name="startDate" id="startDate" onclick="new Calendar().show(this);" readonly value="<?php echo $startDate; ?>" size="8" />
        ~
        <input type="text" name="endDate" id="endDate" onclick="new Calendar().show(this);" readonly value="<?php echo $endDate; ?>" size="8" />
        <input type="submit" name="submit" value="<?php echo \Lang\gettext("查询"); ?>" class="button green medium" />
        <hr />
    </form>
    <table width="50%">
        <?php
        if ($payGroupInfo) {
            echo "<thead><tr>";
            foreach ($tableArray as $value) {
                echo "<th width=\"" . $value[1] . "\">" . $value[0] . "</td>";
            }
            echo "</tr></thead>";
        } else {
            echo \Lang\gettext("暂无数据"), "<br/>";
        }
        $Num = $skip;
        $roleInfoArray = array();
        foreach ($payGroupInfo as $GroupName => $info) {
            $Num += 1;
            echo "<tr class='trc'>";
            foreach ($tableArray as $key => $value) {
                $tdContent = $info[$key];
                if ($key == "Num") {
                    $tdContent = $Num;
                } elseif ($key == "GroupName") {
                    $tdContent = $GroupName;
                } elseif ($key == "payTotal") {
                    $tdContent = round($tdContent, 2);
                }
                echo "<td align='" . $value[2] . "' style=\"display:table-cell; vertical-align:middle\">";
                echo "<div id='" . $key . "_" . $Num . "'>" . $tdContent . "</div>";
                echo "</td>";
            }
            echo "</tr>";
        }
        ?>
    </table>
</body>
<script type='text/javascript' src='/language/gettext.js'></script>
<script type='text/javascript' src="/js/calendar.js"></script>
<script type='text/javascript' src="/js/common.js"></script>
<script type="text/javascript">
</script>
</html>