import request from "@/utils/request";
let { api, imgApi, weApi } = process.env.CONFIG;



/**获取企微列表*/
export async function api_corpUser_allOfUser(userId: string) {
    return request({ url: `/corpUser/allOfUser/${userId}` })
}
/** 获取组员及组员账号列表 */
export async function getAdAccountAllOfMember() {
    return request({ url: api + '/erp/user/subUserWithSelf' })
}

/**创建通用分组*/
export async function api_post_common_group_create(data: any) {
    return request({
        url: '/corp/common/group/create',
        method: 'POST',
        data
    })
}
/**删除通用分组*/
export async function api_post_common_group_delete(data: any) {
    return request({
        url: '/corp/common/group/delete',
        method: 'DELETE',
        params: data
    })
}
/**查询通用分组*/
export async function api_get_common_group_list(data: any) {
    return request({
        url: '/corp/common/group/list',
        method: 'GET',
        params: data
    })
}
/**通用分组枚举*/
export async function api_get_common_group_type_enym(data: any) {
    return request({
        url: '/corp/common/group/type/enum',
        method: 'GET',
    })
}
/**更新通用分组*/
export async function api_patch_common_group_update(data: any) {
    return request({
        url: '/corp/common/group/update',
        method: 'PATCH',
        params: data
    })
}
/**获取企业下的标签列表全部*/
export async function api_get_external_tag_group_list(params: { corpId: string }) {
    return request({
        url: '/corp/external/tag/group/list',
        method: 'GET',
        params
    })
}

/**
 * 所有企业
 * @param params 
 * @returns 
 */
export async function getCorpAllListApi(params: { corpName?: string }) {
    return request({
        url: '/corp/listAll',
        method: 'POST',
        params
    })
}

export interface GetCorpExternalUserProps {
    pageSize: number,
    pageNum: number,
    corpId: string,
    noExternalTag?:boolean,//无标签用户
    externalTagRelation?: "AND" | "OR",
    sysExternalTagRelation?: "AND" | "OR",
    /** 企微号ID */
    corpUserIds?: string,
    // 客户ID
    externalUserId?: string,
    // 关注时间
    beginTime?: string,
    // 关注结束时间
    endTime?: string,
    // 客户名称
    name?: string,
    // 性别 
    genders?: number
    // 是否已删除 
    deleted?: boolean
    externalTagIds?: number[],
    sysExternalTagIds?: number[],
    // 排除客户标签
    externalExcludeTagIds?:number[],
    externalExcludeTagRelation?: "AND" | "OR",
    sysExternalExcludeTagIds?:number[],
    sysExternalExcludeTagRelation?: "AND" | "OR",
    // 书城标识
    platformKey?: string
    //书城用户ID
    platformUserId?: string
    // 最低充值次数
    rechargeCountMin?: number
    // 最大充值次数
    rechargeCountMax?: number
    // 最低充值金额
    rechargeMoneyMin?: number
    // 最大充值金额
    rechargeMoneyMax?: number
    // 充值小说
    rechargeBook?: string
    // 最少充值次数
    lastRechargeTimeMin?: number
    // 最大充值次数
    lastRechargeTimeMax?: number
    // 最低首充金额
    firstRechargeMoneyMin?: number
    firstRechargeMoneyMax?: number
    // 最低单笔最大充值金额
    rechargeMoneyMaxMin?: number
    rechargeMoneyMaxMax?: number
    // 系统 手机系统：0：未知、1：安卓、2：IOS
    operList?: number
    remarkMobiles?: string
    registerBeginTime?: string
    registerEndTime?: string
    firstRechargeBeginTime?: string
    firstRechargeEndTime?: string,
    subHourMin?: number
    subHourMax?: number
    subDayMin?: number
    subDayMax?: number
    deleteBeginTime?:string// "删除时间-最小(deleted = 1时出现)")
    deleteEndTime?:string//"删除时间-最大(deleted = 1时出现)")
    gameId?:number//游戏id
    roleName?:string//角色名称
    roleCreateTimeBegin?:string//角色创建时间-最小
    roleCreateTimeEnd?:string//角色创建时间-最大
    roleVipLevelMin?:number//角色VIP等级-最小
    roleVipLevelMax?:number//角色VIP等级-最大
    userRegTimeBegin?:string//角色对应玩家注册时间-最小
    userRegTimeEnd?:string//角色对应玩家注册时间-最大
    roleTodayRechargeMoneyMin?:number//角色当天充值金额-最小
    roleTodayRechargeMoneyMax?:number//角色当天充值金额-最大
    roleTotalRechargeMoneyMin?:number//角色累计充值金额-最小
    roleTotalRechargeMoneyMax?:number//角色累计充值金额-最大
    roleLastRechargeTimeBegin?:string//角色最近充值时间-最小
    roleLastRechargeTimeEnd?:string//角色最近充值时间-最大
    roleLastActiveTimeBegin?:string//角色最近活跃时间-最小
    roleLastActiveTimeEnd?:string//角色最近活跃时间-最大
    singleDeleteBeginTime?: number
    singleDeleteEndTime?: number

}
/**
 * 获取客服列表
 * @param data 
 * @returns 
 */
export async function getCorpExternalUserListApi(data: GetCorpExternalUserProps) {
    return request({
        url: '/corpExternalUser/listOfPage',
        method: 'POST',
        data
    });
}

/**获取背景图ID列表*/
export async function api_get_img_typeList() {
    return request({
        url: imgApi + '/img/typeList',
        method: 'GET',
    })
}
/**获取背景图对应列表*/
export async function api_post_img_list(data: {
    id: string,
    page: string,
    pageSize: string
}) {
    return request({
        url: imgApi + '/img/list',
        method: 'POST',
        data
    })
}

/**
 * 获取Appid列表
 * @param data 
 * @returns 
 */
export async function getAppIdListApi(data: { pageNum: number, pageSize: number, appId: string }) {
    return request({
        url: '/sys/app/listOfPage',
        method: 'POST',
        data
    })
}
/**游戏列表*/
export async function api_get_gameList() {
    return request({
        url: weApi + '/gameRole/gameList',
        method: 'GET',
    })
}
/**游戏列表*/
export async function api_get_gameServerList(gameId: string | number) {
    return request({
        url: weApi + `/gameRole/serverList/${gameId}`,
        method: 'GET',
    })
}