作者 赵彬吉

update

@@ -1241,30 +1241,15 @@ function getDomain($url) { @@ -1241,30 +1241,15 @@ function getDomain($url) {
1241 /** 1241 /**
1242 * 解析url的 route 1242 * 解析url的 route
1243 * @param $pathInfo 1243 * @param $pathInfo
1244 - * @return array 1244 + * @return string
1245 * @author zbj 1245 * @author zbj
1246 * @date 2025/5/24 1246 * @date 2025/5/24
1247 */ 1247 */
1248 -function analysisRoute($pathInfo): array 1248 +function analysisRoute($pathInfo)
1249 { 1249 {
1250 $language = ''; 1250 $language = '';
1251 $router = ""; 1251 $router = "";
1252 $page = null; 1252 $page = null;
1253 - $routeType = "";  
1254 - $source = "";  
1255 -  
1256 - if (strpos($pathInfo, '_catalog') !== false) {  
1257 - $source = "module_category";  
1258 - }  
1259 - if (strpos($pathInfo, 'news_catalog') !== false) {  
1260 - $source = "news_category";  
1261 - }  
1262 - if (strpos($pathInfo, 'blog_catalog') !== false) {  
1263 - $source = "blog_category";  
1264 - }  
1265 - if (strpos($pathInfo, 'top-blog') !== false) {  
1266 - $source = "ai_blog_list";  
1267 - }  
1268 1253
1269 $pathArr = explode("/", $pathInfo); 1254 $pathArr = explode("/", $pathInfo);
1270 $pathArr = array_filter($pathArr); 1255 $pathArr = array_filter($pathArr);
@@ -1302,14 +1287,6 @@ function analysisRoute($pathInfo): array @@ -1302,14 +1287,6 @@ function analysisRoute($pathInfo): array
1302 } 1287 }
1303 } else { 1288 } else {
1304 if (isset($router_array['last'])) { 1289 if (isset($router_array['last'])) {
1305 - if ($router_array['first']) {  
1306 - if ($router_array['first'] == "news" || $router_array['first'] == "blogs") {  
1307 - $routeType = $router_array['first'];  
1308 - }  
1309 - if ($router_array['first'] == "user"){  
1310 - $source = "ai_blog_author";  
1311 - }  
1312 - }  
1313 if (in_array($router_array['first'], $topSearchRoute)) { 1290 if (in_array($router_array['first'], $topSearchRoute)) {
1314 $router = $router_array['first']; 1291 $router = $router_array['first'];
1315 $page = (int)$router_array['last']; 1292 $page = (int)$router_array['last'];
@@ -1322,11 +1299,6 @@ function analysisRoute($pathInfo): array @@ -1322,11 +1299,6 @@ function analysisRoute($pathInfo): array
1322 } 1299 }
1323 } else { 1300 } else {
1324 if (isset($router_array['last'])) { 1301 if (isset($router_array['last'])) {
1325 - if (isset($router_array['other'])) {  
1326 - if ($router_array['other'] == "news" || $router_array['other'] == "blogs") {  
1327 - $routeType = $router_array['other'];  
1328 - }  
1329 - }  
1330 if ($router_array['last'] != "page") { 1302 if ($router_array['last'] != "page") {
1331 if (isset($router_array['other']) && in_array($router_array['other'], $topSearchRoute)) { 1303 if (isset($router_array['other']) && in_array($router_array['other'], $topSearchRoute)) {
1332 $router = $router_array['other']; 1304 $router = $router_array['other'];
@@ -1365,9 +1337,7 @@ function analysisRoute($pathInfo): array @@ -1365,9 +1337,7 @@ function analysisRoute($pathInfo): array
1365 $tlsLang = Translate::getTls(); 1337 $tlsLang = Translate::getTls();
1366 $isLang = in_array($lang, $tlsLang); 1338 $isLang = in_array($lang, $tlsLang);
1367 if (!$isLang) { 1339 if (!$isLang) {
1368 - $page = (int)$router;  
1369 $router = $lang; 1340 $router = $lang;
1370 - $lang = "";  
1371 } 1341 }
1372 } 1342 }
1373 } else { 1343 } else {
@@ -1375,22 +1345,8 @@ function analysisRoute($pathInfo): array @@ -1375,22 +1345,8 @@ function analysisRoute($pathInfo): array
1375 $isLang = in_array($lang, $tlsLang); 1345 $isLang = in_array($lang, $tlsLang);
1376 if (!$isLang) { 1346 if (!$isLang) {
1377 $router = $lang; 1347 $router = $lang;
1378 - $lang = "";  
1379 } 1348 }
1380 } 1349 }
1381 } 1350 }
1382 -  
1383 - if ($routeType == "news") {  
1384 - $source = "news";  
1385 - }  
1386 - if ($routeType == "blogs") {  
1387 - $source = "blog";  
1388 - }  
1389 -  
1390 - $routeArr["lang"] = $lang;  
1391 - $routeArr["router"] = $router;  
1392 - $routeArr["page"] = (int)$page;  
1393 - $routeArr["routeType"] = $routeType;  
1394 - $routeArr["source"] = $source;  
1395 - return $routeArr; 1351 + return $router;
1396 } 1352 }