/**
 * 活动模块
 */
import {get,post} from './http'

/**
 * 活动列表
 * @param {active_state} 活动状态 1-未开始 2-进行中 3-已结束
 * @param {activity_type} 活动类型 1-线上会议 3-线下沙龙
 * @param {title} 活动类别/标题(搜索可用)
 * @param page
 * @param limit
 */
 export const apiActivityList = (params) => {
    return get("/activity/getPageList", params);
};

/**
 * 活动详情
 * @param activity_id
 */
export const apiActivityDetail = (params) => {
    return get("/activity/getActivityDetail", params);
};

/**
 * 活动设置提醒
 * @param activity_id
 */
export const apiActivityAddRemind = (params) => {
    return post("/activity/addRemind", params);
};

/**
 * 活动取消提醒
 * @param activity_id
 */
export const apiActivityCancelRemind = (params) => {
    return post("/activity/cancelRemind", params);
};

/**
 * 活动线下报名
 * @param activity_id
 */
export const apiActivityRegister = (params) => {
    return post("/activity/registerActivity", params);
};

/**
 * 活动取消线下报名
 * @param activity_id
 */
export const apiActivityCancelRegister = (params) => {
    return post("/activity/cancelRegister", params);
};

/**
 * 获取活动音频
 * @param activity_id
 */
export const apiActivityAudios=params=>{
    return get('/activity/getActivityVoices',params)
}

// 获取报告详情
//research_report_id
export const apiGetReportDetail=(params)=>{
    return get('/report/research_report',params)
}

//获取周度报告详情
//research_report_type_id
export const apiGetChapterReportDetail=params=>{
    return get('/report/research_report_chapter',params)
}


/**
 * 新增活动音频播放记录
 * @param primary_id 音频ID
 * @param extend_id 活动ID
 * @param source 来源：1-小程序；2-小程序PC端；3-公众号；4-Web PC端
 * @param from_page 来源页面:eg：活动详情
 */
export const apiActivityAudioPlayRecordAdd=params=>{
    let source_agent=2
	if(window.__wxjs_environment === 'miniprogram'){
		source_agent=2
	}else{
		source_agent=4
	}
    return post('/activity/voice_log/add',{...params,source:source_agent})
}

/**
 * 新增活动音频播放记录
 */
export const apiActivityAudioPlayRecordUpate=params=>{
    return post('/activity/voice_log/update',params)
}