APIResult.cs
846 Bytes
namespace HHECS.DAQServer.Dto
{
public class APIResult<T> : APIResult where T : class
{
public APIResult(string message) : base(message) { }
/// <summary>
/// 数据
/// </summary>
public T Data { get; set; } = default!;
}
public class APIResult
{
public APIResult(string message, int code = 500)
{
Code = code;
Message = message;
}
/// <summary>
/// 状态码
/// </summary>
public int Code { get; set; } = 500;
/// <summary>
/// 成功或失败消息
/// </summary>
public string Message { get; set; } = null!;
/// <summary>
/// 时间戳
/// </summary>
public double Timestamp => DateTimeOffset.UtcNow.ToUnixTimeSeconds();
}
}