From 18f71f19ce0d4c188dacd8fc8206d44a230f7c7c Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 16 三月 2026 19:57:47 +0800
Subject: [PATCH] 16 卡牌服务端(自动开服相关;增加是否允许加入跨服标记,默认否;优化ServersConfig.json配置,支持后台导出,优化战斗服务器配置;服务器信息增加 GroupName、MapID、服务器类型、是否可跨服;)
---
task/minuteLoop.php | 63 +++++++++++++++++++------------
1 files changed, 39 insertions(+), 24 deletions(-)
diff --git a/task/minuteLoop.php b/task/minuteLoop.php
index beb38b9..28777da 100644
--- a/task/minuteLoop.php
+++ b/task/minuteLoop.php
@@ -64,20 +64,31 @@
function OnMinute($minuteStr)
{
\Logging\LogInfo("Todo OnMinute: " . $minuteStr);
- checkAutoOpenServer();
+ checkAutoOpenServer_ByCreateRole();
checkPreOpenServer();
- checkOpenServerTime();
+ checkOpenServer_ClearData(); // 鍚屾娓呮。
}
//==========================================================================================================
/**
- * 妫�鏌ヨ嚜鍔ㄦ湇鍔″櫒淇℃伅锛屾瘡鍒嗛挓澶勭悊涓�娆�
+ * 鑷姩寮�鏈嶆祦绋�
+ * 1. 璁剧疆棰勫紑鏈嶆柟寮忥紙璁剧疆寮�鏀炬湇鍔″櫒鍏ュ彛鏃堕棿锛�
+ * 1.1 鐩存帴璁剧疆寮�鏈嶆椂闂达紙寮�鏀惧叆鍙f椂闂达級
+ * 1.2 璁剧疆鏍规嵁鏌愪釜鏈嶅姟鍣ㄥ垱瑙掍汉鏁版弧瓒硏浜哄悗寮�鏈嶏紝婊¤冻鏉′欢鍚庝細鏍规嵁閰嶇疆 AutoOpenServerTimeByCreateRole 璁剧疆寮�鏈嶆椂闂达紝鍚� 1.1 鐨勫紑鏈嶆椂闂�
+ *
+ * 2. 鏍规嵁鏈�缁堢殑寮�鏈嶆椂闂�/寮�鏀惧叆鍙f椂闂村悓姝ユ父鎴忔湇鎻愬墠娓呮。 - 娓告垙鏈嶇殑瀹為檯寮�鏈嶆椂闂�
+ *
+ * 3. 鏍规嵁棰勫紑鏈嶆椂闂村強娓呮。鐘舵�侀獙璇佹弧瓒冲悗寮�鏀惧叆鍙o紝鍚屾椂浼氶獙璇佹父鎴忔湇鐩稿叧鐘舵�佹槸鍚︽弧瓒� checkOpenServer 锛堟父鎴忕増鏈�佸紑鏈嶅ぉ绛夛級
+ *
*/
-function checkAutoOpenServer()
+/**
+ * 妫�鏌ヨ嚜鍔ㄦ湇鍔″櫒淇℃伅锛屾瘡鍒嗛挓澶勭悊涓�娆★紝鏍规嵁鍏宠仈鐨勬湇鍔″櫒鍒涜浜烘暟婊¤冻鏉′欢鍚庤嚜鍔ㄨ缃寮�鏈嶆椂闂�
+ */
+function checkAutoOpenServer_ByCreateRole()
{
$curDate = getdate();
$dateStr = $curDate['year'] . "-" . $curDate['mon'] . "-" . $curDate['mday'];
- \Logging\LogInfo("=== Do checkAutoOpenServer ===");
+ \Logging\LogInfo("=== Do checkAutoOpenServer_ByCreateRole ===");
// 璁惧畾鏃堕棿鑼冨洿 濡�21-24鐐� 涓嶄細鑷姩寮�鏈�
CommFunc\GetConfig("ServerInfo", "AutoOpenServerLimitTimeRange", $AutoOpenServerLimitTimeRange);
$limitTimeList = json_decode($AutoOpenServerLimitTimeRange);
@@ -110,7 +121,8 @@
}
// 杈惧埌鏉′欢鍚庡灏戝垎閽熷悗鍏ュ彛寮�鏀撅紝鍒嗛挓锛岄渶瑕侀鐣欐竻妗g紦鍐叉椂闂达紝闇�澶т簬鎻愬墠娓呮。鏃堕棿锛岀洰鍓嶆槸鎻愬墠15鍒嗛挓娓呮。
- $setStartDate = \CommFunc\TimeToStrDateTime(strtotime("+20 minutes"));
+ CommFunc\GetConfig("ServerInfo", "AutoOpenServerTimeByCreateRole", $AutoOpenServerTimeByCreateRole);
+ $setStartDate = \CommFunc\TimeToStrDateTime(strtotime("+" . $AutoOpenServerTimeByCreateRole . " minutes"));
\Logging\LogInfo("setStartDate." . $setStartDate);
$serverCreateRoleInfo = array();
@@ -179,7 +191,7 @@
return;
}
- $x7notifyserverInfo = array();
+ // $x7notifyserverInfo = array();
$refrshJsonBranchArray = array();
$curTime = strtotime(date("Y-m-d H:i:s", time()));
@@ -209,7 +221,8 @@
}
// 杩涗竴姝ユ鏌ユ渶鏂版湇鍔″櫒寮�鏈嶇姸鎬佹槸鍚︽甯�
- $checkUrl = "http://127.0.0.1/serverops/checkOpenServer.php";
+ $baseUrl = CommFunc\GetBaseUrl();
+ $checkUrl = $baseUrl . "/serverops/checkOpenServer.php";
$retStr = \CommFunc\DoGet($checkUrl, array("channel" => $Channel, "serverID" => $ServerID));
$checkRet = json_decode($retStr, true);
if (!isset($checkRet) || !array_key_exists("errMsg", $checkRet) || $checkRet["errMsg"] != "OK") {
@@ -223,6 +236,7 @@
"RunningStatus" => \ServerOPS\ServerRunningStatus::Light,
"Statue" => \ServerOPS\ServerStatue::Open,
"Recommend" => 1, // 鏂板紑鏀惧叆鍙f湇榛樿鎺ㄨ崘
+ "CanCross" => 1, // 鑷姩寮�鏈嶇殑寮�鏀惧叆鍙i粯璁よ缃负鍙法鏈嶏紝娓告垙鏈嶅湪鑷姩寮�鏈嶆竻妗f椂涔熸槸榛樿璁剧疆涓哄彲璺ㄦ湇
);
if (\DBOper\Update("GameServers", $find, $set)) {
\Logging\LogInfo("set server open ok." . print_r($serverInfo, true));
@@ -231,8 +245,8 @@
"Channel" => $Channel,
"ServerID" => array('$nin' => array($ServerID))
), array("Recommend" => 0), false, false, true);
- // 閫氱煡sp鏈嶅姟鍣ㄥ紑鏀�
- \CommFunc\DoPost("http://127.0.0.1/serverops/hy/report_server.php", array("channel" => $Channel, "server_id" => $ServerID));
+ // 銆愰�氱煡sp鏈嶅姟鍣ㄥ紑鏀俱��
+ // \CommFunc\DoPost("http://127.0.0.1/serverops/hy/report_server.php", array("channel" => $Channel, "server_id" => $ServerID));
} else {
\Logging\LogError("set server open error." . print_r($serverInfo, true));
}
@@ -242,14 +256,14 @@
array_push($refrshJsonBranchArray, $refreshBranch);
}
- if (\CommFunc\GetConfig("x7", "JsonBranch_" . $Channel, $branch) && $branch == $JsonBranch) {
- if (!array_key_exists($Channel, $x7notifyserverInfo)) {
- $x7notifyserverInfo[$Channel] = array();
- }
- $x7notifyserverList = $x7notifyserverInfo[$Channel];
- array_push($x7notifyserverList, $serverInfo);
- $x7notifyserverInfo[$Channel] = $x7notifyserverList;
- }
+ // if (\CommFunc\GetConfig("x7", "JsonBranch_" . $Channel, $branch) && $branch == $JsonBranch) {
+ // if (!array_key_exists($Channel, $x7notifyserverInfo)) {
+ // $x7notifyserverInfo[$Channel] = array();
+ // }
+ // $x7notifyserverList = $x7notifyserverInfo[$Channel];
+ // array_push($x7notifyserverList, $serverInfo);
+ // $x7notifyserverInfo[$Channel] = $x7notifyserverList;
+ // }
}
\Logging\LogInfo("refrshJsonBranchArray." . print_r($refrshJsonBranchArray, true));
@@ -257,9 +271,9 @@
\ServerOPS\RefreshCommonServerlistJson($refreshBranch["Channel"], $refreshBranch["JsonBranch"], "System");
}
- foreach ($x7notifyserverInfo as $Channel => $x7notifyserverList) {
- x7_common_serverNotify($Channel, $x7notifyserverList);
- }
+ // foreach ($x7notifyserverInfo as $Channel => $x7notifyserverList) {
+ // x7_common_serverNotify($Channel, $x7notifyserverList);
+ // }
}
function x7_common_serverNotify($appid, $notifyserverList)
@@ -303,9 +317,9 @@
send_common_to_x7($serverNotifyUrl, $bizParams, $appkey, $prikey, $pubkey, $apiMethod);
}
-function checkOpenServerTime()
+function checkOpenServer_ClearData()
{
- \Logging\LogInfo("=== Do checkOpenServerTime ===");
+ \Logging\LogInfo("=== Do checkOpenServer_ClearData ===");
// 鎵惧嚭鎵�鏈夋湭娓呮。鏈嶅姟鍣�
\DBOper\Find("GameServers", array("ClearState" => 0), $serverList);
@@ -313,7 +327,8 @@
return;
}
- $aheadClearMin = 15; // 鎻愬墠娓呮。鏃堕棿锛屽垎閽燂紝0鐐箏0鐐箈鍒嗛挓锛岀粺涓�0鐐规竻妗o紝涓嶇劧鍙兘瀵艰嚧娓呮。鍚�0鐐瑰張杩囧ぉ鐨勯棶棰橈紱x=鎻愬墠娓呮。鏃堕棿
+ // 鎻愬墠娓呮。鏃堕棿锛屽垎閽燂紝0鐐箏0鐐箈鍒嗛挓锛岀粺涓�0鐐规竻妗o紝涓嶇劧鍙兘瀵艰嚧娓呮。鍚�0鐐瑰張杩囧ぉ鐨勯棶棰橈紱x=鎻愬墠娓呮。鏃堕棿
+ CommFunc\GetConfig("ServerInfo", "AheadClearDataTime", $aheadClearMin);
$aheadSyncMin = 15; // 鐩稿娓呮。鏃堕棿鎻愬墠鍚屾璁剧疆娓呮。鏃堕棿锛屽垎閽�
$curTime = strtotime(date("Y-m-d H:i:s", time()));
--
Gitblit v1.8.0