import { request } from '@umijs/max';
import { downLoadXlsx } from '@/utils/downloadfile';

export async function getCmsAppUserList(params?: API.MobileUser.ListParams) {
  return request<API.MobileUser.ListResult>(`/api/cms/appUser/list`, {
    method: 'GET',
    params: params,
    isEncrypt: true,
  });
}

export async function getCmsAppUser(userId?: string) {
  return request<API.MobileUser.ListResult>(`/api/cms/appUser/${userId}`, {
    method: 'GET',
  });
}
export async function getBehaviorLog(params?:API.MobileUser.LogParams) {
  return request<API.MobileUser.LogResult>(`/api/cms/behaviorLog/getList`, {
    method: 'GET',
    params
  });
}

export async function exportCmsAppUserExport(params?: API.MobileUser.ListParams) {
  return downLoadXlsx(
    `/api/cms/appUser/export`,
    { params },
    `job_data_${new Date().getTime()}.xlsx`,
  );
}
