Compare commits
	
		
			No commits in common. "32ea7191ee6d37ebc709477b66ece449057147dc" and "bb1a33824cb2f39837465a041a5f199d46621b1e" have entirely different histories. 
		
	
	
		
			32ea7191ee
			...
			bb1a33824c
		
	
		|  | @ -2,5 +2,5 @@ | ||||||
| 
 | 
 | ||||||
| public class GetUserDto : PageBase | public class GetUserDto : PageBase | ||||||
| { | { | ||||||
|     public string? Keyword { get; set; } |     public string Keyword { get; set; } | ||||||
| } | } | ||||||
|  | @ -1,31 +0,0 @@ | ||||||
| using System.Threading.Tasks; |  | ||||||
| using Microsoft.AspNetCore.Mvc; |  | ||||||
| using UserPointManagement.Application.Services; |  | ||||||
| using UserPointManagement.Model; |  | ||||||
| using UserPointManagement.Model.Dtos.User; |  | ||||||
| using UserPointManagement.Model.Entities; |  | ||||||
| 
 |  | ||||||
| namespace UserPointManagement.Web.Controllers; |  | ||||||
| 
 |  | ||||||
| [ApiController] |  | ||||||
| [Route("[controller]")]
 |  | ||||||
| public class UserController : ControllerBase |  | ||||||
| { |  | ||||||
|     private readonly IUserService _userService; |  | ||||||
| 
 |  | ||||||
|     public UserController(IUserService userService) |  | ||||||
|     { |  | ||||||
|         _userService = userService; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     /// <summary> |  | ||||||
|     /// 获取用户 |  | ||||||
|     /// </summary> |  | ||||||
|     /// <param name="req"></param> |  | ||||||
|     /// <returns></returns> |  | ||||||
|     [HttpGet] |  | ||||||
|     public async Task<PageResultDto<User>> GetUsers([FromQuery]GetUserDto req) |  | ||||||
|     { |  | ||||||
|         return await _userService.GetUsers(req).ConfigureAwait(false); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  | @ -1,45 +0,0 @@ | ||||||
| using System.Linq; |  | ||||||
| using Microsoft.AspNetCore.Mvc; |  | ||||||
| using Microsoft.AspNetCore.Mvc.ApplicationModels; |  | ||||||
| using Microsoft.AspNetCore.Mvc.Routing; |  | ||||||
| 
 |  | ||||||
| namespace UserPointManagement.Web; |  | ||||||
| 
 |  | ||||||
| public static class MvcOptionsExtensions |  | ||||||
| { |  | ||||||
|     private static void UseGeneralRoutePrefix(this MvcOptions opts, IRouteTemplateProvider routeAttribute) |  | ||||||
|     { |  | ||||||
|         opts.Conventions.Add(new RoutePrefixConvention(routeAttribute)); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public static void UseGeneralRoutePrefix(this MvcOptions opts, string  |  | ||||||
|         prefix) |  | ||||||
|     { |  | ||||||
|         opts.UseGeneralRoutePrefix(new RouteAttribute(prefix)); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| public class RoutePrefixConvention : IApplicationModelConvention |  | ||||||
| { |  | ||||||
|     private readonly AttributeRouteModel _routePrefix; |  | ||||||
| 
 |  | ||||||
|     public RoutePrefixConvention(IRouteTemplateProvider route) |  | ||||||
|     { |  | ||||||
|         _routePrefix = new AttributeRouteModel(route); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void Apply(ApplicationModel application) |  | ||||||
|     { |  | ||||||
|         foreach (var selector in application.Controllers.SelectMany(c => c.Selectors)) |  | ||||||
|         { |  | ||||||
|             if (selector.AttributeRouteModel != null) |  | ||||||
|             { |  | ||||||
|                 selector.AttributeRouteModel = AttributeRouteModel.CombineAttributeRouteModel(_routePrefix, selector.AttributeRouteModel); |  | ||||||
|             } |  | ||||||
|             else |  | ||||||
|             { |  | ||||||
|                 selector.AttributeRouteModel = _routePrefix; |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  | @ -1,6 +1,4 @@ | ||||||
| using System; | using System; | ||||||
| using System.IO; |  | ||||||
| using System.Linq; |  | ||||||
| using System.Net.Http; | using System.Net.Http; | ||||||
| using AntDesign.ProLayout; | using AntDesign.ProLayout; | ||||||
| using Microsoft.AspNetCore.Builder; | using Microsoft.AspNetCore.Builder; | ||||||
|  | @ -28,20 +26,6 @@ namespace UserPointManagement.Web | ||||||
|         // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 |         // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 | ||||||
|         public void ConfigureServices(IServiceCollection services) |         public void ConfigureServices(IServiceCollection services) | ||||||
|         { |         { | ||||||
|             services.AddControllers(options => |  | ||||||
|             { |  | ||||||
|                 options.UseGeneralRoutePrefix("/api"); |  | ||||||
|             }); |  | ||||||
|             services.AddEndpointsApiExplorer(); |  | ||||||
|             services.AddSwaggerGen(options => |  | ||||||
|             { |  | ||||||
|                 Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.xml").ToList().ForEach(file => |  | ||||||
|                 { |  | ||||||
|                     options.IncludeXmlComments(file, true); |  | ||||||
|                 }); |  | ||||||
|             }); |  | ||||||
|             services.AddRouting(options => options.LowercaseUrls = true); |  | ||||||
|              |  | ||||||
|             services.AddRazorPages(); |             services.AddRazorPages(); | ||||||
|             services.AddServerSideBlazor(); |             services.AddServerSideBlazor(); | ||||||
|             services.AddAntDesign(); |             services.AddAntDesign(); | ||||||
|  | @ -62,7 +46,6 @@ namespace UserPointManagement.Web | ||||||
|              |              | ||||||
|             AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); |             AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); | ||||||
|             AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true); |             AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true); | ||||||
|              |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. |         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. | ||||||
|  | @ -71,16 +54,6 @@ namespace UserPointManagement.Web | ||||||
|             if (env.IsDevelopment()) |             if (env.IsDevelopment()) | ||||||
|             { |             { | ||||||
|                 app.UseDeveloperExceptionPage(); |                 app.UseDeveloperExceptionPage(); | ||||||
|                 app.UseSwagger(o => |  | ||||||
|                 { |  | ||||||
|                     // o.RouteTemplate = $"/api/swagger/{{documentName}}/swagger.json"; |  | ||||||
|                 }); |  | ||||||
|                 app.UseSwaggerUI(c => |  | ||||||
|                 { |  | ||||||
|                     // c.RoutePrefix = $"/api/swagger"; |  | ||||||
|                     // c.SwaggerEndpoint($"/api/swagger/v1/swagger.json", |  | ||||||
|                     //     "UserPointManagement.Api API V1"); |  | ||||||
|                 }); |  | ||||||
|             } |             } | ||||||
|             else |             else | ||||||
|             { |             { | ||||||
|  | @ -96,7 +69,6 @@ namespace UserPointManagement.Web | ||||||
| 
 | 
 | ||||||
|             app.UseEndpoints(endpoints => |             app.UseEndpoints(endpoints => | ||||||
|             { |             { | ||||||
|                 endpoints.MapControllers(); |  | ||||||
|                 endpoints.MapBlazorHub(); |                 endpoints.MapBlazorHub(); | ||||||
|                 endpoints.MapFallbackToPage("/_Host"); |                 endpoints.MapFallbackToPage("/_Host"); | ||||||
|             }); |             }); | ||||||
|  |  | ||||||
|  | @ -9,7 +9,6 @@ | ||||||
|     <PackageReference Include="AntDesign.Charts" Version="0.2.3" /> |     <PackageReference Include="AntDesign.Charts" Version="0.2.3" /> | ||||||
|     <PackageReference Include="AntDesign.ProLayout" Version="0.12.4" /> |     <PackageReference Include="AntDesign.ProLayout" Version="0.12.4" /> | ||||||
|     <PackageReference Include="System.Net.Http.Json" Version="6.0.0" /> |     <PackageReference Include="System.Net.Http.Json" Version="6.0.0" /> | ||||||
|     <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" /> |  | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
| 
 | 
 | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue