hxp
2025-06-09 6c3f6335c70859ded94a1ad8d218acb0ac34239c
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
<?php
include_once "/Account/User.php";
include_once "/Common/Logging.php";
include_once "/Common/CommFunc.php";
include_once "/language/lang.php";
 
\Logging\CreateLogging("CompensationTempSend.php");
 
$UserAccount = $_SESSION['UserAccount'];
$user = new \User\User($UserAccount);
 
$spID = $user->GetSPID();
$readTempContent = \CommFunc\GetFileContents("MailTemp/" . $spID . "_Person.json", "[]");
// $mailTempArray = json_decode($readTempContent, true);
 
$moneyNameInfo = CommFunc\getCfgKeyNameContent("money", true);
$itemIDNameInfo = CommFunc\getCfgKeyNameContent("item", false);
 
?>
 
<!DOCTYPE html>
<html>
<style>
    /*设置p标签上下间距为1px,左右为0 */
    p {
        margin: 1px 0;
    }
</style>
 
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title><?php echo \Lang\gettext("个人邮件-群发"); ?></title>
</head>
 
<body>
 
    <center>
        <p><?php echo \Lang\gettext("个人邮件-群发"); ?></P>
    </center>
 
    <form id="CompensationTempSend" name="CompensationTempSend" action="CompensationTempSendMulti.php" method="post">
        <div id="TempSendHtml"></div>
        <input type="hidden" name="massSendMaxNum" id="massSendMaxNum" value="" />
        <hr />
        <input type="button" value="<?php echo \Lang\gettext("添加邮件"); ?>" onclick="addTempHtml()" />
        <input type="button" value="<?php echo \Lang\gettext("显隐邮件明细"); ?>" onclick="changeMailDetailDisplay()" />
        <br />
        <hr />
        <p>
            <?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\" />";
            }
            ?>
            <input type="submit" name="submit" value="<?php echo \Lang\gettext("提交"); ?>" onclick="return CheckTempSend()" /><br />
        </p>
        <hr />
    </form>
    <script src="/js/calendar.js"></script>
    <script language='javascript' src='compensationTemp.js' type='text/javascript'></script>
    <script type="text/javascript">
        window.onload = function() {
            // 默认两个
            addPersonTempSendHtml(<?php echo $readTempContent; ?>);
            addPersonTempSendHtml(<?php echo $readTempContent; ?>);
        }
 
        function addTempHtml() {
            addPersonTempSendHtml(<?php echo $readTempContent; ?>);
        }
 
        var massSendNum = -1; // 群发邮件编号
        function CheckTempSend() {
            var massSendMaxNum = parseInt(document.getElementById("massSendMaxNum").value);
            for (let num = 0; num <= massSendMaxNum; num++) {
                if (!document.getElementById("send" + num)) {
                    continue;
                }
 
                if (!document.getElementById("playerList" + num).value) {
                    alert("<?php echo \Lang\gettext("玩家不能为空"); ?>!");
                    document.getElementById("playerList" + num).focus();
                    return false;
                }
 
                if (document.getElementById("MailTemp" + num).value == "") {
                    alert("<?php echo \Lang\gettext("需选择邮件模板"); ?>!");
                    document.getElementById("MailTemp" + num).focus();
                    return false;
                }
            }
 
            if (document.getElementById("key").type != "hidden" && !document.getElementById("key").value) {
                alert("<?php echo \Lang\gettext("请输入授权码!"); ?>");
                return false;
            }
 
            if (!confirm("<?php echo \Lang\gettext("请检查模板详情内容是否正确!确认无误并发送?"); ?>")) {
                return false;
            }
 
            return true;
        }
 
        // 添加个人模板群发 html
        function addPersonTempSendHtml(tempInfo) {
            if (!tempInfo) {
                alert("<?php echo \Lang\gettext("无模板内容"); ?>!");
                return
            }
 
            massSendNum++;
 
            var insHtml = "";
            insHtml += "<div id=\"send" + massSendNum + "\">";
            insHtml += "<hr/>";
            insHtml += "<input type=\"radio\" id=\"queryType" + massSendNum + "\" name=\"queryType" + massSendNum + "\" value=\"accID\" checked /><?php echo \Lang\gettext("按账号"); ?>";
            insHtml += "<input type=\"radio\" id=\"queryType" + massSendNum + "\" name=\"queryType" + massSendNum + "\" value=\"playerName\" /><?php echo \Lang\gettext("角色名"); ?>";
            insHtml += "<input type=\"radio\" id=\"queryType" + massSendNum + "\" name=\"queryType" + massSendNum + "\" value=\"familyID\" /><?php echo \Lang\gettext("仙盟"); ?>";
            insHtml += "&nbsp;&nbsp;<input type=\"text\" id=\"playerList" + massSendNum + "\" name=\"playerList" + massSendNum + "\" value=\"\" size=\"50\" />";
            insHtml += "<a href=\"javascript:delPersonTempSendHtml(" + massSendNum + ")\"><?php echo \Lang\gettext("删除"); ?></a>";
 
            insHtml += "<br/>";
            insHtml += "<select id='MailTemp" + massSendNum + "' name='MailTemp" + massSendNum + "' onchange='selectTemp(" + massSendNum + ", this.selectedIndex)'>";
            insHtml += "    <option value=''><?php echo \Lang\gettext("选择邮件模板"); ?></option>";
            for (let index = 0; index < tempInfo.length; index++) {
                const temp = tempInfo[index];
                insHtml += "    <option value='" + index + "'>" + temp["Name"] + "</option>";
            }
            insHtml += "</select>";
            insHtml += "<br/>";
 
            // 邮件明细
            insHtml += "    <div id=\"mailDetail" + massSendNum + "\" style=\"text-indent:2em;font-size:14px;\">";
            // ... 由  onSelectTemp 触发改变明细内容
            insHtml += "    </div>";
 
            insHtml += "<br/>";
            insHtml += "</div>";
 
            document.getElementById("TempSendHtml").insertAdjacentHTML("beforeEnd", insHtml);
            // 更新群发最大编号
            document.getElementById("massSendMaxNum").value = massSendNum;
        }
 
        function selectTemp(num, selectIndex) {
            onSelectTemp(num, selectIndex, <?php echo $readTempContent; ?>);
        }
 
        // 选择群发模板
        function onSelectTemp(num, selectIndex, tempInfo) {
            var tempIndex = selectIndex - 1;
            var innerHTML = "";
            if (tempIndex >= 0) {
                var temp = tempInfo[tempIndex]
                innerHTML += "<p><?php echo \Lang\gettext("结束时间"); ?>: " + sumDateByDays(temp.EndDays) + " 00:00:00</p>";
                innerHTML += "<p><?php echo \Lang\gettext("标题"); ?>: " + temp.Title + "</p>";
                innerHTML += "<p><?php echo \Lang\gettext("内容"); ?>: " + temp.Text + "</p>";
                innerHTML += "<p><?php echo $moneyNameInfo["1"]; ?>: <font color=\"red\"><b>" + temp.Gold + "</b></font>" +
                    "&nbsp;&nbsp;<?php echo $moneyNameInfo["2"]; ?>: <font color=\"blue\"><b>" + temp.GoldPaper + "</b></font>" +
                    "&nbsp;&nbsp;<?php echo $moneyNameInfo["3"]; ?>: <font><b>" + temp.Silver + "</b></font>" +
                    "</p>";
                // innerHTML += "物品: ";
                var itemIDNameInfo = <?php echo $itemIDNameInfo; ?>;
                for (let index = 0; index < temp.Items.length; index++) {
                    const itemInfo = temp.Items[index];
                    var itemName = itemIDNameInfo[itemInfo[0]];
                    if (itemName) {
                        innerHTML += "<p><?php echo \Lang\gettext("物品ID"); ?>: <font color=\"blue\"><b>" + itemName + "(" + itemInfo[0] + ")" + "</b></font>";
                    } else {
                        innerHTML += "<p><?php echo \Lang\gettext("物品ID"); ?>: <font color=\"red\"><b><?php echo \Lang\gettext("未知物品ID"); ?>(" + itemInfo[0] + ")" + "</b></font>";
                    }
                    innerHTML += " x <b>" + itemInfo[1] + "</b><?php echo \Lang\gettext("个"); ?>";
                    if (itemInfo[2]) {
                        innerHTML += " (<?php echo \Lang\gettext("拍品"); ?>)";
                    }
                    innerHTML += "</p>";
                }
            }
            document.getElementById("mailDetail" + num).innerHTML = innerHTML;
        }
 
        // 显隐 邮件内容明细
        function changeMailDetailDisplay() {
            var display = null;
            for (let num = 0; num < massSendNum + 1; num++) {
                const detailDiv = document.getElementById("mailDetail" + num);
                if (!detailDiv) {
                    continue
                }
                if (display == null) {
                    if (detailDiv.style.display == "") {
                        display = "none"; // 隐
                    } else {
                        display = ""; // 显
                    }
                }
                detailDiv.style.display = display;
            }
        }
 
        // 删除个人模板群发 html
        function delPersonTempSendHtml(delNum) {
            document.getElementById("TempSendHtml").removeChild(document.getElementById("send" + delNum));
        }
    </script>
</body>
 
</html>