70 lines
3.5 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Microsoft.AspNetCore.Http;
using MilliSim.Common.Dtos;
using MilliSim.Common.Models;
namespace MilliSim.Services;
public interface IProjectService
{
// ===== 项目 =====
Task<ApiResponse<PagedResult<ProjectDto>>> GetProjectsAsync(ProjectQueryRequest request);
Task<ApiResponse<PagedResult<ProjectDto>>> GetPublishedProjectsAsync(ProjectQueryRequest request);
Task<ApiResponse<ProjectDto>> GetProjectByIdAsync(long id, bool incrementView = false);
Task<ApiResponse<ProjectDto>> CreateProjectAsync(CreateProjectRequest request);
Task<ApiResponse<ProjectDto>> UpdateProjectAsync(long id, UpdateProjectRequest request);
Task<ApiResponse> DeleteProjectAsync(long id);
Task<ApiResponse> TogglePublishAsync(long id);
Task<ApiResponse> ToggleFeaturedAsync(long id);
Task<ApiResponse> ToggleFavoriteAsync(long projectId);
Task<ApiResponse<PagedResult<ProjectDto>>> GetFavoritesAsync(PageRequest request);
Task<ApiResponse> RecordExperienceAsync(long projectId, int durationSeconds);
Task<ApiResponse<PagedResult<ExperienceLogDto>>> GetExperienceLogsAsync(PageRequest request);
Task<ApiResponse<List<ProjectDto>>> GetRelatedProjectsAsync(long projectId, int count = 4);
// ===== 项目分类 =====
Task<ApiResponse<List<CategoryDto>>> GetCategoriesAsync();
Task<ApiResponse<CategoryDto>> CreateCategoryAsync(CreateCategoryRequest request);
Task<ApiResponse<CategoryDto>> UpdateCategoryAsync(long id, CreateCategoryRequest request);
Task<ApiResponse> DeleteCategoryAsync(long id);
// ===== 平台类型 =====
Task<ApiResponse<List<PlatformDto>>> GetPlatformsAsync();
Task<ApiResponse<PlatformDto>> CreatePlatformAsync(CreatePlatformRequest request);
Task<ApiResponse<PlatformDto>> UpdatePlatformAsync(long id, CreatePlatformRequest request);
Task<ApiResponse> DeletePlatformAsync(long id);
// ===== 特性标签 =====
Task<ApiResponse<List<TagDto>>> GetTagsAsync();
Task<ApiResponse<TagDto>> CreateTagAsync(CreateTagRequest request);
Task<ApiResponse<TagDto>> UpdateTagAsync(long id, CreateTagRequest request);
Task<ApiResponse> DeleteTagAsync(long id);
// ===== 资源包 =====
Task<ApiResponse<List<PackageDto>>> GetPackagesAsync(long projectId);
Task<ApiResponse<PackageDto>> UploadPackageAsync(long projectId, PackageType type, IFormFile file, string wakeProtocolPrefix, string wakeProtocolParam);
Task<ApiResponse> DeletePackageAsync(long id);
/// <summary>
/// 下载资源包(返回文件流和原始文件名,用于 Content-Disposition
/// </summary>
Task<(Stream Stream, string ContentType, string FileName)> DownloadPackageAsync(long packageId);
/// <summary>
/// 获取 WebGL 资源包的在线运行入口 URL解压后的 index.html 签名 URL
/// </summary>
Task<ApiResponse<string>> GetWebGLRunUrlAsync(long projectId);
/// <summary>
/// 获取 WebGL 代理后的 index.html 内容(注入 base 标签资源走代理重定向到签名URL
/// </summary>
Task<string> GetWebGLIndexHtmlAsync(long projectId);
/// <summary>
/// 获取 WebGL 资源文件的签名 URL用于资源代理重定向
/// </summary>
Task<string> GetWebGLResourceUrlAsync(long projectId, string resourcePath);
/// <summary>
/// 获取视频流(防盗链代理,不暴露 COS 直链,支持 Range 请求)
/// </summary>
Task<(Stream Stream, string ContentType, long? FileSize, bool IsPartial, string? ContentRange)> GetVideoStreamAsync(long projectId, string? rangeHeader);
}