import request from '@/utils/request'

// api地址
const api = {
  userInfo: 'user/info',
  assets: 'user/assets',
  bindMobile: 'user/bindMobile',
  personal: 'user/personal'
}

// 腾讯人脸核身
export const wxHuman = (param, option) => {
  return request.get('/api/wx/txy/detectauth', param, option)
}

// 腾讯人脸核身回调信息
export const wxGetDetectInfo = (param, option) => {
  return request.get('/api/wx/txy/getdetectinfo', param, option)
}

// 微信JSSDK参数
export const getWxSign = (param, option) => {
  return request.get('/api/wx/jsapiconfig?url=' + param, param, option)
}

// 绑定手机号
export const bindMobile = (data, option) => {
  return request.post('', data, option)
}



// 更新 客户信息手机号
export const bindCustomer = (param, option) => {
  param.pagevalue = 304
  return request.get('/api/up', param, option)
}

// 获取 客户信息
export const getCustomer = (param, option) => {
  param.pagevalue = 305
  return request.get('/api/query/list', param, option)
}

// 获取 用户与盒子 信息
export const getYhinfo = (param, option) => {
  param.pagevalue = 334
  return request.get('/api/query/list', param, option)
}

// 获取 用户与订单 信息
export const getUserDdinfo = (param, option) => {
  param.pagevalue = 335
  return request.get('/api/query/list', param, option)
}

// 获取 代理商信息
export const getAgents = (param, option) => {
  param.pagevalue = 307
  param.rows = 1
  param.pageindex = 1
  return request.get('/api/query/list', param, option)
}

// 获取 代理商企业二维码内容
export const createOpenid = (param, option) => {
  return request.get('/api/wx/qy/qrcode/create', param, option)
}

// 查询商品列表
export function getShopList(param, option) {
  param.pagevalue = 297
  return request.get('/api/query/list', param, option)
}

// 查询商品列表 - 连产品套餐的表
export function getShopTaochanList(param, option) {
  param.pagevalue = 355
  return request.get('/api/query/list', param, option)
}

// 支付宝列表
export function getPalList(param, option) {
  return request.get('/api/query/list', param, option)
}

// 支付接口 - 通过人员，支付类型，返回支付二维码链接
export function plFomr3(param, option) {
  return request.get(`/p/${param.customerid}/${param.openid}/${param.paysortid}/${param.productid}`)
}

// 支付接口 - 续费 - 通过人员，支付类型，返回支付二维码链接
export function plXufei(param, option) {
  return request.get(`/x/${param.customerid}/${param.yhinfoid}/${param.openid}/${param.paysortid}/${param.productid}`)
}

// 支付接口 - 续费 - 通过人员，支付类型，返回支付二维码链接
export function plLyqXufei(param, option) {
  return request.get(`/x/${param.customerid}/${param.yhinfoid}/${param.openid}/${param.paysortid}`)
}

// 支付码 - 通过微信code获得
export function openidCode(param, option) {
  return request.get(`/api/wx/openid`, param, option)
}

//* *********** 图片上传 **************
// 添加附件记录并返回路径
export function addtoPathImg(param, option) {
  return request.form('/api/attachment/addtoPath?pagevalue=300', param, option)
}

//* *********** 短信验证码 **************
export function verifycodesmsbykt(param, option) {
  return request.get(`/api/verifycodesmsbykt`, param, option)
}

//* *********** 企业端接口 **************

// 企业用户登录
export const companyLogin = (param, option) => {
  param.pagevalue = 304
  return request.get('/api/wx/createagents', param, option)
}

// 获取企业用户登录 验证码
export const getSmsCode = (param, option) => {
  return request.get('/api/verifycodesmsbyqy', param, option)
}


//* *********** 激活路由器端口 **************

// 发送路由器激活验证短信 验证码
export const verifycodesmsbylyq = (param, option) => {
  return request.get('/api/verifycodesmsbylyq', param, option)
}

// 激活路由器
export const activationlyq = (param, option) => {
  return request.get('/api/wx/activationlyq', param, option)
}


// 更新代理商信息
export const upDlsMsg = (param, option) => {
  return request.get('/api/up?pagevalue=309', param, option)
}
// 获取代理商信息 - 列表
export const getDlsMsg = (param, option) => {
  return request.get('/api/query/list?pagevalue=310', param, option)
}
// 输入激活码
export const bindqym = (param, option) => {
  return request.get('/api/wx/bindqym', param, option)
}

// 订单开通认证
export const personrz = (param, option) => {
  return request.get('/api/wx/personrz', param, option)
}

//* *********** 通用接口 **************
// 查询列表get
export function _get_list(param, option) {
  return request.get('/api/query/list', param, option)
}

// 查询详情get
export function _get_view(param, option) {
  param.pagevalue = 285
  return request.get('/api/query/view', param, option)
}

// 更新数据get
export function _get_up(param, option) {
  param.pagevalue = 287
  return request.get('/api/up', param, option)
}

// 删除get
export function _get_del(param, option) {
  param.pagevalue = 286
  return request.get('/api/del', param, option)
}

// 查询详情get
export function _post_view_common(param, option) {
  return request.get('/api/query/view', param, option)
}


// app客户端

// 获取验证码
export function getCodeImg(param, option) {
  return request.arraybuffer('/api/sys/getloginvifcode', param, option)
}

// 登录方法
export function login(param) {
  return request.form('/api/sys/login', param)
}
