import { param } from "jquery" import request from "./request" // 导出一个名为login_api的函数,该函数使用request.post方法发送post请求到/api/auth/login路径 const login = async (param)=> await request.post('/api/auth/login',param) // 导出一个名为registered_api的函数,该函数接收一个参数param,并使用request.post方法发送一个POST请求到/api/Auth/Register接口,请求体为param const register = async (param)=> await request.post('/api/Auth/Register',param) // 导出一个名为SendValidateCode_api的函数,该函数使用request.post方法发送POST请求,请求的URL为'/api/Auth/SendValidateCode' const SendValidateCode = async (param)=> await request.post(`/api/Auth/SendValidateCode?email=${param}`) //获取所有系统配置 const getAllConfig = async ()=> await request.get('/api/systemconfig/getallsystemconfig') //获取用户个人信息 const getUserInfo = async () => await request.get('/api/User/UserInfo') //获取用户列表(分页) const getUserList = async (pageIndex,pageSize,desc) => await request.get(`/api/Admin/UserList?pageIndex=${pageIndex}&pageSize=${pageSize}&desc=${desc}`) //获取用户数量 const getUserCount = async () => await request.get('/api/Admin/UserCount') //删除用户 const deleteUser = async (id) => await request.delete(`/api/Admin/DeleteUser?userId=${id}`) //获取指定用户信息 const getUserInfoById = async (id) => await request.get(`/api/Admin/UserInfo?userId=${id}`) //更新用户信息 const updateUserInfo = async (id,param) => await request.post(`/api/Admin/UpdateUser?userId=${id}`,param) //添加用户 const addUser =async (param) => await request.post('/api/admin/adduser',param) //获取api列表 const getApiList = async (pageIndex,pageSize,desc) => await request.get(`/api/apis/ApiList?pageIndex=${pageIndex}&pageSize=${pageSize}&desc=${desc}`) //删除API const deleteApi = async (id) => await request.delete(`/api/Apis/DeleteApi?apiId=${id}`) //获取指定API信息 const getApiInfoById = async (id) => await request.get(`/api/Apis/ApiInfo?apiId=${id}`) //更新API信息 const updateApiInfo = async (id,param) => await request.post(`/api/Apis/UpdateApi?apiId=${id}`,param) //获取套餐列表 const getPackageList = async (pageIndex,pageSize,desc) => await request.get(`/api/Package/GetPackageList?pageIndex=${pageIndex}&pageSize=${pageSize}&desc=${desc}`) //删除套餐 const deletePackageById = async (id) => await request.delete(`/api/Package/DeletePackage?packageId=${id}`) //更新套餐信息 const updatePackage = async (id,param) => await request.post(`/api/Package/UpdatePackage?packageId=${id}`,param) //添加套餐 const addPackage = async (param) => await request.post("/api/Package/AddPackage",param) //获取套餐信息 const getPackageInfoById = async (id) => await request.get(`/api/Package/GetPackageInfo?packageId=${id}`) //更新系统配置 const updateSystemConfig = async (configName,configBody) => await request.post('/api/SystemConfig/UpdateSystemConfig',{configName:configName,configBody:configBody}) //创建支付 const createPayment = async (id,Amount,ReturnUrl) => await request.post('/api/pay/createpayment',{id:id,Amount:Amount,ReturnUrl:ReturnUrl}); //支付通知 const payNotice = async (pid, trade_no, out_trade_no, type, name, money, trade_status, sign, sign_type) => { const query = new URLSearchParams({ pid, trade_no, out_trade_no, type, name, money, trade_status, sign, sign_type }).toString(); return await request.get(`/api/pay/notice?${query}`); }; //获取用户套餐列表 const getUserPackagesAdmin = async (pageIndex,pageSize,desc) => await request.get(`/api/Package/GetUserPackageListAdmin?pageIndex=${pageIndex}&pageSize=${pageSize}&desc=${desc}`); //获取订单列表 const getOrderList = async (pageIndex,pageSize,desc) => await request.get(`/api/order/getorders?pageIndex=${pageIndex}&pageSize=${pageSize}&desc=${desc}`); //获取个人订单列表 const getMyOrderList = async (pageIndex,pageSize,desc) => await request.get(`/api/order/getmyorders?pageIndex=${pageIndex}&pageSize=${pageSize}&desc=${desc}`); //上传用户头像 const uploadAvatar = async (formData) => await request.post('/api/upload/UploadPic',formData,{ headers: { 'Content-Type': 'multipart/form-data', }, }) //上传网站LOGO const uploadLogo = async (formData) => await request.post('/api/upload/UploadLogo',formData,{ headers: { 'Content-Type': 'multipart/form-data', }, }) //上传网站LOGO const uploadFavicon = async (formData) => await request.post('/api/upload/UploadFavicon',formData,{ headers: { 'Content-Type': 'multipart/form-data', }, }) //更新用户信息 const updateMyInfo = async (params) => await request.post('api/user/update',params) //购买套餐 const buyPackage = async (params) => await request.post('api/pay/buy',params) //获取订单数量 const getOrderNum = async () => await request.get('api/order/GetOrderNum') //获取订单数量 const getMyOrderNum = async () => await request.get('api/order/GetMyOrderNum') //重置apiKey const setApiKey = async () => await request.post('api/user/setapikey') //获取所有支付配置 const getAllPayment = async () => await request.get('api/payment/getAllPayment') //获取所有支付配置 const getAllPublicPayment = async () => await request.get('api/payment/getAllPublicPayment') //更新支付配置 const updatePayment = async (params) => await request.post('api/payment/updatePayment',params) //获取公开api列表 const getPublicApiList = async (pageIndex,pageSize,desc) => await request.get(`/api/apis/getapispublic?pageIndex=${pageIndex}&pageSize=${pageSize}&desc=${desc}`) //获取已订购套餐 const getUserPackages = async () => await request.get('/api/user/GetUserPackages') //获取API对应套餐列表 const getApiPackages = async (ids) => await request.get('/api/apis/getapipackages',{ params: { apiId: ids // Axios 会自动转换成 ?apiId=1&apiId=2&apiId=3 } }) //获取系统统计信息 const getSystemInfo = async () => await request.get('/api/systeminfo/getinfo') //设置api套餐 const setApiPackage = async (params) => await request.post('/api/package/setapipackageitem',params) export default { login, register, SendValidateCode, getAllConfig, getUserInfo, getUserList, getUserCount, deleteUser, getUserInfoById, updateUserInfo, getApiList, deleteApi, getApiInfoById, updateApiInfo, getPackageList, updateSystemConfig, payNotice, createPayment, addUser, getUserPackagesAdmin, deletePackageById, updatePackage, addPackage, getPackageInfoById, getOrderList, getMyOrderList, uploadAvatar, updateMyInfo, uploadLogo, uploadFavicon, buyPackage, getOrderNum, getMyOrderNum, setApiKey, getAllPayment, updatePayment, getUserPackages, getPublicApiList, getApiPackages, getAllPublicPayment, getSystemInfo, setApiPackage }