Skip to content

Commit

Permalink
[*] Upgrade API
Browse files Browse the repository at this point in the history
  • Loading branch information
Muska-Ami committed Dec 2, 2024
1 parent 8624625 commit 08763f0
Show file tree
Hide file tree
Showing 65 changed files with 194 additions and 355 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "locyanfrp",
"private": true,
"version": "2.3",
"version": "2.4",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 + ',请重新登录后台!')
}
Expand Down
4 changes: 2 additions & 2 deletions src/api/base.ts
Original file line number Diff line number Diff line change
@@ -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 ??
Expand Down
15 changes: 0 additions & 15 deletions src/api/v1/Account/EditEmail.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/api/v1/Account/SendEditMail.ts

This file was deleted.

7 changes: 0 additions & 7 deletions src/api/v1/Account/index.ts

This file was deleted.

19 changes: 0 additions & 19 deletions src/api/v1/App/GetBroadCast.ts

This file was deleted.

20 changes: 0 additions & 20 deletions src/api/v1/App/GetCSApp.ts

This file was deleted.

20 changes: 0 additions & 20 deletions src/api/v1/App/_root.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/api/v1/App/index.ts

This file was deleted.

13 changes: 0 additions & 13 deletions src/api/v1/Donate/GetDonateList.ts

This file was deleted.

18 changes: 0 additions & 18 deletions src/api/v1/Donate/SetMessage.ts

This file was deleted.

6 changes: 1 addition & 5 deletions src/api/v1/Donate/index.ts
Original file line number Diff line number Diff line change
@@ -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
}
14 changes: 0 additions & 14 deletions src/api/v1/Proxies/GetConfigFile.ts

This file was deleted.

4 changes: 1 addition & 3 deletions src/api/v1/Proxies/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import GetConfigFile from './GetConfigFile'
import GetRandomPort from './GetRandomPort'

export default {
GetRandomPort: GetRandomPort,
GetConfigFile: GetConfigFile
GetRandomPort: GetRandomPort
}
16 changes: 0 additions & 16 deletions src/api/v1/User/DoResetPassowrdEmailSend.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/api/v1/User/DoResetPassword.ts

This file was deleted.

7 changes: 0 additions & 7 deletions src/api/v1/User/index.ts

This file was deleted.

10 changes: 2 additions & 8 deletions src/api/v1/index.ts
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 1 addition & 1 deletion src/api/v2/auth/login.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions src/api/v2/auth/oauth/qq/bind.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions src/api/v2/donate/list.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions src/api/v2/donate/root.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/api/v2/donate/say/all.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
4 changes: 2 additions & 2 deletions src/api/v2/donate/say/root.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
4 changes: 2 additions & 2 deletions src/api/v2/email/email.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/api/v2/email/password.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Loading

0 comments on commit 08763f0

Please sign in to comment.