StorageController.ts 1.37 KB
import { AxiosResponse, AxiosStatic } from "axios";
import dayjs, { Dayjs } from "dayjs";
// region 前端扩展导入包
// endregion

/**
 * @author kepler
 */
export class StorageController {
	/**
	 */
	static removeVehicleAlbum(axios: AxiosStatic, filePath: string, vehicleId: number): Promise<AxiosResponse<void>> {
		return axios.delete("upload/removeVehicleAlbum", { params: { filePath: filePath, vehicleId: vehicleId } });
	}

	/**
	 * 更新车辆图片
	 * @param vehicle
	 * @return int
	 */
	static updateVehicleAlbums(axios: AxiosStatic, vehicle: any): Promise<AxiosResponse<number>> {
		return axios.post("upload/updateVehicleAlbums", vehicle);
	}

	/**
	 * 富文本图片上传
	 * @param file
	 * @param request
	 * @return Map
	 * @throws FileStorageException
	 */
	static uploadPasteImage(axios: AxiosStatic, file: any): Promise<AxiosResponse<any>> {
		return axios.post("upload/uploadRichTextImage", null, { params: { file: file } });
	}

	/**
	 */
	static uploadVehicleAlbum(
		axios: AxiosStatic,
		file: any,
		vehicleId: number,
		fileSubtype: string,
		directory: string,
		cache: boolean | undefined | null,
	): Promise<AxiosResponse<FileInfo>> {
		return axios.post("upload/uploadVehicleAlbum", null, {
			params: { file: file, vehicleId: vehicleId, fileSubtype: fileSubtype, directory: directory, cache: cache },
		});
	}

	// region 前端扩展代码区
	// endregion
}