particularly complete forum function, add point order export and user delete

This commit is contained in:
2024-03-22 01:47:55 +08:00
parent 87df8d5966
commit 932b83ddcd
52 changed files with 2806 additions and 132 deletions

View File

@@ -0,0 +1,49 @@
import { ResponsePointGoodModel } from "@/api/api-models";
import { QueryGetAPI } from "@/api/query";
import { POINT_API_URL } from "@/data/constants";
import { MessageApiInjection } from "naive-ui/es/message/src/MessageProvider";
import { defineStore } from "pinia";
import { useAuthStore } from "./useAuthStore";
export const usePointStore = defineStore('point', () => {
const useAuth = useAuthStore()
async function GetSpecificPoint(id: number) {
try {
const data = await useAuth.QueryBiliAuthGetAPI<number>(POINT_API_URL + 'user/get-point', { id: id })
if (data.code == 200) {
return data.data
} else {
console.error('[point] 无法获取在指定直播间拥有的积分: ' + data.message)
}
} catch (err) {
console.error('[point] 无法获取在指定直播间拥有的积分: ' + err)
}
return null
}
async function GetGoods(id: number | undefined = undefined, message?: MessageApiInjection) {
if (!id) {
return []
}
try {
const resp = await QueryGetAPI<ResponsePointGoodModel[]>(POINT_API_URL + 'get-goods', {
id: id,
})
if (resp.code == 200) {
return resp.data
} else {
message?.error('无法获取数据: ' + resp.message)
console.error('无法获取数据: ' + resp.message)
}
} catch (err) {
message?.error('无法获取数据: ' + err)
console.error('无法获取数据: ' + err)
}
return []
}
return {
GetSpecificPoint,
GetGoods
}
})