diff --git a/.gitignore b/.gitignore
index b2b23fa..8146c59 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,5 @@
/BitgetApi/obj
/BitgetApi/bin
/BitgetApi/Properties/licenses.licx
+/Bitget_Server/bin
+/Bitget_Server/obj
diff --git a/BitgetApi.sln b/BitgetApi.sln
index d82c2ac..3167b86 100644
--- a/BitgetApi.sln
+++ b/BitgetApi.sln
@@ -5,6 +5,8 @@ VisualStudioVersion = 17.9.34902.65
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BitgetApi", "BitgetApi\BitgetApi.csproj", "{09813A63-9EF4-4D6D-BA41-5F610909BDEC}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bitget_Server", "Bitget_Server\Bitget_Server.csproj", "{725DC784-0243-4FDF-921E-91CF09580A03}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
{09813A63-9EF4-4D6D-BA41-5F610909BDEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{09813A63-9EF4-4D6D-BA41-5F610909BDEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{09813A63-9EF4-4D6D-BA41-5F610909BDEC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {725DC784-0243-4FDF-921E-91CF09580A03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {725DC784-0243-4FDF-921E-91CF09580A03}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {725DC784-0243-4FDF-921E-91CF09580A03}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {725DC784-0243-4FDF-921E-91CF09580A03}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/BitgetApi/BitgetApi.csproj b/BitgetApi/BitgetApi.csproj
index 4fe3fe7..5ed9445 100644
--- a/BitgetApi/BitgetApi.csproj
+++ b/BitgetApi/BitgetApi.csproj
@@ -92,7 +92,6 @@
MainForm.cs
-
ResXFileCodeGenerator
Resources.Designer.cs
diff --git a/Bitget_Server/Bitget_Server.csproj b/Bitget_Server/Bitget_Server.csproj
new file mode 100644
index 0000000..ff273c0
--- /dev/null
+++ b/Bitget_Server/Bitget_Server.csproj
@@ -0,0 +1,22 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
diff --git a/Bitget_Server/Common/CommonProperty.cs b/Bitget_Server/Common/CommonProperty.cs
new file mode 100644
index 0000000..d80dc31
--- /dev/null
+++ b/Bitget_Server/Common/CommonProperty.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Bitget_Server.Common
+{
+ public static class CommonProperty
+ {
+ public static string DbIp { get; set; } = "localhost";
+
+ public static string DbName { get; set; } = "Bitget";
+ public static string DbId { get; set; } = "million";
+ public static string DbPw { get; set; } = "million!";
+
+ public static string EfCoreConnectionStr { get; set; } = $"Server={DbIp};database={DbName};uid={DbId};pwd={DbPw};TrustServerCertificate=true;";
+ }
+}
diff --git a/Bitget_Server/Controller/PushAlarmController.cs b/Bitget_Server/Controller/PushAlarmController.cs
new file mode 100644
index 0000000..b377ccb
--- /dev/null
+++ b/Bitget_Server/Controller/PushAlarmController.cs
@@ -0,0 +1,24 @@
+using Bitget_Server.EFCore.Models;
+using Bitget_Server.EFCore;
+using Microsoft.AspNetCore.Mvc;
+
+namespace Bitget_Server.Controller
+{
+
+ [ApiController, Route("api/push")]
+ public class PushAlarmController : ControllerBase
+ {
+ private readonly BitgetContext context;
+
+ public PushAlarmController(BitgetContext _context)
+ {
+ context = _context;
+ }
+
+ [HttpGet, Route("newalarm")]
+ public List GetAlarm(int index)
+ {
+ return context.PushAlarms.Where(x => x.Id > index).ToList();
+ }
+ }
+}
diff --git a/Bitget_Server/EFCore/BitgetContext.cs b/Bitget_Server/EFCore/BitgetContext.cs
new file mode 100644
index 0000000..5e9126d
--- /dev/null
+++ b/Bitget_Server/EFCore/BitgetContext.cs
@@ -0,0 +1,33 @@
+using Bitget_Server.Common;
+using Bitget_Server.EFCore.Models;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Bitget_Server.EFCore
+{
+ public class BitgetContext : DbContext
+ {
+
+ public DbSet PushAlarms { get; set; }
+
+ public BitgetContext(DbContextOptions options)
+ : base(options)
+ {
+ }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ optionsBuilder.UseSqlServer(CommonProperty.EfCoreConnectionStr);
+ base.OnConfiguring(optionsBuilder);
+ }
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ base.OnModelCreating(modelBuilder);
+ }
+ }
+}
diff --git a/Bitget_Server/EFCore/Models/PushAlarm.cs b/Bitget_Server/EFCore/Models/PushAlarm.cs
new file mode 100644
index 0000000..66664ac
--- /dev/null
+++ b/Bitget_Server/EFCore/Models/PushAlarm.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Bitget_Server.EFCore.Models
+{
+ public class PushAlarm
+ {
+
+ [Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int Id { get; set; }
+
+ public DateTime AlarmTime { get; set; }
+
+ public string Title { get; set; } = string.Empty;
+
+ public string Contents { get; set; } = string.Empty;
+ }
+}
diff --git a/Bitget_Server/Migrations/20240602102008_init1.Designer.cs b/Bitget_Server/Migrations/20240602102008_init1.Designer.cs
new file mode 100644
index 0000000..dfe59c6
--- /dev/null
+++ b/Bitget_Server/Migrations/20240602102008_init1.Designer.cs
@@ -0,0 +1,54 @@
+//
+using System;
+using Bitget_Server.EFCore;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace Bitget_Server.Migrations
+{
+ [DbContext(typeof(BitgetContext))]
+ [Migration("20240602102008_init1")]
+ partial class init1
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.6")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("Bitget_Server.EFCore.Models.PushAlarm", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AlarmTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Contents")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("PushAlarms");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Bitget_Server/Migrations/20240602102008_init1.cs b/Bitget_Server/Migrations/20240602102008_init1.cs
new file mode 100644
index 0000000..50c970f
--- /dev/null
+++ b/Bitget_Server/Migrations/20240602102008_init1.cs
@@ -0,0 +1,37 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Bitget_Server.Migrations
+{
+ ///
+ public partial class init1 : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "PushAlarms",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ AlarmTime = table.Column(type: "datetime2", nullable: false),
+ Title = table.Column(type: "nvarchar(max)", nullable: false),
+ Contents = table.Column(type: "nvarchar(max)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_PushAlarms", x => x.Id);
+ });
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "PushAlarms");
+ }
+ }
+}
diff --git a/Bitget_Server/Migrations/BitgetContextModelSnapshot.cs b/Bitget_Server/Migrations/BitgetContextModelSnapshot.cs
new file mode 100644
index 0000000..5d005a4
--- /dev/null
+++ b/Bitget_Server/Migrations/BitgetContextModelSnapshot.cs
@@ -0,0 +1,51 @@
+//
+using System;
+using Bitget_Server.EFCore;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace Bitget_Server.Migrations
+{
+ [DbContext(typeof(BitgetContext))]
+ partial class BitgetContextModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.6")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("Bitget_Server.EFCore.Models.PushAlarm", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AlarmTime")
+ .HasColumnType("datetime2");
+
+ b.Property("Contents")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("PushAlarms");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Bitget_Server/Program.cs b/Bitget_Server/Program.cs
new file mode 100644
index 0000000..663096c
--- /dev/null
+++ b/Bitget_Server/Program.cs
@@ -0,0 +1,27 @@
+using Bitget_Server.EFCore;
+using Microsoft.EntityFrameworkCore;
+
+namespace Bitget_Server
+{
+ public class Program
+ {
+ public static void Main(string[] args)
+ {
+ var builder = WebApplication.CreateBuilder(args);
+ builder.Services.AddDbContext();
+ var app = builder.Build();
+
+ using (var scope = app.Services.CreateScope())
+ {
+ var services = scope.ServiceProvider;
+ var context = services.GetRequiredService();
+ context.Database.Migrate();
+ }
+
+
+ app.MapGet("/", () => "Hello World!");
+
+ app.Run();
+ }
+ }
+}
diff --git a/Bitget_Server/Properties/launchSettings.json b/Bitget_Server/Properties/launchSettings.json
new file mode 100644
index 0000000..cffc662
--- /dev/null
+++ b/Bitget_Server/Properties/launchSettings.json
@@ -0,0 +1,29 @@
+{
+ "$schema": "http://json.schemastore.org/launchsettings.json",
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:46411",
+ "sslPort": 0
+ }
+ },
+ "profiles": {
+ "http": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "applicationUrl": "http://localhost:5045",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ }
+ }
+}
diff --git a/Bitget_Server/appsettings.Development.json b/Bitget_Server/appsettings.Development.json
new file mode 100644
index 0000000..0c208ae
--- /dev/null
+++ b/Bitget_Server/appsettings.Development.json
@@ -0,0 +1,8 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ }
+}
diff --git a/Bitget_Server/appsettings.json b/Bitget_Server/appsettings.json
new file mode 100644
index 0000000..10f68b8
--- /dev/null
+++ b/Bitget_Server/appsettings.json
@@ -0,0 +1,9 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "AllowedHosts": "*"
+}