feat: 项目初始化并添加数据库使用

master
zhangyousheng 2023-07-29 00:59:17 +08:00
commit 5800f7167b
36 changed files with 1881 additions and 0 deletions

25
.dockerignore Normal file
View File

@ -0,0 +1,25 @@
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.idea
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md

341
.gitignore vendored Normal file

File diff suppressed because it is too large Load Diff

51
UserPointManagement.sln Normal file
View File

@ -0,0 +1,51 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{14E4E7B1-DAC3-4F63-9C6F-3875AE5C7502}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{EB952040-7FE7-492A-BBAA-E347A3C049F1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserPointManagement.Web", "src\UserPointManagement.Web\UserPointManagement.Web.csproj", "{F76FAFB7-B604-4CD6-AF5D-B7BB47F34EFC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserPointManagement.Persistence", "src\UserPointManagement.Persistence\UserPointManagement.Persistence.csproj", "{4F219EA1-BC60-475A-9BC2-5BE6DD38C221}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserPointManagement.Application", "src\UserPointManagement.Application\UserPointManagement.Application.csproj", "{F7D6BA14-96C2-4DA9-8BC7-F50DFA14EC66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserPointManagement.Model", "src\UserPointManagement.Model\UserPointManagement.Model.csproj", "{75EC6A62-86F4-4D0C-A222-9BA11AA82A0E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserPointManagement.Tests", "test\UserPointManagement.Tests\UserPointManagement.Tests.csproj", "{F831F9D1-54CD-4566-ADBB-BAE879A78488}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F76FAFB7-B604-4CD6-AF5D-B7BB47F34EFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F76FAFB7-B604-4CD6-AF5D-B7BB47F34EFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F76FAFB7-B604-4CD6-AF5D-B7BB47F34EFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F76FAFB7-B604-4CD6-AF5D-B7BB47F34EFC}.Release|Any CPU.Build.0 = Release|Any CPU
{4F219EA1-BC60-475A-9BC2-5BE6DD38C221}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4F219EA1-BC60-475A-9BC2-5BE6DD38C221}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F219EA1-BC60-475A-9BC2-5BE6DD38C221}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4F219EA1-BC60-475A-9BC2-5BE6DD38C221}.Release|Any CPU.Build.0 = Release|Any CPU
{F7D6BA14-96C2-4DA9-8BC7-F50DFA14EC66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F7D6BA14-96C2-4DA9-8BC7-F50DFA14EC66}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F7D6BA14-96C2-4DA9-8BC7-F50DFA14EC66}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F7D6BA14-96C2-4DA9-8BC7-F50DFA14EC66}.Release|Any CPU.Build.0 = Release|Any CPU
{75EC6A62-86F4-4D0C-A222-9BA11AA82A0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{75EC6A62-86F4-4D0C-A222-9BA11AA82A0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{75EC6A62-86F4-4D0C-A222-9BA11AA82A0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{75EC6A62-86F4-4D0C-A222-9BA11AA82A0E}.Release|Any CPU.Build.0 = Release|Any CPU
{F831F9D1-54CD-4566-ADBB-BAE879A78488}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F831F9D1-54CD-4566-ADBB-BAE879A78488}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F831F9D1-54CD-4566-ADBB-BAE879A78488}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F831F9D1-54CD-4566-ADBB-BAE879A78488}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F76FAFB7-B604-4CD6-AF5D-B7BB47F34EFC} = {14E4E7B1-DAC3-4F63-9C6F-3875AE5C7502}
{4F219EA1-BC60-475A-9BC2-5BE6DD38C221} = {14E4E7B1-DAC3-4F63-9C6F-3875AE5C7502}
{F7D6BA14-96C2-4DA9-8BC7-F50DFA14EC66} = {14E4E7B1-DAC3-4F63-9C6F-3875AE5C7502}
{75EC6A62-86F4-4D0C-A222-9BA11AA82A0E} = {14E4E7B1-DAC3-4F63-9C6F-3875AE5C7502}
{F831F9D1-54CD-4566-ADBB-BAE879A78488} = {EB952040-7FE7-492A-BBAA-E347A3C049F1}
EndGlobalSection
EndGlobal

