using SJZY.Expand.ABP.Core.Localization; using SJZY.InterfaceRelay.Application.Contracts; using SJZY.Track.Application.Contract; using SJZY.Track.Application.Localization; using SJZY.UserCenter.Contracts; using SJZY.UserCenter.SharedModel; using SJZY.UserCenter.SharedModel.Pub; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AutoMapper; using Volo.Abp.FluentValidation; using Volo.Abp.Http.Client; using Volo.Abp.Localization; using Volo.Abp.Modularity; using Volo.Abp.VirtualFileSystem; namespace SJZY.Track.Application { [DependsOn( typeof(AbpAutoMapperModule), typeof(AbpFluentValidationModule), typeof(AbpLocalizationModule), typeof(AbpVirtualFileSystemModule), typeof(AbpHttpClientModule), typeof(SjzyUserCenterHttpApiModule), typeof(SJZYInterfaceRelayApplicationContractsModule), typeof(SjzyTrackDomainModule), typeof(SjzyTrackApplicationContractModule) )] public class SjzyTrackApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { var configuration = context.Services.GetConfiguration(); Configure(options => { options.AddMaps(true); }); Configure(options => { options.ConventionalControllers.Create(typeof(SjzyTrackApplicationModule).Assembly); //创建动态api }); //添加虚拟文件系统 Configure(options => { options.FileSets.AddEmbedded("SJZY.Track.Application"); }); //添加多语言 Configure(options => { options.Resources .Add("zh") .AddBaseTypes(typeof(SjzyBasicLocalization)) .AddVirtualJson("/Localization/Resources"); }); //授权拦截提示 context.Services.Configure(options => { options.Filters.Add(new ApiAsyncAuthorizationFilter()); }); //用户中心 context.Services.AddHttpClientProxies(typeof(SjzyUserCenterHttpApiModule).Assembly, "UserCenter", false); context.Services.AddHttpClient("InterfaceForward").AddHttpMessageHandler(); context.Services.AddHttpClientProxy( remoteServiceConfigurationName: "InterfaceForward", asDefaultService: false ); } public override void PreConfigureServices(ServiceConfigurationContext context) { var configuration = context.Services.GetConfiguration(); PreConfigure(options => { options.ProxyClientActions.Add(async (remoteName, serviceProvider, httpClient) => { //如果设置Token,前端需要传入Token 否则引发异常 httpClient.SetTokenHeader(); httpClient.Timeout = TimeSpan.FromMinutes(3); await Task.CompletedTask; }); }); } } }