General.Services/SystemStartUp/SystemStartUpService.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using General.Core.Common.OAuth.WeChat;
using General.Core.Config;
using General.Core.Data;
using General.Entities.Models;
using General.Services.Authority;
using General.Services.Role;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace General.Services.SystemStartUp
{
public class SystemStartUpService : ISystemStartUpService
{
private readonly IMemoryCache memoryCache;
private readonly IRepository<tc_sysconfig> tc_SysconfigRepository;
private readonly IRoleService roleService;
private readonly IAuthorityService authorityService;
public SystemStartUpService(IMemoryCache memoryCache,
IRepository<tc_sysconfig> tc_sysconfigRepository,
IRoleService roleService,
IAuthorityService authorityService)
{
this.memoryCache = memoryCache;
tc_SysconfigRepository = tc_sysconfigRepository;
this.roleService = roleService;
this.authorityService = authorityService;
}
/// <summary>
/// 应用启动获取基础配置
/// </summary>
/// <returns></returns>
public async Task InitializationConfiguration()
{
await GetWebSiteConfig();
//获取角色数据
await roleService.GetDataWriteMemory();
await authorityService.GetDataWriteMemory();
}
/// <summary>
/// 获取网站配置
/// </summary>
/// <returns></returns>
public async Task GetWebSiteConfig()
{
var siteConfigResult = await tc_SysconfigRepository.GetAllAsync(x=>x.code.StartsWith(GobalConfig.SYSTEM_CONFIG_STRING) || x.code.StartsWith(GobalConfig.SYSTEM_MAIL_STRING) || x.code.StartsWith(GobalConfig.SYSTEM_SEO_STRING)).ToListAsync();
foreach (var item in siteConfigResult)
{
memoryCache.Set(item.code,item.value);
后面还有 59 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
