Ver Fonte

fix: 456 多人 【bcwin网站】优化)提现操作有未完成的彩金游戏提示

Before há 7 meses atrás
pai
commit
5e1c67068e

+ 2 - 2
.env.development

@@ -1,7 +1,7 @@
 # 环境
 #baseurl
-#NEXT_PUBLIC_BASE_URL=http://192.168.0.84:8800
-NEXT_PUBLIC_BASE_URL=https://server-webapi.tiktokjakjkl.icu
+NEXT_PUBLIC_BASE_URL=http://192.168.0.84:8800
+#NEXT_PUBLIC_BASE_URL=https://server-webapi.tiktokjakjkl.icu
 #share link
 NEXT_PUBLIC_SHARE_URL=http://192.168.0.84:3000
 

+ 2 - 2
.env.local

@@ -1,7 +1,7 @@
 # 环境
 #baseurl
-#NEXT_PUBLIC_BASE_URL=http://192.168.0.84:8800
-NEXT_PUBLIC_BASE_URL=https://server-webapi.tiktokjakjkl.icu
+NEXT_PUBLIC_BASE_URL=http://192.168.0.84:8800
+#NEXT_PUBLIC_BASE_URL=https://server-webapi.tiktokjakjkl.icu
 #share link
 NEXT_PUBLIC_SHARE_URL=http://192.168.0.84:3000
 

+ 1 - 1
src/api/home.ts

