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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<?php
include_once "/Common/ConfigReader.php";
include_once "/Common/CommFunc.php";
include_once "/Common/Logging.php";
include_once "/Common/Logging.php";
include_once "/Account/User.php";
include_once "/language/lang.php";
 
\Logging\CreateLogging("GMT_DelPlayerItem.php");
 
\CommFunc\SessionStart();
$Permission = \User\Permission::P_DelPlayerItem;
$spid = $_SESSION['spid'];
$user = new \User\User($_SESSION['UserAccount']);
if (!$user->HavePermission($Permission)) {
    exit;
}
 
$itemInfoKeyCh = array(
    'ItemPlaceIndex' => \Lang\gettext('索引'),
    'ItemTypeID' => \Lang\gettext('物品ID'),
    'ItemName' => \Lang\gettext('物品名'),
    'Count' => \Lang\gettext('个数'),
    'IsBind' => \Lang\gettext('拍品'),
    'IsSuite' => \Lang\gettext('套装'),
    'GearScore' => \Lang\gettext('评分'),
    'UserData' => \Lang\gettext('UserData'),
    'ItemGUID' => \Lang\gettext('ItemGUID'),
    'CreateTime' => \Lang\gettext('创建时间'),
    'RemainHour' => \Lang\gettext('剩余时间'),
);
 
$itemNameArray = CommFunc\getCfgKeyNameContent("item", true, $spid);
$packTypeCh = CommFunc\getCfgKeyNameContent("packType", true, $spid);
 
$resultInfo = $_POST;
$ResultMsg = $resultInfo["ResultMsg"];
 
$accID = $ResultMsg["accID"];
$itemID = $ResultMsg["itemID"];
$delCount = $ResultMsg["delCount"];
$findItemDict = $ResultMsg["findItemDict"];
 
// echo $_POST[data];
function ShowPackItemInfo($packItemDict, $showCheckBox)
{
    global $packTypeCh, $itemInfoKeyCh, $itemNameArray;
 
    foreach ($packItemDict as $packIndex => $itemList) {
        echo "<p/>";
        echo \Lang\gettext("背包") . ":" . $packIndex;
        if (array_key_exists($packIndex, $packTypeCh)) {
            echo " 【" . $packTypeCh[$packIndex] . "】";
        }
        echo "<br/>";
        echo "<table id=\"tf\" class=\"border-table\">";
        echo "<tr>";
        foreach ($itemInfoKeyCh as $key => $value) {
            echo "<td align='center'>" . $value . "</td>";
        }
        echo "</tr>";
        for ($i = 0; $i < count($itemList); $i++) {
            // $idKey = "_" . $packIndex . "_" . $i;
            $dataInfo = $itemList[$i];
            echo "<tr>";
            foreach ($itemInfoKeyCh as $key => $value) {
                // $widgetName = "lab" . $key . $idKey;
                $tdContent = $dataInfo[$key];
 
                if ($key == "ItemPlaceIndex") {
                    if (!$tdContent) {
                        $tdContent = 0;
                    }
                    if ($packIndex == 33) {
                        $tdContent = "<br/>" . \Lang\gettext("神兽") . (intval($tdContent / 5)  + 1);
                    }
                    if ($showCheckBox) {
                        $itemPlaceIndex = $dataInfo[$key];
                        $itemGUID = $dataInfo["ItemGUID"];
                        $tdContent = "<input type='checkbox' onclick='checkDelItem(this, $packIndex, $itemPlaceIndex, \"$itemGUID\")' />&nbsp;" . $tdContent;
                    }
                }
 
                if ($key == "ItemName") {
                    $itemID = $dataInfo["ItemTypeID"];
                    if (array_key_exists($itemID, $itemNameArray)) {
                        $tdContent = $itemNameArray[$itemID];
                    } else {
                        $tdContent  = "<font color='red'>" . \Lang\gettext("未知物品ID") . "</font>";
                    }
                }
 
                // $tdContent = '<label name="' . $widgetName . '" id="' . $widgetName . '"/>' . $tdContent . '</label>';
                if ($key == "Count" || $key == "IsBind" || $key == "IsSuite" || $key == "GearScore") {
                    $align = "center";
                } else {
                    $align = "left";
                }
                echo "<td align='" . $align . "'>" . $tdContent . "</td>";
            }
            echo "</tr>";
        }
        echo "</table>";
    }
    echo "<hr />";
}
 
?>
 
<!DOCTYPE html>
<html>
 
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="gettext" type="application/x-po" href="/language/<?php echo \Lang\getLang(); ?>/LC_MESSAGES/<?php echo \Lang\getjspodomain(); ?>.po" />
</head>
 
