<?php
|
set_time_limit(300); //暂时设置本脚本执行时间300秒
|
include_once "/Common/Logging.php";
|
include_once "/Common/CommFunc.php";
|
include_once "/Account/User.php";
|
include_once "/language/lang.php";
|
|
|
\Logging\CreateLogging("AddPersonalCompensation.php");
|
|
$Permission = \User\Permission::P_PersonalMailSend;
|
$spid = $_SESSION['spid'];
|
$user = new \User\User($_SESSION['UserAccount']);
|
if (!$user->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 "<br/>tempCount: " . $tempCount;
|
// echo "<br/>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 '<hr />';
|
echo \Lang\gettext("发送邮件") . ": " . $tempInfo["Name"] . "<br/>";
|
echo \Lang\gettext("发送目标") . ": " . $pack_data["playerList"] . "<br/>";
|
$ret = \CommFunc\DoPost($postUrl, $pack_data, true);
|
\Logging\LogInfo("----------------" . $num);
|
\Logging\LogInfo("sendData: " . print_r($pack_data, true));
|
\Logging\LogInfo("---");
|
\Logging\LogInfo("sendRet : " . print_r($ret, true));
|
echo $ret;
|
echo "<br/>";
|
}
|