/**
 * 语音播报模块
 */
import {get,post} from './http'

/**
 * 语音列表
 * @param page_index 
 * @param page_size
 * @param broadcast_id 语音id
 * @param section_id 板块id
 */
export const apiVoiceList=params=>{
    return post('/voice/broadcast/list',params)
}

/**
 * 语音板块列表
 */
export const apiVoiceSectionList=()=>{
    return get('/voice/broadcast/section/list',{})
}

/**
 * 删除语音
 * @param broadcast_id
 */
export const apiVoiceDel=params=>{
    return get('/voice/broadcast/delete',params)
}

/**
 * 播放记录
 * @param broadcast_id
 * @param source 来源平台：1:小程序、2:小程序(pc)、3:公众号、4:官网web(pc)
 */
export const apiVoicePlayRecord=params=>{
    let source=2
	if(window.__wxjs_environment === 'miniprogram'){
		source=2
	}else{
		source=4
	}
    return post('/voice/broadcast/statistics/add',{...params,source:source})
}

/**
 * 推送客群、模板消息
 * @param broadcast_id
 */
export const apiVoiceSendMsg=params=>{
    return post('/voice/broadcast/msg_send',params)
}

/**
 * 我的语音数量统计
 * @param author_id
 */
export const apiMyVoiceCount=params=>{
    return get('/voice/broadcast/list_count',params)
}

/**
 * 语音详情
 * @param broadcast_id
 */
export const apiVoiceDetail=params=>{
    return get('/voice/broadcast/detail',params)
}

/**
 * 发布语音
 * @param broadcast_id 语音播报ID
 * @param publish_type 发布类型：1-发布 2-定时发布
 * @param pre_publish_time 预发布时间（类型为定时发布时必填）
 */
export const apiVoicePublish=params=>{
    return post('/voice/broadcast/publish',params)
}