64 lines
2.2 KiB
C#
64 lines
2.2 KiB
C#
//namespace Atomx.Data.CacheServices
|
|
//{
|
|
// public partial interface ICacheService
|
|
// {
|
|
// /// <summary>
|
|
// /// 获取代理信息
|
|
// /// </summary>
|
|
// /// <param name="id"></param>
|
|
// /// <param name="reload"></param>
|
|
// /// <returns></returns>
|
|
// Task<Agency> GetAgencyById(long id, bool? reload = null);
|
|
|
|
// /// <summary>
|
|
// /// 获取代理的客服信息
|
|
// /// </summary>
|
|
// /// <param name="agencyId"></param>
|
|
// /// <param name="reload"></param>
|
|
// /// <returns></returns>
|
|
// Task<List<CustomerService>> GetCustomerServices(long agencyId, bool? reload = null);
|
|
// }
|
|
// public partial class CacheService : ICacheService
|
|
// {
|
|
// /// <summary>
|
|
// /// 获取代理信息
|
|
// /// </summary>
|
|
// /// <param name="id"></param>
|
|
// /// <param name="reload"></param>
|
|
// /// <returns></returns>
|
|
// public async Task<Agency> GetAgencyById(long id, bool? reload = null)
|
|
// {
|
|
// var cacheData = await GetCacheAsync<Agency>($"{CacheKeys.AgencyPrefix}{id}");
|
|
|
|
// if (cacheData == null || reload.HasValue)
|
|
// {
|
|
// var data = _dbContext.Agencies.SingleOrDefault(p => p.Id == id);
|
|
// if (data != null)
|
|
// {
|
|
// cacheData = data;
|
|
// await SetCacheAsync($"{CacheKeys.AgencyPrefix}{id}", cacheData);
|
|
// }
|
|
// }
|
|
|
|
// return cacheData;
|
|
// }
|
|
|
|
// public async Task<List<CustomerService>> GetCustomerServices(long agencyId, bool? reload = null)
|
|
// {
|
|
// var cacheData = await GetCacheAsync<List<CustomerService>>($"{CacheKeys.CustomerServicePrefix}{agencyId}");
|
|
|
|
// if (cacheData == null || reload.HasValue)
|
|
// {
|
|
// var data = _dbContext.CustomerServices.Where(p => p.Enabled && p.AgencyId == agencyId).ToList();
|
|
// if (data != null)
|
|
// {
|
|
// cacheData = data;
|
|
// await SetCacheAsync($"{CacheKeys.CustomerServicePrefix}{agencyId}", cacheData);
|
|
// }
|
|
// }
|
|
|
|
// return cacheData;
|
|
// }
|
|
// }
|
|
//}
|