import request from "@/utils/httpRequest";
import { FILE_PATH as prefix } from "../AppPath";

export default {
	upload: function (formData, config = {}) {
		return request({
			url: prefix + "/file/upload?uploadPath=userdir",
			method: "post",
			config: config,
			data: formData,
			headers: { "Content-Type": "multipart/form-data" },
		});
	},

	download: function (params) {
		return request({
			url: prefix + "/file/download",
			method: "get",
			params: params,
		});
	},

	uploadFile: function (formData, config = {}) {
		return request({
			url: prefix + "/file/uploadFile?uploadPath=userdir",
			method: "post",
			config: config,
			data: formData,
			headers: { "Content-Type": "multipart/form-data" },
		});
	},
	downloadFile: function (params) {
		return request({
			url: prefix + "/file/downloadFile",
			method: "get",
			params: params,
		});
	},
	ossUploadFile: function (formData, config = {}) {
		return request({
			url: "/public-modules-server/oss/file/webUpload/upload",
			method: "post",
			data: formData,
			config: config,
		});
	}
};
