update 去除了开发模式下的缓存

This commit is contained in:
2021-05-26 17:27:31 +08:00
parent c833d4a1f4
commit 249007c237
6 changed files with 32 additions and 1 deletions

View File

@@ -35,7 +35,10 @@ namespace Ewide.Core.Service.Area
CheckCode(input);
CheckArea(input);
await _areaCodeRep.InsertNowAsync(input.Adapt<SysAreaCode>());
#if DEBUG
#else
await _sysCacheService.SetAreaCode(await _areaCodeRep.DetachedEntities.ToListAsync());
#endif
}
/// <summary>
/// 删除一个区域
@@ -50,7 +53,10 @@ namespace Ewide.Core.Service.Area
throw Oops.Oh("不能删除已包含区域的组织");
}
await AreaCode.DeleteNowAsync();
#if DEBUG
#else
await _sysCacheService.SetAreaCode(await _areaCodeRep.DetachedEntities.ToListAsync());
#endif
}
/// <summary>
/// 根据区域代码获取区域信息
@@ -63,7 +69,10 @@ namespace Ewide.Core.Service.Area
if (cachedAreaCodes == null || cachedAreaCodes.Count < 0)
{
cachedAreaCodes = await _areaCodeRep.DetachedEntities.ToListAsync();
#if DEBUG
#else
await _sysCacheService.SetAreaCode(cachedAreaCodes);
#endif
}
return cachedAreaCodes.FirstOrDefault(a => a.Code == code);
}
@@ -78,7 +87,10 @@ namespace Ewide.Core.Service.Area
if (cachedAreaCodes == null || cachedAreaCodes.Count < 0)
{
cachedAreaCodes = await _areaCodeRep.DetachedEntities.ToListAsync();
#if DEBUG
#else
await _sysCacheService.SetAreaCode(cachedAreaCodes);
#endif
}
cachedAreaCodes = cachedAreaCodes.Where(p => p.LevelType <= level).ToList();
return new TreeBuildUtil<AreaTreeNode>().DoTreeBuild(cachedAreaCodes.Select(u => new AreaTreeNode
@@ -120,7 +132,10 @@ namespace Ewide.Core.Service.Area
CheckArea(input);
var area = input.Adapt<SysAreaCode>();
await area.UpdateNowAsync();
#if DEBUG
#else
await _sysCacheService.SetAreaCode(await _areaCodeRep.DetachedEntities.ToListAsync());
#endif
}
private bool CheckInput(AreaCodeInput input)
{

View File

@@ -129,7 +129,10 @@ namespace Ewide.Core.Service
{
var config = await _sysConfigRep.DetachedEntities.FirstOrDefaultAsync(u => u.Code == code);
value = config != null ? config.Value : "";
#if DEBUG
#else
await _sysCacheService.SetAsync(code, value);
#endif
}
return value;
}
@@ -142,7 +145,10 @@ namespace Ewide.Core.Service
/// <returns></returns>
public async Task UpdateConfigCache(string code, object value)
{
#if DEBUG
#else
await _sysCacheService.SetAsync(code, value);
#endif
}
/// <summary>

View File

@@ -56,7 +56,10 @@ namespace Ewide.Core.Service
.Where(u => u.Type == (int)MenuType.BTN)
.Where(u => u.Status == (int)CommonStatus.ENABLE)
.Select(u => u.Permission).ToListAsync();
#if DEBUG
#else
await _sysCacheService.SetPermission(userId, permissions); // 缓存结果
#endif
}
return permissions;
}

View File

@@ -90,9 +90,12 @@ namespace Ewide.Core.Service
var parentAndChildIdListWithSelf = sysOrg.Pids.TrimEnd(',').Replace("[", "").Replace("]", "")
.Split(",").ToList();
dataScopeList.AddRange(parentAndChildIdListWithSelf);
// 添加本级(不知道为什么框架在这里排除了本级)
dataScopeList.Add(u);
});
}
return dataScopeList;
return dataScopeList.Distinct().ToList();
}
/// <summary>

View File

@@ -395,7 +395,10 @@ namespace Ewide.Core.Service
dataScopes = userDataScopeIdListForUser.Concat(userDataScopeIdListForRole).Distinct().ToList(); // 并集
#if DEBUG
#else
await _sysCacheService.SetDataScope(userId, dataScopes); // 缓存结果
#endif
}
return dataScopes;
}

View File

@@ -84,6 +84,7 @@
"getLoginUser",
"logout",
"sysDictType:dropDown",
"sysDictType:dropDowns",
"sysFileInfo:upload",
"sysFileInfo:download",
"sysFileInfo:preview",