year hace 1 mes
padre
commit
8034a08d52
Se han modificado 2 ficheros con 17 adiciones y 5 borrados
  1. 1 0
      src/api/depositsApi.ts
  2. 16 5
      src/app/[locale]/(TabBar)/deposit/page.tsx

+ 1 - 0
src/api/depositsApi.ts

@@ -76,6 +76,7 @@ export interface ShopItem {
         min: number;
         max: number;
     };
+    time_last: number;
 }
 
 export const getShopListApi = () => {

+ 16 - 5
src/app/[locale]/(TabBar)/deposit/page.tsx

@@ -34,18 +34,29 @@ const Deposit = () => {
     const getData = async () => {
         const res = await getShopListApi();
         if (res?.code === 200 && res?.data) {
-            setShopTypeList(res?.data || []);
+            const toData = res?.data.filter((item) => {
+                if (item.id === 1) {
+                    return item.time_last > 0;
+                }
+                return true;
+            });
+            const toUseData = toData || [];
+
+            setShopTypeList(toUseData);
 
             if (searchParams.get("target_id")) {
-                const act = res.data.findIndex(
+                let act = toUseData.findIndex(
                     (item: any) => item.id == searchParams.get("target_id")
                 );
+                if (act < 0) {
+                    act = 0;
+                }
                 setActIdx(act);
-                doChangeChannel(res?.data[act]?.pay_channel[0]);
+                doChangeChannel(toUseData[act]?.pay_channel[0]);
                 return;
             }
-            if (res?.data[actIdx]?.pay_channel[0]) {
-                doChangeChannel(res?.data[actIdx]?.pay_channel[0]);
+            if (toUseData[actIdx]?.pay_channel[0]) {
+                doChangeChannel(toUseData[actIdx]?.pay_channel[0]);
             }
         }
     };