hxp
2025-06-04 f4a514d5ac952110da846636ecbb9de951eaf3d2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<?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("payorderlist.php");
$Permission = \User\Permission::P_PayOrder;
 
$spid = $_SESSION['spid'];
$UserAccount = $_SESSION['UserAccount'];
$user = new \User\User($UserAccount);
if (!$user->HavePermission($Permission)) {
    exit;
}
$server_id = $_SESSION['server_id'];
 
$isSpecialAccount = False;
\CommFunc\GetConfig("ServerInfo", "SpecialAccountList", $SpecialAccountList);
$SpecialAccountList = explode(",", $SpecialAccountList);
// 特殊账号,只能看本服
if (in_array($UserAccount, $SpecialAccountList)) {
    $isSpecialAccount = True;
}
 
$onlyServerID = "on";
if (array_key_exists("search", $_POST)) {
    $onlyServerID = $_POST["onlyServerID"];
}
$queryAccID = $_POST["AccID"];
$queryOrderID = $_POST["OrderID"];
$queryOrderIDSDK = $_POST["OrderIDSDK"];
 
$find = array("Channel" => $spid);
if ($onlyServerID == 'on' || $isSpecialAccount) {
    $serversCfg = $user->GetServersCfg($spid);
    if (array_key_exists($server_id, $serversCfg)) {
        $find["ServerID"] = intval($serversCfg[$server_id]["ServerID"]);
    }
}
if ($queryAccID) {
    $accIDParts = explode("@", $queryAccID);
    $find["AccountID"] = implode("@", array_slice($accIDParts, 0, count($accIDParts) - 2));
}
if ($queryOrderID) {
    $find["OrderID"] = $queryOrderID;
}
if ($queryOrderIDSDK) {
    $find["OrderIDSDK"] = $queryOrderIDSDK;
}
$find["State"] = array('$gte' => 1); // 只显示有结果的订单; 1-成功;2-失败
 
$limitDefault = 25;
$limit = array_key_exists("limit", $_COOKIE) ? intval($_COOKIE["limit"]) : $limitDefault; // 单页条数
$page = 1;
if (array_key_exists("limit", $_POST) && intval($_POST["limit"]) > 0) {
    $limit = intval($_POST["limit"]);
}
if (array_key_exists("topage", $_POST) && intval($_POST["topage"]) > 1) {
    $page = intval($_POST["topage"]);
} else if (array_key_exists("page", $_POST) && intval($_POST["page"]) > 1) {
    $page = intval($_POST["page"]);
}
$skip = ($page - 1) * $limit;
\DBOper\Find("PayOrder", $find, $orderArray, null, array("Createtime" => -1), $limit, $skip);
$totalCount = count($orderArray);
if ($totalCount >= $limit || $page > 1) {
    $totalCount = \DBOper\Count("PayOrder", $find);
}
 
// echo "_POST:", json_encode($_POST), "<br/>";
// echo "find:", json_encode($find), "<br/>";
 
//显示表格字段配置 key-参数名,value-说明
$tableArray = array(
    "Num" => array(\Lang\gettext("编号"), "3%", "center"),
    "AccountGroup" => array(\Lang\gettext("分组"), "3%", "center"),
    "PlayerName" => array(\Lang\gettext("玩家名"), "5%", "center"),
    "AccountID" => array(\Lang\gettext("游戏账号"), "14%", "center"),
    "OrderInfo" => array(\Lang\gettext("商品编号"), "8%", "center"),
    "OrderAmount" => array(\Lang\gettext("支付金额"), "5%", "center"),
    "OriginalAmount" => array(\Lang\gettext("下单金额"), "5%", "center"),
    "OrderID" => array(\Lang\gettext("订单ID"), "13%", "center"),
    "OrderIDSDK" => array(\Lang\gettext("SDK订单ID"), "13%", "center"),
    "PayTime" => array(\Lang\gettext("支付时间"), "11%", "center"),
    "Createtime" => array(\Lang\gettext("订单时间"), "11%", "center"),
    "State" => array(\Lang\gettext("状态"), "3%", "center"),
    "" => array(\Lang\gettext("操作"), "3", "center"),
);
 
// 保存cookie
setcookie("limit", $limit);
 
CommFunc\GetConfig("ServerInfo", "CoupontypeGroup", $CoupontypeGroup);
$CoupontypeGroup = json_decode($CoupontypeGroup, true);
if (!isset($CoupontypeGroup)) {
    unset($tableArray['AccountGroup']);
    $tableArray['State'][1] = "5%";
}
 
?>
 
