add point chart

This commit is contained in:
Timi
2026-09-23 21:54:19 +08:00
parent f8574c387d
commit 3a9dbbb60b
14 changed files with 462 additions and 93 deletions
+26
View File
@@ -0,0 +1,26 @@
import { axios } from "timi-web-api";
import type { GaoPointChartReq, GaoPointDailyStatView, GaoPointRedemptionProductRankView } from "@/types/GaoChart";
import { getStoreChartCache } from "@/utils/storeChartCache";
import { withCurrentStoreId } from "@/utils/store";
const BASE_URI = "/gao/store/chart";
/** 查询按日汇总的获得积分、消耗积分及两者差值。 */
async function dailyTrend(req: GaoPointChartReq): Promise<GaoPointDailyStatView[]> {
return await requestList("point-daily-trend", "/point/ledger/daily", req);
}
/** 查询兑换积分最高的前 10 个产品,不扣除退回积分。 */
async function redemptionProductRank(req: GaoPointChartReq): Promise<GaoPointRedemptionProductRankView[]> {
return await requestList("point-redemption-product-rank", "/point/redemption/product/rank", req);
}
async function requestList<T>(name: string, path: string, req: GaoPointChartReq): Promise<T[]> {
const request = withCurrentStoreId(req);
return await getStoreChartCache(`gao-point:${name}:${JSON.stringify(request)}`, async () => await axios.post(`${BASE_URI}${path}`, request));
}
export default {
dailyTrend,
redemptionProductRank
};
+11
View File
@@ -0,0 +1,11 @@
import { axios } from "timi-web-api";
import type { Role } from "timi-web-api";
const BASE_URI = "/gao/role";
export const GaoRoleAPI = {
/** 查询登录用户所属门店内可管理的角色。 */
async managementList(): Promise<Role[]> {
return await axios.post(`${BASE_URI}/management/list`);
}
};