
import apis from '../utils/request';
const { GET, POST, PUT, DELETE } = apis
// 保存用户信息
export const login = async function(data) {
  return await POST('/wx/login', data);
}

// 非管理员验证
export const userValidate = async function(data) {
  return await POST('/wx/user/validate', data);
}

// 获取用户邀请二维码
export const getWxCode = async function(id) {
  return await GET(`/wx/getWxCode?id=${id}`);
}

// 获取扫描二维码的列表
export const getApproveList = async function(status=0) {
  return await GET('/wx/getApproveList?status=' + status, );
}

// 审批用户加入
export const approveUser = async function(data) {
  return await POST('/wx/approve', data);
}

// 移除用户
export const removeUser = async function(uid, tid) {
  return await DELETE(`/wx/removeUser/${tid}/${uid}`);
}

// 获取用户最新信息
export const getUserInfo = async function(id) {
  return await GET('/wx/getUserInfo?tenement=' + id);
}

// 非管理员重新提交申请
export const reApprove = async function() {
  return await POST('/wx/reApprove');
}

// 非管理员扫码
export const userApply = async function(data) {
  return await POST('/wx/apply', data);
}

// 获取所有的园区和商户
export const getUserParksAndTenementsList = async function() {
  return await GET('/wx/getUserParksAndTenementsList');
}

// 获取所有未阅读的用户数
export const getUnReadApproveNumber = async function() {
  return await GET('/wx/getApproveNumber');
}
// 退出登录
export const logout = async function() {
  return await POST('/wx/logout');
}

// 获取隐私协议
export const getPrivaciList = async function() {
  return await GET('/wx/getQuestions?page=1&type=' + 1);
}
// 获取常见问题
export const getQuestionList = async function(page) {
  return await GET(`/wx/getQuestions?page=${page}&type=0`);
}

// 获取扫描二维码的列表
export const getBackApproveList = async function(tenement) {
  return await GET(`/wx/getWorkUserList?tenement=${tenement}`);
}