feat: 二维码访问功能,统一端点管道增强,端点迁移至 Services 层
- 新增二维码生成端点,自动检测局域网 IP,前端扫一扫即可打开网站 - 提取 IApiResponse 接口,ServiceRequestBinder 支持强类型请求 DTO 绑定 - FileStream 端点迁移至 AppEndpoints 统一注册,管道支持 FileStreamResponse 原始文件返回 - 文件库端点全面使用 MapGet<TService, TRequest> 泛型注册 - 移除 Avalonia-API/Extensions 中的业务端点文件,统一由 Services 层管理
This commit is contained in:
@@ -2,12 +2,24 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Avalonia_Common.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 统一端点响应契约。
|
||||
/// </summary>
|
||||
public interface IApiResponse
|
||||
{
|
||||
/// <summary>是否成功。</summary>
|
||||
bool Success { get; }
|
||||
|
||||
/// <summary>业务状态码。</summary>
|
||||
int Code { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 统一 API 返回格式。
|
||||
/// 所有接口的返回都包装为此格式,确保前端收到一致的数据结构。
|
||||
/// </summary>
|
||||
/// <typeparam name="T">业务数据类型</typeparam>
|
||||
public class ApiResponse<T>
|
||||
public class ApiResponse<T> : IApiResponse
|
||||
{
|
||||
/// <summary>是否成功</summary>
|
||||
[JsonPropertyName("success")]
|
||||
@@ -113,7 +125,7 @@ namespace Avalonia_Common.Core
|
||||
/// <summary>
|
||||
/// 分页返回格式
|
||||
/// </summary>
|
||||
public class PagedResponse<T>
|
||||
public class PagedResponse<T> : IApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置操作是否成功。
|
||||
|
||||
Reference in New Issue
Block a user