42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import http from "./http";
|
|
import { SysPlatformConfig } from "../types";
|
|
|
|
/**
|
|
* 获取公开平台配置
|
|
*/
|
|
export async function getOpenPlatformConfig() {
|
|
const resp = await http.get("/api/open/platform/config");
|
|
return resp.data.data as SysPlatformConfig;
|
|
}
|
|
|
|
/**
|
|
* 获取管理端平台配置
|
|
*/
|
|
export async function getAdminPlatformConfig() {
|
|
const resp = await http.get("/api/admin/platform/config");
|
|
return resp.data.data as SysPlatformConfig;
|
|
}
|
|
|
|
/**
|
|
* 更新平台配置
|
|
*/
|
|
export async function updatePlatformConfig(payload: SysPlatformConfig) {
|
|
const resp = await http.put("/api/admin/platform/config", payload);
|
|
return resp.data.data as boolean;
|
|
}
|
|
|
|
/**
|
|
* 上传平台资源文件
|
|
* @param file 文件对象
|
|
*/
|
|
export async function uploadPlatformAsset(file: File) {
|
|
const formData = new FormData();
|
|
formData.append("file", file);
|
|
const resp = await http.post("/api/admin/platform/config/upload", formData, {
|
|
headers: {
|
|
"Content-Type": "multipart/form-data",
|
|
},
|
|
});
|
|
return resp.data.data as string;
|
|
}
|