You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.8 KiB
54 lines
1.8 KiB
using Znyc.CloudCar.IRepository.Recharge;
|
|
using Znyc.CloudCar.IServices.CaChe;
|
|
using Znyc.CloudCar.IServices.Recharge;
|
|
using Znyc.CloudCar.Model.Dtos.Recharge;
|
|
using Znyc.CloudCar.Model.ViewModels.ReportsCallBack;
|
|
using Znyc.CloudCar.Utility.Extensions;
|
|
|
|
namespace Znyc.CloudCar.Services.Recharge
|
|
{
|
|
/// <summary>
|
|
/// 充值活动服务
|
|
/// </summary>
|
|
public class RechargeService : IRechargeService
|
|
{
|
|
private readonly IRechargeRepository _rechargeRepository;
|
|
private readonly IRechargeIntroRepository _rechargeIntroRepository;
|
|
private readonly ICacheService _cacheService;
|
|
|
|
|
|
public RechargeService(
|
|
IRechargeRepository rechargeRepository,
|
|
IRechargeIntroRepository rechargeIntroRepository,
|
|
ICacheService cacheService
|
|
)
|
|
{
|
|
_rechargeRepository = rechargeRepository;
|
|
_rechargeIntroRepository = rechargeIntroRepository;
|
|
_cacheService = cacheService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询充值活动详情
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async Task<ResponseOutput> GetAsync()
|
|
{
|
|
RechargeOutput Rrecharge = await _cacheService.GetRechargeAsync();
|
|
if (Rrecharge.IsNull())
|
|
{
|
|
Rrecharge = await _rechargeRepository.Select.Where(x => x.State == 1).FirstAsync<RechargeOutput>();
|
|
|
|
Rrecharge.introOutputs = await _rechargeIntroRepository.Select.Where(x => x.ParentId == Rrecharge.Id)
|
|
.ToListAsync<RechargeIntroOutput>();
|
|
await _cacheService.SetRechargeAsync(Rrecharge);
|
|
}
|
|
return new ResponseOutput()
|
|
{
|
|
Data = Rrecharge,
|
|
Successed = true,
|
|
Code = 1
|
|
};
|
|
}
|
|
}
|
|
}
|
|
|