update customer chart
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
import { axios } from "timi-web-api";
|
||||
import type { CustomerChartReq } from "@/types/Customer";
|
||||
import type { CustomerChartReq, CustomerDiseaseWordView } from "@/types/Customer";
|
||||
import type { StoreEventRecordCalendarView, StoreEventRecordDailyStatView } from "@/types/Store";
|
||||
import { getStoreChartCache } from "@/utils/storeChartCache";
|
||||
import { withCurrentStoreId } from "@/utils/store";
|
||||
|
||||
const BASE_URI = "/gao/customer/chart";
|
||||
type CustomerDiseaseWordReq = {
|
||||
storeId?: string;
|
||||
topN: number;
|
||||
};
|
||||
|
||||
async function eventRecordDailyStat(req: CustomerChartReq): Promise<StoreEventRecordDailyStatView[]> {
|
||||
return await axios.post(`${BASE_URI}/event/record/daily`, withCurrentStoreId(req));
|
||||
@@ -13,7 +18,13 @@ async function eventRecordCalendar(req: CustomerChartReq): Promise<StoreEventRec
|
||||
return await axios.post(`${BASE_URI}/event/record/calendar`, withCurrentStoreId(req));
|
||||
}
|
||||
|
||||
async function diseaseWord(topN = 60): Promise<CustomerDiseaseWordView[]> {
|
||||
const request = withCurrentStoreId<CustomerDiseaseWordReq>({ topN });
|
||||
return await getStoreChartCache(`customer-disease-word:${JSON.stringify(request)}`, async () => await axios.post(`${BASE_URI}/customer/disease/word`, request));
|
||||
}
|
||||
|
||||
export default {
|
||||
eventRecordDailyStat,
|
||||
eventRecordCalendar
|
||||
eventRecordCalendar,
|
||||
diseaseWord
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user