init project
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
import { axios, type Page, type PageResult } from "timi-web";
|
||||
import type { Customer, CustomerDailyStatView, CustomerGenderStatView, CustomerInviteUpdateReq, CustomerSearchReq, CustomerTrendStatReq, QuickRegisterReq } from "@/types/Customer";
|
||||
import type { RegistrationEventRecord } from "@/types/RegistrationEventRecord";
|
||||
|
||||
const BASE_URI = "/gao/customer";
|
||||
|
||||
async function list(req: Page<Customer>): Promise<PageResult<Customer>> {
|
||||
return await axios.post(`${BASE_URI}/list`, req);
|
||||
}
|
||||
|
||||
async function search(req: CustomerSearchReq): Promise<Customer[]> {
|
||||
return await axios.post(`${BASE_URI}/search`, req);
|
||||
}
|
||||
|
||||
async function searchPage(req: Page<CustomerSearchReq>): Promise<PageResult<Customer>> {
|
||||
return await axios.post(`${BASE_URI}/search/page`, req);
|
||||
}
|
||||
|
||||
async function exportExcel(req: CustomerSearchReq): Promise<Blob> {
|
||||
return await axios.post(`${BASE_URI}/export`, req, {
|
||||
responseType: "blob"
|
||||
});
|
||||
}
|
||||
|
||||
async function detail(id: string): Promise<Customer> {
|
||||
return await axios.post(`${BASE_URI}/detail`, undefined, {
|
||||
params: { id }
|
||||
});
|
||||
}
|
||||
|
||||
async function detailByCode(code: string): Promise<Customer> {
|
||||
return await axios.post(`${BASE_URI}/detail/code`, undefined, {
|
||||
params: { code }
|
||||
});
|
||||
}
|
||||
|
||||
async function nullableDetailByCode(code: string): Promise<Customer | null> {
|
||||
return await axios.post(`${BASE_URI}/detail/code/nullable`, undefined, {
|
||||
params: { code }
|
||||
});
|
||||
}
|
||||
|
||||
async function invitedList(introducerCustomerId: string): Promise<Customer[]> {
|
||||
return await axios.post(`${BASE_URI}/invited/list`, undefined, {
|
||||
params: { introducerCustomerId }
|
||||
});
|
||||
}
|
||||
|
||||
async function create(req: Customer): Promise<Customer> {
|
||||
return await axios.post(`${BASE_URI}/create`, req);
|
||||
}
|
||||
|
||||
async function quickRegister(req: QuickRegisterReq): Promise<RegistrationEventRecord> {
|
||||
return await axios.post(`${BASE_URI}/quick/register`, req);
|
||||
}
|
||||
|
||||
async function update(req: Customer): Promise<void> {
|
||||
return await axios.post(`${BASE_URI}/update`, req);
|
||||
}
|
||||
|
||||
async function remove(id: string): Promise<void> {
|
||||
return await axios.post(`${BASE_URI}/delete`, undefined, {
|
||||
params: { id }
|
||||
});
|
||||
}
|
||||
|
||||
async function createInvite(req: CustomerInviteUpdateReq): Promise<void> {
|
||||
return await axios.post(`${BASE_URI}/invite/create`, req);
|
||||
}
|
||||
|
||||
async function updateInvite(req: CustomerInviteUpdateReq): Promise<void> {
|
||||
return await axios.post(`${BASE_URI}/invite/update`, req);
|
||||
}
|
||||
|
||||
async function deleteInvite(customerId: string): Promise<void> {
|
||||
return await axios.post(`${BASE_URI}/invite/delete`, undefined, {
|
||||
params: { customerId }
|
||||
});
|
||||
}
|
||||
|
||||
async function dailyStat(req: CustomerTrendStatReq): Promise<CustomerDailyStatView[]> {
|
||||
return await axios.post(`${BASE_URI}/stat/daily`, req);
|
||||
}
|
||||
|
||||
async function genderStat(): Promise<CustomerGenderStatView[]> {
|
||||
return await axios.post(`${BASE_URI}/stat/gender`);
|
||||
}
|
||||
|
||||
export default {
|
||||
list,
|
||||
search,
|
||||
searchPage,
|
||||
exportExcel,
|
||||
detail,
|
||||
detailByCode,
|
||||
nullableDetailByCode,
|
||||
invitedList,
|
||||
create,
|
||||
quickRegister,
|
||||
update,
|
||||
remove,
|
||||
createInvite,
|
||||
updateInvite,
|
||||
deleteInvite,
|
||||
dailyStat,
|
||||
genderStat
|
||||
};
|
||||
Reference in New Issue
Block a user