using MyCode.Project.Domain.Message.Response.Lxm;
using MyCode.Project.Infrastructure.Common;
using MyCode.Project.Repositories.Lxm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyCode.Project.Services.BLL
{
///
/// 卡券
///
public class CardBLL
{
#region 初始化
private readonly LxmInfraRepository _lxmInfraRepository;
public CardBLL(LxmInfraRepository lxmInfraRepository)
{
_lxmInfraRepository = lxmInfraRepository;
}
#endregion
#region GetLxmServiceResp(得到流行美服务)
///
/// 得到服务的明细
///
///
///
private LxmCardResp GetLxmCardResp(Guid cardId)
{
var cardInfo = _lxmInfraRepository.GetCard(cardId);
if (cardInfo == null)
{
return new LxmCardResp()
{
Name = "卡券"
};
}
return new LxmCardResp() { Name = cardInfo.Name };
}
#endregion
#region GetCacheLxmCardResp(得到缓存的卡券信息)
///
/// 得到缓存的卡券信息
///
///
///
public LxmCardResp GetCacheLxmCardResp(Guid cardId)
{
return CacheHelper.GetCacheValue(
$"GetLxmCardResp-{cardId}",
() => { return GetLxmCardResp(cardId); },
3600
);
}
#endregion
}
}