ソースを参照

fix: 增加手机号限制,pixel充值上报

ansoni 4 ヶ月 前
コミット
588dc009a7

+ 1 - 1
.env.local

@@ -1,7 +1,7 @@
 # 环境
 #baseurl
 # NEXT_PUBLIC_BASE_URL=http://192.168.0.71:8800
-NEXT_PUBLIC_BASE_URL=https://br-api.tiktokjakjkl.icu
+NEXT_PUBLIC_BASE_URL=http://192.168.0.84:8800
 #NEXT_PUBLIC_BASE_URL=https://3rd-api.tiktokjakjkl.icu
 #share link
 NEXT_PUBLIC_SHARE_URL=http://192.168.0.84:3000

+ 1 - 0
messages/br.json

@@ -429,6 +429,7 @@
     "phone":"Número de Celular",
     "phoneReg": "O número de telefone não pode estar vazio",
     "phoneMinReg": "Digite o número de telefone correto",
+    "phoneRules": "Número errado",
     "password": "Senha",
     "passwordReg": "A senha não pode estar vazia",
     "newPwd": "Por favor, digite uma nova senha",

+ 1 - 0
messages/en.json

@@ -429,6 +429,7 @@
     "phone":"Phone Number",
     "phoneReg": "The phone number cannot be empty",
     "phoneMinReg": "Please enter the correct phone number",
+    "phoneRules": "Code Error",
     "password": "Password",
     "passwordReg": "The password cannot be empty",
     "newPwd": "Please enter a new password",

+ 30 - 0
src/api/user.ts

@@ -334,3 +334,33 @@ export const getUserTransferApi = (data: { wallet_type: number }) => {
         data,
     });
 };
+
+/**
+ * 获取用户最新充值订单信息
+ *   POST /v1/api/user/user_deposit_latest
+ *   接口ID:265942160
+ *   接口地址:https://app.apifox.com/link/project/4790544/apis/api-265942160
+ */
+export interface DepositsLatestRep {
+    /**
+     * 是否首充: 1是 2否
+     */
+    is_first_pay: number;
+    /**
+     * 是否成功: 1是 2否
+     */
+    is_success: number;
+    /**
+     * 订单编号
+     */
+    order_id: string;
+    /**
+     * 订单状态
+     */
+    status: number;
+}
+export const getUserDepositApi = () => {
+    return server.post<DepositsLatestRep>({
+        url: "/v1/api/user/user_deposit_latest",
+    });
+};

+ 4 - 1
src/app/[locale]/(enter)/components/Form/index.tsx

@@ -299,7 +299,10 @@ const FormComponent: FC<Props> = (props) => {
 
     // 手机号验证规则
     const checkMobile = (_: any, value: any) => {
-        if (value.realValue.length < 10) {
+        const reg = /^.{2}9/;
+        if (!reg.test(value.realValue)) {
+            return Promise.reject(new Error(t("form.phoneRules")));
+        } else if (value.realValue.length < 10) {
             return Promise.reject(new Error(t("form.phoneMinReg")));
         } else {
             return Promise.resolve();

+ 1 - 1
src/app/[locale]/(enter)/login/page.tsx

@@ -29,7 +29,7 @@ const Login = async () => {
                             href={item.url}
                             className={
                                 "flex h-[0.54rem] w-[0.54rem] items-center justify-center rounded-[50%]" +
-                                " bg-gradient-to-t from-[#ff611b] to-[#ffcf35]"
+                                " mb-[0.2778rem] bg-gradient-to-t from-[#ff611b] to-[#ffcf35]"
                             }
                             target={"_blank"}
                         >

+ 2 - 1
src/app/[locale]/(enter)/register/page.tsx

@@ -33,7 +33,8 @@ const Register: FC<Props> = async () => {
                             key={index}
                             href={item.url}
                             className={
-                                "flex h-[0.54rem] w-[0.54rem] items-center justify-center rounded-[50%]" +
+                                "mb-[0.2778rem] flex h-[0.54rem] w-[0.54rem] items-center justify-center" +
+                                " rounded-[50%]" +
                                 " bg-gradient-to-t from-[#ff611b] to-[#ffcf35]"
                             }
                             target={"_blank"}

+ 4 - 1
src/app/[locale]/(enter)/resetPhone/page.tsx

@@ -47,7 +47,10 @@ const ResetPhone: FC<Props> = () => {
     };
 
     const checkMobile = (_: any, value: any) => {
-        if (value.realValue.length < 10) {
+        const reg = /^.{2}9/;
+        if (!reg.test(value.realValue)) {
+            return Promise.reject(new Error(t("form.phoneRules")));
+        } else if (value.realValue.length < 10) {
             return Promise.reject(new Error(tCode("form.phoneMinReg")));
         } else {
             return Promise.resolve();

+ 2 - 2
src/components/Card/Card.tsx

@@ -42,7 +42,7 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
         element.current = document.getElementById("app");
     }, []);
     const playGameHandler = async (game: GameListRep) => {
-        const type = getCoinType(game, groupType);
+        const type = getCoinType(game, groupType!);
 
         if (!token) {
             router.push("/login?redirect=/");
@@ -112,7 +112,7 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
         });
     };
 
-    const demoPlayGameHandler = (game) => {
+    const demoPlayGameHandler = (game: GameListRep) => {
         const params = {
             id: game.id + "",
             demo: game.demo,

+ 24 - 1
src/components/Footer/index.tsx

@@ -8,7 +8,8 @@ import { useTranslations } from "next-intl";
 import { ChangeEvent, FC, ReactNode, useEffect } from "react";
 import "./style.scss";
 
-import { getUserMoneyApi } from "@/api/user";
+import { getUserDepositApi, getUserMoneyApi } from "@/api/user";
+import { useEventPoint } from "@/hooks/useEventPoint";
 import { useGlobalNoticeStore } from "@/stores/useGlobalNoticeStore";
 import { useWalletStore } from "@/stores/useWalletStore";
 import { useRequest } from "ahooks";
@@ -53,6 +54,7 @@ const tabList = [
 const Footer: FC = () => {
     const token = getToken();
     const t = useTranslations("navBar");
+    const { eventPurchase, eventFirstDeposit } = useEventPoint();
 
     const pathname = usePathname();
 
@@ -107,12 +109,33 @@ const Footer: FC = () => {
             setWallet(res.data);
         },
     });
+    const { run: depositRun } = useRequest(getUserDepositApi, {
+        pollingInterval: 5000,
+        pollingWhenHidden: true,
+        pollingErrorRetryCount: 3,
+        staleTime: 5000,
+        manual: true,
+        refreshDeps: [token],
+        onError: (error) => {},
+        onSuccess: (res) => {
+            if (Object.keys(res.data).length < 0) return;
+
+            if (res.data.is_first_pay) {
+                eventFirstDeposit();
+                return;
+            }
+            if (res.data.is_success) {
+                eventPurchase();
+            }
+        },
+    });
 
     useEffect(() => {
         if (getToken()) {
             run();
             walletRun();
             userRun();
+            depositRun();
         }
     }, []);