update customer chart

This commit is contained in:
Timi
2026-09-11 17:33:28 +08:00
parent 537eb5ac7a
commit 62add33884
25 changed files with 150 additions and 135 deletions
+13 -2
View File
@@ -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
};