xiaolin.fu пре 3 месеци
родитељ
комит
62cde0b96e
1 измењених фајлова са 6 додато и 2 уклоњено
  1. 6 2
      src/hooks/useGame.tsx

+ 6 - 2
src/hooks/useGame.tsx

@@ -48,8 +48,9 @@ const useGame = () => {
 
                     // 获取游戏的品牌
                     const categoryName:any = game?.category_name;
+                    const gameId= game?.game_id;
 
-                    console.log('category_name222',game,categoryName.toLowerCase())
+                    console.log('category_name222',gameId,/^1\d{5}$/.test(gameId))
 
                     // 然后是文档对象
                     if (game_url.indexOf("!doctype") !== -1) {
@@ -61,8 +62,11 @@ const useGame = () => {
                     const url = `${encodeURI(res.data.game_url)}&return_url=${encodeURI(window.location.href.replace(pathname, ""))}&category_name=${game.provider}`;
 
                     // 如果是pp游戏,则当前窗口打开新的地址,不需要加return_url
-                    if(categoryName?.toLowerCase() === 'pp'){
+                    // gid 如果开头是1的6位数的数字,则认为是pp游戏
+                    // if(categoryName?.toLowerCase() === 'pp'){
+                    if(/^1\d{5}$/.test(gameId)){
                       const ppUrl = `${encodeURI(res.data.game_url)}&category_name=${game.provider}`;
+                      console.log('category_name333',ppUrl)
                       window.open(ppUrl,'_self');
                       return
                     }