From 5f4384bdab4697cc0a678fb17e55603a91a4750b Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期五, 12 四月 2024 08:44:54 +0800 Subject: [PATCH] Merge branch 'master' of http://47.108.235.38:8080/r/baifenbaishop --- CoreCms.Net.Services/baifenbingfa/BfbfComAPIService.cs | 26 +++++++++++++++++++++++--- 1 files changed, 23 insertions(+), 3 deletions(-) diff --git a/CoreCms.Net.Services/baifenbingfa/BfbfComAPIService.cs b/CoreCms.Net.Services/baifenbingfa/BfbfComAPIService.cs index e02d672..ff01659 100644 --- a/CoreCms.Net.Services/baifenbingfa/BfbfComAPIService.cs +++ b/CoreCms.Net.Services/baifenbingfa/BfbfComAPIService.cs @@ -1,7 +1,9 @@ -锘縰sing CoreCms.Net.IRepository.UnitOfWork; +锘縰sing CoreCms.Net.Configuration; +using CoreCms.Net.IRepository.UnitOfWork; using CoreCms.Net.IServices; using CoreCms.Net.IServices.baifenbingfa; using CoreCms.Net.Model.Entities; +using CoreCms.Net.Utility.Helper; using System; using System.Collections.Generic; using System.Linq; @@ -18,11 +20,12 @@ private readonly ICoreCmsUserServices _userServices; private readonly IUnitOfWork _unitOfWork; - - public BfbfComAPIService(ICoreCmsUserServices userServices,IUnitOfWork unitOfWork) + private readonly ICoreCmsSettingServices _coreCmsSettingServices; + public BfbfComAPIService(ICoreCmsUserServices userServices,IUnitOfWork unitOfWork, ICoreCmsSettingServices coreCmsSettingServices) { _userServices = userServices; _unitOfWork = unitOfWork; + _coreCmsSettingServices = coreCmsSettingServices; } public async Task<List<SearchUserData>> SearchUserData(string s) { @@ -38,5 +41,22 @@ } return ListData.Where(x => x.name.Contains(s)).ToList(); } + + public async Task<bool> IsDictionary(int UserId) + { + if (UserId == 0) + return false; + var user=await _unitOfWork.GetDbClient().Queryable<CoreCmsUser>().Includes(x=>x.gradeInfo).Where(x=>x.id== UserId).WithCache(10).SingleAsync(); + if (user == null) + return false; + if(user.gradeInfo==null) + return false; + var allConfigs = await _coreCmsSettingServices.GetConfigDictionaries(); + var kc = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.DictionaryUserGroupKey); + if (user.gradeInfo.valueKey == kc) + return true; + return false; + + } } } -- Gitblit v1.9.1