HavePermission($Permission)) {
exit;
}
\Logging\LogInfo("_SESSION:" . print_r($_SESSION, true));
\Logging\LogInfo("_POST:" . print_r($_POST, true));
$spID = $user->GetSPID();
$readTempContent = \CommFunc\GetFileContents("MailTemp/" . $spID . "_Person.json", "[]");
$mailTempArray = json_decode($readTempContent, true);
if (!$mailTempArray || !count($mailTempArray)) {
echo "邮件模板加载异常!";
return;
}
$tempCount = count($mailTempArray);
$massSendMaxNum = intval($_POST['massSendMaxNum']);
// echo "
tempCount: " . $tempCount;
// echo "
massSendMaxNum: " . $massSendMaxNum;
$postUrl = 'http://' . $_SERVER['HTTP_HOST'] . "/Common/GMCmdProcess.php";
\Logging\LogInfo("postUrl:" . $postUrl);
for ($num = 0; $num <= $massSendMaxNum; $num++) {
if (!array_key_exists("playerList" . $num, $_POST)) {
continue;
}
$tempIndex = $_POST["MailTemp" . $num]; // 模板索引
if ($tempIndex >= $tempCount) {
continue;
}
$tempInfo = $mailTempArray[$tempIndex];
$pack_data = array();
$pack_data["playerList"] = $_POST["playerList" . $num];
$pack_data["queryType"] = $_POST["queryType" . $num];
$pack_data['playerFind'] = "0"; // 实际不用该参数,兼容旧版用
$pack_data['EndTime'] = date('Y-m-d', strtotime('+' . $tempInfo["EndDays"] . ' day')) . " 00:00:00";
$pack_data["Title"] = $tempInfo["Title"];
$pack_data["Text"] = $tempInfo["Text"];
$pack_data["Gold"] = $tempInfo["Gold"];
$pack_data["GoldPaper"] = $tempInfo["GoldPaper"];
$pack_data["Silver"] = $tempInfo["Silver"];
# 物品信息
$pack_data["itemNums"] = implode(",", array_keys($tempInfo["Items"]));
foreach ($tempInfo["Items"] as $itemIndex => $itemInfo) {
$pack_data["ItemID" . $itemIndex] = $itemInfo[0];
$pack_data["ItemCnt" . $itemIndex] = $itemInfo[1];
$pack_data["IsBind" . $itemIndex] = $itemInfo[2];
}
$pack_data["key"] = $_POST["key"];
$pack_data["Permission"] = \User\Permission::P_PersonalMailSend;
$pack_data["pack_type"] = "GMT_AddPersonalCompensation"; // 群发模板仅针对个人邮件
$pack_data['tool_page'] = $_SESSION['tool_page'];
$pack_data['session_username'] = $_SESSION['username']; // post的username参数key做区分,防止功能有同参数名导致覆盖
\Lang\setLang(\Lang\getLang());
$pack_data['spid'] = $_SESSION['spid'];
$pack_data['lang'] = \Lang\getLang();
echo '