7
global.json Normal file
View File

@ -0,0 +1,7 @@
{
"sdk": {
"version": "6.0.0",
"rollForward": "latestMinor",
"allowPrerelease": false
}
}

View File

@ -0,0 +1,27 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace UserPointManagement.Application;

public static class ServiceInjectExtensions
{
public static IServiceCollection AddServices(this IServiceCollection services)
{
var assembly = typeof(ServiceInjectExtensions).Assembly;
var types = assembly
.GetTypes()
.Where(t =>
!t.IsGenericType &&
!t.IsAbstract &&
t.IsClass &&
!t.Name.EndsWith("ApiService") &&
t.Name.EndsWith("Service"))
.ToList();
foreach (var type in types)
{
var baseType = type.GetInterfaces().FirstOrDefault(t => t.Name == $"I{type.Name}");
services.TryAddScoped(baseType, type);
}
return services;
}
}

View File

@ -0,0 +1,11 @@
namespace UserPointManagement.Application.Services;

public interface IUserService
{
}

public class UserService : IUserService
{
}

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
</ItemGroup>

</Project>

View File

@ -0,0 +1,10 @@
namespace UserPointManagement.Model.Entities;

public class User
{
public int Id { get; set; }

public string Name { get; set; }

public string Mobile { get; set; }
}

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
</ItemGroup>

</Project>

View File

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using UserPointManagement.Model.Entities;

namespace UserPointManagement.Persistence.EntityTypeConfigurations;

public class UserConfiguration : IEntityTypeConfiguration<User>
{
public void Configure(EntityTypeBuilder<User> builder)
{
builder.HasKey(e => e.Id);
builder.Property(e => e.Id)
.HasComment("主键");
builder.Property(e => e.Name)
.HasComment("姓名")
.HasMaxLength(50);

builder.Property(e => e.Mobile)
.HasComment("手机号")
.HasMaxLength(30);
}
}

View File

@ -0,0 +1,58 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using UserPointManagement.Persistence;

#nullable disable

namespace UserPointManagement.Persistence.Migrations
{
[DbContext(typeof(UserPointManagementDbContext))]
[Migration("20230728165153_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);

NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

modelBuilder.Entity("UserPointManagement.Model.Entities.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasComment("主键");

NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

b.Property<string>("Mobile")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)")
.HasColumnName("mobile")
.HasComment("手机号");

b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasColumnName("name")
.HasComment("姓名");

b.HasKey("Id")
.HasName("pk_user");

b.ToTable("user", (string)null);
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,33 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace UserPointManagement.Persistence.Migrations
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "user",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false, comment: "主键")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false, comment: "姓名"),
mobile = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false, comment: "手机号")
},
constraints: table =>
{
table.PrimaryKey("pk_user", x => x.id);
});
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "user");
}
}
}

View File

@ -0,0 +1,56 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using UserPointManagement.Persistence;

#nullable disable

namespace UserPointManagement.Persistence.Migrations
{
[DbContext(typeof(UserPointManagementDbContext))]
partial class UserPointManagementDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);

NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

modelBuilder.Entity("UserPointManagement.Model.Entities.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasComment("主键");

NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

b.Property<string>("Mobile")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)")
.HasColumnName("mobile")
.HasComment("手机号");

b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasColumnName("name")
.HasComment("姓名");

b.HasKey("Id")
.HasName("pk_user");

b.ToTable("user", (string)null);
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,26 @@
using System.Text.RegularExpressions;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace UserPointManagement.Persistence
{
public static class ModelBuilderExtensions
{
public static void SnakeCaseTableNameConvention(this ModelBuilder modelBuilder)
{
foreach (IMutableEntityType entity in modelBuilder.Model.GetEntityTypes())
{
var pattern =
new Regex(@"[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+");

var snakeCaseName = entity.DisplayName() == null
? null
: string
.Join("_", pattern.Matches(entity.DisplayName()).Cast<Match>().Select(m => m.Value))
.ToLower();

entity.SetTableName(snakeCaseName);
}
}
}
}

View File

