import { request } from 'umi';
import { api } from '../api';
import { Paging, SortProps } from './rankingList';
let wapi = api + '/gameData'

/**
 * 推广每日数据
 * @param data 
 * @returns 
 */
export interface EverydayListType extends Paging, SortProps {
    // 推广账号ID
    accountId?: number,
    // 投放渠道Id
    agentId?: number,
    // 消耗开始日期
    beginDay?: string,
    // 消耗结束日期
    endDay?: string
    cpName?: string
    gameName?: string
    gameType?: string,
    sysUserId?: number
}
/**
 * 每日推广数据
 * @param data 
 * @returns 
 */
export async function getPromoteDayListApi(data: EverydayListType) {
    return request(wapi + `/promote/day`, {
        method: 'POST',
        data
    });
}

/**
 * 每日数据总计
 * @param data 
 * @returns 
 */
export async function getPromoteDayTotalApi(data: EverydayListType) {
    return request(wapi + `/promote/day/total`, {
        method: 'POST',
        data
    });
}


export interface PromoteTotalProps extends Paging, SortProps {
    // 推广账号ID
    accountId?: number,
    // 投放渠道Id
    agentId?: number,
    // 消耗开始日期
    costBeginDay?: string,
    // 消耗结束日期
    costEndDay?: string
    // cp名
    cpName?: string
    gameName?: string
    gameType?: string,
    sysUserId?: number
    // 充值开始日期
    rechargeBeginDay?: string,
    // 充值结束日期
    rechargeEndDay?: string
}
/**
 * 推广总数据
 * @param data 
 * @returns 
 */
export async function getPromoteTotalListApi(data: EverydayListType) {
    return request(wapi + `/promote/total`, {
        method: 'POST',
        data
    });
}
/**
 * 总计
 * @param data 
 * @returns 
 */
export async function getPromoteTotalApi(data: EverydayListType) {
    return request(wapi + `/promote/total/sum`, {
        method: 'POST',
        data
    });
}

export interface PromoteAgainProps {
    accountId: number,
    agentId?: number,
    beginDate?: string,
    endDate?: string,
    sourceSystem?: string
}
/**
 * 推广渠道每日复充数据q
 * @param data 
 * @returns 
 */
export async function getPromoteAgainListApi(data: PromoteAgainProps) {
    return request(wapi + `/promote/again`, {
        method: 'POST',
        data
    });
}