<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 id="payorderlist" action="payorderlist.php" method="post">
        账号: <input type="input" name="AccID" id="AccID" value="<?php echo $queryAccID ?>" />
        订单ID: <input type="input" name="OrderID" id="OrderID" value="<?php echo $queryOrderID ?>" />
        SDK订单ID: <input type="input" name="OrderIDSDK" id="OrderIDSDK" value="<?php echo $queryOrderIDSDK ?>" />
        <?php
        if (!$isSpecialAccount) {
            // 仅显示本服
            echo "&nbsp;&nbsp;";
            echo '<input type="checkbox" name="onlyServerID" id="onlyServerID" ' . ($onlyServerID == "on" ? "checked" : "") . ' />' . \Lang\gettext("仅显示本服");
        }
        ?>
        &nbsp;&nbsp;<input type="submit" name="submit" value="<?php echo \Lang\gettext("搜索"); ?>" class="button green medium" />
        <hr />
        <table width="100%">
            <?php
            if ($orderArray) {
                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 ($orderArray as $info) {
                $Num += 1;
                echo "<tr class='trc'>";
                $OrderID = $info["OrderID"];
                foreach ($tableArray as $key => $value) {
                    if (!$key) {
                        echo "<td align='center'>";
                        $OrderIDSDK = $info["OrderIDSDK"];
                        $PayTime = $info["PayTime"];
                        echo "<input type=\"button\" value=\"" . \Lang\gettext("补单") . "\" onclick=\"PayOrderRepeat('" . $Num . "', '" . $OrderID . "', '" . $OrderIDSDK . "', '" . $PayTime . "')\" />";
                        echo "</td>";
                        continue;
                    }
 
                    $tdContent = $info[$key];
                    if ($key == "Num") {
                        $tdContent = $Num;
                    } elseif ($key == "AccountID") {
                        $tdContent = $info["AccountID"] . "@" .  $info["Channel"] . "@s" . $info["ServerID"];
                    } elseif ($key == "PlayerName") {
                        $accountKey = $info["AccountID"] . "@" .  $info["Channel"];
                        $find = array("Channel" => $info["Channel"], "AccountID" => $info["AccountID"]);
                        if (!$roleInfoArray[$accountKey] && \DBOper\FindOne("GameRoles", $find, $findData) && isset($findData)) {
                            $roleInfoArray[$accountKey] = $findData;
                        }
                        $tdContent = "";
                        if ($roleInfoArray[$accountKey] && $roleInfoArray[$accountKey]["s" . $info["ServerID"]]) {
                            $tdContent = $roleInfoArray[$accountKey]["s" . $info["ServerID"]]["PlayerName"];
                        }
                    } elseif ($key == "AccountGroup") {
                        $Coupontype = \DataMgr\GetCoupontypeGroup($info["Channel"], $info["AccountID"], $info["ServerID"]);
                        $tdContent = array_key_exists($Coupontype, $CoupontypeGroup) ? $CoupontypeGroup[$Coupontype] : "";
                    } elseif ($key == "OriginalAmount") {
                        if (array_key_exists("OriginalAmount", $info)) {
                            $tdContent =  $info["OriginalAmount"];
                        } else {
                            $tdContent = $info["OrderAmount"];
                        }
                    } elseif ($key == "State") {
                        if ($info[$key] == 1) {
                            $tdContent = \Lang\gettext("成功");
                        } elseif ($info[$key] == 2) {
                            $tdContent = "<span title='" . $info["SyncRet"]["errordesc"] . "' ><font color='red'>" . \Lang\gettext("失败") . "</font></span>";
                        } elseif ($info[$key] == 0) {
                            $tdContent = \Lang\gettext("未支付");
                        }
                    }
                    echo "<td align='" . $value[2] . "' style=\"display:table-cell; vertical-align:middle\">";
                    echo "<div id='" . $key . "_" . $Num . "'>" . $tdContent . "</div>";
                    echo "</td>";
                }
                echo "</tr>";
            }
            ?>
        </table>
        <input type="hidden" name="search" value="1" />
        <?php
        include_once "/Common/SelectPage.php";
        ?>
    </form>
</body>
 
<script type='text/javascript' src="/js/common.js"></script>
<script type="text/javascript">
    function PayOrderRepeat(Num, OrderID, OrderIDSDK, PayTime) {
        ajaxRequest("payorderrepeat.php?OrderID=" + OrderID + "&OrderIDSDK=" + OrderIDSDK + "&PayTime=" + PayTime,
            function(xmlhttp) {
                var br = getbr();
                var res = JSON.parse(xmlhttp.responseText);
                if (res["errorcode"] == 0) {
                    var fail = '<?php echo \Lang\gettext("失败") ?>';
                    alert(fail + br + res["errordesc"]);
                } else {
                    var succ = '<?php echo \Lang\gettext("成功") ?>';
                    alert(succ);
                    var stateObj = document.getElementById("State" + "_" + Num);
                    stateObj.innerHTML = succ;
                }
            },
            "POST"
        );
    }
</script>
 
</html>