import { request } from '@@/plugin-request/request';
import { stringify } from 'qs';

/**
 * 查询推送消息列表
 * @param param
 */
export async function queryPushMessage(param: object) {
  return request(`/web/v2/push?${stringify(param)}`);
}

/**
 * 删除推送消息
 * @param record_id
 */
export async function delPushMessage(record_id: any) {
  return request(`/web/v2/push/${record_id}`, {
    method: 'DELETE',
  });
}
/**
 * 新增推送内容
 * @param params
 */
export async function createPushMessage(params: object) {
  return request(`/web/v2/push`, {
    method: 'POST',
    data: params,
  });
}

/**
 * 编辑推送内容
 * @param params
 */
export async function editPushMessage(params: any) {
  return request(`/web/v2/push/${params.record_id}`, {
    method: 'PUT',
    data: params,
  });
}

/**
 * 推送消息
 * @param params
 */
export async function createPush(params: object) {
  return request(`/web/v2/push/do`, {
    method: 'POST',
    data: params,
  });
}

/**
 * 查询推送历史列表
 * @param param
 */
export async function queryPushHistory(param: object) {
  return request(`/web/v2/push_his?${stringify(param)}`);
}

/**
 * 查询推送历史详情
 * @param record_id
 */
export async function queryPushHistoryDetail(record_id: string) {
  return request(`/web/v2/push_his/${record_id}`);
}
