Browse Source

fix: 钱包进入游戏增加mode

Before 6 tháng trước cách đây
mục cha
commit
23127368eb

+ 6 - 3
src/app/[locale]/(TabBar)/profile/ProfileHeader.tsx

@@ -1,5 +1,5 @@
 "use client";
-import { GameListRep } from "@/api/home";
+import { GameListRep, GameRequest } from "@/api/home";
 import { userInfoApi } from "@/api/login";
 import { UserInfoRep, UserVipInfo, Wallet, getUserTransferApi } from "@/api/user";
 import {
@@ -88,7 +88,7 @@ const WalletCard = (props: { userMoney: Wallet }) => {
 
     // 未完成游戏
     const gameModelRef = useRef<ModalProps>(null);
-    const game = useRef<GameListRep | null>(null);
+    const game = useRef<(GameListRep & { mode: GameRequest["mode"] }) | null>(null);
 
     // 彩金、免费币、重玩币提现到钱包操作
     const handleAcquire = async (wallet_type: number, transfer: boolean) => {
@@ -101,6 +101,7 @@ const WalletCard = (props: { userMoney: Wallet }) => {
         // 如果有未完成游戏 彩金游戏-2、免费游戏-3、重玩游戏-4
         if (wallet_type === 2 && data.play_list && data.play_list.length > 0) {
             game.current = data.play_list[0];
+            game.current!.mode = 1;
             gameModelRef.current?.onOpen();
             return;
         }
@@ -108,11 +109,13 @@ const WalletCard = (props: { userMoney: Wallet }) => {
         if (wallet_type === 3 && data.free_game_list && data.free_game_list.length > 0) {
             game.current = data.free_game_list[0];
             gameModelRef.current?.onOpen();
+            game.current!.mode = 2;
             return;
         }
 
         if (wallet_type === 4 && data.lose_game_list && data.lose_game_list.length > 0) {
             game.current = data.lose_game_list[0];
+            game.current!.mode = 3;
             gameModelRef.current?.onOpen();
             return;
         }
@@ -134,7 +137,7 @@ const WalletCard = (props: { userMoney: Wallet }) => {
     const { getGameUrl } = useGame();
     const goGame = () => {
         const current = game.current;
-        getGameUrl(current!, { id: current?.id + "" });
+        getGameUrl(current!, { id: current?.id + "", mode: game.current?.mode || 1 });
         tipsRef.current?.onClose();
         gameModelRef.current?.onClose();
     };

+ 3 - 3
src/components/ModalPopup/WalletDescribeModal/index.tsx

@@ -80,7 +80,7 @@ export const BonusContent = (props: { wallet: Wallet; handleAcquire?: any }) =>
             {handleAcquire && (
                 <a
                     className={`carteira-box ${wallet.is_point_transfer ? "active" : ""}`}
-                    onClick={() => handleAcquire(1, wallet.is_point_transfer)}
+                    onClick={() => handleAcquire(2, wallet.is_point_transfer)}
                 >
                     {t("carteira")}
                 </a>
@@ -111,7 +111,7 @@ export const FreeContent = (props: { wallet: Wallet; handleAcquire?: any }) => {
             {handleAcquire && (
                 <a
                     className={`carteira-box ${wallet.is_free_transfer ? "active" : ""}`}
-                    onClick={() => handleAcquire(2, wallet.is_free_transfer)}
+                    onClick={() => handleAcquire(3, wallet.is_free_transfer)}
                 >
                     {t("carteira")}
                 </a>
@@ -141,7 +141,7 @@ export const ReplayContent = (props: { wallet: Wallet; handleAcquire?: any }) =>
             {handleAcquire && (
                 <a
                     className={`carteira-box ${wallet.is_lose_transfer ? "active" : ""}`}
-                    onClick={() => handleAcquire(3, wallet.is_lose_transfer)}
+                    onClick={() => handleAcquire(4, wallet.is_lose_transfer)}
                 >
                     {t("carteira")}
                 </a>