diff --git a/package.json b/package.json index c5f2097..227f7a0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "locyanfrp", "private": true, - "version": "2.3", + "version": "2.4", "type": "module", "scripts": { "dev": "vite", diff --git a/src/App.vue b/src/App.vue index 8f90ffa..bb04244 100644 --- a/src/App.vue +++ b/src/App.vue @@ -121,7 +121,7 @@ vRouter.afterEach(() => { async function fetchUserInfo() { let rs try { - rs = await api.v2.user.info.root.get(userData.getters.get_username) + rs = await api.v2.user.info.root.get(userData.getters.get_user_id) } catch (e) { sendWarningMessage('查询用户信息失败: ' + e + ',请重新登录后台!') } diff --git a/src/api/base.ts b/src/api/base.ts index 36b15ce..780ec62 100644 --- a/src/api/base.ts +++ b/src/api/base.ts @@ -1,7 +1,7 @@ const base = { api_v1_url: 'https://api.locyanfrp.cn', - api_v2_url: 'https://api-v2.locyanfrp.cn/api/v2', - // api_v2_url: 'http://localhost:18080/api/v2', + // api_v2_url: 'https://api-v2.locyanfrp.cn/api/v2', + api_v2_url: 'http://localhost:18080/api/v2', buildResponse: (res: any, useDataPath: boolean = true) => { const message = res.data?.message ?? diff --git a/src/api/v1/Account/EditEmail.ts b/src/api/v1/Account/EditEmail.ts deleted file mode 100644 index 1ac60c4..0000000 --- a/src/api/v1/Account/EditEmail.ts +++ /dev/null @@ -1,15 +0,0 @@ -import base from '@/api/base' -//@ts-ignore -import { get } from '@/utils/request' - -const EditEmail = async (username: string, token: string, email: string, code: string) => { - const rs = await get(`${base.api_v1_url}/Account/EditEmail`, { - username: username, - token: token, - email: email, - code: code - }) - return base.buildResponse(rs, false) -} - -export default EditEmail diff --git a/src/api/v1/Account/SendEditMail.ts b/src/api/v1/Account/SendEditMail.ts deleted file mode 100644 index 90c0aa3..0000000 --- a/src/api/v1/Account/SendEditMail.ts +++ /dev/null @@ -1,14 +0,0 @@ -import base from '@/api/base' -//@ts-ignore -import { get } from '@/utils/request' - -const SendEditMail = async (username: string, token: string, email: string) => { - const rs = await get(`${base.api_v1_url}/Account/SendEditMail`, { - username: username, - token: token, - email: email - }) - return base.buildResponse(rs, false) -} - -export default SendEditMail diff --git a/src/api/v1/Account/index.ts b/src/api/v1/Account/index.ts deleted file mode 100644 index c23ce48..0000000 --- a/src/api/v1/Account/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import EditEmail from './EditEmail' -import SendEditMail from './SendEditMail' - -export default { - EditEmail: EditEmail, - SendEditMail: SendEditMail -} diff --git a/src/api/v1/App/GetBroadCast.ts b/src/api/v1/App/GetBroadCast.ts deleted file mode 100644 index 86b799a..0000000 --- a/src/api/v1/App/GetBroadCast.ts +++ /dev/null @@ -1,19 +0,0 @@ -import base from '@/api/base' -//@ts-ignore -import { get } from '@/utils/request' - -/** - * 获取公告 - * @returns { - * status: int, - * data: { - * broadcast: string - * } - * } - */ -const GetBroadCast = async () => { - const rs = await get(`${base.api_v1_url}/App/GetBroadCast`, {}) - return base.buildResponse(rs, false) -} - -export default GetBroadCast diff --git a/src/api/v1/App/GetCSApp.ts b/src/api/v1/App/GetCSApp.ts deleted file mode 100644 index ac6e53f..0000000 --- a/src/api/v1/App/GetCSApp.ts +++ /dev/null @@ -1,20 +0,0 @@ -import base from '@/api/base' -//@ts-ignore -import { get } from '@/utils/request' - -/** - * 获取公告 - * @returns { - * status: int, - * data: { - * url: string, - * name: string, - * } - * } - */ -const GetCSApp = async () => { - const rs = await get(`${base.api_v1_url}/App/GetCSApp`, {}) - return base.buildResponse(rs, false) -} - -export default GetCSApp diff --git a/src/api/v1/App/_root.ts b/src/api/v1/App/_root.ts deleted file mode 100644 index a4f7f75..0000000 --- a/src/api/v1/App/_root.ts +++ /dev/null @@ -1,20 +0,0 @@ -import base from '@/api/base' -//@ts-ignore -import { get } from '@/utils/request' - -/** - * 获取通知 - * @returns { - * status: int, - * data: { - * ads: string, - * content: string - * } - * } - */ -const root = async () => { - const rs = await get(`${base.api_v1_url}/App`, {}) - return base.buildResponse(rs, false) -} - -export default root diff --git a/src/api/v1/App/index.ts b/src/api/v1/App/index.ts deleted file mode 100644 index 0906172..0000000 --- a/src/api/v1/App/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -import root from './_root' -import GetBroadCast from './GetBroadCast' -import GetCSApp from './GetCSApp' - -export default { - root: root, - GetBroadCast: GetBroadCast, - GetCSApp: GetCSApp -} diff --git a/src/api/v1/Donate/GetDonateList.ts b/src/api/v1/Donate/GetDonateList.ts deleted file mode 100644 index ef9a8b5..0000000 --- a/src/api/v1/Donate/GetDonateList.ts +++ /dev/null @@ -1,13 +0,0 @@ -import base from '@/api/base' -//@ts-ignore -import { get } from '@/utils/request' - -/** - * 列出赞助列表 - */ -const GetDonateList = async () => { - const rs = get(`${base.api_v1_url}/Donate/GetDonateList`, {}) - return base.buildResponse(await rs, false) -} - -export default GetDonateList diff --git a/src/api/v1/Donate/SetMessage.ts b/src/api/v1/Donate/SetMessage.ts deleted file mode 100644 index f9a3cdb..0000000 --- a/src/api/v1/Donate/SetMessage.ts +++ /dev/null @@ -1,18 +0,0 @@ -import base from '@/api/base' -//@ts-ignore -import { get } from '@/utils/request' - -/** - * 列出赞助列表 - */ -const SetMessage = async (username: string, token: string, trade_no: string, message: string) => { - const rs = get(`${base.api_v1_url}/Donate/SetMessage`, { - username: username, - token: token, - trade_no: trade_no, - message: message - }) - return base.buildResponse(await rs, false) -} - -export default SetMessage diff --git a/src/api/v1/Donate/index.ts b/src/api/v1/Donate/index.ts index 246d872..cef8189 100644 --- a/src/api/v1/Donate/index.ts +++ b/src/api/v1/Donate/index.ts @@ -1,9 +1,5 @@ import GetDonateInfo from './GetDonateInfo' -import GetDonateList from './GetDonateList' -import SetMessage from './SetMessage' export default { - GetDonateList: GetDonateList, - GetDonateInfo: GetDonateInfo, - SetMessage: SetMessage + GetDonateInfo: GetDonateInfo } diff --git a/src/api/v1/Proxies/GetConfigFile.ts b/src/api/v1/Proxies/GetConfigFile.ts deleted file mode 100644 index 51c443d..0000000 --- a/src/api/v1/Proxies/GetConfigFile.ts +++ /dev/null @@ -1,14 +0,0 @@ -import base from '@/api/base' -//@ts-ignore -import { get } from '@/utils/request' - -const GetConfigFile = async (username: string, token: string, node_id: number) => { - const rs = get(`${base.api_v1_url}/Proxies/GetConfigFile`, { - username: username, - token: token, - node: node_id - }) - return base.buildResponse(await rs, false) -} - -export default GetConfigFile diff --git a/src/api/v1/Proxies/index.ts b/src/api/v1/Proxies/index.ts index c59fce4..df75618 100644 --- a/src/api/v1/Proxies/index.ts +++ b/src/api/v1/Proxies/index.ts @@ -1,7 +1,5 @@ -import GetConfigFile from './GetConfigFile' import GetRandomPort from './GetRandomPort' export default { - GetRandomPort: GetRandomPort, - GetConfigFile: GetConfigFile + GetRandomPort: GetRandomPort } diff --git a/src/api/v1/User/DoResetPassowrdEmailSend.ts b/src/api/v1/User/DoResetPassowrdEmailSend.ts deleted file mode 100644 index 16e23b0..0000000 --- a/src/api/v1/User/DoResetPassowrdEmailSend.ts +++ /dev/null @@ -1,16 +0,0 @@ -import base from '@/api/base' -//@ts-ignore -import { get } from '@/utils/request' - -/** - * 发送重置密码邮件 - */ -const DoResetPasswordEmailSend = async (username: string) => { - // 2024-09-06 Muska_Ami: 怎么有人把 Password 打成 Passowrd,害的我还在想为什么 API 404 - const rs = get(`${base.api_v1_url}/User/DoResetPassowrdEmailSend`, { - username: username - }) - return base.buildResponse(await rs, false) -} - -export default DoResetPasswordEmailSend diff --git a/src/api/v1/User/DoResetPassword.ts b/src/api/v1/User/DoResetPassword.ts deleted file mode 100644 index cf5892f..0000000 --- a/src/api/v1/User/DoResetPassword.ts +++ /dev/null @@ -1,14 +0,0 @@ -import base from '@/api/base' -//@ts-ignore -import { get } from '@/utils/request' - -const DoResetPassword = async (password: string, confirm: string, code: string) => { - const rs = get(`${base.api_v1_url}/User/DoResetPassword`, { - password: password, - confirm: confirm, - code: code - }) - return base.buildResponse(await rs, false) -} - -export default DoResetPassword diff --git a/src/api/v1/User/index.ts b/src/api/v1/User/index.ts deleted file mode 100644 index 55ffd3c..0000000 --- a/src/api/v1/User/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import DoResetPasswordEmailSend from './DoResetPassowrdEmailSend' -import DoResetPassword from './DoResetPassword' - -export default { - DoResetPassword: DoResetPassword, - DoResetPasswordEmailSend: DoResetPasswordEmailSend -} diff --git a/src/api/v1/index.ts b/src/api/v1/index.ts index 6d8fa23..a0ad471 100644 --- a/src/api/v1/index.ts +++ b/src/api/v1/index.ts @@ -1,13 +1,7 @@ -import Account from './Account' -import App from './App' -import Donate from './Donate' import Proxies from './Proxies' -import User from './User' +import Donate from './Donate' export default { - App: App, - Account: Account, Proxies: Proxies, - Donate: Donate, - User: User + Donate: Donate } diff --git a/src/api/v2/auth/login.api.ts b/src/api/v2/auth/login.api.ts index fad0b8b..5dd35d5 100644 --- a/src/api/v2/auth/login.api.ts +++ b/src/api/v2/auth/login.api.ts @@ -2,7 +2,7 @@ import { post } from '@/utils/request' import base from '@/api/base' -const login = async (username: string, password: string, captcha_response_token: string) => { +const login = async (username: number, password: string, captcha_response_token: string) => { const rs = post(`${base.api_v2_url}/auth/login`, { username: username, password: password, diff --git a/src/api/v2/auth/oauth/qq/bind.api.ts b/src/api/v2/auth/oauth/qq/bind.api.ts index 57ed743..a8bd9af 100644 --- a/src/api/v2/auth/oauth/qq/bind.api.ts +++ b/src/api/v2/auth/oauth/qq/bind.api.ts @@ -2,24 +2,24 @@ import base from '@/api/base' //@ts-ignore import { get, post, deleteReq } from '@/utils/request' -const getBind = async (username: string) => { +const getBind = async (user_id: number) => { const rs = await get(`${base.api_v2_url}/auth/oauth/qq/bind`, { - username: username + user_id: user_id }) return base.buildResponse(rs) } -const postBind = async (username: string, code: string) => { +const postBind = async (user_id: number, code: string) => { const rs = await post(`${base.api_v2_url}/auth/oauth/qq/bind`, { - username: username, + user_id: user_id, code: code }) return base.buildResponse(rs) } -const deleteBind = async (username: string) => { +const deleteBind = async (user_id: number) => { const rs = await deleteReq(`${base.api_v2_url}/auth/oauth/qq/bind`, { - username: username + user_id: user_id }) return base.buildResponse(rs) } diff --git a/src/api/v2/donate/list.api.ts b/src/api/v2/donate/list.api.ts index f1cb42e..2eb242e 100644 --- a/src/api/v2/donate/list.api.ts +++ b/src/api/v2/donate/list.api.ts @@ -5,9 +5,9 @@ import { get } from '@/utils/request' /** * 列出赞助列表 */ -const list = async (username: number) => { +const list = async (user_id: number) => { const rs = get(`${base.api_v2_url}/donate/list`, { - username: username + user_id: user_id }) return base.buildResponse(await rs) } diff --git a/src/api/v2/donate/root.api.ts b/src/api/v2/donate/root.api.ts index 38cd948..fd2a946 100644 --- a/src/api/v2/donate/root.api.ts +++ b/src/api/v2/donate/root.api.ts @@ -5,9 +5,9 @@ import { post } from '@/utils/request' /** * 创建赞助订单 */ -const postDonate = async (username: string, money: string) => { +const postDonate = async (user_id: number, money: string) => { const rs = post(`${base.api_v2_url}/donate`, { - username: username, + user_id: user_id, money: money }) return base.buildResponse(await rs) diff --git a/src/api/v2/donate/say/all.api.ts b/src/api/v2/donate/say/all.api.ts index 041746e..faf1504 100644 --- a/src/api/v2/donate/say/all.api.ts +++ b/src/api/v2/donate/say/all.api.ts @@ -2,12 +2,12 @@ import base from '@/api/base' //@ts-ignore import { get } from '@/utils/request' -const all = async (username: string | undefined) => { +const all = async (user_id: number | undefined) => { const rs = get( `${base.api_v2_url}/donate/say/all`, - username + user_id ? { - username: username + user_id: user_id } : null ) diff --git a/src/api/v2/donate/say/root.api.ts b/src/api/v2/donate/say/root.api.ts index bd3c5f3..5f421be 100644 --- a/src/api/v2/donate/say/root.api.ts +++ b/src/api/v2/donate/say/root.api.ts @@ -5,9 +5,9 @@ import { post } from '@/utils/request' /** * 列出赞助列表 */ -const postSay = async (username: number, trade_no: string, message: string) => { +const postSay = async (user_id: number, trade_no: string, message: string) => { const rs = post(`${base.api_v2_url}/donate/say`, { - username: username, + user_id: user_id, trade_no: trade_no, message: message }) diff --git a/src/api/v2/email/email.api.ts b/src/api/v2/email/email.api.ts index c718901..da78a9f 100644 --- a/src/api/v2/email/email.api.ts +++ b/src/api/v2/email/email.api.ts @@ -2,9 +2,9 @@ import { get } from '@/utils/request' import base from '@/api/base' -const email = async (username: string, email: string) => { +const email = async (user_id: number, email: string) => { const rs = get(`${base.api_v2_url}/email/email`, { - username: username, + user_id: user_id, email: email }) return base.buildResponse(await rs) diff --git a/src/api/v2/email/password.api.ts b/src/api/v2/email/password.api.ts index e7a1d77..eed5714 100644 --- a/src/api/v2/email/password.api.ts +++ b/src/api/v2/email/password.api.ts @@ -2,9 +2,9 @@ import { get } from '@/utils/request' import base from '@/api/base' -const password = async (username: string) => { +const password = async (user_id: number) => { const rs = get(`${base.api_v2_url}/email/password`, { - username: username + user_id: user_id }) return base.buildResponse(await rs) } diff --git a/src/api/v2/icp.api.ts b/src/api/v2/icp.api.ts index deb00ad..edefc46 100644 --- a/src/api/v2/icp.api.ts +++ b/src/api/v2/icp.api.ts @@ -5,17 +5,17 @@ import { get, post, deleteReq } from '@/utils/request' /** * 审核 ICP 备案域名 */ -const postIcp = async (username: string, domain: string) => { +const postIcp = async (user_id: number, domain: string) => { const rs = post(`${base.api_v2_url}/icp`, { - username: username, + user_id: user_id, domain: domain }) return base.buildResponse(await rs) } -const deleteIcp = async (username: string, domain_id: number) => { +const deleteIcp = async (user_id: number, domain_id: number) => { const rs = deleteReq(`${base.api_v2_url}/icp`, { - username: username, + user_id: user_id, id: domain_id }) return base.buildResponse(await rs) @@ -24,9 +24,9 @@ const deleteIcp = async (username: string, domain_id: number) => { /** * 列出已审核 ICP 备案域名 */ -const getIcp = async (username: string) => { +const getIcp = async (user_id: number) => { const rs = get(`${base.api_v2_url}/icp`, { - username: username + user_id: user_id }) return base.buildResponse(await rs) } diff --git a/src/api/v2/minecraft/game/all.api.ts b/src/api/v2/minecraft/game/all.api.ts index d1919d2..e6ef171 100644 --- a/src/api/v2/minecraft/game/all.api.ts +++ b/src/api/v2/minecraft/game/all.api.ts @@ -2,9 +2,9 @@ import base from '@/api/base' //@ts-ignore import { get } from '@/utils/request' -const all = async (username: string) => { +const all = async (user_id: number) => { const rs = await get(`${base.api_v2_url}/minecraft/game/all`, { - username: username + user_id: user_id }) return base.buildResponse(rs) } diff --git a/src/api/v2/minecraft/game/root.api.ts b/src/api/v2/minecraft/game/root.api.ts index 0c8d093..cdaaa0a 100644 --- a/src/api/v2/minecraft/game/root.api.ts +++ b/src/api/v2/minecraft/game/root.api.ts @@ -2,17 +2,17 @@ import base from '@/api/base' //@ts-ignore import { post, deleteReq } from '@/utils/request' -const postGame = async (username: string, proxy_id: number) => { +const postGame = async (user_id: number, proxy_id: number) => { const rs = await post(`${base.api_v2_url}/minecraft/game`, { - username: username, + user_id: user_id, proxy_id: proxy_id }) return base.buildResponse(await rs) } -const deleteGame = async (username: string, code: number) => { +const deleteGame = async (user_id: number, code: number) => { const rs = await deleteReq(`${base.api_v2_url}/minecraft/game`, { - username: username, + user_id: user_id, code: code }) return base.buildResponse(await rs) diff --git a/src/api/v2/notice/content.api.ts b/src/api/v2/notice/content.api.ts index 16dbca9..9165c29 100644 --- a/src/api/v2/notice/content.api.ts +++ b/src/api/v2/notice/content.api.ts @@ -2,9 +2,9 @@ import base from '@/api/base' //@ts-ignore import { get } from '@/utils/request' -const content = async (username: string, token: string) => { +const content = async (user_id: number, token: string) => { const rs = get(`${base.api_v2_url}/notice/content`, { - username: username, + user_id: user_id, token: token }) return base.buildResponse(await rs) diff --git a/src/api/v2/proxy/all.api.ts b/src/api/v2/proxy/all.api.ts index ba85330..f64f63e 100644 --- a/src/api/v2/proxy/all.api.ts +++ b/src/api/v2/proxy/all.api.ts @@ -2,9 +2,9 @@ import base from '@/api/base' //@ts-ignore import { get } from '@/utils/request' -const list = async (username: string) => { +const list = async (user_id: number) => { const rs = get(`${base.api_v2_url}/proxy/all`, { - username: username + user_id: user_id }) return base.buildResponse(await rs) } diff --git a/src/api/v2/proxy/config.api.ts b/src/api/v2/proxy/config.api.ts index 4dac83b..192db61 100644 --- a/src/api/v2/proxy/config.api.ts +++ b/src/api/v2/proxy/config.api.ts @@ -5,9 +5,9 @@ import { get } from '@/utils/request' /** * 获取单个隧道配置文件 */ -const config = async (username: string, proxy_id: number, node_id: number) => { +const config = async (user_id: number, proxy_id: number, node_id: number) => { const rs = get(`${base.api_v2_url}/proxy/config`, { - username: username, + user_id: user_id, proxy_id: proxy_id, node_id: node_id }) diff --git a/src/api/v2/proxy/down.api.ts b/src/api/v2/proxy/down.api.ts index 0c21a78..224d337 100644 --- a/src/api/v2/proxy/down.api.ts +++ b/src/api/v2/proxy/down.api.ts @@ -2,9 +2,9 @@ import base from '@/api/base' //@ts-ignore import { post } from '@/utils/request' -const down = async (username: string, proxy_id: string) => { +const down = async (user_id: number, proxy_id: string) => { const rs = post(`${base.api_v2_url}/proxy/down`, { - username: username, + user_id: user_id, proxy_id: proxy_id }) return base.buildResponse(await rs) diff --git a/src/api/v2/proxy/root.api.ts b/src/api/v2/proxy/root.api.ts index 90b57ae..bcc20f6 100644 --- a/src/api/v2/proxy/root.api.ts +++ b/src/api/v2/proxy/root.api.ts @@ -3,7 +3,7 @@ import base from '@/api/base' import { post, deleteReq } from '@/utils/request' const postProxy = async ( - username: string, + user_id: number, name: string, local_ip: string, type: string, @@ -16,7 +16,7 @@ const postProxy = async ( domain: string ) => { const rs = post(`${base.api_v2_url}/proxy`, { - username: username, + user_id: user_id, name: name, local_ip: local_ip, type: type, @@ -31,9 +31,9 @@ const postProxy = async ( return base.buildResponse(await rs) } -const deleteProxy = async (username: string, proxy_id: number) => { +const deleteProxy = async (user_id: number, proxy_id: number) => { const rs = deleteReq(`${base.api_v2_url}/proxy`, { - username: username, + user_id: user_id, proxy_id: proxy_id }) return base.buildResponse(await rs) diff --git a/src/api/v2/proxy/update.api.ts b/src/api/v2/proxy/update.api.ts index 5f09d08..cca67b5 100644 --- a/src/api/v2/proxy/update.api.ts +++ b/src/api/v2/proxy/update.api.ts @@ -3,7 +3,7 @@ import base from '@/api/base' import { post } from '@/utils/request' const update = async ( - username: string, + user_id: number, proxy_id: number, proxy_name: string, proxy_type: string, @@ -17,7 +17,7 @@ const update = async ( secret_key: string ) => { const rs = post(`${base.api_v2_url}/proxy/update`, { - username: username, + user_id: user_id, proxy_id: proxy_id, proxy_type: proxy_type, proxy_name: proxy_name, diff --git a/src/api/v2/sign.api.ts b/src/api/v2/sign.api.ts index 4e3540d..143f175 100644 --- a/src/api/v2/sign.api.ts +++ b/src/api/v2/sign.api.ts @@ -2,16 +2,16 @@ import base from '@/api/base' //@ts-ignore import { get, post } from '@/utils/request' -const getSign = async (username: string) => { +const getSign = async (user_id: number) => { const rs = get(`${base.api_v2_url}/sign`, { - username: username + user_id: user_id }) return base.buildResponse(await rs) } -const postSign = async (username: string) => { +const postSign = async (user_id: number) => { const rs = post(`${base.api_v2_url}/sign`, { - username: username + user_id: user_id }) return base.buildResponse(await rs) } diff --git a/src/api/v2/user/email.api.ts b/src/api/v2/user/email.api.ts new file mode 100644 index 0000000..80f3010 --- /dev/null +++ b/src/api/v2/user/email.api.ts @@ -0,0 +1,16 @@ +import base from '@/api/base' +//@ts-ignore +import { post } from '@/utils/request' + +const password = async ( + user_id: number, + verify_code: string +) => { + const rs = await post(`${base.api_v2_url}/user/email`, { + user_id: user_id, + verify_code: verify_code + }) + return base.buildResponse(rs) +} + +export default password diff --git a/src/api/v2/user/frp/token.api.ts b/src/api/v2/user/frp/token.api.ts index 0db065f..2baa80e 100644 --- a/src/api/v2/user/frp/token.api.ts +++ b/src/api/v2/user/frp/token.api.ts @@ -2,9 +2,9 @@ import base from '@/api/base' //@ts-ignore import { post } from '@/utils/request' -const token = async (username: string) => { +const token = async (user_id: number) => { const rs = await post(`${base.api_v2_url}/user/frp/token`, { - username: username + user_id: user_id }) return base.buildResponse(rs) } diff --git a/src/api/v2/user/index.ts b/src/api/v2/user/index.ts index d60047a..f16d15b 100644 --- a/src/api/v2/user/index.ts +++ b/src/api/v2/user/index.ts @@ -3,11 +3,13 @@ import info from './info' import password from './password.api' import token from './token' import traffic from './traffic.api' +import email from './email.api' export default { info: info, token: token, password: password, traffic: traffic, - frp: frp + frp: frp, + email: email } diff --git a/src/api/v2/user/info/qq.api.ts b/src/api/v2/user/info/qq.api.ts index ef7c5bd..a4311c2 100644 --- a/src/api/v2/user/info/qq.api.ts +++ b/src/api/v2/user/info/qq.api.ts @@ -2,9 +2,9 @@ import base from '@/api/base' //@ts-ignore import { get } from '@/utils/request' -const qq = async (username: string) => { +const qq = async (user_id: number) => { const rs = await get(`${base.api_v2_url}/user/info/qq`, { - username: username + user_id: user_id }) return base.buildResponse(rs) } diff --git a/src/api/v2/user/info/root.api.ts b/src/api/v2/user/info/root.api.ts index cf7b03d..514fe6e 100644 --- a/src/api/v2/user/info/root.api.ts +++ b/src/api/v2/user/info/root.api.ts @@ -2,9 +2,9 @@ import { get } from '@/utils/request' import base from '@/api/base' -const getInfo = async (username: string) => { +const getInfo = async (user_id: number) => { const rs = get(`${base.api_v2_url}/user/info`, { - username: username + user_id: user_id }) return base.buildResponse(await rs) } diff --git a/src/api/v2/user/password.api.ts b/src/api/v2/user/password.api.ts index 177f375..d6e0c19 100644 --- a/src/api/v2/user/password.api.ts +++ b/src/api/v2/user/password.api.ts @@ -3,13 +3,13 @@ import base from '@/api/base' import { post } from '@/utils/request' const password = async ( - username: string, + user_id: number, old_password: string | undefined, new_password: string, verify_code: string | undefined ) => { const rs = await post(`${base.api_v2_url}/user/password`, { - username: username, + user_id: user_id, old_password: old_password, new_password: new_password, verify_code: verify_code diff --git a/src/api/v2/user/token/all.api.ts b/src/api/v2/user/token/all.api.ts index e6658c8..f2fb923 100644 --- a/src/api/v2/user/token/all.api.ts +++ b/src/api/v2/user/token/all.api.ts @@ -2,9 +2,9 @@ import base from '@/api/base' //@ts-ignore import { deleteReq } from '@/utils/request' -const all = async (username: string) => { +const all = async (user_id: number) => { const rs = await deleteReq(`${base.api_v2_url}/user/token/all`, { - username: username + user_id: user_id }) return base.buildResponse(rs) } diff --git a/src/api/v2/user/token/root.api.ts b/src/api/v2/user/token/root.api.ts index 533e993..429d307 100644 --- a/src/api/v2/user/token/root.api.ts +++ b/src/api/v2/user/token/root.api.ts @@ -2,16 +2,16 @@ import { get, deleteReq } from '@/utils/request' import base from '@/api/base' -const getToken = async (username: string) => { +const getToken = async (user_id: number) => { const rs = get(`${base.api_v2_url}/user/token`, { - username: username + user_id: user_id }) return base.buildResponse(await rs) } -const deleteToken = async (username: string) => { +const deleteToken = async (user_id: number) => { const rs = deleteReq(`${base.api_v2_url}/user/token`, { - username: username + user_id: user_id }) return base.buildResponse(await rs) } diff --git a/src/api/v2/user/traffic.api.ts b/src/api/v2/user/traffic.api.ts index 696468c..1e82239 100644 --- a/src/api/v2/user/traffic.api.ts +++ b/src/api/v2/user/traffic.api.ts @@ -2,9 +2,9 @@ import base from '@/api/base' //@ts-ignore import { post } from '@/utils/request' -const traffic = async (username: string) => { +const traffic = async (user_id: number) => { const rs = await post(`${base.api_v2_url}/user/traffic`, { - username: username + user_id: user_id }) return base.buildResponse(rs) } diff --git a/src/api/v2/verification/realname.api.ts b/src/api/v2/verification/realname.api.ts index 52d7956..167654b 100644 --- a/src/api/v2/verification/realname.api.ts +++ b/src/api/v2/verification/realname.api.ts @@ -2,9 +2,9 @@ import base from '@/api/base' //@ts-ignore import { post } from '@/utils/request' -const realname = async (username: string, name: string, id_card: string) => { +const realname = async (user_id: number, name: string, id_card: string) => { const rs = post(`${base.api_v2_url}/verification/realname`, { - username: username, + user_id: user_id, name: name, id_card: id_card }) diff --git a/src/api/v2/verification/realperson/pay.api.ts b/src/api/v2/verification/realperson/pay.api.ts index 8de50cf..e4a9ccb 100644 --- a/src/api/v2/verification/realperson/pay.api.ts +++ b/src/api/v2/verification/realperson/pay.api.ts @@ -2,9 +2,9 @@ import base from '@/api/base' //@ts-ignore import { get } from '@/utils/request' -const pay = async (username: string) => { +const pay = async (user_id: number) => { const rs = get(`${base.api_v2_url}/verification/realperson/pay`, { - username: username + user_id: user_id }) return base.buildResponse(await rs) } diff --git a/src/api/v2/verification/realperson/query.api.ts b/src/api/v2/verification/realperson/query.api.ts index 84a8177..e4e19df 100644 --- a/src/api/v2/verification/realperson/query.api.ts +++ b/src/api/v2/verification/realperson/query.api.ts @@ -2,9 +2,9 @@ import base from '@/api/base' //@ts-ignore import { get } from '@/utils/request' -const query = async (username: string, certify_id: string) => { +const query = async (user_id: number, certify_id: string) => { const rs = get(`${base.api_v2_url}/verification/realperson/query`, { - username: username, + user_id: user_id, certify_id: certify_id }) return base.buildResponse(await rs) diff --git a/src/api/v2/verification/realperson/root.api.ts b/src/api/v2/verification/realperson/root.api.ts index 3c4a399..d670dad 100644 --- a/src/api/v2/verification/realperson/root.api.ts +++ b/src/api/v2/verification/realperson/root.api.ts @@ -2,9 +2,9 @@ import base from '@/api/base' //@ts-ignore import { post } from '@/utils/request' -const postRealperson = async (username: string, name: string, id_card: string) => { +const postRealperson = async (user_id: number, name: string, id_card: string) => { const rs = post(`${base.api_v2_url}/verification/realperson`, { - username: username, + user_id: user_id, name: name, id_card: id_card }) diff --git a/src/api/v2/verification/root.api.ts b/src/api/v2/verification/root.api.ts index 9ff5bf9..3805e24 100644 --- a/src/api/v2/verification/root.api.ts +++ b/src/api/v2/verification/root.api.ts @@ -2,9 +2,9 @@ import base from '@/api/base' //@ts-ignore import { get } from '@/utils/request' -const getVerification = async (username: string) => { +const getVerification = async (user_id: number) => { const rs = get(`${base.api_v2_url}/verification`, { - username: username + user_id: user_id }) return base.buildResponse(await rs) } diff --git a/src/components/UserInfo.vue b/src/components/UserInfo.vue index ad3737f..9d5f363 100644 --- a/src/components/UserInfo.vue +++ b/src/components/UserInfo.vue @@ -142,7 +142,7 @@ onMounted(async () => { if (userData.getters.get_token !== '') { let rs try { - rs = await api.v2.user.info.qq(userData.getters.get_username) + rs = await api.v2.user.info.qq(userData.getters.get_user_id) } catch (e) { logger.error(e) bindQQ.value.isDisable = true @@ -176,10 +176,8 @@ async function changeEmail() { let rs ldb.start() try { - rs = await api.v1.Account.EditEmail( - userData.getters.get_username, - userData.getters.get_token, - tEmail.value.email, + rs = await api.v2.user.email( + userData.getters.get_user_id, tEmail.value.verify.code ) } catch (e) { @@ -214,7 +212,7 @@ async function sendChangeEmailCode() { ldb.start() let rs try { - rs = await api.v2.email.email(userData.getters.get_username, tEmail.value.email) + rs = await api.v2.email.email(userData.getters.get_user_id, tEmail.value.email) } catch (e) { logger.error(e) message.error('请求邮件验证码失败: ' + e) @@ -240,7 +238,7 @@ async function doBindQQ() { binding.value = true let rs try { - rs = await api.v2.auth.oauth.qq.bind.get(userData.getters.get_username) + rs = await api.v2.auth.oauth.qq.bind.get(userData.getters.get_user_id) } catch (e) { logger.error(e) message.error('请求失败: ' + e) @@ -256,7 +254,7 @@ async function unBindQQ() { binding.value = true let rs try { - rs = await api.v2.auth.oauth.qq.bind.delete(userData.getters.get_username) + rs = await api.v2.auth.oauth.qq.bind.delete(userData.getters.get_user_id) } catch (e) { logger.error(e) binding.value = false @@ -303,13 +301,13 @@ async function changePassword() { return } const data = { - username: userData.getters.get_username, + user_id: userData.getters.get_user_id, oldPassword: tPassword.value.oldPassword, newPassword: tPassword.value.newPassword } let rs try { - rs = await api.v2.user.password(data.username, data.oldPassword, data.newPassword, undefined) + rs = await api.v2.user.password(data.user_id, data.oldPassword, data.newPassword, undefined) } catch (e) { logger.error(e) tPassword.value.isLoading = false @@ -330,7 +328,7 @@ async function resetFrpToken() { resetFrpTokenLoading.value = true const data = { - username: userData.getters.get_username + user_id: userData.getters.get_user_id } dialog.warning({ @@ -342,7 +340,7 @@ async function resetFrpToken() { onPositiveClick: async () => { let rs try { - rs = await api.v2.user.frp.token(data.username) + rs = await api.v2.user.frp.token(data.user_id) } catch (e) { logger.error(e) resetFrpTokenLoading.value = false @@ -368,7 +366,7 @@ async function exitAllDevices() { exitAllDevicesLoading.value = true const data = { - username: userData.getters.get_username + user_id: userData.getters.get_user_id } dialog.warning({ @@ -380,7 +378,7 @@ async function exitAllDevices() { onPositiveClick: async () => { let rs try { - rs = await api.v2.user.token.all(data.username) + rs = await api.v2.user.token.all(data.user_id) } catch (e) { logger.error(e) exitAllDevicesLoading.value = false diff --git a/src/utils/stores/userData/def.js b/src/utils/stores/userData/def.js index 67218ec..da69751 100644 --- a/src/utils/stores/userData/def.js +++ b/src/utils/stores/userData/def.js @@ -1,8 +1,9 @@ export default { token: '', username: '', + user_id: 0, email: '', - frptoken: '', + frp_token: '', inbound: 0, outbound: 0, avatar: '', diff --git a/src/utils/stores/userData/local.js b/src/utils/stores/userData/local.js index 6714109..2ce047d 100644 --- a/src/utils/stores/userData/local.js +++ b/src/utils/stores/userData/local.js @@ -4,8 +4,9 @@ import defStateData from './def' const loadFromLocal = () => { userData.commit('set_token', localStorage.getItem('token') ?? defStateData.token) userData.commit('set_username', localStorage.getItem('username') ?? defStateData.username) + userData.commit('set_user_id', localStorage.getItem('user_id') ?? defStateData.user_id) userData.commit('set_user_email', localStorage.getItem('email') ?? defStateData.email) - userData.commit('set_frp_token', localStorage.getItem('frptoken') ?? defStateData.frptoken) + userData.commit('set_frp_token', localStorage.getItem('frp_token') ?? defStateData.frp_token) userData.commit( 'set_user_inbound', Number(localStorage.getItem('inbound') ?? defStateData.inbound) diff --git a/src/utils/stores/userData/store.js b/src/utils/stores/userData/store.js index 636484b..9e4d0fd 100644 --- a/src/utils/stores/userData/store.js +++ b/src/utils/stores/userData/store.js @@ -4,8 +4,9 @@ import defStateData from './def' const stateData = { token: '', username: '', + user_id: 0, email: '', - frptoken: '', + frp_token: '', inbound: 0, outbound: 0, avatar: '', @@ -23,11 +24,14 @@ export default new vuex.Store({ get_username(state) { return state.username }, + get_user_id(state) { + return state.user_id + }, get_email(state) { return state.email }, get_frp_token(state) { - return state.frptoken + return state.frp_token }, get_user_inbound(state) { // 限速方面必须返回整数 @@ -65,14 +69,24 @@ export default new vuex.Store({ state.username = defStateData.username localStorage.removeItem('username') }, + // user id + set_user_id(state, user_id) { + console.log(user_id) + state.user_id = user_id + localStorage.setItem('user_id', user_id) + }, + remove_user_id(state) { + state.user_id = defStateData.user_id + localStorage.removeItem('user_id') + }, // frp token - set_frp_token(state, frptoken) { - state.frptoken = frptoken - localStorage.setItem('frptoken', frptoken) + set_frp_token(state, frp_token) { + state.frp_token = frp_token + localStorage.setItem('frp_token', frp_token) }, remove_frp_token(state) { - state.frptoken = defStateData.frptoken - localStorage.removeItem('frptoken') + state.frp_token = defStateData.frp_token + localStorage.removeItem('frp_token') }, // inbound set_user_inbound(state, inbound) { @@ -126,28 +140,31 @@ export default new vuex.Store({ localStorage.setItem('outbound', limit_info.outbound) }, // 可选 - set_user_info(state, userdata) { - // console.log(userdata) - state.username = userdata.username - state.email = userdata.email - state.frptoken = userdata.frp_token - state.inbound = userdata.inbound - state.outbound = userdata.outbound - state.avatar = userdata.avatar - state.traffic = userdata.traffic + set_user_info(state, userData) { + // console.log(userData) + state.username = userData.username + state.user_id = userData.id + state.email = userData.email + state.frptoken = userData.frp_token + state.inbound = userData.inbound + state.outbound = userData.outbound + state.avatar = userData.avatar + state.traffic = userData.traffic // state.proxies_num = userdata.proxies_num - localStorage.setItem('username', userdata.username) - localStorage.setItem('email', userdata.email) - localStorage.setItem('traffic', userdata.traffic) - localStorage.setItem('frptoken', userdata.frp_token) - localStorage.setItem('inbound', userdata.inbound) - localStorage.setItem('outbound', userdata.outbound) - localStorage.setItem('avatar', userdata.avatar) + localStorage.setItem('username', userData.username) + localStorage.setItem('user_id', userData.id) + localStorage.setItem('email', userData.email) + localStorage.setItem('traffic', userData.traffic) + localStorage.setItem('frp_token', userData.frp_token) + localStorage.setItem('inbound', userData.inbound) + localStorage.setItem('outbound', userData.outbound) + localStorage.setItem('avatar', userData.avatar) // localStorage.setItem('proxies_num', userdata.proxies_num) }, delete_user_info(state) { state.token = defStateData.token state.username = defStateData.username + state.user_id = defStateData.user_id state.email = defStateData.email state.frptoken = defStateData.frptoken state.inbound = defStateData.inbound @@ -156,14 +173,15 @@ export default new vuex.Store({ state.traffic = defStateData.traffic localStorage.removeItem('token') localStorage.removeItem('username') + localStorage.removeItem('user_id') localStorage.removeItem('email') localStorage.removeItem('avatar') localStorage.removeItem('traffic') - localStorage.removeItem('frptoken') + localStorage.removeItem('frp_token') localStorage.removeItem('inbound') localStorage.removeItem('outbound') localStorage.removeItem('proxies') - localStorage.removeItem('avator') + localStorage.removeItem('avatar') } }, diff --git a/src/views/DashboardView.vue b/src/views/DashboardView.vue index 543820f..94b3d8b 100644 --- a/src/views/DashboardView.vue +++ b/src/views/DashboardView.vue @@ -251,11 +251,11 @@ async function resetTraffic() { onPositiveClick: async () => { startLoadingBar() const data = { - username: userData.getters.get_username + user_id: userData.getters.get_user_id } let rs try { - rs = await api.v2.user.traffic(data.username) + rs = await api.v2.user.traffic(data.user_id) } catch (e) { logger.error(e) sendErrorMessage('请求重置流量失败: ' + e) diff --git a/src/views/DonateView.vue b/src/views/DonateView.vue index 25bfd9b..069acfb 100644 --- a/src/views/DonateView.vue +++ b/src/views/DonateView.vue @@ -170,7 +170,7 @@ onMounted(async () => { showModal.value = true let rs try { - rs = await api.v1.Donate.GetDonateInfo(inputTradeNo) + rs = await api.v2.Donate.GetDonateInfo(inputTradeNo) } catch (e) { sendErrorMessage('请求列表失败: ' + e) } @@ -233,7 +233,7 @@ async function submitMessage() { let rs try { rs = await api.v2.donate.say.root.post( - userData.getters.get_username, + userData.getters.get_user_id, inputTradeNo, message.value.message ) @@ -260,7 +260,7 @@ async function doDonate() { } let rs try { - rs = await api.v2.donate.root.post(userData.getters.get_username, amount.value) + rs = await api.v2.donate.root.post(userData.getters.get_user_id, amount.value) } catch (e) { sendErrorMessage('请求列表失败: ' + e) } diff --git a/src/views/IcpCheckView.vue b/src/views/IcpCheckView.vue index 4febbae..16fc6cb 100644 --- a/src/views/IcpCheckView.vue +++ b/src/views/IcpCheckView.vue @@ -84,7 +84,7 @@ async function submit() { } let rs try { - rs = await api.v2.icp.post(userData.getters.get_username, domainInput.value.domain) + rs = await api.v2.icp.post(userData.getters.get_user_id, domainInput.value.domain) } catch (e) { sendErrorMessage('请求审核失败: ' + e) } @@ -109,7 +109,7 @@ async function removeICP(id) { onPositiveClick: async () => { let rs try { - rs = await api.v2.icp.delete(userData.getters.get_username, id) + rs = await api.v2.icp.delete(userData.getters.get_user_id, id) } catch (e) { sendErrorMessage('请求移除域名失败: ' + e) } @@ -134,7 +134,7 @@ async function getList() { icpListLoading.value = true let rs try { - rs = await api.v2.icp.get(userData.getters.get_username) + rs = await api.v2.icp.get(userData.getters.get_user_id) } catch (e) { sendErrorMessage('请求移除域名失败: ' + e) } diff --git a/src/views/SignView.vue b/src/views/SignView.vue index 5352bd0..273a564 100644 --- a/src/views/SignView.vue +++ b/src/views/SignView.vue @@ -119,7 +119,7 @@ const status = ref(false) async function checkSign() { let rs try { - rs = await api.v2.sign.get(userData.getters.get_username) + rs = await api.v2.sign.get(userData.getters.get_user_id) } catch (e) { sendErrorMessage('获取签到状态失败: ' + e) loading.value = false @@ -134,7 +134,7 @@ async function checkSign() { async function doSign() { let rs try { - rs = await api.v2.sign.post(userData.getters.get_username) + rs = await api.v2.sign.post(userData.getters.get_user_id) } catch (e) { sendErrorMessage('签到失败: ' + e) } diff --git a/src/views/VerificationView.vue b/src/views/VerificationView.vue index 6b2441e..c0813fd 100644 --- a/src/views/VerificationView.vue +++ b/src/views/VerificationView.vue @@ -196,14 +196,14 @@ const segmented = { async function submitRealName() { startLoadingBar() const submitForm = { - username: userData.getters.get_username, + user_id: userData.getters.get_user_id, name: userProfile.value.name, id_card: userProfile.value.idCard } let rs try { rs = await api.v2.verification.realname( - submitForm.username, + submitForm.user_id, submitForm.name, submitForm.id_card ) @@ -227,14 +227,14 @@ async function submitRealName() { async function submitRealPerson() { startLoadingBar() const submitForm = { - username: userData.getters.get_username, + user_id: userData.getters.get_user_id, name: userProfile.value.name, id_card: userProfile.value.idCard } let rs try { rs = await api.v2.verification.realperson.root.post( - submitForm.username, + submitForm.user_id, submitForm.name, submitForm.id_card ) @@ -265,7 +265,7 @@ async function submitRealPerson() { async function queryRealPersonStatus() { let rs try { - rs = await api.v2.verification.realperson.query(userData.getters.get_username, ci.value) + rs = await api.v2.verification.realperson.query(userData.getters.get_user_id, ci.value) } catch (e) { sendErrorMessage('请求失败: ' + e) } @@ -281,7 +281,7 @@ async function queryRealPersonStatus() { async function checkVerificationStatus() { let rs try { - rs = await api.v2.verification.root.get(userData.getters.get_username) + rs = await api.v2.verification.root.get(userData.getters.get_user_id) } catch (e) { sendErrorMessage('请求失败: ' + e) } @@ -333,7 +333,7 @@ async function checkVerificationStatus() { async function realPersonPay() { let rs try { - rs = await api.v2.verification.realperson.pay(userData.getters.get_username) + rs = await api.v2.verification.realperson.pay(userData.getters.get_user_id) } catch (e) { sendErrorMessage('请求失败: ' + e) } diff --git a/src/views/callback/auth/oauth/qq/BindView.vue b/src/views/callback/auth/oauth/qq/BindView.vue index c50ca12..497e048 100644 --- a/src/views/callback/auth/oauth/qq/BindView.vue +++ b/src/views/callback/auth/oauth/qq/BindView.vue @@ -22,9 +22,9 @@ let error = ref(false) let success = ref(false) let errorMessage = ref('') -const username = userData.getters.get_username +const user_id = userData.getters.get_user_id -if (username == null) { +if (user_id == null) { error.value = true errorMessage.value = '需要登录才能继续操作' } @@ -35,7 +35,7 @@ if (!error.value && code !== null) { onMounted(async () => { let rs try { - rs = await api.v2.auth.oauth.qq.bind.post(username, code) + rs = await api.v2.auth.oauth.qq.bind.post(get_user_id, code) } catch (e) { sendErrorMessage('登录失败: ' + e) error.value = true diff --git a/src/views/games/MinecraftView.vue b/src/views/games/MinecraftView.vue index b87efac..f1c7c4c 100644 --- a/src/views/games/MinecraftView.vue +++ b/src/views/games/MinecraftView.vue @@ -83,7 +83,7 @@ let created = ref([]) async function initProxyList() { let rs try { - rs = await api.v2.proxy.all(userData.getters.get_username) + rs = await api.v2.proxy.all(userData.getters.get_user_id) } catch (e) { sendErrorMessage('请求隧道列表失败: ' + e) } @@ -111,7 +111,7 @@ async function initCreatedGames() { created.value.length = 0 let rs try { - rs = await api.v2.minecraft.game.all(userData.getters.get_username) + rs = await api.v2.minecraft.game.all(userData.getters.get_user_id) } catch (e) { sendErrorMessage('请求游戏列表失败: ' + e) } @@ -129,7 +129,7 @@ async function createMinecraftGame() { let selectedId = selected.value let rs try { - rs = await api.v2.minecraft.game.root.post(userData.getters.get_username, selectedId) + rs = await api.v2.minecraft.game.root.post(userData.getters.get_user_id, selectedId) } catch (e) { sendErrorMessage('创建联机失败: ' + e) } @@ -147,7 +147,7 @@ async function createMinecraftGame() { async function deleteMinecraftGame(code) { let rs try { - rs = await api.v2.minecraft.game.root.delete(userData.getters.get_username, code) + rs = await api.v2.minecraft.game.root.delete(userData.getters.get_user_id, code) } catch (e) { sendErrorMessage('删除联机失败: ' + e) } diff --git a/src/views/proxies/AddView.vue b/src/views/proxies/AddView.vue index 8882f86..fe0e4a8 100644 --- a/src/views/proxies/AddView.vue +++ b/src/views/proxies/AddView.vue @@ -304,7 +304,7 @@ async function addProxy() { return } const tunnelCreateInfo = { - username: userData.getters.get_username, + user_id: userData.getters.get_user_id, name: proxyInfo.value.proxyName, localIp: proxyInfo.value.localIp, proxyType: proxyInfo.value.proxyType, @@ -320,7 +320,7 @@ async function addProxy() { let rs try { rs = await api.v2.proxy.root.post( - tunnelCreateInfo.username, + tunnelCreateInfo.user_id, tunnelCreateInfo.name, tunnelCreateInfo.localIp, tunnelCreateInfo.proxyType, diff --git a/src/views/proxies/ConfigView.vue b/src/views/proxies/ConfigView.vue index e8b8c11..0438c3f 100644 --- a/src/views/proxies/ConfigView.vue +++ b/src/views/proxies/ConfigView.vue @@ -133,7 +133,7 @@ async function updateValue(value) { loading.value = true let rs try { - rs = await api.v2.proxy.config(userData.getters.get_username, null, value) + rs = await api.v2.proxy.config(userData.getters.get_user_id, null, value) } catch (e) { logger.error(e) sendErrorMessage('请求获取隧道配置文件失败: ' + e) diff --git a/src/views/proxies/ProxiesView.vue b/src/views/proxies/ProxiesView.vue index 08cdaf6..8721289 100644 --- a/src/views/proxies/ProxiesView.vue +++ b/src/views/proxies/ProxiesView.vue @@ -352,7 +352,7 @@ async function forceDownProxy(proxyId) { onPositiveClick: async () => { let rs try { - rs = await api.v2.proxy.down(userData.getters.get_username, proxyId) + rs = await api.v2.proxy.down(userData.getters.get_user_id, proxyId) } catch (e) { logger.error(e) sendErrorMessage(`请求强制下线隧道失败: ${e}`) @@ -386,7 +386,7 @@ async function editProxy(proxyId) { let rs try { rs = await api.v2.proxy.update( - userData.getters.get_username, + userData.getters.get_user_id, editInfo.proxyId, editInfo.proxyName, editInfo.proxyType, @@ -568,7 +568,7 @@ async function initList() { let rs2 try { - rs2 = await api.v2.proxy.all(userData.getters.get_username) + rs2 = await api.v2.proxy.all(userData.getters.get_user_id) } catch (e) { sendErrorMessage('请求隧道列表失败: ' + e) } @@ -577,6 +577,7 @@ async function initList() { proxiesList.value = rs2.data.list loading.value = false } else if (rs2.status === 404) { + loading.value = false // sendErrorMessage('你还没有隧道,先创建一个吧?') } else { sendErrorMessage(rs2.message) @@ -609,7 +610,7 @@ function deleteProxy(id) { loading.value = true let rs try { - rs = await api.v2.proxy.root.delete(userData.getters.get_username, proxiesList.value[id].id) + rs = await api.v2.proxy.root.delete(userData.getters.get_user_id, proxiesList.value[id].id) } catch (e) { sendErrorMessage('请求删除隧道失败: ' + e) loading.value = false