@ -0,0 +1,27 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace UserPointManagement.Persistence
{
public static class RepositoryInjectExtensions
{
public static IServiceCollection AddRepositories(this IServiceCollection services)
{
var assembly = typeof(RepositoryInjectExtensions).Assembly;
var types = assembly
.GetTypes()
.Where(t =>
!t.IsGenericType &&
!t.IsAbstract &&
t.IsClass &&
t.Name.EndsWith("Repository"))
.ToList();
foreach (var type in types)
{
var baseType = type.GetInterfaces().FirstOrDefault(t => t.Name == $"I{type.Name}");
services.TryAddScoped(baseType, type);
}
return services;
}
}
}

View File

@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.0" />
<PackageReference Include="EFCore.NamingConventions" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<Folder Include="Migrations" />
<Folder Include="Repositories" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\UserPointManagement.Model\UserPointManagement.Model.csproj" />
</ItemGroup>

</Project>

View File

@ -0,0 +1,20 @@
using Microsoft.EntityFrameworkCore;
using UserPointManagement.Model.Entities;
using UserPointManagement.Persistence.EntityTypeConfigurations;

namespace UserPointManagement.Persistence;

public class UserPointManagementDbContext : Microsoft.EntityFrameworkCore.DbContext
{
public UserPointManagementDbContext(DbContextOptions options) : base(options)
{
}
public virtual DbSet<User> Users { get; set; }

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.SnakeCaseTableNameConvention();
modelBuilder.ApplyConfiguration(new UserConfiguration());
}
}

View File

@ -0,0 +1,18 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using UserPointManagement.Persistence;

namespace UserPointManagement.Web;

public class UserPointManagementDbContextFactory : IDesignTimeDbContextFactory<UserPointManagementDbContext>
{
public UserPointManagementDbContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder<UserPointManagementDbContext>();
optionsBuilder
.UseNpgsql("Server=67.230.184.225;Port=58007;UserId=postgres;Password=postgres;Database=tiamo;")
.UseSnakeCaseNamingConvention();

return new UserPointManagementDbContext(optionsBuilder.Options);
}
}

View File

@ -0,0 +1,11 @@
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(BasicLayout)" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(BasicLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
<AntContainer />

View File

@ -0,0 +1,56 @@
@namespace UserPointManagement.Web
@inherits LayoutComponentBase

<AntDesign.ProLayout.BasicLayout
Logo="@("https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg")"
MenuData="_menuData">
<RightContentRender>
<UserPointManagement.Web.Components.RightContent />
</RightContentRender>
<ChildContent>
@Body
</ChildContent>
<FooterRender>
<FooterView Copyright="2021 Ant Design Blazor" Links="Links"></FooterView>
</FooterRender>
</AntDesign.ProLayout.BasicLayout>
<SettingDrawer />

@code
{
private readonly MenuDataItem[] _menuData =
{
new MenuDataItem
{
Path = "/",
Name = "welcome",
Key = "welcome",
Icon = "smile",
}
};

public LinkItem[] Links { get; set; } =
{
new LinkItem
{
Key = "Ant Design Blazor",
Title = "Ant Design Blazor",
Href = "https://antblazor.com",
BlankTarget = true,
},
new LinkItem
{
Key = "github",
Title = (RenderFragment)(@<Icon Type="github" />),
Href = "https://github.com/ant-design-blazor/ant-design-pro-blazor",
BlankTarget = true,
},
new LinkItem
{
Key = "Blazor",
Title = "Blazor",
Href = "https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor?WT.mc_id=DT-MVP-5003987",
BlankTarget = true,
}
};
}

View File

@ -0,0 +1,41 @@
@page "/"

