| | |
| | | using CoreCms.Net.IRepository.UnitOfWork; |
| | | using 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; |
| | |
| | | |
| | | 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) |
| | | { |
| | | var ListData= await _unitOfWork.GetDbClient().Queryable<CoreCmsUser>().Where(x => x.isDelete == false).Select(x => new SearchUserData |
| | | { |
| | | Id = x.id, |
| | | name = x.mobile + "|" + x.userName + "|" + x.nickName, |
| | | name = x.mobile /*+ "|" + x.userName*/ + "|" + x.nickName, |
| | | |
| | | }).WithCache(50).ToListAsync(); |
| | | if (string.IsNullOrEmpty(s)) |
| | |
| | | } |
| | | 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; |
| | | |
| | | } |
| | | |
| | | public async Task<List<CoreCmsGoodsCategory>> GetGoodsCategory() |
| | | { |
| | | return await _unitOfWork.GetDbClient().Queryable<CoreCmsGoodsCategory>().Where(x=>x.isShow==true).WithCache(10).ToTreeAsync(x=>x.children, x=>x.parentId,0); |
| | | } |
| | | |
| | | |
| | | public decimal CommandCustomizable(int count) |
| | | { |
| | | if (count > 9999) |
| | | return 0; |
| | | return count * 1; |
| | | } |
| | | } |
| | | } |