mall数据库文件
This commit is contained in:
41
services/analytics/couponAnalysisService.uts
Normal file
41
services/analytics/couponAnalysisService.uts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { computeDateRange } from './dateRange.uts'
|
||||
import { rpcOrEmptyArray, rpcOrNull } from './rpc.uts'
|
||||
|
||||
export type CouponAnalysisData = {
|
||||
overviewRow: UTSJSONObject | null
|
||||
typeList: Array<UTSJSONObject>
|
||||
channelList: Array<UTSJSONObject>
|
||||
trendList: Array<UTSJSONObject>
|
||||
conversionList: Array<UTSJSONObject>
|
||||
}
|
||||
|
||||
export async function fetchCouponAnalysis(period: string): Promise<CouponAnalysisData> {
|
||||
const { startIso, endIso } = computeDateRange(period)
|
||||
|
||||
const overviewRow = await rpcOrNull('rpc_coupon_effectiveness_overview', {
|
||||
p_start: startIso,
|
||||
p_end: endIso
|
||||
} as UTSJSONObject)
|
||||
|
||||
const typeList = await rpcOrEmptyArray('rpc_coupon_type_stats', {
|
||||
p_start: startIso,
|
||||
p_end: endIso
|
||||
} as UTSJSONObject)
|
||||
|
||||
const channelList = await rpcOrEmptyArray('rpc_coupon_channel_stats', {
|
||||
p_start: startIso,
|
||||
p_end: endIso
|
||||
} as UTSJSONObject)
|
||||
|
||||
const trendList = await rpcOrEmptyArray('rpc_coupon_trend_daily', {
|
||||
p_start: startIso,
|
||||
p_end: endIso
|
||||
} as UTSJSONObject)
|
||||
|
||||
const conversionList = await rpcOrEmptyArray('rpc_coupon_conversion_effect', {
|
||||
p_start: startIso,
|
||||
p_end: endIso
|
||||
} as UTSJSONObject)
|
||||
|
||||
return { overviewRow, typeList, channelList, trendList, conversionList }
|
||||
}
|
||||
Reference in New Issue
Block a user