Skip to content

Let's use AI to Earn!

feat: 快手登录接入

gaoSir1f84ad071b94
diff --git a/.env b/.env
index dd8c5281..e2339e45 100644
--- a/.env
+++ b/.env
@@ -1,2 +1,8 @@
-# baseURL 代理地址
-NEXT_PUBLIC_API_URL_PROXY="/baseUrlProxy/"
\ No newline at end of file
+# baseURL 代理字段
+NEXT_PUBLIC_API_URL_PROXY="/baseUrlProxy/"
+
+# 快手API代理字段
+NEXT_PUBLIC_API_PROXY="/kuaishoApi/"
+# 快手API上传代理字段
+NEXT_PUBLIC_API_UPLOAD_PROXY="/kuaishoUploadApi/"
+
diff --git a/next.config.mjs b/next.config.mjs
index 6b655809..32447398 100644
--- a/next.config.mjs
+++ b/next.config.mjs
@@ -43,17 +43,13 @@ nextConfig.rewrites = async () => {
destination: `${process.env.NEXT_PUBLIC_API_URL}:path*`,
},
{
- source: `/xhsXS/:path*`,
- destination: `http://116.62.154.231:7879/:path*`,
+ source: `${process.env.NEXT_PUBLIC_API_PROXY}:path*`,
+ destination: `https://open.kuaishou.com/:path*`,
},
{
- source: `/xiaohongshu/:path*`,
- destination: `https://edith.xiaohongshu.com/api/:path*`,
+ source: `${process.env.NEXT_PUBLIC_API_UPLOAD_PROXY}:path*`,
+ destination: `https://upload.kuaishouzt.com/:path*`,
},
- {
- source: `/platapiProxy/:path*`,
- destination: `https://platapi.yikart.cn/api/:path*`
- }
];
return {
diff --git a/package-lock.json b/package-lock.json
index 6a0569d6..10541c8e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -16,6 +16,7 @@
"@szhsin/react-menu": "^4.4.1",
"accept-language": "3.0.20",
"antd": "^5.25.2",
+ "axios": "^1.9.0",
"cookies-next": "^4.3.0",
"cropperjs": "^1.6.2",
"dayjs": "^1.11.13",
@@ -26,6 +27,7 @@
"lodash": "^4.17.21",
"next": "14.2.29",
"next-sitemap": "^4.2.3",
+ "qs": "^6.14.0",
"react": "^18",
"react-dom": "^18",
"react-i18next": "15.4.1",
@@ -39,6 +41,7 @@
"@eslint/eslintrc": "^3",
"@types/lodash": "^4.17.17",
"@types/node": "^20",
+ "@types/qs": "^6.14.0",
"@types/react": "^18",
"@types/react-dom": "^18",
"@typescript-eslint/eslint-plugin": "^8.0.0",
@@ -1309,6 +1312,13 @@
"devOptional": true,
"license": "MIT"
},
+ "node_modules/@types/qs": {
+ "version": "6.14.0",
+ "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.14.0.tgz",
+ "integrity": "sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/react": {
"version": "18.3.22",
"resolved": "https://registry.npmmirror.com/@types/react/-/react-18.3.22.tgz",
@@ -2187,6 +2197,12 @@
"node": ">= 0.4"
}
},
+ "node_modules/asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
+ "license": "MIT"
+ },
"node_modules/available-typed-arrays": {
"version": "1.0.7",
"resolved": "https://registry.npmmirror.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz",
@@ -2213,6 +2229,17 @@
"node": ">=4"
}
},
+ "node_modules/axios": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.9.0.tgz",
+ "integrity": "sha512-re4CqKTJaURpzbLHtIi6XpDv20/CnpXOtjRY5/CU32L8gU8ek9UIivcfvSWvmKEngmVbrUtPpdDwWDWL7DNHvg==",
+ "license": "MIT",
+ "dependencies": {
+ "follow-redirects": "^1.15.6",
+ "form-data": "^4.0.0",
+ "proxy-from-env": "^1.1.0"
+ }
+ },
"node_modules/axobject-query": {
"version": "4.1.0",
"resolved": "https://registry.npmmirror.com/axobject-query/-/axobject-query-4.1.0.tgz",
@@ -2313,7 +2340,6 @@
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
- "dev": true,
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
@@ -2327,7 +2353,6 @@
"version": "1.0.4",
"resolved": "https://registry.npmmirror.com/call-bound/-/call-bound-1.0.4.tgz",
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
- "dev": true,
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
@@ -2484,6 +2509,18 @@
"node": ">=0.1.90"
}
},
+ "node_modules/combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "license": "MIT",
+ "dependencies": {
+ "delayed-stream": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
"node_modules/commander": {
"version": "9.5.0",
"resolved": "https://registry.npmmirror.com/commander/-/commander-9.5.0.tgz",
@@ -2737,6 +2774,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
"node_modules/detect-libc": {
"version": "1.0.3",
"resolved": "https://registry.npmmirror.com/detect-libc/-/detect-libc-1.0.3.tgz",
@@ -2849,7 +2895,6 @@
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz",
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
- "dev": true,
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.1",
@@ -2960,7 +3005,6 @@
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz",
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
@@ -2970,7 +3014,6 @@
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
@@ -3008,7 +3051,6 @@
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
- "dev": true,
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0"
@@ -3021,7 +3063,6 @@
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
"integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
- "dev": true,
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
@@ -3737,6 +3778,26 @@
"@fluent/syntax": "0.19.0"
}
},
+ "node_modules/follow-redirects": {
+ "version": "1.15.9",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
+ "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/RubenVerborgh"
+ }
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=4.0"
+ },
+ "peerDependenciesMeta": {
+ "debug": {
+ "optional": true
+ }
+ }
+ },
"node_modules/for-each": {
"version": "0.3.5",
"resolved": "https://registry.npmmirror.com/for-each/-/for-each-0.3.5.tgz",
@@ -3753,6 +3814,22 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/form-data": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.3.tgz",
+ "integrity": "sha512-qsITQPfmvMOSAdeyZ+12I1c+CKSstAFAwu+97zrnWAbIr5u8wfsExUzCesVLC8NgHuRUqNN4Zy6UPWUTRGslcA==",
+ "license": "MIT",
+ "dependencies": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "es-set-tostringtag": "^2.1.0",
+ "hasown": "^2.0.2",
+ "mime-types": "^2.1.12"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -3764,7 +3841,6 @@
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
- "dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
@@ -3805,7 +3881,6 @@
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
- "dev": true,
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
@@ -3830,7 +3905,6 @@
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/get-proto/-/get-proto-1.0.1.tgz",
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
- "dev": true,
"license": "MIT",
"dependencies": {
"dunder-proto": "^1.0.1",
@@ -3975,7 +4049,6 @@
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz",
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
@@ -4053,7 +4126,6 @@
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.1.0.tgz",
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
@@ -4066,7 +4138,6 @@
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
"integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
- "dev": true,
"license": "MIT",
"dependencies": {
"has-symbols": "^1.0.3"
@@ -4082,7 +4153,6 @@
"version": "2.0.2",
"resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
- "dev": true,
"license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
@@ -4950,7 +5020,6 @@
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
@@ -4978,6 +5047,27 @@
"node": ">=8.6"
}
},
+ "node_modules/mime-db": {
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+ "license": "MIT",
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.2.tgz",
@@ -5212,7 +5302,6 @@
"version": "1.13.4",
"resolved": "https://registry.npmmirror.com/object-inspect/-/object-inspect-1.13.4.tgz",
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
@@ -5627,6 +5716,12 @@
"react-is": "^16.13.1"
}
},
+ "node_modules/proxy-from-env": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
+ "license": "MIT"
+ },
"node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmmirror.com/punycode/-/punycode-2.3.1.tgz",
@@ -5637,6 +5732,21 @@
"node": ">=6"
}
},
+ "node_modules/qs": {
+ "version": "6.14.0",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz",
+ "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "side-channel": "^1.1.0"
+ },
+ "engines": {
+ "node": ">=0.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/queue-microtask": {
"version": "1.2.3",
"resolved": "https://registry.npmmirror.com/queue-microtask/-/queue-microtask-1.2.3.tgz",
@@ -6741,7 +6851,6 @@
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/side-channel/-/side-channel-1.1.0.tgz",
"integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
- "dev": true,
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
@@ -6761,7 +6870,6 @@
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/side-channel-list/-/side-channel-list-1.0.0.tgz",
"integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",
- "dev": true,
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
@@ -6778,7 +6886,6 @@
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/side-channel-map/-/side-channel-map-1.0.1.tgz",
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
- "dev": true,
"license": "MIT",
"dependencies": {
"call-bound": "^1.0.2",
@@ -6797,7 +6904,6 @@
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
- "dev": true,
"license": "MIT",
"dependencies": {
"call-bound": "^1.0.2",
diff --git a/package.json b/package.json
index aa81cb94..92368227 100644
--- a/package.json
+++ b/package.json
@@ -23,6 +23,7 @@
"@szhsin/react-menu": "^4.4.1",
"accept-language": "3.0.20",
"antd": "^5.25.2",
+ "axios": "^1.9.0",
"cookies-next": "^4.3.0",
"cropperjs": "^1.6.2",
"dayjs": "^1.11.13",
@@ -33,6 +34,7 @@
"lodash": "^4.17.21",
"next": "14.2.29",
"next-sitemap": "^4.2.3",
+ "qs": "^6.14.0",
"react": "^18",
"react-dom": "^18",
"react-i18next": "15.4.1",
@@ -46,6 +48,7 @@
"@eslint/eslintrc": "^3",
"@types/lodash": "^4.17.17",
"@types/node": "^20",
+ "@types/qs": "^6.14.0",
"@types/react": "^18",
"@types/react-dom": "^18",
"@typescript-eslint/eslint-plugin": "^8.0.0",
diff --git a/src/api/types/account.type.ts b/src/api/types/account.type.ts
index 82739168..4e1fc297 100644
--- a/src/api/types/account.type.ts
+++ b/src/api/types/account.type.ts
@@ -4,7 +4,9 @@ import { PlatType } from "@/app/config/platConfig";
export interface SocialAccount {
id: number;
type: PlatType;
- loginCookie: string;
+ loginCookie?: string;
+ access_token?: string;
+ refresh_token?: string;
loginTime: string;
uid: string;
account: string;
diff --git a/src/app/[lng]/accounts/add/accountAdd.module.scss b/src/app/[lng]/accounts/add/accountAdd.module.scss
new file mode 100644
index 00000000..190b9d3f
--- /dev/null
+++ b/src/app/[lng]/accounts/add/accountAdd.module.scss
@@ -0,0 +1,27 @@
+.accountAdd {
+ @include height_100vh;
+ width: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+
+ :global {
+ .accountAdd-success, .accountAdd-fail {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ color: var(--success-color);
+ .anticon {
+ font-size: 60px;
+ margin-bottom: 10px;
+ }
+ &-text {
+ font-size: var(--fs-lg);
+ }
+ }
+ .accountAdd-fail {
+ color: var(--error-color);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/app/[lng]/accounts/add/page.tsx b/src/app/[lng]/accounts/add/page.tsx
new file mode 100644
index 00000000..b5e74159
--- /dev/null
+++ b/src/app/[lng]/accounts/add/page.tsx
@@ -0,0 +1,78 @@
+"use client";
+
+import { useEffect, useState } from "react";
+import styles from "./accountAdd.module.scss";
+import { useRouter, useSearchParams } from "next/navigation";
+import { PlatType } from "@/app/config/platConfig";
+import { kwaiLogin } from "@/app/[lng]/accounts/plat/kwaiLogin";
+import { Spin } from "antd";
+import {CheckCircleOutlined, CloseCircleOutlined} from "@ant-design/icons";
+
+enum LoginStatusEnum {
+ // 加载中
+ Loading = 0,
+ // 失败
+ Fail = 1,
+ // 成功
+ Success = 2,
+}
+
+export default function Page() {
+ const searchParams = useSearchParams();
+ const router = useRouter();
+ const [status, setStatus] = useState(LoginStatusEnum.Loading);
+
+ useEffect(() => {
+ login();
+ }, []);
+
+ const login = async () => {
+ let isSuccess = true;
+
+ switch (searchParams.get("platType") as PlatType) {
+ case PlatType.KWAI:
+ const res = await kwaiLogin(searchParams.get("code") as string).catch(
+ () => (isSuccess = false),
+ );
+ if (!res) isSuccess = false;
+ break;
+ default:
+ console.error("没有 search 参数:platType");
+ router.replace("/accounts");
+ return;
+ }
+
+ if (isSuccess) {
+ setStatus(LoginStatusEnum.Success);
+ setTimeout(() => {
+ router.replace("/accounts");
+ }, 500);
+ } else {
+ setStatus(LoginStatusEnum.Fail);
+ }
+ };
+
+ return (
+ <Spin
+ wrapperClassName={styles.accountAdd}
+ spinning={status === LoginStatusEnum.Loading}
+ tip={status === LoginStatusEnum.Loading ? "正在添加账户..." : ""}
+ >
+ {" "}
+ {status === LoginStatusEnum.Success && (
+ <div className="accountAdd-success">
+ <CheckCircleOutlined />
+ <div className="accountAdd-success-text">账号添加成功</div>
+ </div>
+ )}
+ {status === LoginStatusEnum.Fail && (
+ <div className="accountAdd-fail">
+ <CloseCircleOutlined />
+ <div className="accountAdd-success-text">
+ 账号添加失败,请稍后重试
+ </div>
+ </div>
+ )}
+ </Spin>
+ );
+}
diff --git a/src/app/[lng]/accounts/components/AddAccountModal/index.tsx b/src/app/[lng]/accounts/components/AddAccountModal/index.tsx
index 3441aa7a..838bf7b5 100644
--- a/src/app/[lng]/accounts/components/AddAccountModal/index.tsx
+++ b/src/app/[lng]/accounts/components/AddAccountModal/index.tsx
@@ -1,8 +1,9 @@
-import { ForwardedRef, forwardRef, memo, useState } from "react";
+import { ForwardedRef, forwardRef, memo } from "react";
import styles from "./AddAccountModal.module.scss";
import { Button, Modal, Tooltip } from "antd";
import { AccountPlatInfoArr, PlatType } from "@/app/config/platConfig";
import { SocialAccount } from "@/api/types/account.type";
+import { kwaiSkip } from "@/app/[lng]/accounts/plat/kwaiLogin";
export interface IAddAccountModalRef {}
@@ -18,9 +19,6 @@ const AddAccountModal = memo(
{ open, onClose, onAddSuccess }: IAddAccountModalProps,
ref: ForwardedRef<IAddAccountModalRef>,
) => {
- const [accountLoginOpen, setAccountLoginOpen] = useState(false);
- const [addPlat, setAddPlat] = useState<PlatType>();
-
const handleOk = () => {
onClose();
};
@@ -49,8 +47,10 @@ const AddAccountModal = memo(
type="text"
className="addAccountModal_plats-item"
onClick={async () => {
- setAddPlat(key);
- setAccountLoginOpen(true);
+ switch (key) {
+ case PlatType.KWAI:
+ kwaiSkip(key);
+ }
}}
>
<div className="addAccountModal_plats-item-con">
diff --git a/src/app/[lng]/accounts/plat/kwaiLogin.ts b/src/app/[lng]/accounts/plat/kwaiLogin.ts
new file mode 100644
index 00000000..d0ca92a4
--- /dev/null
+++ b/src/app/[lng]/accounts/plat/kwaiLogin.ts
@@ -0,0 +1,56 @@
+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 {AccountStatus} from "@/app/config/accountConfig";
+
+export const kwaiAppId = "ks715790869885446758";
+export const kwaiAppSecret = "cqSvJvBSPJjd-4pBH_4N0Q";
+
+export function kwaiSkip(platType: PlatType) {
+ const authParams = qs.stringify({
+ app_id: kwaiAppId,
+ scope: "user_info,user_video_publish",
+ response_type: "code",
+ ua: "pc",
+ redirect_uri: `https://localhost:6060/accounts/add?platType=${platType}`,
+ });
+ window.open(`https://open.kuaishou.com/oauth2/authorize?${authParams}`);
+}
+
+export function kwaiLogin(code: string): Promise<boolean> {
+ return new Promise(async (resolve, reject) => {
+ try {
+ const accessTokenRes = await requestPlatApi({
+ url: `/kuaishoApi/oauth2/access_token`,
+ method: "GET",
+ params: {
+ app_id: kwaiAppId,
+ app_secret: kwaiAppSecret,
+ code,
+ grant_type: "authorization_code",
+ },
+ });
+ if (accessTokenRes?.result !== 1) {
+ return reject("accessToken 获取失败!");
+ }
+ const kwaiPlat = new KwaiPlat({
+ access_token: accessTokenRes.access_token,
+ refresh_token: accessTokenRes.refresh_token,
+ });
+ const userInfo = await kwaiPlat.getAccountInfo();
+ userInfo!.account = accessTokenRes.open_id;
+ userInfo!.uid = accessTokenRes.open_id;
+ userInfo!["refresh_token"] = accessTokenRes.refresh_token;
+ userInfo!["access_token"] = accessTokenRes.access_token;
+
+ const res = await createOrUpdateAccountApi({
+ ...userInfo,
+ }).catch(() => false);
+ resolve(!!res);
+ } catch (e) {
+ reject(e);
+ }
+ });
+}
diff --git a/src/app/[lng]/publish/components/PubProgressModule/PubProgressModule.tsx b/src/app/[lng]/publish/components/PubProgressModule/PubProgressModule.tsx
index cb4faa6a..37cca0f4 100644
--- a/src/app/[lng]/publish/components/PubProgressModule/PubProgressModule.tsx
+++ b/src/app/[lng]/publish/components/PubProgressModule/PubProgressModule.tsx
@@ -21,7 +21,7 @@ function getMsg(progressData: PublishProgressRes) {
} else if (progressData.progress === -1) {
return "发布错误";
} else {
- return progressData.message || "正在加载...";
+ return progressData.msg || "正在加载...";
}
}
diff --git a/src/app/config/accountConfig.ts b/src/app/config/accountConfig.ts
index 4df47c6d..2c293289 100644
--- a/src/app/config/accountConfig.ts
+++ b/src/app/config/accountConfig.ts
@@ -1,9 +1,9 @@
// 账号状态
export enum AccountStatus {
// 未失效
- USABLE = 0,
+ USABLE = 1,
// 失效
- DISABLE = 1,
+ DISABLE = 0,
}
// 小红书账号异常状态
diff --git a/src/app/plat/PlatBase.ts b/src/app/plat/PlatBase.ts
index 58de3e29..41ba73d7 100644
--- a/src/app/plat/PlatBase.ts
+++ b/src/app/plat/PlatBase.ts
@@ -1,29 +1,15 @@
import { SocialAccount } from "@/api/types/account.type";
-import { Cookie } from "undici-types";
import { IPlatConstrParams } from "@/app/plat/plat.type";
export abstract class PlatBase {
- cookieStr: string;
- cookieList: Cookie[];
- proxy?: string;
+ access_token: string;
+ refresh_token: string;
// 用户账户信息
abstract getAccountInfo(): Promise<Partial<SocialAccount> | null>;
constructor(params: IPlatConstrParams) {
- this.cookieList = params.cookieList;
- this.cookieStr = this.convertCookieToJson(params.cookieList);
- this.proxy = params.proxy;
- }
-
- convertCookieToJson(cookieJson: any) {
- if (typeof cookieJson === "string") {
- cookieJson = JSON.parse(cookieJson);
- }
- let cookieStr = "";
- cookieJson.forEach((cookie: any) => {
- cookieStr += `${cookie.name}=${cookie.value}; `;
- });
- return cookieStr;
+ this.access_token = params.access_token;
+ this.refresh_token = params.refresh_token;
}
}
diff --git a/src/app/plat/PlatManage.ts b/src/app/plat/PlatManage.ts
index b1919f44..67f18047 100644
--- a/src/app/plat/PlatManage.ts
+++ b/src/app/plat/PlatManage.ts
@@ -1,15 +1,10 @@
import { PlatType } from "@/app/config/platConfig";
-import { IPlatConstrParams } from "@/app/plat/plat.type";
-import { PlatDouyin } from "@/app/plat/platChildren/douyin/PlatDouyin";
-import { PlatXhs } from "@/app/plat/platChildren/xhs/PlatXhs";
class PlatManage {
- private getPlat(type: PlatType, params: IPlatConstrParams) {
+ private getPlat(type: PlatType) {
switch (type) {
- case PlatType.Douyin:
- return new PlatDouyin(params);
- case PlatType.Xhs:
- return new PlatXhs(params);
+ case PlatType.KWAI:
+ return;
}
}
}
diff --git a/src/app/plat/plat.type.ts b/src/app/plat/plat.type.ts
index 1e3dee8d..a98d9742 100644
--- a/src/app/plat/plat.type.ts
+++ b/src/app/plat/plat.type.ts
@@ -1,12 +1,9 @@
// plat构造器参数
-import { Cookie } from "undici-types";
import { SocialAccount } from "@/api/types/account.type";
export interface IPlatConstrParams {
- // cookie
- cookieList: Cookie[];
- // 代理
- proxy?: string;
+ access_token: string;
+ refresh_token: string;
}
export interface IMixItem {
diff --git a/src/app/plat/platChildren/douyin/PlatDouyin.ts b/src/app/plat/platChildren/douyin/PlatDouyin.ts
deleted file mode 100644
index 7ed844b2..00000000
--- a/src/app/plat/platChildren/douyin/PlatDouyin.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { PlatBase } from "@/app/plat/PlatBase";
-import { SocialAccount } from "@/api/types/account.type";
-
-export class PlatDouyin extends PlatBase {
- getAccountInfo(): Promise<Partial<SocialAccount> | null> {
- return Promise.resolve(null);
- }
-}
diff --git a/src/app/plat/platChildren/douyin/douyin.type.ts b/src/app/plat/platChildren/douyin/douyin.type.ts
deleted file mode 100644
index 9b445b57..00000000
--- a/src/app/plat/platChildren/douyin/douyin.type.ts
+++ /dev/null
@@ -1,771 +0,0 @@
-interface TopicSug {
- cha_name: string;
- view_count: number;
- cid: string;
- group_id: string;
- tag: number;
-}
-
-interface WordsQueryRecord {
- info: string;
- words_source: string;
- query_id: string;
-}
-
-interface Extra {
- now: number;
- logid: string;
- fatal_item_ids: any[];
- search_request_id: string;
-}
-
-interface LogPb {
- impr_id: string;
-}
-
-interface AddressInfo {
- ad_code_v2: string;
- addr_with_extra_info: string;
- address: string;
- city: string;
- city_code: string;
- district: string;
- im_addr: string;
- province: string;
- simple_addr: string;
-}
-
-interface Cover {
- uri: string;
- url_list: string[];
-}
-
-interface Icon {
- uri: string;
- url_list: string[];
-}
-
-interface LifeCommerceInfo {
- simple_addr_str: string;
-}
-
-interface PoiBackendType {
- code: string;
- content: string;
- l1_name: string;
- l2_name: string;
- l3_name: string;
- name: string;
-}
-
-interface PoiFrontendType {
- code: string;
- name: string;
-}
-
-interface ShareInfo {
- bool_persist: number;
- share_title: string;
- share_url: string;
- share_weibo_desc: string;
-}
-
-interface Poi {
- Staturated_tags: any;
- address_info: AddressInfo;
- anchor_post_ext: {
- is_recommend: boolean;
- };
- business_area_name: string;
- channel_exclusive: any;
- collect_stat: number;
- collected_count: string;
- cost: number;
- cover_hd: Cover;
- cover_item: Cover;
- cover_large: Cover;
- cover_medium: Cover;
- cover_thumb: Cover;
- cps_commission_rate_range: any;
- cps_commission_value_range: any;
- distance: string;
- effect_ids: string[];
- expand_type: number;
- fulfill_task_list: any;
- icon_on_entry: Icon;
- icon_on_info: Icon;
- icon_on_map: Icon;
- icon_service_type_list: any;
- icon_type: number;
- is_admin_area: boolean;
- is_commerce_intention: boolean;
- item_count: number;
- life_commerce_info: LifeCommerceInfo;
- poi_backend_type: PoiBackendType;
- poi_detail_tags: any;
- poi_frontend_type: PoiFrontendType[];
- poi_id: string;
- poi_latitude: number;
- poi_latitude_gcj02: number;
- poi_longitude: number;
- poi_longitude_gcj02: number;
- poi_name: string;
- poi_ranks: any;
- poi_search_tags: any;
- poi_search_tags_v2: any;
- poi_type: number;
- poi_voucher: string;
- service_type_list: any;
- share_info: ShareInfo;
- show_type: number;
- simple_address_str: string;
- type_code: string;
- user_count: number;
- view_count: string;
- voucher_release_areas: any[];
- with_recommend_tag: number;
-}
-
-interface ContentTab {
- default_tab: number;
- tab_list: number[];
-}
-
-interface GuideInfo {
- guide_text_after: string;
- guide_text_before: string;
- guide_url: string;
-}
-
-interface DriftInfo {
- score: number;
- timestamp: number;
-}
-
-interface Cover {
- uri: string;
- url_list: string[];
-}
-
-export interface DouyinActivity {
- activity_id: string;
- activity_level: number;
- activity_name: string;
- activity_status: number;
- activity_type: number;
- challenge: string[];
- challenge_ids: number[];
- collect_id: number;
- collect_status: boolean;
- cover_image: string;
- game_id: string;
- hot_score: number;
- if_well_chosen: boolean;
- jump_link: string;
- jump_type: number;
- query_tag: number;
- reward_type: number;
- show_end_time: string;
- show_start_time: string;
-}
-
-interface Video {
- big_thumbs?: any;
- bit_rate?: any;
- cover: Cover;
- duration: number;
-}
-
-export interface DouyinHotSentence {
- aweme_infos: any;
- challenge_id: string;
- display_style: number;
- drift_info: DriftInfo[];
- event_time: number;
- group_id: string;
- hot_value: number;
- hotlist_param: string;
- label: number;
- related_words: any;
- sentence_id: string;
- video_count: number;
- word: string;
- word_cover: Cover;
- word_sub_board: any;
- word_type: number;
-}
-
-interface ActivityInfo {
- activity_id: string;
- activity_level: number;
- activity_name: string;
- activity_status: number;
- activity_type: number;
- challenge?: any;
- challenge_ids: number[];
- collect_id: number;
- collect_status: boolean;
- cover_image: string;
- game_id: string;
- hot_score: number;
- if_well_chosen: boolean;
- jump_link: string;
- jump_type: number;
- post_url: string;
- query_tag: number;
- reward_type: number;
- show_end_time: string;
- show_start_time: string;
-}
-
-interface DouyinUser {
- avatar_larger: Avatar;
- avatar_medium: Avatar;
- avatar_thumb: Avatar;
- aweme_count: number;
- card_entries: any;
- custom_verify: string;
- enterprise_verify_reason: string;
- favoriting_count: number;
- follow_status: number;
- follower_count: number;
- follower_status: number;
- followers_detail: any;
- following_count: number;
- geofencing: any;
- has_orders: boolean;
- is_ad_fake: boolean;
- is_gov_media_vip: boolean;
- mix_info: any;
- nickname: string;
- original_musician: OriginalMusician;
- platform_sync_info: any;
- policy_version: any;
- rate: number;
- region: string;
- sec_uid: string;
- secret: number;
- short_id: string;
- signature: string;
- status: number;
- story_open: boolean;
- total_favorited: string;
- type_label: any[];
- uid: string;
- unique_id: string;
- user_canceled: boolean;
- verification_type: number;
- video_icon: VideoIcon;
- with_commerce_entry: boolean;
- with_fusion_shop_entry: boolean;
- with_shop_entry: boolean;
-}
-
-interface Avatar {
- uri: string;
- url_list: string[];
-}
-
-interface OriginalMusician {
- music_count: number;
- music_used_count: number;
-}
-
-interface VideoIcon {
- uri: string;
- url_list: string[];
-}
-
-export interface DemoVideo {
- aweme_id: string;
- cha_list?: any;
- chapter_bar_color?: any;
- chapter_list?: any;
- comment_list?: any;
- geofencing?: any;
- image_infos?: any;
- images?: any;
- img_bitrate?: any;
- interaction_stickers?: any;
- label_top_text?: any;
- long_video?: any;
- promotions?: any;
- text_extra?: any;
- video: Video;
- video_labels?: any;
- video_text?: any;
-}
-
-// 抖音活动详情接口的返回值
-export interface DouyinActivityDetailResponse {
- activity_description: string;
- activity_info: ActivityInfo;
- demo_videos: DemoVideo[];
- extra: Extra;
- my_publish_videos: any;
- other_publish_videos: any;
- publish_end_time: string;
- publish_start_time: string;
- reward_rules: string;
- status_code: number;
- topics: string[];
- topics_ids: string[];
-}
-
-// 抖音活动标签item
-export interface DouyinQueryTags {
- id: number;
- name: string;
-}
-
-// 抖音活动标签返回数据
-export interface DouyinActivityTagsResponse {
- status_code: number;
- extra: Extra;
- query_tags: DouyinQueryTags[];
-}
-
-// 抖音活动列表
-export interface DouyinActivityListResponse {
- activity_list: DouyinActivity[];
- extra: Extra;
- status_code: number;
-}
-
-// 抖音的热点数据
-export interface DouyinHotDataResponse {
- extra: Extra;
- log_pb: LogPb;
- sentences: DouyinHotSentence[];
- status_code: number;
-}
-
-// 抖音的所有热点数据
-export interface DouyinAllHotDataResponse {
- extra: Extra;
- log_pb: LogPb;
- all_sentences: DouyinHotSentence[];
- status_code: number;
-}
-
-// 抖音的话题数据
-export interface DouyinTopicsSugResponse {
- sug_list: TopicSug[];
- status_code: number;
- status_msg: string;
- rid: string;
- words_query_record: WordsQueryRecord;
- extra: Extra;
- log_pb: LogPb;
-}
-
-// 抖音的位置数据
-export interface DouyinLocationDataResponse {
- ab_param_extra: string;
- content_tab: ContentTab;
- current_locs: any[];
- extra: Extra;
- guide_info: GuideInfo;
- has_keyuser_combo_entrance: boolean;
- has_more: number;
- has_promote_auth: boolean;
- log_pb: LogPb;
- page: number;
- poi_activity: any;
- poi_list: Poi[];
- poi_search_range: number[];
- post_role: number;
- show_filter_option: boolean;
- show_guide: boolean;
- show_new_merchant_guide: boolean;
- status_code: number;
- status_msg: string;
- user_interest_city_code_list: any;
-}
-
-// 抖音用户数据
-export interface DouyinUserListResponse {
- challenge_list: any[];
- cursor: number;
- extra: Extra;
- has_more: boolean;
- scene: number;
- status_code: number;
- user_list: DouyinUser[];
-}
-
-// 抖音作品列表
-export interface DouyinCreatorListResponse {
- extra: Extra;
- status_code: number; // 0
- status_msg: string;
- has_more: boolean;
- item_info_list: {
- anchor_user_id: string;
- cursor: string;
- comment_count: number; // 回复数量
- cover_image_url: string; // 'https://p3-sign.douyinpic.com/c5d200033ae82940b280~tplv-dy-resize-walign-adapt-aq:540:q75.jpeg?lk3s=138a59ce&x-expires=1742889600&x-signature=jcYpgxENZDa38hHUHNFfpcAPUDs%3D&from=327834062&s=PackSourceEnum_PUBLISH&se=false&sc=cover&biz_tag=aweme_video&l=20250311165957E85797DDC3B0DA04AEBA';
- create_time: string; // '发布于2018年09月23日 17:51';
- creator_item_setting: {
- charge_comment_audit: boolean; // 收费评论审计
- };
- duration: number;
- item_id: string; // '@j/do779EQE//uctS8r3tvsx9pyuRYyn/J6krPKNgjq9hkia+W5A7RJEoPQpq6PZlQedr6LX3XaKU0Yc8jcykog==';
- item_id_plain: string; // '6604355150884637966';
- item_link: string; // 'https://www.iesdouyin.com/share/video/6604355150884637966/?region=CN&mid=6568746752824380174&u_code=16b4ji55k&did=MS4wLjABAAAANwkJuWIRFOzg5uCpDRpMj4OX-QryoDgn-yYlXQnRwQQ&iid=MS4wLjABAAAANwkJuWIRFOzg5uCpDRpMj4OX-QryoDgn-yYlXQnRwQQ&with_sec_did=1&video_share_track_ver=&titleType=&share_sign=qwbHwbUn9.rqVOBIpmIak8F4W9CXvvE18GzpMaAUfyU-&share_version=210100&ts=1741683597&from_aid=1128&from_ssr=1';
- media_type: number; // 4;
- title: string; // '';
- }[];
- total_count: number;
-}
-
-// 抖音作品评论列表
-export interface DouyinCreatorCommentListResponse {
- comment_info_list: {
- comment_id: string; // '@j/do779EQE//uctS8rzvtsh7oymVZyz/K6UlPqVrj61hkia+W5A7RJEoPQpq6PZl0KYgJ8TOofuQDOgXI12wCA==';
- create_time: string; // '1741694473';
- digg_count: string; // '0';
- followed: boolean; // false;
- following: boolean; // false;
- is_author: boolean; // true;
- level: number; // 1;
- reply_count: string; // '0';
- reply_to_user_info: {
- avatar_url: string; // '';
- screen_name: string; // '';
- user_id: string; // '@j/do779EQE//uctS8rvZjLtLqeE8MOypT/Xro3hVZaE=';
- };
- status: number; // 1;
- text: string; // '不知道在哪里学的';
- user_bury: boolean; // false;
- user_digg: boolean; // false;
- user_info: {
- avatar_url: string; // 'https://p3.douyinpic.com/aweme/100x100/aweme-avatar/mosaic-legacy_9bae0021f45bb7d411b0.jpeg?from=2956013662';
- screen_name: string; // '沐墨人';
- user_id: string; // '@j/do779EQE//uctS8rrrvst3qyiRYCHwJpoaCJNev56Vc+YwAlekyGOU0vO5C292';
- };
- }[];
- cursor: number; // 3;
- extra: { now: number }; // 1741874549000 };
- has_more: boolean; // false;
- has_vcd_filter: boolean; // false;
- status_code: number; // 0;
- status_msg: string; // '';
- total_count: number; // 3;
-}
-
-// 抖音评论回复列表
-export interface DouyinCommentReplyListResponse {
- status_code: 0;
- comments: {
- cid: string; // '7484226055910605622';
- text: string; // ''哈哈哈,[捂脸],留不长,发质太差了';
- aweme_id: string; // ''7484154434176568630';
- create_time: number; // 1742557174;
- digg_count: number; // 0;
- status: number; // 1;
- user: {
- uid: string; // ''153519948306846';
- short_id: string; // ''2308542007';
- nickname: string; // ''海宝💃';
- signature: string; // ''';
- avatar_larger: {
- uri: string; // ''';
- url_list: string[]; // [];
- width: number; // 720;
- height: number; // 720;
- };
- avatar_thumb: {
- uri: string; // ''100x100/aweme-avatar/tos-cn-i-0813c001_oUDEAA5qhfAx5dAgIewzNvptBoNAuByobAvNC1';
- url_list: string[]; // 'https://p3.douyinpic.com/aweme/100x100/aweme-avatar/tos-cn-i-0813c001_oUDEAA5qhfAx5dAgIewzNvptBoNAuByobAvNC1.jpeg?from=2956013662',
- width: number; // 720;
- height: number; // 720;
- };
- avatar_medium: {
- uri: string; // '720x720/aweme-avatar/tos-cn-i-0813c001_oUDEAA5qhfAx5dAgIewzNvptBoNAuByobAvNC1';
- url_list: string[]; // 'https://p3.douyinpic.com/aweme/720x720/aweme-avatar/tos-cn-i-0813c001_oUDEAA5qhfAx5dAgIewzNvptBoNAuByobAvNC1.jpeg?from=2956013662',
- width: number; // 720;
- height: number; // 720;
- };
- is_verified: boolean; // true;
- follow_status: number; // 0;
- aweme_count: number; // 0;
- following_count: number; // 0;
- follower_count: number; // 0;
- favoriting_count: number; // 0;
- total_favorited: number; // 0;
- is_block: boolean; // false;
- hide_search: boolean; // true;
- constellation: number; // 9;
- location: string; // '';
- hide_location: boolean; // false;
- weibo_verify: string; // '';
- custom_verify: string; // '';
- unique_id: string; // 'dyehawbhyehm';
- bind_phone: string; // '';
- special_lock: number; // 1;
- need_recommend: number; // 1;
- is_binded_weibo: boolean; // false;
- weibo_name: string; // '';
- weibo_schema: string; // '';
- weibo_url: string; // '';
- story_open: boolean; // false;
- story_count: number; // 0;
- has_facebook_token: boolean; // false;
- has_twitter_token: boolean; // false;
- fb_expire_time: number; // 0;
- tw_expire_time: number; // 0;
- has_youtube_token: boolean; // false;
- youtube_expire_time: number; // 0;
- room_id: number; // 0;
- live_verify: number; // 2;
- authority_status: number; // 0;
- verify_info: string; // '';
- shield_follow_notice: number; // 0;
- shield_digg_notice: number; // 0;
- shield_comment_notice: number; // 0;
- school_name: string; // '';
- school_poi_id: string; // '';
- school_type: number; // 0;
- with_commerce_entry: boolean; // false;
- verification_type: number; // 1;
- enterprise_verify_reason: string; // '';
- is_ad_fake: boolean; // false;
- followers_detail: null;
- region: string; // 'CN';
- account_region: string; // '';
- sync_to_toutiao: number; // 0;
- live_agreement: number; // 0;
- platform_sync_info: null;
- with_shop_entry: boolean; // false;
- secret: number; // 0;
- has_orders: boolean; // true;
- prevent_download: boolean; // false;
- show_image_bubble: boolean; // false;
- geofencing: any[]; // [];
- unique_id_modify_time: number; // 1742631181;
- video_icon: {
- uri: string; // '';
- url_list: string[];
- width: number; // 720;
- height: number; // 720;
- };
- ins_id: string; // '';
- google_account: string; // '';
- youtube_channel_id: string; // '';
- youtube_channel_title: string; // '';
- apple_account: number; // 0;
- with_dou_entry: boolean; // false;
- with_fusion_shop_entry: boolean; // false;
- is_phone_binded: boolean; // false;
- accept_private_policy: boolean; // false;
- twitter_id: string; // '';
- twitter_name: string; // '';
- user_canceled: boolean; // false;
- has_email: boolean; // false;
- is_gov_media_vip: boolean; // false;
- live_agreement_time: number; // 0;
- status: number; // 1;
- avatar_uri: string; // 'aweme-avatar/tos-cn-i-0813c001_oUDEAA5qhfAx5dAgIewzNvptBoNAuByobAvNC1';
- follower_status: number; // 0;
- neiguang_shield: number; // 0;
- comment_setting: number; // 0;
- duet_setting: number; // 0;
- reflow_page_gid: number; // 0;
- reflow_page_uid: number; // 0;
- user_rate: number; // 1;
- download_setting: number; // -1;
- download_prompt_ts: number; // 0;
- react_setting: number; // 0;
- live_commerce: boolean; // false;
- cover_url: string[]; // [];
- show_gender_strategy: number; // 0;
- language: string; // 'zh-Hans';
- has_insights: boolean; // false;
- item_list: null;
- user_mode: number; // 0;
- user_period: number; // 0;
- has_unread_story: boolean; // false;
- new_story_cover: null;
- is_star: boolean; // false;
- cv_level: string; // '';
- type_label: any; // null;
- ad_cover_url: any; // null;
- comment_filter_status: number; // 0;
- avatar_168x168: {
- uri: string; // '';
- url_list: string[]; // [];
- width: number; // 720;
- height: number; // 720;
- };
- avatar_300x300: {
- uri: string; // '';
- url_list: string[]; //[];
- width: number; // 720;
- height: number; // 720;
- };
- relative_users: any; // null;
- cha_list: any; // null;
- sec_uid: string; // 'MS4wLjABAAAAh24q23iMa0OxvuFitRcT13v6lQJpYWVp7TEZGcuX908';
- urge_detail: {
- user_urged: number; // 0;
- };
- need_points: any; // null;
- homepage_bottom_toast: any; // null;
- can_set_geofencing: any; // null;
- room_id_str: string; // '0';
- white_cover_url: any; // null;
- user_tags: any; // null;
- stitch_setting: number; // 0;
- is_mix_user: boolean; // false;
- enable_nearby_visible: boolean; // true;
- ban_user_functions: any[]; // [];
- aweme_control: {
- can_forward: boolean; // true;
- can_share: boolean; // true;
- can_comment: boolean; // true;
- can_show_comment: boolean; // true;
- };
- user_not_show: number; // 1;
- ky_only_predict: number; // 0;
- user_not_see: number; // 0;
- card_entries: any; // null;
- signature_display_lines: number; // 5;
- display_info: any; // null;
- follower_request_status: number; // 0;
- live_status: number; // 0;
- is_not_show: boolean; // false;
- card_entries_not_display: any; // null;
- card_sort_priority: any; // null;
- show_nearby_active: boolean; // false;
- interest_tags: any; // null;
- school_category: number; // 0;
- search_impr: {
- entity_id: string; // '153519948306846';
- };
- link_item_list: any; // null;
- user_permissions: any; // null;
- offline_info_list: any; // null;
- is_cf: number; // 0;
- is_blocking_v2: boolean; // false;
- is_blocked_v2: boolean; // false;
- close_friend_type: number; // 0;
- signature_extra: any; // null;
- max_follower_count: number; // 0;
- personal_tag_list: any; // null;
- cf_list: any; // null;
- im_role_ids: any; // null;
- not_seen_item_id_list: any; // null;
- user_age: number; // 32;
- contacts_status: number; // 1;
- risk_notice_text: string; // '';
- follower_list_secondary_information_struct: any; // null;
- endorsement_info_list: any; // null;
- text_extra: any; // null;
- contrail_list: any; // null;
- data_label_list: any; // null;
- not_seen_item_id_list_v2: any; // null;
- is_ban: boolean; // false;
- special_people_labels: any; // null;
- special_follow_status: number; // 0;
- familiar_visitor_user: any; // null;
- live_high_value: number; // 0;
- avatar_schema_list: any; // null;
- profile_mob_params: any; // null;
- disable_image_comment_saved: number; // 0;
- verification_permission_ids: any; // null;
- batch_unfollow_relation_desc: any; // null;
- batch_unfollow_contain_tabs: any; // null;
- creator_tag_list: any; // null;
- private_relation_list: any; // null;
- mate_add_permission: number; // 0;
- familiar_confidence: number; // 0;
- mate_count: number; // 0;
- follower_count_str: string; // '';
- social_real_relation_type: number; // 0;
- };
- reply_id: string; // '7484209708376032050';
- user_digged: number; // 0;
- reply_comment: any; // null;
- text_extra: string[];
- label_text: string; // '作者';
- label_type: number; // 1;
- reply_to_reply_id: string; // '0';
- is_author_digged: boolean; // false;
- user_buried: boolean; // false;
- label_list: any; // null;
- is_hot: boolean; // false;
- text_music_info: any; // null;
- image_list: any; // null;
- is_note_comment: number; // 0;
- root_comment_id: string; // '7484226055910605622';
- can_share: boolean; // true;
- level: number; // 2;
- comment_reply_total: number; // 1;
- video_list: any; // null;
- content_type: number; // 1;
- is_folded: boolean; // false;
- }[];
- cursor: number; // 10;
- has_more: number; // 0;
- total: number; // 1;
- extra: {
- now: number; // 1742631181000;
- fatal_item_ids: any; // null;
- };
- log_pb: {
- impr_id: string; // '20250322161300615408A9FEC29A97BD28';
- };
-}
-
-export interface DouyinNewCommentResponse {
- comment_info: {
- comment_id: string; // '@j/Jr6bdET0rxssxd57/to896qi+WZSz3LqQlN6Nuja9BugWjRo0mWYw1IBd39et4ggwDVwRptqsgeUQSJiFcAg==';
- create_time: string; // '1741955069';
- digg_count: string; // '0';
- followed: boolean; // false;
- following: boolean; // false;
- is_author: boolean; // true;
- level: number; // 1 | 2; // 第几层
- reply_count: string; // '0';
- status: number; // 7;
- text: string; // '天真蓝';
- user_digg: boolean; // false;
- user_info: {
- avatar_url: string; // 'https://p11.douyinpic.com/aweme/720x720/aweme-avatar/tos-cn-i-0813c001_oUDEAA5qhfAx5dAgIewzNvptBoNAuByobAvNC1.jpeg?from=4010531038';
- screen_name: string; // '海宝💃';
- user_id: string; // '@j/Jr6bdET0rxssxd57/to8l7oSuRbyDzJ64tOaxtjpj2c9bt4zgRjBU4l2s/OnM0';
- };
- };
- extra: {
- now: number; // 1741955069000;
- };
- status_code: number; // 0;
- status_msg: string; // '';
-}
-
-// 合集数据
-export interface DouyinGetMixListResponse {
- total: number;
- status_code: number;
- mix_list: {
- author: DouyinUser;
- cover_url: {
- uri: string;
- url_list: string[];
- };
- statis: {
- collect_vv: number;
- current_episode: number;
- play_vv: number;
- updated_to_episode: number;
- };
- status: {
- is_collected: number;
- status: number;
- };
- mix_name: string;
- mix_id: string;
- ban_episode_count: number;
- }[];
-}
diff --git a/src/app/plat/platChildren/kwai/KwaiPlat.ts b/src/app/plat/platChildren/kwai/KwaiPlat.ts
new file mode 100644
index 00000000..78ab702d
--- /dev/null
+++ b/src/app/plat/platChildren/kwai/KwaiPlat.ts
@@ -0,0 +1,35 @@
+import { PlatBase } from "@/app/plat/PlatBase";
+import { SocialAccount } from "@/api/types/account.type";
+import { RequestParams } from "@/utils/FetchService/types";
+import { requestPlatApi } from "@/utils/otherRequest";
+import { KwaiApiProxyUrl } from "@/constant";
+import { kwaiAppId } from "@/app/[lng]/accounts/plat/kwaiLogin";
+import { PlatType } from "@/app/config/platConfig";
+
+export class KwaiPlat extends PlatBase {
+ async getAccountInfo(): Promise<Partial<SocialAccount> | null> {
+ const { user_info } = await this.request({
+ url: "openapi/user_info",
+ method: "GET",
+ });
+ return {
+ avatar: user_info.bigHead,
+ forwardCount: user_info.follow,
+ fansCount: user_info.fan,
+ nickname: user_info.name,
+ type: PlatType.KWAI,
+ account: "",
+ uid: "",
+ };
+ }
+
+ request(params: RequestParams) {
+ params.url = `${KwaiApiProxyUrl}${params.url}`;
+ params.params = {
+ ...(params.params ?? {}),
+ access_token: this.access_token,
+ app_id: kwaiAppId,
+ };
+ return requestPlatApi(params);
+ }
+}
diff --git a/src/app/plat/platChildren/wxSph/wxShp.type.ts b/src/app/plat/platChildren/wxSph/wxShp.type.ts
deleted file mode 100644
index 63347b91..00000000
--- a/src/app/plat/platChildren/wxSph/wxShp.type.ts
+++ /dev/null
@@ -1,214 +0,0 @@
-interface Location {
- longitude: number;
- latitude: number;
- country: string;
- countryCode: string;
- province: string;
- city: string;
- region: string;
- poiCheckSum: string;
-}
-
-interface POI {
- uid: string;
- name: string;
- longitude: number;
- latitude: number;
- address: string;
- province: string;
- city: string;
- region: string;
- fullAddress: string;
- source: number;
- poiCheckSum: string;
-}
-
-interface Data {
- eventList: WxSphEventList[];
- lastBuff: string;
- continueFlag: boolean;
-}
-
-export interface WxSphEventList {
- eventTopicId: string;
- eventName: string;
- eventCreatorNickname: string;
-}
-
-export interface WeChatVideoApiResponse {
- errCode: number;
- errMsg: string;
- data: Data;
-}
-
-export interface WeChatLocationData {
- errCode: number;
- errMsg: string;
- data: {
- list: POI[];
- cookies: string;
- address: Location;
- continueFlag: number;
- };
-}
-
-interface WeChatVideoUser {
- username: string;
- headImgUrl: string;
- nickName: string;
- authImgUrl: string;
- authCompanyName: string;
-}
-
-export interface WeChatVideoUserData {
- errCode: number;
- errMsg: string;
- data: {
- list: WeChatVideoUser[];
- totalCount: number;
- };
-}
-
-export interface SphGetPostListResponse {
- errCode: number; // 0;
- errMsg: string; // 'request successful';
- data: {
- list: {
- commentList: any[]; // []
- objectId: string; //'export/UzFfAgtgekIEAQAAAAAAOhIpzVxlAQAAAAstQy6ubaLX4KHWvLEZgBPExKFQKCowfoSJzNPgMJrD53jJrD_NBzgU3Ncr3usg';
- createTime: number; // 1741695600;
- likeCount: number; // 0;
- commentCount: number; // 2;
- readCount: number; // 179;
- forwardCount: number; // 0;
- favCount: number; // 1;
- commentClose: number; // 0;
- visibleType: number; // 1;
- status: number; // 1;
- desc: {
- media: {
- spec: any[];
- url: string; // 'https://finder.video.qq.com/251/20302/stodownload?encfilekey=Cvvj5Ix3eewK0tHtibORqcsqchXNh0Gf3sJcaYqC2rQDU5W1jYgILickxkJbjKjCA0skc49CeUbEks0sibuZiaibwQtatVH36DrA4RMiahjHkvAnuexRR8PIU1aUV21WSwOPRd&token=Cvvj5Ix3eewUo13ia09jtLw4nzPEZ0ias6WossfHM76uPFlClLIfTfsFxHS4QJJg4M52GoRJJVV1apGUpUDXaL1XrLckI8PmvWrNpyzDp5Kkpmdjaibb8VLdpj9tlO1icudZ9rgSqhevAB8OxZjUr5UNTk75rEDAv9cADibb2Wx3cGyyTRAjPdUs679Mho6aAkV7r&idx=1&bizid=1023&dotrans=0&hy=SH&m=&uzid=1&web=1';
- thumbUrl: string; // 'https://finder.video.qq.com/251/20304/stodownload?encfilekey=S7s6ianIic0ia4PicKJSfB8EjyjpQibPUAXolPZYpiae6M5FCeWvaib76vAJ6gaDiazGwGHqGF3FfswaNmyszKNzIlo7mOFB4PqcVll7iasQMzLYL7N6GicD6zcfOGww&token=o3K9JoTic9IhZNy9rvFF19YdS0Ej1KlFbPdgZw0k4Xicia8hcnPcxYp5eGVTBeNQ4ZAgoxjlhjjKHaxzg1dib7FAPEQuXvLHdaZuLj91kArMIT8cXmIBHuJY6Zk8HVW0dcyzemUOccm3en5nQ3dwIed3uc2AcezIozkgPDe5pre0tjAwDrtPoTeCVQ&idx=1&bizid=1023&dotrans=0&hy=SH&m=&uzid=1';
- mediaType: number; // 4;
- videoPlayLen: number; // 17;
- width: number; // 720;
- height: number; // 1280;
- md5sum: string; // '6bc1da4fb3224c28c19e9dfd1e077c19';
- fileSize: string; // '10132537';
- bitrate: number; // 4613120;
- coverUrl: string; // 'https://finder.video.qq.com/251/20304/stodownload?encfilekey=rjD5jyTuFrIpZ2ibE8T7YmwgiahniaXswqzmBbTGWBbgZKiaUl56F8wcYSPDRlQqZmtSct3JYHtJHl0Eal0qkCbP2NEFkepZYeh5VnibDXhuvE7dy0jCNa96ZVw&token=2lt8WBSnjTmtsqoH1VcEvDTFaR2SnFUYmDhrIsRVhu6HhdyGOls5ibYXnWXqib9bcXvehgEic5JO6RP96bG3P6WPyyHe5VEyg54PrM6WP4sRqLtNkIUzNAHicc6xmwL8UOtwyeq37Lcf3ic1icMibSXKc6g2ZOZXgdnyE9diaKt3WazBHMRD8c0icInmtOQ&idx=1&hy=SH&m=&scene=2';
- fullThumbUrl: string; // '';
- fullUrl: string; // '';
- fullWidth: number; // 0;
- fullHeight: number; // 0;
- fullMd5sum: string; // '';
- fullFileSize: string; // '0';
- fullBitrate: number; // 0;
- halfRect: any; // {};
- fullCoverUrl: string; // 'https://finder.video.qq.com/251/20304/stodownload?encfilekey=rjD5jyTuFrIpZ2ibE8T7YmwgiahniaXswqzmBbTGWBbgZKiaUl56F8wcYSPDRlQqZmtSct3JYHtJHl0Eal0qkCbP2NEFkepZYeh5VnibDXhuvE7dy0jCNa96ZVw&token=o3K9JoTic9IhZNy9rvFF19exicGwXO43K38lOWeKkiaONWmIf7iaZlVef8hOBfFvB1f6yUJruuNI2EEFicrRfIOgYEh9v7MQ58ibMLbQxDN56eL7T2c8BtKAVmUib3pKGU87JmPjfR9jpnSXSPibsc9PaznwHyNJfldyhQ3Tn6z7V1b1RAWKjHpq27UI2Q&idx=1&hy=SH&m=&scene=2';
- cardShowStyle: number; // 0;
- }[];
- mentionedMusics: any[];
- shortTitle: {
- shortTitle: string; // '我家的干饭宝宝';
- }[];
- description: string; // '#干饭宝宝';
- mediaType: number; // 4;
- location: {
- longitude: number; // 117.07821655273438;
- latitude: number; // 39.982460021972656;
- city: string; // '廊坊市';
- poiClassifyId: string; // '';
- };
- extReading: any; // {};
- topic: any; // {};
- feedLocation: any; // {};
- event: {
- eventTopicId: string; // '';
- eventName: string; // '';
- eventCreatorNickname: string; // '';
- eventAttendCount: number; // 0;
- };
- audio: any; // {};
- member: any; // {};
- finderNewlifeDesc: any; // {};
- };
- objectType: number; // 0;
- attachList: { attachments: any[] };
- flag: number; // 0;
- objectNonce: string; // '12188256280973362673';
- permissionFlag: number; // 0;
- canSetOriginalsoundTitle: true;
- fullPlayRate: number; // 0.0782122905027933;
- avgPlayTimeSec: number; // 6.877094972067039;
- disableInfo: { isDisabled: false };
- showOriginal: false;
- exportId: string; // 'export/UzFfAgtgekIEAQAAAAAAOhIpzVxlAQAAAAstQy6ubaLX4KHWvLEZgBPExKFQKCowfoSJzNPgMJrD53jJrD_NBzgU3Ncr3usg';
- ringsetCount: number; // 0;
- snscoverCount: number; // 0;
- statusrefCount: number; // 0;
- forwardAggregationCount: number; // 0;
- originalInfo: {
- auditOriginalFlag: number; // 0;
- isDeclared: number; // 0;
- isOriginalUpgrad: number; // 0;
- };
- followCount: number; // 1;
- fastFlipRate: number; // 0.49162011173184356;
- forwardSnsCount: number; // 0;
- forwardAllChatCount: number; // 0;
- argsInfo: {
- poiCheckSum: string; // '99b069319e6b279e8aff6ec656879f25' };
- }[];
- yesterdayReadCount: number; // 143
- }[];
- bindInfo: any[];
- totalCount: number;
- };
-}
-
-export interface CommentInfo {
- levelTwoComment: CommentInfo[]; // 二级评论
- commentId: string; // '14610404657143548189';
- commentNickname: string; // '义务之后是金钱';
- commentContent: string; // '可爱吧';
- commentHeadurl: string; // 'http://wx.qlogo.cn/finderhead/Q3auHgzwzM5OEKzc5UdzOUJUbOsaCtSkcCctCb9ddrCKiag4ZibQ73oA/0';
- commentCreatetime: string; // '1741695959';
- commentLikeCount: number; // 0;
- lastBuff: string; // '';
- downContinueFlag: number; // 0;
- visibleFlag: number; // 0;
- readFlag: true;
- displayFlag: number; // 514;
- blacklistFlag: number; // 0;
- likeFlag: number; // 0;
- replyCommentId?: string; // '14610404657143548189';
- replyContent?: string; // '可爱吧';
-}
-
-export interface SphGetCommentListResponse {
- errCode: number;
- errMsg: string;
- data: {
- comment: CommentInfo[];
- lastBuff: string; // 'AATVfYAEAAABAAAAAADWiCo0vu4ltcc8lXzRZyAAAADzrBEppsryM1QLZ+dDmBLm9XwcA0exd+eEMM5e+lsrR+oHHo2NIZY18J6IkJAbntQxZiEBkXZ24Y1hrnqW334ItvllglnXoA==',
- commentCount: number; // 2;
- downContinueFlag: number; // 0;
- };
-}
-
-// 微信视频号的合集
-export interface WxSPHGetMixListResponse {
- errCode: number;
- data: {
- collectionList: {
- id: string;
- name: string;
- desc: string;
- coverImgUrl?: string;
- feedCount: number;
- }[];
- collectionListCount: number;
- };
-}
diff --git a/src/app/plat/platChildren/xhs/PlatXhs.ts b/src/app/plat/platChildren/xhs/PlatXhs.ts
deleted file mode 100644
index 720ee24b..00000000
--- a/src/app/plat/platChildren/xhs/PlatXhs.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import {PlatBase} from "@/app/plat/PlatBase";
-import {requestPlatApi} from "@/utils/otherRequest";
-import {SocialAccount} from "@/api/types/account.type";
-import {PlatType} from "@/app/config/platConfig";
-
-export class PlatXhs extends PlatBase {
- async getAccountInfo(): Promise<Partial<SocialAccount> | null> {
- try {
- const res = await requestPlatApi({
- url: "xhs/me",
- method: "POST",
- data: {
- proxy: this.proxy,
- cookie: this.cookieStr,
- },
- });
- const { basic_info, interactions } = res.data.response_body.data;
-
- return {
- loginCookie: JSON.stringify(this.cookieList),
- type: PlatType.Xhs,
- uid: basic_info.red_id,
- account: basic_info.red_id,
- nickname: basic_info.nickname,
- avatar: basic_info.images,
- fansCount: interactions.find((v: any) => v.type === "fans").count,
- };
- } catch (e) {
- console.warn(e);
- return null;
- }
- }
-}
diff --git a/src/constant.ts b/src/constant.ts
index bcf90979..e326c720 100644
--- a/src/constant.ts
+++ b/src/constant.ts
@@ -1,10 +1,14 @@
// api url
export const APP_HOT_URL = "https://att-contents.yikart.cn/api";
+// 快手API代理地址
+export const KwaiApiProxyUrl = process.env.NEXT_PUBLIC_API_PROXY;
+// 快手API 上传 代理地址
+export const KwaiApiUploadProxyUrl = process.env.NEXT_PUBLIC_API_UPLOAD_PROXY;
+
// 代理地址
export const ProxyUrls = [
process.env.NEXT_PUBLIC_API_URL_PROXY,
- "/xhsXS",
- "/xiaohongshu/",
- "/platapiProxy/",
+ KwaiApiProxyUrl,
+ KwaiApiUploadProxyUrl,
];
diff --git a/src/utils/otherRequest.ts b/src/utils/otherRequest.ts
index ab474aaf..ba476db7 100644
--- a/src/utils/otherRequest.ts
+++ b/src/utils/otherRequest.ts
@@ -55,7 +55,7 @@ class OtherRequest {
}
}
-const requestPlatapi = new OtherRequest("https://platapi.yikart.cn/api/");
+const requestPlatapi = new OtherRequest("");
export async function requestPlatApi<T = any>(params: RequestParams) {
return await requestPlatapi.request(params);
}
diff --git a/src/utils/request.ts b/src/utils/request.ts
index f3163e94..9baa37b0 100644
--- a/src/utils/request.ts
+++ b/src/utils/request.ts
@@ -42,7 +42,7 @@ export async function request<T>(params: RequestParams) {
const data: ResponseType<T> = await res.json();
if (res.status === 401) {
- useUserStore.getState().logout();
+ // useUserStore.getState().logout();
message.error({
key: "NoPermission",
content: "登录状态过期,请重新登录",