111
This commit is contained in:
@@ -45,6 +45,7 @@ export interface Coin {
|
||||
code: string
|
||||
name: string
|
||||
price: number
|
||||
initialPrice?: number
|
||||
priceType: number // 1: 实时 2: 手动
|
||||
status: number
|
||||
createTime: string
|
||||
@@ -57,7 +58,9 @@ export interface OrderFund {
|
||||
username: string
|
||||
type: number // 1: 充值 2: 提现
|
||||
amount: number
|
||||
status: number // 充值: 1待付款 2待确认 3已完成 4已驳回 5已取消; 提现: 1待审批 2已完成 3已驳回 4已取消
|
||||
fee?: number // 手续费
|
||||
receivableAmount?: number // 应收款项
|
||||
status: number // 充值: 1待付款 2待确认 3已完成 4已驳回 5已取消; 提现: 1待审批 2已完成 3已驳回 4已取消 5待财务审核
|
||||
walletId?: number
|
||||
walletAddress?: string
|
||||
withdrawContact?: string
|
||||
@@ -66,6 +69,12 @@ export interface OrderFund {
|
||||
createTime: string
|
||||
rejectReason?: string
|
||||
adminRemark?: string
|
||||
approveAdminId?: number
|
||||
approveAdminName?: string
|
||||
approveTime?: string
|
||||
financeAdminId?: number
|
||||
financeAdminName?: string
|
||||
financeApproveTime?: string
|
||||
}
|
||||
|
||||
export interface ColdWallet {
|
||||
@@ -351,7 +360,91 @@ export function useToggleWalletStatusMutation() {
|
||||
})
|
||||
}
|
||||
|
||||
// ========== 分析相关 API ==========
|
||||
// ========== 管理员管理 API ==========
|
||||
|
||||
export interface AdminRecord {
|
||||
id: number
|
||||
username: string
|
||||
nickname: string
|
||||
role: number
|
||||
permissions?: string
|
||||
isSystem?: number
|
||||
status?: number
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export function useGetAdminListQuery() {
|
||||
const { axiosInstance } = useAxios()
|
||||
|
||||
return useQuery<ApiResult<AdminRecord[]>, AxiosError>({
|
||||
queryKey: ['useGetAdminListQuery'],
|
||||
queryFn: async () => {
|
||||
const response = await axiosInstance.get('/admin/admin/list')
|
||||
return response.data
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function useCreateAdminMutation() {
|
||||
const { axiosInstance } = useAxios()
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation<ApiResult<{ id: number, username: string, role: number }>, AxiosError, { username: string, password: string, nickname?: string, role?: number }>({
|
||||
mutationKey: ['useCreateAdminMutation'],
|
||||
mutationFn: async (params) => {
|
||||
const response = await axiosInstance.post('/admin/admin/create', params)
|
||||
return response.data
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['useGetAdminListQuery'] })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function useToggleAdminStatusMutation() {
|
||||
const { axiosInstance } = useAxios()
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation<ApiResult<void>, AxiosError, { id: number, status: number }>({
|
||||
mutationKey: ['useToggleAdminStatusMutation'],
|
||||
mutationFn: async (params) => {
|
||||
const response = await axiosInstance.post('/admin/admin/status', params)
|
||||
return response.data
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['useGetAdminListQuery'] })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function usePromoteUserToAdminMutation() {
|
||||
const { axiosInstance } = useAxios()
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation<ApiResult<{ id: number, username: string, role: number }>, AxiosError, { username: string, password: string, nickname?: string }>({
|
||||
mutationKey: ['usePromoteUserToAdminMutation'],
|
||||
mutationFn: async (params) => {
|
||||
const response = await axiosInstance.post('/admin/user/promote-admin', params)
|
||||
return response.data
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['useGetAdminListQuery'] })
|
||||
queryClient.invalidateQueries({ queryKey: ['useGetUserListQuery'] })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function useChangePasswordMutation() {
|
||||
const { axiosInstance } = useAxios()
|
||||
|
||||
return useMutation<ApiResult<void>, AxiosError, { oldPassword: string, newPassword: string }>({
|
||||
mutationKey: ['useChangePasswordMutation'],
|
||||
mutationFn: async (params) => {
|
||||
const response = await axiosInstance.post('/admin/change-password', params)
|
||||
return response.data
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 盈利分析
|
||||
export function useGetProfitAnalysisQuery(range: string = 'month') {
|
||||
|
||||
Reference in New Issue
Block a user