<PageContainer Title="Welcome">
<Card>
<Alert
Message="AntDesign.Templates have been published to nuget, you can download and use them directly."
Type="success"
ShowIcon="true"
Banner
Style="margin: -12px; margin-bottom: 24px"/>
<Text Strong>
<a target="_blank" rel="noopener noreferrer" href="https://www.nuget.org/packages/AntDesign.Templates">
Use .NET CLI to install the latest template quickly.
</a>
</Text>
<pre class="pre"><code><Text Copyable> dotnet new --install AntDesign.Templates::0.1.0-*</Text></code></pre>
<Text
Strong
Style="margin-bottom: 12px">
<a target="_blank" rel="noopener noreferrer" href="https://github.com/ant-design-blazor/ant-design-pro-blazor">
Create an empty blazor WebAssembly project
</a>
</Text>
<pre class="pre"><code><Text Copyable> dotnet new antdesign --host=wasm</Text></code></pre>
<Text
Strong
Style="margin-bottom: 12px">
<a target="_blank" rel="noopener noreferrer" href="https://github.com/ant-design-blazor/ant-design-pro-blazor">
Create a blazor webassembly project with all pages.
</a>
</Text>
<pre class="pre"><code><Text Copyable> dotnet new antdesign --host=wasm --full</Text></code></pre>
</Card>
<p style="text-align: center; margin-top: 24px;">
Want to add more pages? Please refer to
<a href="https://github.com/ant-design-blazor/ant-design-pro-blazor" target="_blank" rel="noopener noreferrer">
ant-design-pro-blazor project
</a>
.
</p>
</PageContainer>

View File

@ -0,0 +1,7 @@
.pre {
margin: 12px 0;
padding: 12px 20px;
background: #fff;
box-shadow: 0 1px 2px -2px rgba(0, 0, 0, 0.16),
0 3px 6px 0 rgba(0, 0, 0, 0.12), 0 5px 12px 4px rgba(0, 0, 0, 0.09);
}

View File

@ -0,0 +1,38 @@
using System;
using System.Net.Http;
using System.Threading.Tasks;
using AntDesign.ProLayout;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using UserPointManagement.Application;
using UserPointManagement.Persistence;

namespace UserPointManagement.Web
{
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");

builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddAntDesign();
builder.Services.AddServices();
builder.Services.AddRepositories();
builder.Services.Configure<ProSettings>(builder.Configuration.GetSection("ProSettings"));
builder.Services.AddDbContext<UserPointManagementDbContext>(option =>
{
option
.UseNpgsql(builder.Configuration["Connection:UserPointManagement"])
.UseSnakeCaseNamingConvention();
});

var host = builder.Build();
await host.RunAsync();
}
}
}

View File

@ -0,0 +1,29 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:53775/",
"sslPort": 44358
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"UserPointManagement.Web": {
"commandName": "Project",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
}
}

View File

@ -0,0 +1 @@
# UserPointManagement.Web

View File

@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net6</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AntDesign.Charts" Version="0.2.3" />
<PackageReference Include="AntDesign.ProLayout" Version="0.12.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
<PackageReference Include="System.Net.Http.Json" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\UserPointManagement.Application\UserPointManagement.Application.csproj" />
<ProjectReference Include="..\UserPointManagement.Persistence\UserPointManagement.Persistence.csproj" />
</ItemGroup>

</Project>

View File

@ -0,0 +1,11 @@
@using AntDesign
@using AntDesign.Charts
@using AntDesign.ProLayout
@using System.Net.Http
@using System.Net.Http.Json
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.WebAssembly.Http
@using Microsoft.JSInterop
@using UserPointManagement.Web

View File