<body>
    <form id="DelPlayerItem" name="DelPlayerItem" action="/Common/GMCmdProcess.php" method="post">
        <br />
        <?php
 
        echo \Lang\gettext("删除目标物品") . ": ";
        if (array_key_exists($itemID, $itemNameArray)) {
            echo $itemNameArray[$itemID];
        } else {
            echo "<font color='red'>" . \Lang\gettext("未知物品ID") . "</font>";
        }
        echo " (" . $itemID . ")";
        echo "<p/>";
 
        // 删除结果
        if (array_key_exists("succDelCount", $ResultMsg)) {
            echo \Lang\gettext("所需删除个数") . ": ", $ResultMsg["delItemCount"], "<br/>";
            echo \Lang\gettext("成功删除个数") . ": ", $ResultMsg["succDelCount"], "<p/>";
            $succDelItemDict = $ResultMsg["succDelItemDict"];
            echo \Lang\gettext("删除物品明细如下") . ": <br/>";
            ShowPackItemInfo($succDelItemDict, false);
        }
 
        // 查询/剩余结果
        if (count($findItemDict) > 0) {
            echo \Lang\gettext("玩家当前剩余该物品所在背包列表如下,勾选需要删除的物品") . "! <br/>";
            ShowPackItemInfo($findItemDict, true);
        ?>
            <label><?php echo \Lang\gettext("总需扣除数量"); ?>:</label><br />
            <input class="long_input" type="text" name="delItemCount" id="delItemCount" value="1" />
            <p />
            <label><?php echo \Lang\gettext("扣除物品说明"); ?>:</label><br />
            <input class="long_input" type="text" name="delRemark" id="delRemark" value="" />
            <p />
            <?php
            if ($user->NeedCheckKey()) {
                echo \Lang\gettext("授权码(key)") . ":<br/>";
                echo "<input type=\"text\" name=\"key\" id=\"key\" />";
            } else {
                echo "<input type=\"hidden\" name=\"key\" id=\"key\" />";
            }
            ?>
            <p />
 
            <input type="hidden" name="delGUIDInfo" id="delGUIDInfo" value="{}" />
            <input type="hidden" name="queryType" id="queryType" value="accID" />
            <input type="hidden" name="playerFind" id="playerFind" value="<?php echo $accID ?>" />
            <input type="hidden" name="itemID" id="itemID" value="<?php echo $itemID ?>" />
            <input type="hidden" name="Permission" value="<?php echo $Permission; ?>" />
            <input type="hidden" name="pack_type" value="GMT_DelPlayerItem" />
            <input type="submit" name="submit" value="<?php echo \Lang\gettext("提交"); ?>" onclick="return CheckSubmit()" />
        <?php
        } else {
            echo \Lang\gettext("玩家没有该物品") . "! <br/>";
        }
        ?>
    </form>
</body>
 
</html>
 
<script type='text/javascript' src='/language/gettext.js'></script>
<script type='text/javascript' src="/js/common.js"></script>
<script type="text/javascript">
    var delGUIDList = [];
    var delGUIDMap = new Map();
 
    function checkDelItem(checkbox, packIndex, itemPlaceIndex, itemGUID) {
        if (checkbox.checked == true) {
            if (!delGUIDMap.has(itemGUID)) {
                delGUIDMap.set(itemGUID, [packIndex, itemPlaceIndex]);
            }
        } else {
            if (delGUIDMap.has(itemGUID)) {
                delGUIDMap.delete(itemGUID);
            }
        }
    }
 
    function CheckSubmit() {
        if (!document.getElementById("delRemark").value) {
            alert("<?php echo \Lang\gettext("扣除说明信息不能为空"); ?>!");
            return false;
        }
        if (!CheckKey("key")) {
            return false;
        }
        var br = getbr();
        let delDetail = "";
        let temp = {};
        for (const [k, v] of delGUIDMap) {
            temp[k] = v;
            delDetail += br + v + " : " + k;
        }
        var checkInfo = JSON.stringify(temp);
        if (checkInfo == "{}") {
            alert("<?php echo \Lang\gettext("没有勾选需要删除的目标物品"); ?>!");
            return false;
        }
        document.getElementById("delGUIDInfo").value = checkInfo;
 
        var delItemID = document.getElementById("itemID").value;
        var delItemCount = document.getElementById("delItemCount").value;
 
        if (!confirm(
                "<?php echo \Lang\gettext("请求删除物品"); ?>: " + delItemID + br +
                "<?php echo \Lang\gettext("请求删除个数"); ?>: " + delItemCount + br +
                "<?php echo \Lang\gettext("指定删除 背包,索引 : GUID 明细"); ?>:" + delDetail + br +
                "<?php echo \Lang\gettext("确认扣除"); ?>?")) {
            return false;
        }
        return true;
    }
</script>
<style type="text/css">
    .border-table {
        border-collapse: collapse;
        border: none;
    }
 
    .border-table td {
        border: solid #000 1px;
    }
</style>