import { fetchApi } from './fetchClient'; import { type BaseResult, type PaginatedResult, type PictureResponse, type BatchDeleteResult } from './types'; // 获取图片列表 export const getManagementPictures = async ( page: number = 1, pageSize: number = 10 ): Promise> => { const response = await fetchApi(`/management/picture/get_pictures?page=${page}&pageSize=${pageSize}`); return response as PaginatedResult; }; // 根据ID获取单张图片 export const getManagementPictureById = async (id: number): Promise> => { return fetchApi( `/management/picture/get_picture/${id}`, { method: 'GET' } ); }; // 删除图片 export const deleteManagementPicture = async (id: number): Promise> => { return fetchApi( '/management/picture/delete_picture', { method: 'POST', body: JSON.stringify(id) } ); }; // 批量删除图片 export const batchDeleteManagementPictures = async ( ids: number[] ): Promise> => { return fetchApi( '/management/picture/batch_delete_pictures', { method: 'POST', body: JSON.stringify(ids) } ); }; // 根据用户ID获取图片 export const getManagementPicturesByUserId = async ( userId: number, page: number = 1, pageSize: number = 10 ): Promise> => { const response = await fetchApi(`/management/picture/get_pictures_by_user/${userId}?page=${page}&pageSize=${pageSize}`); return response as PaginatedResult; };