@ -0,0 +1,19 @@
{
"ProSettings": {
"NavTheme": "dark",
"Layout": "side",
"ContentWidth": "Fluid",
"FixedHeader": false,
"FixSiderbar": true,
"Title": "Ant Design Pro",
"PrimaryColor": "daybreak",
"ColorWeak": false,
"SplitMenus": false,
"HeaderRender": true,
"FooterRender": true,
"MenuRender": true,
"MenuHeaderRender": true,
"HeaderHeight": 48
},
"Connection:UserPointManagement": "Server=67.230.184.225;Port=58007;UserId=postgres;Password=postgres;Database=tiamo;"
}

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 54 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,52 @@
/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */
/* stylelint-disable no-duplicate-selectors */
/* stylelint-disable */
/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */
html,
body,
#root,
#app,
app {
height: 100%;
}
.colorWeak {
filter: invert(80%);
}
.ant-layout {
min-height: 100vh;
}
canvas {
display: block;
}
body {
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
ul,
ol {
list-style: none;
}
@media (max-width: 480px) {
.ant-table {
width: 100%;
overflow-x: auto;
}
.ant-table-thead > tr > th,
.ant-table-tbody > tr > th,
.ant-table-thead > tr > td,
.ant-table-tbody > tr > td {
white-space: pre;
}
.ant-table-thead > tr > th > span,
.ant-table-tbody > tr > th > span,
.ant-table-thead > tr > td > span,
.ant-table-tbody > tr > td > span {
display: block;
}
}
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
body .ant-design-pro > .ant-layout {
min-height: 100vh;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,210 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="keywords" content="antd,umi,umijs,ant design,脚手架,布局, Ant Design,项目,Pro,admin,控制台,主页,开箱即用,中后台,解决方案,组件库" />
<meta name="description" content="An out-of-box UI solution for enterprise applications as a React boilerplate." />
<meta name="description" content="开箱即用的中台前端/设计解决方案。" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<title>Ant Design Pro Blazor</title>
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<base href="/" />
<link href="_content/AntDesign/css/ant-design-blazor.css" rel="stylesheet" />
<link href="_content/AntDesign.ProLayout/css/ant-design-pro-layout-blazor.css" rel="stylesheet" />
<link href="./css/site.css" rel="stylesheet" />
<link href="UserPointManagement.Web.styles.css" rel="stylesheet" />
</head>

<body>
<noscript>Out-of-the-box mid-stage front/design solution!</noscript>
<div id="app">
<style>
html,
body,
#app {
height: 100%;
margin: 0;
padding: 0;
}

#app {
background-repeat: no-repeat;
background-size: 100% auto;
}

.page-loading-warp {
padding: 98px;
display: flex;
justify-content: center;
align-items: center;
}

.ant-spin {
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin: 0;
padding: 0;
color: rgba(0, 0, 0, 0.65);
font-size: 14px;
font-variant: tabular-nums;
line-height: 1.5;
list-style: none;
-webkit-font-feature-settings: 'tnum';
font-feature-settings: 'tnum';
position: absolute;
display: none;
color: #1890ff;
text-align: center;
vertical-align: middle;
opacity: 0;
-webkit-transition: -webkit-transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
transition: -webkit-transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86),
-webkit-transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
}

.ant-spin-spinning {
position: static;
display: inline-block;
opacity: 1;
}

.ant-spin-dot {
position: relative;
display: inline-block;
font-size: 20px;
width: 20px;
height: 20px;
}

.ant-spin-dot-item {
position: absolute;
display: block;
width: 9px;
height: 9px;
background-color: #1890ff;
border-radius: 100%;
-webkit-transform: scale(0.75);
-ms-transform: scale(0.75);
transform: scale(0.75);
-webkit-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
transform-origin: 50% 50%;
opacity: 0.3;
-webkit-animation: antSpinMove 1s infinite linear alternate;
animation: antSpinMove 1s infinite linear alternate;
}

.ant-spin-dot-item:nth-child(1) {
top: 0;
left: 0;
}

.ant-spin-dot-item:nth-child(2) {
top: 0;
right: 0;
-webkit-animation-delay: 0.4s;
animation-delay: 0.4s;
}

.ant-spin-dot-item:nth-child(3) {
right: 0;
bottom: 0;
-webkit-animation-delay: 0.8s;
animation-delay: 0.8s;
}

.ant-spin-dot-item:nth-child(4) {
bottom: 0;
left: 0;
-webkit-animation-delay: 1.2s;
animation-delay: 1.2s;
}

.ant-spin-dot-spin {
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-animation: antRotate 1.2s infinite linear;
animation: antRotate 1.2s infinite linear;
}

.ant-spin-lg .ant-spin-dot {
font-size: 32px;
width: 32px;
height: 32px;
}

.ant-spin-lg .ant-spin-dot i {
width: 14px;
height: 14px;
}

@media all and (-ms-high-contrast: none),
(-ms-high-contrast: active) {
.ant-spin-blur {
background: #fff;
opacity: 0.5;
}
}

@-webkit-keyframes antSpinMove {
to {
opacity: 1;
}
}

@keyframes antSpinMove {
to {
opacity: 1;
}
}

@-webkit-keyframes antRotate {
to {
-webkit-transform: rotate(405deg);
transform: rotate(405deg);
}
}

