Browse Source

短信

master
DESKTOP-G961P6V\Zhh 1 year ago
parent
commit
a73fe7682b
  1. 11
      src/Shentun.WebPeis.Application/Persons/PersonAppService.cs
  2. 1
      src/Shentun.WebPeis.Application/Shentun.WebPeis.Application.csproj
  3. 11
      src/Shentun.WebPeis.Application/WebPeisApplicationModule.cs
  4. 4
      src/Shentun.WebPeis.HttpApi.Host/appsettings.json

11
src/Shentun.WebPeis.Application/Persons/PersonAppService.cs

@ -71,7 +71,7 @@ namespace Shentun.WebPeis.Persons
IRepository<PatientRegister> patientRegisterRepository, IRepository<PatientRegister> patientRegisterRepository,
IRepository<Patient> patientRepository, IRepository<Patient> patientRepository,
CacheService cacheService, CacheService cacheService,
//IHttpContextAccessor httpContextAccessor,
IHttpContextAccessor httpContextAccessor,
IRepository<CustomerOrg> customerOrgRepository) IRepository<CustomerOrg> customerOrgRepository)
{ {
_repository = repository; _repository = repository;
@ -85,7 +85,7 @@ namespace Shentun.WebPeis.Persons
_patientRegisterRepository = patientRegisterRepository; _patientRegisterRepository = patientRegisterRepository;
_patientRepository = patientRepository; _patientRepository = patientRepository;
_cacheService = cacheService; _cacheService = cacheService;
//_httpContextAccessor = httpContextAccessor;
_httpContextAccessor = httpContextAccessor;
_customerOrgRepository = customerOrgRepository; _customerOrgRepository = customerOrgRepository;
} }
@ -130,11 +130,14 @@ namespace Shentun.WebPeis.Persons
var dicStr = dic.Select(m => m.Key + "=" + m.Value).DefaultIfEmpty().Aggregate((m, n) => m + "&" + n); var dicStr = dic.Select(m => m.Key + "=" + m.Value).DefaultIfEmpty().Aggregate((m, n) => m + "&" + n);
var token = await GetTokenAsync(dicStr); var token = await GetTokenAsync(dicStr);
var options = new DistributedCacheEntryOptions()
.SetAbsoluteExpiration(TimeSpan.FromDays(3));
var sessionKey = CacheKeys.SessionKey + Guid.NewGuid().ToString(); var sessionKey = CacheKeys.SessionKey + Guid.NewGuid().ToString();
var sessionKeyValue = Guid.NewGuid().ToString(); var sessionKeyValue = Guid.NewGuid().ToString();
_cache.Set(sessionKey, sessionKeyValue);
_cache.Set(sessionKey, sessionKeyValue, options);
token.SessionKey = sessionKey; token.SessionKey = sessionKey;
token.SessionKeyValue = sessionKeyValue; token.SessionKeyValue = sessionKeyValue;
return token; return token;
} }
@ -517,7 +520,7 @@ namespace Shentun.WebPeis.Persons
OpenId = wechatUserDto.OpenId OpenId = wechatUserDto.OpenId
}; };
var options = new DistributedCacheEntryOptions() var options = new DistributedCacheEntryOptions()
.SetAbsoluteExpiration(TimeSpan.FromMinutes(720));
.SetAbsoluteExpiration(TimeSpan.FromDays(3));
_cache.Set(CacheKeys.OpenIdKey + wechatUserDto.OpenId, _cache.Set(CacheKeys.OpenIdKey + wechatUserDto.OpenId,
wechatUserDto.OpenId, options); wechatUserDto.OpenId, options);

1
src/Shentun.WebPeis.Application/Shentun.WebPeis.Application.csproj

@ -21,6 +21,7 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.6.0" /> <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.6.0" />
<PackageReference Include="Volo.Abp.Account.Application" Version="8.1.3" /> <PackageReference Include="Volo.Abp.Account.Application" Version="8.1.3" />
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="8.1.3" />
<PackageReference Include="Volo.Abp.Identity.Application" Version="8.1.3" /> <PackageReference Include="Volo.Abp.Identity.Application" Version="8.1.3" />
<PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="8.1.3" /> <PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="8.1.3" />
<PackageReference Include="Volo.Abp.TenantManagement.Application" Version="8.1.3" /> <PackageReference Include="Volo.Abp.TenantManagement.Application" Version="8.1.3" />

11
src/Shentun.WebPeis.Application/WebPeisApplicationModule.cs

@ -3,6 +3,8 @@ using Shentun.Peis.OrganizationUnits;
using Shentun.WebPeis.Users; using Shentun.WebPeis.Users;
using Volo.Abp.Account; using Volo.Abp.Account;
using Volo.Abp.AutoMapper; using Volo.Abp.AutoMapper;
using Volo.Abp.Caching;
using Volo.Abp.Caching.StackExchangeRedis;
using Volo.Abp.FeatureManagement; using Volo.Abp.FeatureManagement;
using Volo.Abp.Identity; using Volo.Abp.Identity;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
@ -20,7 +22,8 @@ namespace Shentun.WebPeis;
typeof(AbpPermissionManagementApplicationModule), typeof(AbpPermissionManagementApplicationModule),
typeof(AbpTenantManagementApplicationModule), typeof(AbpTenantManagementApplicationModule),
typeof(AbpFeatureManagementApplicationModule), typeof(AbpFeatureManagementApplicationModule),
typeof(AbpSettingManagementApplicationModule)
typeof(AbpSettingManagementApplicationModule),
typeof(AbpCachingStackExchangeRedisModule)
)] )]
public class WebPeisApplicationModule : AbpModule public class WebPeisApplicationModule : AbpModule
{ {
@ -32,5 +35,11 @@ public class WebPeisApplicationModule : AbpModule
}); });
context.Services.AddTransient<OrganizationUnitsAppService>(); context.Services.AddTransient<OrganizationUnitsAppService>();
context.Services.AddTransient<UserAppService>(); context.Services.AddTransient<UserAppService>();
Configure<AbpDistributedCacheOptions>(options =>
{
options.KeyPrefix = "WebPeis";
options.HideErrors = false;
});
} }
} }

4
src/Shentun.WebPeis.HttpApi.Host/appsettings.json

@ -55,5 +55,9 @@
"VerifySmsTypeId": "3a12e09d-438a-1d08-d4f0-712aef13708d", "VerifySmsTypeId": "3a12e09d-438a-1d08-d4f0-712aef13708d",
"VerifySmsValidTime": "1", "VerifySmsValidTime": "1",
"SmsAppId": "3a12e09f-8534-ec43-8c46-e61af0964ab6" "SmsAppId": "3a12e09f-8534-ec43-8c46-e61af0964ab6"
},
"Redis": {
"IsEnabled": "true",
"Configuration": "127.0.0.1"
} }
} }
Loading…
Cancel
Save