From 3c433d5045813bd41d407b34a381cf100465621f Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 19 十一月 2024 18:57:31 +0800
Subject: [PATCH] 10310 【后台】优化游戏分支获取数据的功能

---
 serverops/gameVersion.php |  126 +++++++++++++++++++++++------------------
 1 files changed, 71 insertions(+), 55 deletions(-)

diff --git a/serverops/gameVersion.php b/serverops/gameVersion.php
index 15a031d..c544ea4 100644
--- a/serverops/gameVersion.php
+++ b/serverops/gameVersion.php
@@ -14,6 +14,7 @@
     $channel = $_SESSION['spid'];
     $BranchNum = intval($_POST["BranchNum"]);
     $Version = $_POST["Version"];
+    $VersionState = intval($_POST["VersionState"]);
     $ForceDownUrl = $_POST["ForceDownUrl"];
 
     $find = array(
@@ -36,6 +37,7 @@
         "Channel" => $channel,
         "BranchNum" => $BranchNum,
         "Version" => $Version,
+        "VersionState" => $VersionState,
         "ForceDownUrl" => $ForceDownUrl,
         "UpdateTime" => date("Y-m-d H:i:s")
     );
@@ -82,19 +84,8 @@
     exit;
 }
 
-$AllChannel = \CommFunc\GetAllChannel();
-if ($_POST["opType"]) {
-    GameVersionEdit($_POST["opType"]);
-}
-
-DBOper\Find(
-    "GameVersion",
-    array("Channel" => $channel),
-    $versionArray,
-    null,
-    array("BranchNum" => 1, "VersionTime" => -1)
-);
-
+// 鎵撳寘鍒嗘敮
+$BranchNum = 0;
 $branchNameInfo = array();
 DBOper\Find(
     "GamePackBranch",
@@ -104,15 +95,42 @@
 );
 foreach ($branchArray as $branchInfo) {
     $branchNameInfo[$branchInfo["BranchNum"]] = $branchInfo["BranchName"];
+    if ($BranchNum == 0) {
+        $BranchNum = $branchInfo["BranchNum"];
+    }
 }
 