@@ -173,7 +173,7 @@ export interface GameRequest {
      * 用于主页按钮和重新导向 URL (部份游戏提供此功能)
      */
     return_url?: string;
-    mode: 1 | 2 | 3;
+    mode?: 1 | 2 | 3;
 }
 export const getGameDetailApi = (data: GameRequest) => {
     return server.post<GameInfo>({

+ 2 - 1
src/api/login.ts

@@ -1,3 +1,4 @@
+import { UserInfoRep } from "@/api/user";
 import { server } from "@/utils/client";
 
 export interface loginParams {
@@ -37,7 +38,7 @@ export const loginApi = (data: loginParams) => {
 };
 
 export const userInfoApi = () => {
-    return server.request<any>({
+    return server.request<UserInfoRep>({
         url: "/v1/api/user/user_info",
         method: "POST",
     });

+ 4 - 1
src/api/user.ts

@@ -1,3 +1,4 @@
+import { GameListRep } from "@/api/home";
 import { server } from "@/utils/client";
 
 // 前台用户绑定手机号
@@ -122,10 +123,12 @@ export interface UserInfoRep {
      * 用户电话号码
      */
     user_phone?: string;
+    // 正在进行中的游戏
+    play_list?: GameListRep[];
 }
 // 前台用户获取信息
 export const getUserInfoApi = () => {
-    return server.post<any>({
+    return server.post<UserInfoRep>({
         url: "/v1/api/user/user_info",
     });
 };

+ 1 - 1
src/app/[locale]/(TabBar)/[[...share]]/_home/HomePromotion.tsx

@@ -53,7 +53,7 @@ const HomePromotion: FC<Props> = (props) => {
     if (data && data.length === 0) return null;
     return (
         <div>
-            <Mask visible={visible} onMaskClick={(e) => closeHandler(e)}>
+            <Mask visible={visible} onMaskClick={(e) => closeHandler(e)} opacity={"thick"}>
                 <div
                     className={
                         "promotion-swiper absolute left-1/2 top-[18%] max-w-[3.139rem]" +

+ 2 - 3
src/app/[locale]/(navbar)/recharge/page.tsx

@@ -12,7 +12,7 @@ const getActivityApi = () => {
             method: "post",
         })
         .then((res) => {
-            return !Array.isArray(res.data) ? res.data.first_pay : [];
+            return !Array.isArray(res.data) ? res.data.first_pay || [] : [];
         })
         .catch((e) => {
             return [];
@@ -20,12 +20,11 @@ const getActivityApi = () => {
 };
 const Page = async () => {
     const activities = await getActivityApi();
+    const config = await getConfigApi();
     /// 如果数组不为空, 则有活动
     const hasEndTimeActivities = activities.length > 0;
     const current = activities.find((item) => item.end_time > 0)?.end_time;
     const endtime = current ? current * 1000 : 0;
-
-    const config = await getConfigApi();
     return (
         <>
             <div className={"flex flex-col [min-height:calc(100%-0.81rem)]"}>

+ 40 - 7
src/app/[locale]/(navbar)/withdraw/WithdrawWidget.tsx

@@ -1,4 +1,6 @@
 "use client";
+import { GameListRep } from "@/api/home";
+import { userInfoApi } from "@/api/login";
 import { Wallet } from "@/api/user";
 import { ChannelType, getWithDrawApi, WithDrawType } from "@/api/withdraw";
 import { clearWallet } from "@/app/[locale]/(navbar)/withdraw/actions";
@@ -6,6 +8,7 @@ import Box from "@/components/Box";
 import ButtonOwn from "@/components/ButtonOwn";
 import Empty from "@/components/Empty";
 import TipsModal, { ModalProps } from "@/components/TipsModal";
+import useGame from "@/hooks/useGame";
 import { useUserInfoStore } from "@/stores/useUserInfoStore";
 import { useWalletStore } from "@/stores/useWalletStore";
 import { isEmail } from "@/utils";
@@ -21,6 +24,7 @@ import "./page.scss";
 interface Props {
     channels: WithDrawType[];
     wallet: Wallet;
+    playlist?: GameListRep[];
 }
 
 export enum ChannelEnum {
@@ -107,12 +111,16 @@ const MobileField: FC<MobileFieldProps> = (props) => {
 const WithdrawWidget: FC<Props> = (props) => {
     const t = useTranslations();
     const { channels, wallet } = props;
+    const { getGameUrl } = useGame();
 
     const score = useWalletStore((state) => state.score)!;
 
     const withdrawRef = useRef<ModalProps>(null);
     // 积分
     const scoreRef = useRef<ModalProps>(null);
+    // 未完成游戏
+    const gameModelRef = useRef<ModalProps>(null);
+    const game = useRef<GameListRep | null>(null);
     // 表单
     const formRef = useRef<FormInstance>(null);
 
@@ -178,8 +186,14 @@ const WithdrawWidget: FC<Props> = (props) => {
 
     const onFinish = async (value: any) => {
         const params = { ...value, ...value.channel, amount: +value.amount };
-        // const result = await getUserInfoApi();
-        // console.log(`🚀🚀🚀🚀🚀-> in WithdrawWidget.tsx on 183`, result);
+
+        const { data } = await userInfoApi();
+
+        if (data.play_list && data.play_list.length > 0) {
+            game.current = data.play_list[0];
+            gameModelRef.current?.onOpen();
+            return;
+        }
         paramsTarget.current = params;
         if (
             flatPoint(wallet.target_point_rollover - wallet.current_point_rollover) !== 0 &&
@@ -189,7 +203,6 @@ const WithdrawWidget: FC<Props> = (props) => {
             setIsPay(true);
             return;
         }
-        console.log(`🚀🚀🚀🚀🚀-> in WithdrawWidget.tsx on 185`, value);
         const withResult = await getWithDrawApi(params).catch((error) => {
             Toast.show(t(`code.${error.data.code}`));
         });
@@ -199,10 +212,10 @@ const WithdrawWidget: FC<Props> = (props) => {
         await clearWallet();
     };
 
-    const currentPoint =
-        percentage(wallet.current_point_rollover, wallet.target_point_rollover) !== 100
-            ? 0
-            : wallet.point;
+    const goGame = () => {
+        const current = game.current;
+        getGameUrl(current!, { id: current?.id + "" });
+    };
 
     if (!activeWallet) return <Empty />;
 
@@ -517,6 +530,26 @@ const WithdrawWidget: FC<Props> = (props) => {
                     </li>
                 </ul>
             </TipsModal>
+            {/*   提现拦截 */}
+            <TipsModal title={"Tips"} ref={gameModelRef}>
+                <p className={"text-left text-[0.12rem] font-medium text-[#666]"}>
+                    Atualmente, existem jogos de bônus inacabados que não podem iniciar saques.
+                </p>
+
+                <div className={"mt-[0.0694rem] flex justify-center"}>
+                    <Button
+                        color={"primary"}
+                        className={"mx-auto"}
+                        style={{
+                            "--background-color": "var(--primary-color)",
+                            "--border-color": "var(--primary-color)",
+                        }}
+                        onClick={goGame}
+                    >
+                        para jogos
+                    </Button>
+                </div>
+            </TipsModal>
         </>
     );
 };

+ 15 - 2
src/app/[locale]/(navbar)/withdraw/page.tsx

@@ -1,3 +1,4 @@
+import { UserInfoRep } from "@/api/user";
 import { getMoneyApi } from "@/api/userWallt";
 import { WithDrawType } from "@/api/withdraw";
 import { server } from "@/utils/server";
@@ -20,11 +21,23 @@ const getWithdrawApi = async () => {
             return [];
         });
 };
-
+const getUserInfo = async () => {
+    return server
+        .request<UserInfoRep>({
+            url: "/v1/api/user/user_info",
+            method: "POST",
+            next: { revalidate: 0 },
+        })
+        .then((res) => {
+            if (res.code === 200) return res.data;
+            return {};
+        });
+};
 const Page = async () => {
     const data = await getWithdrawApi();
     const wallet = await getMoneyApi();
-    return <WithdrawWidget channels={data} wallet={wallet} />;
+    const userInfo = await getUserInfo();
+    return <WithdrawWidget channels={data} wallet={wallet} playlist={userInfo.play_list} />;
 };
 
 export default Page;

+ 9 - 33
src/components/Card/Card.tsx

@@ -1,11 +1,11 @@
 "use client";
-import { Category, GameListRep, getGameDetailApi } from "@/api/home";
+import { Category, GameListRep } from "@/api/home";
 import Box from "@/components/Box";
+import useGame from "@/hooks/useGame";
 import { useRouter } from "@/i18n/routing";
 import { useWalletStore } from "@/stores/useWalletStore";
-import { brandList } from "@/utils/constant";
 import { getToken } from "@/utils/Cookies";
-import { Button, Popup, Toast } from "antd-mobile";
+import { Button, Popup } from "antd-mobile";
 import { useTranslations } from "next-intl";
 import { FC, PropsWithChildren, ReactNode, useRef, useState } from "react";
 import styles from "./style.module.scss";
@@ -15,13 +15,13 @@ export interface CardProps {
     groupType?: Category["bet_type"];
 }
 
-const whiteUrls = ["192.168.0.84", "localhost", "192.168.0.46"];
 const Card: FC<PropsWithChildren<CardProps>> = (props) => {
     const { render, item, groupType } = props;
 
+    const { getGameUrl } = useGame();
+
     const t = useTranslations("Game");
-    const tcode = useTranslations();
-    const brandRef = useRef<string>("");
+    const brandRef = useRef<GameListRep | null>(null);
     const wallet = useWalletStore((state) => state.wallet);
 
     const [visible, setVisible] = useState(false);
@@ -30,7 +30,7 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
     const token = getToken();
     const handler = (game: GameListRep) => {
         setVisible(true);
-        brandRef.current = brandList.find((item) => item.gid === game.game_id)?.brand ?? "";
+        brandRef.current = game;
     };
     const playGameHandler = (game: GameListRep) => {
         if (!token) {
@@ -41,36 +41,12 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
             router.push("/deposit");
             return;
         }
-        Toast.show({
-            icon: "loading",
-            duration: 0,
-            maskStyle: { zIndex: 99999, background: "rgba(0,0,0,0.5)" },
-        });
+
         const params = {
             id: game.id + "",
             mode: groupType!,
         };
-        getGameDetailApi(params)
-            .then((res) => {
-                Toast.clear();
-                if (res.data && res.data.game_url) {
-                    const url = `${res.data?.game_url}&brand=${brandRef.current}&return_url=${process.env.NEXT_PUBLIC_SHARE_URL}`;
-                    const protocol = new URL(url).protocol;
-                    if (
-                        whiteUrls.indexOf(window.location.hostname) !== -1 ||
-                        protocol === "https:"
-                    ) {
-                        router.push(`/game?${url}`);
-                    } else {
-                        window.open(url);
-                    }
-                } else {
-                    Toast.show(tcode("code.500"));
-                }
-            })
-            .catch((error) => {
-                Toast.clear();
-            });
+        getGameUrl(brandRef.current!, params);
     };
     return (
         <>

+ 45 - 0
src/hooks/useGame.tsx

@@ -0,0 +1,45 @@
+import { GameListRep, GameRequest, getGameDetailApi } from "@/api/home";
+import { useRouter } from "@/i18n/routing";
+import { brandList } from "@/utils/constant";
+import { Toast } from "antd-mobile";
+import { useTranslations } from "next-intl";
+// 地址白名单
+const whiteUrls = ["192.168.0.84", "localhost", "192.168.0.46"];
+const useGame = () => {
+    const router = useRouter();
+    const t = useTranslations();
+    const getGameUrl = (game: GameListRep, params: GameRequest) => {
+        Toast.show({
+            icon: "loading",
+            duration: 0,
+            maskStyle: { zIndex: 99999, background: "rgba(0,0,0,0.5)" },
+        });
+        const brand = brandList.find((item) => item.gid === game.game_id)?.brand ?? "";
+        getGameDetailApi(params)
+            .then((res) => {
+                Toast.clear();
+                if (res.data && res.data.game_url) {
+                    const url = `${res.data?.game_url}&brand=${brand}&return_url=${process.env.NEXT_PUBLIC_SHARE_URL}`;
+                    const protocol = new URL(url).protocol;
+                    if (
+                        whiteUrls.indexOf(window.location.hostname) !== -1 ||
+                        protocol === "https:"
+                    ) {
+                        router.push(`/game?${url}`);
+                    } else {
+                        window.open(url);
+                    }
+                } else {
+                    Toast.show(t("code.500"));
+                }
+            })
+            .catch((error) => {
+                Toast.clear();
+            });
+    };
+    return {
+        getGameUrl: getGameUrl,
+    };
+};
+
+export default useGame;