<?php
|
include_once "/Common/CommFunc.php";
|
include_once "/Common/Logging.php";
|
include_once "/Account/User.php";
|
include_once "/language/lang.php";
|
include_once "/Common/GMTRetCode.php";
|
|
\Logging\CreateLogging("GMT_CompensationQueryPersonal.php");
|
|
\CommFunc\SessionStart();
|
$Permission = \User\Permission::P_PersonalMailMgr;
|
$spid = $_SESSION['spid'];
|
$toServerID = $_SESSION['serverID'];
|
$user = new \User\User($_SESSION['UserAccount']);
|
if (!$user->HavePermission($Permission)) {
|
exit;
|
}
|
|
\Logging\LogInfo("_POST:" . print_r($_POST, true));
|
$queryType = $_POST["queryType"];
|
$playerFind = $_POST["playerFind"];
|
$opType = array_key_exists("opType", $_POST) ? $_POST["opType"] : "";
|
$GUIDInfo = array_key_exists("GUIDInfo", $_POST) ? $_POST["GUIDInfo"] : "";
|
|
$packData = array(
|
"queryType" => $queryType,
|
"playerFind" => $playerFind,
|
"opType" => $opType,
|
"GUIDInfo" => $GUIDInfo,
|
);
|
$retList = \CommFunc\SendGMTToGameServers(True, "GMT_CompensationQueryPersonal", $packData, $spid, array($toServerID));
|
if (!is_array($retList)) {
|
echo "返回错误,没有返回信息";
|
exit;
|
}
|
$ret = json_decode($retList[$toServerID], true);
|
$errStr = ParseResult($ret, $resultMsg);
|
if ($errStr != "") {
|
echo $errStr;
|
exit;
|
}
|
|
$mailNameArray = CommFunc\getCfgKeyNameContent("mail", true, $spid);
|
$itemNameArray = CommFunc\getCfgKeyNameContent("item", true, $spid);
|
$mailtypes = CommFunc\GetMailTypes();
|
|
//------------------------------------------
|
|
//显示表格字段配置 key-参数名,value-说明
|
$tableArray = array(
|
"Num" => \Lang\gettext("编号"),
|
"State" => \Lang\gettext("状态"),
|
// "MailType" => \Lang\gettext("类型"),
|
"Title" => \Lang\gettext("标题"),
|
"ItemList" => \Lang\gettext("物品"),
|
"CreateTime" => \Lang\gettext("发送时间"),
|
"LimitDays" => \Lang\gettext("有效天数"),
|
"Content" => \Lang\gettext("内容"),
|
"GUID" => \Lang\gettext("GUID"),
|
);
|
|
// 获取字段对应内容
|
function GetContent($mailDict, $keyName, $mailNameArray, $itemNameArray)
|
{
|
global $mailtypes;
|
$c = $mailDict[$keyName];
|
if ($keyName == "State") {
|
$mailState = intval($c);
|
if ($mailState === 1) {
|
return "<font color='red'>" . \Lang\gettext("未读") . "</font>";
|
} else if ($mailState === 2) {
|
return \Lang\gettext("已读");
|
} else if ($mailState === 3) {
|
return \Lang\gettext("已领取");
|
}
|
return "<font color='red'>" . $mailState . "</font>";
|
} elseif ($keyName == "Title") {
|
if (array_key_exists($c, $mailNameArray)) {
|
return $mailNameArray[$c];
|
}
|
} elseif ($keyName == "ItemList") {
|
if (count($c) == 0) {
|
return \Lang\gettext("无");
|
}
|
$itemInfo = "";
|
foreach ($c as $item) {
|
$itemID = "" . $item[0];
|
$itemCount = $item[1];
|
if (array_key_exists($itemID, $itemNameArray)) {
|
$itemInfo .= $itemNameArray[$itemID] . "(" . $itemID . ")";
|
} else {
|
$itemInfo .= "<font color='red'>" . \Lang\gettext("未知物品ID") . "(" . $itemID . ")</font>";
|
}
|
$itemInfo .= " x" . $itemCount . \Lang\gettext("个") . "<br/><br/>";
|
}
|
return $itemInfo;
|
} elseif ($keyName == "MailType") {
|
if (array_key_exists($mailDict["Title"], $mailNameArray)) {
|
// 由模板表定
|
return "";
|
}
|
return $mailtypes["" . $c] . "(" . $c . ")";
|
}
|
return $mailDict[$keyName];
|
}
|
|
$mailList = array();
|
if (array_key_exists("mailList", $resultMsg)) {
|
$mailList = $resultMsg["mailList"];
|
}
|
$retCount = count($mailList);
|
|
if ($opType == "del") {
|
echo "<font color='red'>" . \Lang\gettext("删除成功!可继续操作!") . "</font>";
|
}
|
?>
|
|
<!DOCTYPE html>
|
<html>
|
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<title><?php echo \Lang\gettext("个人邮件管理"); ?></title>
|
</head>
|
|
<body>
|
<form method="post">
|
<input type="hidden" readonly="readonly" name="queryType" value="<?php echo $queryType; ?>" />
|
<?php echo \Lang\gettext("目标玩家"); ?>: <input readonly="readonly" name="playerFind" value="<?php echo $playerFind; ?>" />
|
<br />
|
<hr />
|
<?php echo \Lang\gettext("返回条数"); ?>: <?php echo $retCount; ?><br /><br />
|
<table id="tt" class="border-table">
|
<?php
|
echo "<tr>";
|
foreach ($tableArray as $key => $value) {
|
echo "<td align='center'>" . $value . "</td>";
|
}
|
echo "</tr>";
|
|
for ($i = 0; $i < $retCount; $i++) {
|
$mailDict = $mailList[$i];
|
$num = $i + 1;
|
echo "<tr>";
|
echo "<td align='center'><input name='checkbox" . $i . "' id='checkbox" . $i . "' type='checkbox' />" . $num . " </td>";
|
foreach ($tableArray as $key => $value) {
|
if ($key == "Num") {
|
continue;
|
}
|
|
$widgetName = "lab" . $key . $i;
|
$tdContent = GetContent($mailDict, $key, $mailNameArray, $itemNameArray);
|
$tdContent = '<label name="' . $widgetName . '" id="' . $widgetName . '"/>' . $tdContent . '</label>';
|
if ($key == "Title" || $key == "Content" || $key == "ItemList") {
|
$align = "left";
|
} else {
|
$align = "center";
|
}
|
echo "<td align='" . $align . "'>" . $tdContent . "</td>";
|
}
|
echo "</tr>";
|
}
|
?>
|
</table>
|
<hr />
|
|
<input type="hidden" name="GUIDInfo" id="GUIDInfo" value="" />
|
<?php echo \Lang\gettext("选中需要删除的邮件操作"); ?>:
|
<input type="hidden" name="opType" id="opType" value="del" />
|
|
<p>
|
<input type="hidden" name="Permission" value="<?php echo $Permission; ?>" />
|
<input type="hidden" name="pack_type" value="GMT_CompensationQueryPersonal" />
|
<?php
|
if ($user->NeedCheckKey()) {
|
echo \Lang\gettext("授权码(key)") . ":";
|
echo "<input type=\"text\" name=\"key\" id=\"key\" />";
|
} else {
|
echo "<input type=\"hidden\" name=\"key\" id=\"key\" />";
|
}
|
?>
|
</p>
|
<center>
|
<p>
|
<input type="submit" name="submit" align="center" value="<?php echo \Lang\gettext("提交"); ?>" onclick="return CheckSubmit(<?php echo $retCount; ?>)" />
|
</P>
|
</center>
|
<hr>
|
</form>
|
|
<script>
|
//浏览器类型判定
|
function getOs() {
|
if (navigator.userAgent.indexOf("MSIE") > 0) {
|
return "IE"; //InternetExplor
|
} else if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) {
|
return "FF"; //firefox
|
} else if (isSafari = navigator.userAgent.indexOf("Safari") > 0) {
|
return "SF"; //Safari
|
} else if (isCamino = navigator.userAgent.indexOf("Camino") > 0) {
|
return "C"; //Camino
|
} else if (isMozilla = navigator.userAgent.indexOf("Gecko/") > 0) {
|
return "G"; //Gecko
|
} else if (isMozilla = navigator.userAgent.indexOf("Opera") >= 0) {
|
return "O"; //opera
|
} else {
|
return 'Other';
|
}
|
}
|
|
//获取换行符
|
function getbr() {
|
var os = getOs();
|
if (os == 'FF' || os == 'SF') { //FireFox、谷歌浏览器用这个
|
return "\n";
|
} else { //IE系列用这个
|
return "\r\n";
|
}
|
}
|
|
function CheckSubmit(rCount) {
|
|
var br = getbr();
|
var checkInfo = "";
|
//每次重新提交表单要重置该值,不然单次操作中多次确认提交会产生多余数据
|
document.getElementById("GUIDInfo").value = "";
|
for (var i = 0; i < rCount; i++) {
|
if (!document.getElementById("checkbox" + i).checked) {
|
continue;
|
}
|
|
var guid = document.getElementById("labGUID" + i).innerText;
|
var title = document.getElementById("labTitle" + i).innerText;
|
|
checkInfo = checkInfo + "<?php echo \Lang\gettext("编号"); ?>" + (i + 1) + "." + title + "(" + guid + ")" + br + br;
|
|
var GUIDInfo = document.getElementById("GUIDInfo").value;
|
if (GUIDInfo) {
|
GUIDInfo += ",";
|
}
|
GUIDInfo += guid;
|
document.getElementById("GUIDInfo").value = GUIDInfo;
|
}
|
// alert("GUIDInfo: " + document.getElementById("GUIDInfo").value);
|
|
if (checkInfo == "") {
|
alert("<?php echo \Lang\gettext("没有选中邮件"); ?>!");
|
return false;
|
}
|
|
if (!window.confirm("<?php echo \Lang\gettext("以下邮件确定执行该操作吗"); ?>" + "?【<?php echo \Lang\gettext("删除"); ?>】" + br + br + checkInfo)) {
|
return false;
|
}
|
|
if (document.getElementById("key").type != "hidden" && !document.getElementById("key").value) {
|
alert("<?php echo \Lang\gettext("请输入授权码!"); ?>");
|
return false;
|
}
|
|
return true;
|
}
|
</script>
|
|
<style type="text/css">
|
.border-table {
|
border-collapse: collapse;
|
border: none;
|
font-size: 13px;
|
}
|
|
.border-table td {
|
border: solid #000 1px;
|
}
|
</style>
|
</body>
|
|
</html>
|