diff --git a/Apimanager_backend/Apimanager_backend.csproj b/Apimanager_backend/Apimanager_backend.csproj
index ce65827..533afb7 100644
--- a/Apimanager_backend/Apimanager_backend.csproj
+++ b/Apimanager_backend/Apimanager_backend.csproj
@@ -7,6 +7,7 @@
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -15,11 +16,4 @@
-
-
-
-
-
-
-
diff --git a/Apimanager_backend/Config/MyAutomapper.cs b/Apimanager_backend/Config/MyAutomapper.cs
new file mode 100644
index 0000000..159ff8c
--- /dev/null
+++ b/Apimanager_backend/Config/MyAutomapper.cs
@@ -0,0 +1,14 @@
+using Apimanager_backend.Dtos;
+using Apimanager_backend.Models;
+using AutoMapper;
+
+namespace Apimanager_backend.Config
+{
+ public class MyAutomapper:Profile
+ {
+ public MyAutomapper()
+ {
+ CreateMap();
+ }
+ }
+}
diff --git a/Apimanager_backend/Config/ServiceCollectionExtensions.cs b/Apimanager_backend/Config/ServiceCollectionExtensions.cs
new file mode 100644
index 0000000..28a5528
--- /dev/null
+++ b/Apimanager_backend/Config/ServiceCollectionExtensions.cs
@@ -0,0 +1,15 @@
+using Apimanager_backend.Services;
+using System.Runtime.CompilerServices;
+
+namespace Apimanager_backend.Config
+{
+ public static class ServiceCollectionExtensions
+ {
+ public static IServiceCollection AddAllService(this IServiceCollection services,IConfiguration configuration)
+ {
+ services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
+ services.AddScoped();
+ return services;
+ }
+ }
+}
diff --git a/Apimanager_backend/Controllers/UserController.cs b/Apimanager_backend/Controllers/UserController.cs
new file mode 100644
index 0000000..279a954
--- /dev/null
+++ b/Apimanager_backend/Controllers/UserController.cs
@@ -0,0 +1,53 @@
+using Apimanager_backend.Dtos;
+using Apimanager_backend.Exceptions;
+using Apimanager_backend.Services;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Apimanager_backend.Filters;
+
+namespace Apimanager_backend.Controllers
+{
+ [ModelValidationFilter()]
+ [Route("api/[controller]")]
+ [ApiController]
+ public class UserController : ControllerBase
+ {
+ private readonly IUserService userService;
+ public UserController(IUserService userService)
+ {
+ this.userService = userService;
+ }
+ ///
+ /// 用户登录控制器
+ ///
+ /// 登录信息
+ /// 通用返回信息格式
+ [HttpPost("Login")]
+ public async Task>> Login([FromBody]UserLoginDto dto)
+ {
+ try
+ {
+ UserInfoDto user = await userService.LoginAsync(dto.UserName, dto.Password);
+
+ var responseInfo = new ResponseBase(
+ code: 2000,
+ message: "Login successful",
+ data: user
+ );
+ return Ok(responseInfo);
+ }
+ catch (BaseException e)
+ {
+
+ //错误时,构建错误信息对象
+ var responseInfo = new ResponseBase