import request from "../../utils/request";
import qs from "qs";
let setqs = function (data) {
  return qs.stringify(data);
};

// 获取用户列表
export function getUserListApi (data) {
  console.log(data);
  return request({
    url: `/admin/user/${data.page}/${data.limit}?keyword=${data.keyword}`,
    method: "get",
  });
}

// 获取用户列表
export function getStockUserListApi (data) {
  console.log(data);
  return request({
    url: `/admin/user/stock/${data.page}/${data.limit}?keyword=${data.keyword}`,
    method: "get",
  });
}

// 用户状态变更
export function updateUserStatusApi (data) {
  return request({
    url: `/admin/user/updateStatus/${data.id}/${data.status}`,
    method: "get",
  });
}

// 新增用户
export function addUserApi (data) {
  return request({
    url: `/admin/user/save`,
    method: "post",
    data
  });
}
// 新增个人数据
export function addStockUserApi (data) {
  return request({
    url: `/admin/user/stock/save`,
    method: "post",
    data
  });
}
// 更新用户
export function updateUserApi (data) {
  return request({
    url: `/admin/user/update`,
    method: "put",
    data
  });
}
// 更新用户数据
export function updateUserStockApi (data) {
  return request({
    url: `/admin/user/stock/update`,
    method: "put",
    data
  });
}
// 删除用户
export function delUserApi (data) {
  return request({
    url: `/admin/user/remove/${data}`,
    method: "DELETE",
  });
}

// 获取股权结构列表
export function getUserMoreListApi (data) {
  return request({
    url: `/admin/user/stock/record/${data.userId}/${data.page}/${data.limit}`,
    method: "get",
  });
}
