Skip to content

Let's use AI to Earn!

登陆维妮塔

daoyian8ac24e9084a5
diff --git a/src/app/[lng]/accounts/components/AddAccountModal/index.tsx b/src/app/[lng]/accounts/components/AddAccountModal/index.tsx
index 08355be9..2514dd93 100644
--- a/src/app/[lng]/accounts/components/AddAccountModal/index.tsx
+++ b/src/app/[lng]/accounts/components/AddAccountModal/index.tsx
@@ -5,6 +5,7 @@ import { AccountPlatInfoArr, PlatType } from "@/app/config/platConfig";
import { SocialAccount } from "@/api/types/account.type";
import { kwaiSkip } from "@/app/[lng]/accounts/plat/kwaiLogin";
import { bilibiliSkip } from "../../plat/BilibiliLogin";
+import { youtubeSkip } from "../../plat/YoutubeLogin";
export interface IAddAccountModalRef {}
@@ -54,6 +55,10 @@ const AddAccountModal = memo(
case PlatType.BILIBILI:
bilibiliSkip(key);
+
+ case PlatType.YouTube:
+ console.log('key',key)
+ youtubeSkip(key);
}
}}
>
diff --git a/src/app/[lng]/accounts/plat/BilibiliLogin.ts b/src/app/[lng]/accounts/plat/BilibiliLogin.ts
index c4ced28d..349a2ebd 100644
--- a/src/app/[lng]/accounts/plat/BilibiliLogin.ts
+++ b/src/app/[lng]/accounts/plat/BilibiliLogin.ts
@@ -1,23 +1,9 @@
import qs from "qs";
import { PlatType } from "@/app/config/platConfig";
-import { requestPlatApi } from "@/utils/otherRequest";
-import { KwaiPlat } from "@/app/plat/platChildren/kwai/KwaiPlat";
-import { createOrUpdateAccountApi } from "@/api/account";
import { apiGetBilibiliLoginUrl, apiCheckBilibiliAuth } from "@/api/bilibili";
import { useAccountStore } from "@/store/account";
-export const kwaiAppId = "ks715790869885446758";
-export const kwaiAppSecret = "cqSvJvBSPJjd-4pBH_4N0Q";
-interface BilibiliLoginData {
- taskId: string;
- url: string;
-}
-
-interface AuthResponse {
- code: number;
- data: any;
-}
/**
* b站被点击
diff --git a/src/app/[lng]/accounts/plat/YoutubeLogin.ts b/src/app/[lng]/accounts/plat/YoutubeLogin.ts
new file mode 100644
index 00000000..fb0d854f
--- /dev/null
+++ b/src/app/[lng]/accounts/plat/YoutubeLogin.ts
@@ -0,0 +1,67 @@
+import qs from "qs";
+import { PlatType } from "@/app/config/platConfig";
+import { getYouTubeAuthUrlApi } from "@/api/youtube";
+import { useAccountStore } from "@/store/account";
+
+
+
+/**
+ * b站被点击
+ * @param platType
+ */
+export async function youtubeSkip(platType: PlatType) {
+ if (platType !== PlatType.YouTube) return;
+
+ const res: any = await getYouTubeAuthUrlApi('pc');
+ if (res?.code !== 0) return;
+ const url = res.data.url;
+ window.open(`${url}`);
+
+ // const bilibiliLoginRes = await bilibiliLogin(res.data.taskId);
+
+}
+
+// export function bilibiliLogin(taskId:any): Promise<any> {
+// return new Promise(async (resolve, reject) => {
+// try {
+
+// // 开始轮询检查授权状态
+// const checkAuthStatus = async () => {
+// try {
+// const authRess:any = await apiCheckBilibiliAuth(taskId);
+// let authRes = authRess.data;
+// if (authRes?.code === 0 && authRes?.data.status == 1) {
+// // message.success('授权成功');
+// // useAccountStore
+// const accountStore = useAccountStore.getState();
+// await accountStore.getAccountList();
+// resolve(authRes);
+// return true;
+// }
+// // return false;
+// } catch (error) {
+// console.error('检查授权状态失败:', error);
+// return false;
+// }
+// };
+
+// // 设置轮询间隔
+// const interval = setInterval(async () => {
+// const isSuccess = await checkAuthStatus();
+// if (isSuccess) {
+// clearInterval(interval);
+// }
+// }, 2000);
+
+// // 5分钟后自动停止轮询
+// setTimeout(() => {
+// clearInterval(interval);
+// // message.error('授权超时,请重试');
+// reject(new Error('授权超时'));
+// }, 5 * 60 * 1000);
+
+// } catch (e) {
+// reject(e);
+// }
+// });
+// }