-// echo "branchNameInfo:", print_r($branchNameInfo, true), "<br/>";
+if (array_key_exists("BranchNum", $_POST)) {
+    $BranchNum = intval($_POST["BranchNum"]);
+    GameVersionEdit($_POST["opType"]);
+}
+$BranchName = $branchNameInfo[$BranchNum];
+
+// 鐗堟湰鐘舵��
+$stateNameInfo = array();
+DBOper\Find(
+    "GameVersionState",
+    array("Channel" => $channel, "BranchNum" => $BranchNum),
+    $versionStateArray
+);
+foreach ($versionStateArray as $stateInfo) {
+    $stateNameInfo[$stateInfo["VersionState"]] = $stateInfo["StateName"];
+}
+
+DBOper\Find(
+    "GameVersion",
+    array("Channel" => $channel, "BranchNum" => $BranchNum),
+    $versionArray,
+    null,
+    array("VersionTime" => -1)
+);
 
 //鏄剧ず琛ㄦ牸瀛楁閰嶇疆 key-鍙傛暟鍚嶏紝value-璇存槑
 $tableArray = array(
-    "BranchNum" => array("鍒嗘敮", "5%", "center"),
-    "BranchName" => array("鍚嶇О", "7%", "center"),
+    // "BranchNum" => array("鍒嗘敮", "5%", "center"),
+    // "BranchName" => array("鍚嶇О", "7%", "center"),
     "Version" => array("娓告垙鐗堟湰", "7%", "center"),
+    "VsersionState" => array("鐗堟湰鐘舵��", "5%", "center"),
     "VersionTime" => array("鐗堟湰鏃堕棿", "12%", "center"),
     "UpdateTime" => array("淇敼鏃堕棿", "12%", "center"),
     "ForceDownUrl" => array("寮烘洿涓嬭浇鍦板潃", "40%", "center"),
@@ -138,31 +156,37 @@
         <p><b>鍐呭鐗堟湰绠$悊</b></P>
     </center>
 
-    <input type="button" value="娣诲姞鍒嗘敮" onclick="window.location.href='packBranchEdit.php?opType=add'" />
-    <?php
-    // 鍏堥兘灞曠ず娴嬭瘯鐢紝 鍚庣画鍐嶄紭鍖栧竷灞�
-    foreach ($branchNameInfo as $BranchNum => $BranchName) {
-        echo " <input type=\"button\" value=\"[" . $BranchName . "]鍒嗘敮 -> 娣诲姞鐗堟湰\" " .
-            "onclick=\"window.location.href='gameVersionEdit.php?opType=add&BranchNum=" . $BranchNum . "&BranchName=" . $BranchName . "'\" />";
-    }
-    ?>
-    <hr />
-    <table width="100%">
-        <?php
-        if ($versionArray) {
-            echo "<thead><tr>";
-            foreach ($tableArray as $value) {
-                echo "<th width=\"" . $value[1] . "\">" . $value[0] . "</td>";
+    <form action="" method="post">
+        鎵撳寘鍒嗘敮:
+        <select name="BranchNum" id="BranchNum" onchange="ChangeBranchNum(this)">
+            <?php
+            foreach ($branchNameInfo as $key => $value) {
+                echo "<option value=\"" . $key . "\"";
+                if ($BranchNum == $key) {
+                    echo " selected";
+                }
+                echo ">" . $value . "</option>";
             }
-            echo "</tr></thead>";
-        } else {
-            echo "鏃犳父鎴忕増鏈紝璇锋坊鍔犵増鏈紒<br/>";
+            ?>
+        </select>
+        &nbsp;&nbsp;
+        <input type="button" value="娣诲姞鐗堟湰" onclick="window.location.href='gameVersionEdit.php?opType=add&BranchNum=<?php echo $BranchNum ?>&BranchName=<?php echo $BranchName ?>'" />
+    </form>
+    <hr />
+    <?php
+    if ($versionArray) {
+        echo '<table width="100%">';
+        echo "<thead><tr>";
+        foreach ($tableArray as $value) {
+            echo "<th width=\"" . $value[1] . "\">" . $value[0] . "</td>";
         }
+        echo "</tr></thead>";
 
         foreach ($versionArray as $versionInfo) {
             echo "<tr class='trc'>";
             $BranchNum = $versionInfo["BranchNum"];
-            $BranchName = $branchNameInfo[$BranchNum];
+            $VersionState = $versionInfo["VersionState"];
+            $StateName = $stateNameInfo[$VersionState];
             $Version = $versionInfo["Version"];
             foreach ($tableArray as $key => $value) {
                 if (!$key) {
@@ -173,8 +197,8 @@
                     echo "</td>";
                     continue;
                 }
-                if ($key == "BranchName") {
-                    $tdContent = $BranchName;
+                if ($key == "VsersionState") {
+                    $tdContent = $StateName;
                 } else {
                     $tdContent = $versionInfo[$key];
                 }
@@ -182,34 +206,26 @@
             }
             echo "</tr>";
         }
-        ?>
-    </table>
-
+        echo '</table>';
+    } else {
+        echo "鏃犳父鎴忕増鏈紝璇锋坊鍔犵増鏈紒<br/>";
+    }
+    ?>
+    <script type='text/javascript' src="/js/common.js"></script>
     <script type="text/javascript">
-        function doPost(to, p) { // to:鎻愪氦鍔ㄤ綔锛坅ction锛�,p:鍙傛暟 
-            var myForm = document.createElement("form");
-            myForm.method = "post";
-            myForm.action = to;
-            for (var i in p) {
-                var myInput = document.createElement("input");
-                myInput.setAttribute("name", i); // 涓篿nput瀵硅薄璁剧疆name 
-                myInput.setAttribute("value", p[i]); // 涓篿nput瀵硅薄璁剧疆value 
-                myForm.appendChild(myInput);
-            }
-            document.body.appendChild(myForm);
-            myForm.submit();
-            document.body.removeChild(myForm); // 鎻愪氦鍚庣Щ闄ゅ垱寤虹殑form 
+        function ChangeBranchNum(obj) {
+            document.forms[0].submit();
         }
 
         function suredel(Channel, BranchNum, Version) {
             if (!window.confirm("纭畾鍒犻櫎" + Channel + "鍒嗘敮" + BranchNum + "鐗堟湰" + Version + "锛�")) {
                 return false;
             }
-            doPost("gameVersion.php", {
+            doSubmit("gameVersion.php", {
                 "opType": "del",
                 "BranchNum": BranchNum,
                 "Version": Version,
-            });
+            }, 'post');
             return true;
         }
     </script>

--
Gitblit v1.8.0