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 GoodsBLL { private readonly LxmInfraRepository _lxmInfraRepository; public GoodsBLL(LxmInfraRepository lxmInfraRepository) { _lxmInfraRepository = lxmInfraRepository; } #region GetLxmSimpleGoodsResp(得到商品的明细) /// /// 得到商品的明细 /// /// /// private LxmSimpleGoodsResp GetLxmSimpleGoodsResp(Guid skuId) { var goodsInfo = _lxmInfraRepository.GetGoodsInfo(skuId); if (goodsInfo == null) { return new LxmSimpleGoodsResp() { Name = "商品" }; } return new LxmSimpleGoodsResp() { Name = goodsInfo.Name, TopCategoryId = goodsInfo.TopCategoryId }; } #endregion #region GetCacheLxmSimpleGoodsResp(得到缓存的SKU信息) /// /// 得到缓存的SKU信息 /// /// /// public LxmSimpleGoodsResp GetCacheLxmSimpleGoodsResp(Guid skuId) { return CacheHelper.GetCacheValue( $"GetLxmSimpleGoodsResp-{skuId}", () => { return GetLxmSimpleGoodsResp(skuId); }, 3600 ); } #endregion } }