@keyframes antRotate {
to {
-webkit-transform: rotate(405deg);
transform: rotate(405deg);
}
}
</style>
<div style="
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
min-height: 420px;
height: 100%;
">
<img src="./pro_icon.svg" alt="logo" width="256" />
<div class="page-loading-warp">
<div class="ant-spin ant-spin-lg ant-spin-spinning">
<span class="ant-spin-dot ant-spin-dot-spin"><i class="ant-spin-dot-item"></i><i
class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i
class="ant-spin-dot-item"></i></span>
</div>
</div>
<div style="display: flex; justify-content: center; align-items: center;">
<img src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" width="32"
style="margin-right: 8px;" />
Ant Design Blazor <div class="loading-progress-text"></div>
</div>
</div>
</div>

<script type="text/javascript" src="https://unpkg.com/@antv/g2plot@2.4.17/dist/g2plot.min.js"></script>
<script src="_content/AntDesign/js/ant-design-blazor.js"></script>
<script src="_content/AntDesign.Charts/ant-design-charts-blazor.js"></script>
<script src="_framework/blazor.webassembly.js"></script>
</body>

</html>

View File

@ -0,0 +1,5 @@
<svg width="42" height="42" xmlns="http://www.w3.org/2000/svg">
<g>
<path fill="#070707" d="m6.717392,13.773912l5.6,0c2.8,0 4.7,1.9 4.7,4.7c0,2.8 -2,4.7 -4.9,4.7l-2.5,0l0,4.3l-2.9,0l0,-13.7zm2.9,2.2l0,4.9l1.9,0c1.6,0 2.6,-0.9 2.6,-2.4c0,-1.6 -0.9,-2.4 -2.6,-2.4l-1.9,0l0,-0.1zm8.9,11.5l2.7,0l0,-5.7c0,-1.4 0.8,-2.3 2.2,-2.3c0.4,0 0.8,0.1 1,0.2l0,-2.4c-0.2,-0.1 -0.5,-0.1 -0.8,-0.1c-1.2,0 -2.1,0.7 -2.4,2l-0.1,0l0,-1.9l-2.7,0l0,10.2l0.1,0zm11.7,0.1c-3.1,0 -5,-2 -5,-5.3c0,-3.3 2,-5.3 5,-5.3s5,2 5,5.3c0,3.4 -1.9,5.3 -5,5.3zm0,-2.1c1.4,0 2.2,-1.1 2.2,-3.2c0,-2 -0.8,-3.2 -2.2,-3.2c-1.4,0 -2.2,1.2 -2.2,3.2c0,2.1 0.8,3.2 2.2,3.2z" class="st0" id="Ant-Design-Pro"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 677 B

View File

@ -0,0 +1,49 @@
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using UserPointManagement.Application;
using UserPointManagement.Persistence;
using Xunit.DependencyInjection;
using Xunit.DependencyInjection.Logging;

namespace UserPointManagement.Tests
{
public class Startup
{
public void ConfigureHost(IHostBuilder hostBuilder)
{
hostBuilder
.ConfigureAppConfiguration(builder =>
{
// 注册配置
builder
.AddInMemoryCollection(new List<KeyValuePair<string, string>>
{
new ("Connection:UserPointManagement", "Server=67.230.184.225;Port=58007;UserId=postgres;Password=postgres;Database=tiamo;"),
}).Build();
})
.ConfigureServices((context, services) =>
{
// 注册自定义服务
services.AddDbContext<UserPointManagementDbContext>(option =>
{
option.UseNpgsql(context.Configuration["Connection:UserPointManagement"])
.UseSnakeCaseNamingConvention();
});

services.AddServices();
services.AddRepositories();
});
}

public void Configure(ILoggerFactory loggerFactory, ITestOutputHelperAccessor accessor)
{
using var provider = new XunitTestOutputLoggerProvider(accessor);
loggerFactory.AddProvider(provider);
}
}
}

View File

@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="Xunit.DependencyInjection" Version="8.5.0" />
<PackageReference Include="Xunit.DependencyInjection.Logging" Version="8.0.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\UserPointManagement.Web\UserPointManagement.Web.csproj" />
</ItemGroup>

</Project>