import request from '@/utils/request'
import qs from 'qs'

/**
 * 基础参数接口
 */

// 获取基础参数
const getBase = function() {
    return request({
        url: '/config/showBasicParameters.do',
        method: 'post'
    })
}
// 修改骑行配置
const updateRide = function(params) {
    return request({
        url: '/config/updateRidePayConfig.do',
        method: 'post',
        params
    })
}
// 修改押金配置
const updateDeposit = function(params) {
    return request({
        url: '/config/updateDepositConfig.do',
        method: 'post',
        params
    })
}
// 修改logo名称
const updateLogo = function(params) {
    return request({
        url: '/config/updateLogoName.do',
        method: 'post',
        params
    })
}
// 添加客服电话
const addPhone = function(params) {
    return request({
        url: '/config/addManageAreaServicePhone.do',
        method: 'post',
        params
    })
}
// 删除客服电话
const delPhone = function(params) {
    return request({
        url: '/config/deleteManageAreaServicePhone.do',
        method: 'post',
        params
    })
}

/**
 * 开发参数接口
 */
// 获取开发参数
const getDevelop = function() {
    return request({
        url: '/config/showDevelopmentParameters.do',
        method: 'post'
    })
}
// 修改微信登陆
const updateWx = function(params) {
    return request({
        url: '/config/weiXinLoginConfig.do',
        method: 'post',
        params
    })
}
// 新增微信扫码跳转配置
const addScan = function(params) {
    var formData = new FormData()
    formData.append('foldName', params.foldName)
    formData.append('verifyFile', params.verifyFile)
    return request({
        url: '/config/addWeChatScanCode.do',
        method: 'post',
        data: formData
    })
}
// 修改浏览器扫一扫跳转配置
const updateFile = function(formData) {
    return request({
        url: '/config/uploadFileForBrowserScanCode.do',
        method: 'post',
        data: formData
    })
}
// 修改极光推送配置
const updateJpush = function(params) {
    return request({
        url: '/config/updateJpushConfig.do',
        method: 'post',
        params
    })
}

/**
 * 支付参数接口
 */
// 获取支付配置
const getWxConfig = function() {
    return request({
        url: '/config/findPageList.do',
        method: 'post'
    })
}
// 修改微信配置信息
const updateWxConfig = function(params) {
    return request({
        url: '/config/updatePayConfig.do',
        method: 'post',
        params
    })
}
// 上传密钥文件
const uploadScrert = function(formData) {
    return request({
        url: '/config/uploadScrertKeyFile.do',
        method: 'post',
        data: formData
    })
}

export default {
    getBase,
    updateRide,
    updateDeposit,
    updateLogo,
    addPhone,
    delPhone,

    getDevelop,
    updateWx,
    addScan,
    updateFile,
    updateJpush,

    getWxConfig,
    updateWxConfig,
    uploadScrert
}
