添加管理员控制器,api控制器功能

This commit is contained in:
南浔
2024-11-09 23:36:22 +08:00
26 changed files with 1221 additions and 12 deletions
+5
View File
@@ -16,6 +16,10 @@ namespace Apimanager_backend.Models
[MaxLength(200)]
[Required]
public string Name { get; set; } // varchar(20)
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; } = string.Empty;
/// <summary>
/// API地址
@@ -55,5 +59,6 @@ namespace Apimanager_backend.Models
//导航属性
public Apipackage? Package { get; set; }
public ICollection<ApiCallLog> ApiCalls { get; set; }
public ICollection<ApiRequestExample> ApiRequestExamples { get; set; }
}
}
+4 -4
View File
@@ -2,9 +2,9 @@
{
public enum ApiMethod
{
GET,
POST,
PUT,
DELETE
GET = 0,
POST = 1,
PUT = 2,
DELETE = 3
}
}
@@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
namespace Apimanager_backend.Models
{
public class ApiRequestExample
{
public int Id { get; set; }
public int ApiId { get; set; }
[Required]
public string ResponseType { get; set; }
public string Request { get; set; } = string.Empty;
public string Response { get; set; } = string.Empty;
//导航属性
public Api Api { get; set; }
}
}
+3 -2
View File
@@ -27,10 +27,11 @@ namespace Apimanager_backend.Models
/// </summary>
public decimal Price { get; set; } // decimal(10,2)
/// <summary>
/// 套餐过期时间,可用于控制套餐是否过期
/// 每分钟调用次数限制
/// </summary>
public DateTime ExpiryDate { get; set; } // timestamp
public int OneMinuteLimit { get; set; }
/// <summary>
/// 创建时间
+4
View File
@@ -45,6 +45,10 @@ namespace Apimanager_backend.Models
/// 余额
/// </summary>
public decimal Balance { get; set; } = 0; // Decimal(10)
/// <summary>
/// api调用凭证
/// </summary>
public string? ApiKey { get; set; } = null;
/// <summary>
/// 创建时间,默认当前时间
+4 -1
View File
@@ -20,7 +20,10 @@
/// 剩余调用次数
/// </summary>
public int RemainingCalls { get; set; }
/// <summary>
/// 套餐过期时间,可用于控制套餐是否过期
/// </summary>
public DateTime ExpiryDate { get; set; } // timestamp
/// <summary>
/// 购买时间
/// </summary>