677 lines
23 KiB
C#
677 lines
23 KiB
C#
// <auto-generated />
|
|
using System;
|
|
using Apimanager_backend.Data;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
|
|
#nullable disable
|
|
|
|
namespace Apimanager_backend.Migrations
|
|
{
|
|
[DbContext(typeof(ApiContext))]
|
|
[Migration("20250729080100_add_PaymentConfig")]
|
|
partial class add_PaymentConfig
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
{
|
|
#pragma warning disable 612, 618
|
|
modelBuilder
|
|
.HasAnnotation("ProductVersion", "8.0.0")
|
|
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.Api", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<string>("Description")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("Endpoint")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<bool>("IsDelete")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<bool>("IsThirdParty")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<int>("Method")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("varchar(200)");
|
|
|
|
b.Property<int?>("PackageId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("PackageId");
|
|
|
|
b.ToTable("Apis");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.ApiCallLog", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("ApiId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("CallResult")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime>("CallTime")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<int>("UserId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("ApiId");
|
|
|
|
b.HasIndex("UserId");
|
|
|
|
b.ToTable("CallLogs");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.ApiRequestExample", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("ApiId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Request")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("Response")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("ResponseType")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("ApiId");
|
|
|
|
b.ToTable("ApiRequestExample");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.Apipackage", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("CallLimit")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<bool>("IsDeleted")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(20)
|
|
.HasColumnType("varchar(20)");
|
|
|
|
b.Property<int>("OneMinuteLimit")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<decimal>("Price")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("Apipackages");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.Log", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Exception")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("LogLevel")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("Message")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("MessageTemplate")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("Properties")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<DateTime>("Timestamp")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("Logs");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.OperationLog", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<string>("Description")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("IpAddress")
|
|
.IsRequired()
|
|
.HasMaxLength(45)
|
|
.HasColumnType("varchar(45)");
|
|
|
|
b.Property<string>("Operation")
|
|
.IsRequired()
|
|
.HasMaxLength(20)
|
|
.HasColumnType("varchar(20)");
|
|
|
|
b.Property<int>("TargetId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("TargetType")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("varchar(50)");
|
|
|
|
b.Property<string>("UserAgent")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<int>("UserId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("UserId");
|
|
|
|
b.ToTable("OperationLogs");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.Order", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
b.Property<decimal>("Amount")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<string>("Description")
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<bool>("IsDeleted")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<string>("OrderNumber")
|
|
.IsRequired()
|
|
.HasColumnType("varchar(255)");
|
|
|
|
b.Property<int>("OrderType")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime?>("PaiAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<int>("PaymentType")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("Status")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("ThirdPartyOrderId")
|
|
.HasColumnType("varchar(255)");
|
|
|
|
b.Property<DateTime?>("UpdatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<int>("UserId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("OrderNumber")
|
|
.IsUnique();
|
|
|
|
b.HasIndex("ThirdPartyOrderId")
|
|
.IsUnique();
|
|
|
|
b.HasIndex("UserId");
|
|
|
|
b.ToTable("Orders");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.PaymentConfig", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("AppId")
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("Description")
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("ExtraSettingsJson")
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("GatewayUrl")
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<bool>("IsEnabled")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<int>("Method")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("NotifyUrl")
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("PublicKey")
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("SecretKey")
|
|
.HasColumnType("longtext");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("PaymentConfig");
|
|
|
|
b.HasData(
|
|
new
|
|
{
|
|
Id = 1,
|
|
AppId = "",
|
|
GatewayUrl = "",
|
|
IsEnabled = false,
|
|
Method = 0,
|
|
NotifyUrl = "",
|
|
PublicKey = "",
|
|
SecretKey = ""
|
|
},
|
|
new
|
|
{
|
|
Id = 2,
|
|
AppId = "",
|
|
GatewayUrl = "",
|
|
IsEnabled = false,
|
|
Method = 1,
|
|
NotifyUrl = "",
|
|
PublicKey = "",
|
|
SecretKey = ""
|
|
},
|
|
new
|
|
{
|
|
Id = 3,
|
|
AppId = "",
|
|
GatewayUrl = "",
|
|
IsEnabled = false,
|
|
Method = 3,
|
|
NotifyUrl = "",
|
|
PublicKey = "",
|
|
SecretKey = ""
|
|
},
|
|
new
|
|
{
|
|
Id = 4,
|
|
AppId = "",
|
|
GatewayUrl = "",
|
|
IsEnabled = false,
|
|
Method = 2,
|
|
NotifyUrl = "",
|
|
PublicKey = "",
|
|
SecretKey = ""
|
|
},
|
|
new
|
|
{
|
|
Id = 5,
|
|
AppId = "",
|
|
GatewayUrl = "",
|
|
IsEnabled = false,
|
|
Method = 4,
|
|
NotifyUrl = "",
|
|
PublicKey = "",
|
|
SecretKey = ""
|
|
});
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.SystemConfig", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("ConfigBody")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("ConfigName")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("SystemConfigs");
|
|
|
|
b.HasData(
|
|
new
|
|
{
|
|
Id = 1,
|
|
ConfigBody = "青蓝",
|
|
ConfigName = "SystemName"
|
|
},
|
|
new
|
|
{
|
|
Id = 2,
|
|
ConfigBody = "描述",
|
|
ConfigName = "SystemDescription"
|
|
},
|
|
new
|
|
{
|
|
Id = 3,
|
|
ConfigBody = "",
|
|
ConfigName = "LogoLocation"
|
|
},
|
|
new
|
|
{
|
|
Id = 4,
|
|
ConfigBody = "",
|
|
ConfigName = "FaviconLocation"
|
|
},
|
|
new
|
|
{
|
|
Id = 5,
|
|
ConfigBody = "13000000000",
|
|
ConfigName = "Phone"
|
|
},
|
|
new
|
|
{
|
|
Id = 6,
|
|
ConfigBody = "admin@admin.com",
|
|
ConfigName = "Email"
|
|
},
|
|
new
|
|
{
|
|
Id = 7,
|
|
ConfigBody = "{\"RegisterOn\":true,\"Emailvalidate\":true}",
|
|
ConfigName = "RegisterConfig"
|
|
});
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.User", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("ApiKey")
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<decimal>("Balance")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<string>("Email")
|
|
.IsRequired()
|
|
.HasColumnType("varchar(255)");
|
|
|
|
b.Property<bool>("IsBan")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<bool>("IsDelete")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<string>("PassHash")
|
|
.IsRequired()
|
|
.HasMaxLength(255)
|
|
.HasColumnType("varchar(255)");
|
|
|
|
b.Property<string>("Username")
|
|
.IsRequired()
|
|
.HasColumnType("varchar(255)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Email")
|
|
.IsUnique();
|
|
|
|
b.HasIndex("Username")
|
|
.IsUnique();
|
|
|
|
b.ToTable("Users");
|
|
|
|
b.HasData(
|
|
new
|
|
{
|
|
Id = -1,
|
|
Balance = 0m,
|
|
CreatedAt = new DateTime(2025, 7, 29, 8, 1, 0, 284, DateTimeKind.Utc).AddTicks(4585),
|
|
Email = "admin1@admin.com",
|
|
IsBan = false,
|
|
IsDelete = false,
|
|
PassHash = "e10adc3949ba59abbe56e057f20f883e",
|
|
Username = "admin"
|
|
});
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.UserPackage", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime>("ExpiryDate")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<int>("PackageId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime>("PurchasedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<int>("RemainingCalls")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("UserId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("PackageId");
|
|
|
|
b.HasIndex("UserId");
|
|
|
|
b.ToTable("UserPackages");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.UserRole", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Role")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<int>("UserId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("UserId");
|
|
|
|
b.ToTable("UserRoles");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.Api", b =>
|
|
{
|
|
b.HasOne("Apimanager_backend.Models.Apipackage", "Package")
|
|
.WithMany("Apis")
|
|
.HasForeignKey("PackageId");
|
|
|
|
b.Navigation("Package");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.ApiCallLog", b =>
|
|
{
|
|
b.HasOne("Apimanager_backend.Models.Api", "Api")
|
|
.WithMany("ApiCalls")
|
|
.HasForeignKey("ApiId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Apimanager_backend.Models.User", "User")
|
|
.WithMany("CallLogs")
|
|
.HasForeignKey("UserId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Api");
|
|
|
|
b.Navigation("User");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.ApiRequestExample", b =>
|
|
{
|
|
b.HasOne("Apimanager_backend.Models.Api", "Api")
|
|
.WithMany("ApiRequestExamples")
|
|
.HasForeignKey("ApiId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Api");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.OperationLog", b =>
|
|
{
|
|
b.HasOne("Apimanager_backend.Models.User", "User")
|
|
.WithMany("operationLogs")
|
|
.HasForeignKey("UserId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("User");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.Order", b =>
|
|
{
|
|
b.HasOne("Apimanager_backend.Models.User", "User")
|
|
.WithMany("Orders")
|
|
.HasForeignKey("UserId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("User");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.UserPackage", b =>
|
|
{
|
|
b.HasOne("Apimanager_backend.Models.Apipackage", "Package")
|
|
.WithMany("Packages")
|
|
.HasForeignKey("PackageId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Apimanager_backend.Models.User", "User")
|
|
.WithMany("Packages")
|
|
.HasForeignKey("UserId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Package");
|
|
|
|
b.Navigation("User");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.UserRole", b =>
|
|
{
|
|
b.HasOne("Apimanager_backend.Models.User", "User")
|
|
.WithMany("Roles")
|
|
.HasForeignKey("UserId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("User");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.Api", b =>
|
|
{
|
|
b.Navigation("ApiCalls");
|
|
|
|
b.Navigation("ApiRequestExamples");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.Apipackage", b =>
|
|
{
|
|
b.Navigation("Apis");
|
|
|
|
b.Navigation("Packages");
|
|
});
|
|
|
|
modelBuilder.Entity("Apimanager_backend.Models.User", b =>
|
|
{
|
|
b.Navigation("CallLogs");
|
|
|
|
b.Navigation("Orders");
|
|
|
|
b.Navigation("Packages");
|
|
|
|
b.Navigation("Roles");
|
|
|
|
b.Navigation("operationLogs");
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|