30 lines
1.2 KiB
TypeScript
30 lines
1.2 KiB
TypeScript
import type { TableInput } from '@core/type/baseTable'
|
|||
|
|
import useAxios from '@core/utils/useAxios'
|
||
|
|
// import { Customer } from '@/model/customer'
|
||
|
|
import type { Charge, Wallet, Withdraw, SendWeight } from '@/model/wallet'
|
||
|
|
|
||
|
|
export const getWalletTable = async (params?: TableInput) =>
|
||
|
|
await useAxios.post<Array<Wallet>>('/admin/wallet/table', params)
|
||
|
|
export const chargeWallet = async (params: Charge, type: 'gold' | 'money') =>
|
||
|
|
type === 'money'
|
||
|
|
? await useAxios.post<boolean>('/admin/wallet/charge', params)
|
||
|
|
: await useAxios.post<boolean>('/admin/wallet/charge_gold', params)
|
||
|
|
|
||
|
|
export const getWithdrawTable = async (params: TableInput) =>
|
||
|
|
await useAxios.post<Array<Withdraw>>('/admin/wallet/withdraw/table', params)
|
||
|
|
|
||
|
|
export const completeWithdraw = async (params: Withdraw) =>
|
||
|
|
await useAxios.post<boolean>('/admin/wallet/withdraw/complete', params)
|
||
|
|
|
||
|
|
export const updateSts = async (id: number, sts: Object) => {
|
||
|
|
return await useAxios.put(`/admin/wallet/withdraw/${id}`, sts)
|
||
|
|
}
|
||
|
|
|
||
|
|
export const getWithdrawById = async (id: number) => {
|
||
|
|
return await useAxios.get(`/admin/wallet/withdraw/${id}`)
|
||
|
|
}
|
||
|
|
|
||
|
|
export const sendWeights = async (params: SendWeight ) => {
|
||
|
|
return await useAxios.put(`/admin/wallet/transaction/reprice`, params)
|
||
|
|
}
|