60 lines
1.7 KiB
C#
60 lines
1.7 KiB
C#
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(得到商品的明细)
|
|
/// <summary>
|
|
/// 得到商品的明细
|
|
/// </summary>
|
|
/// <param name="skuId"></param>
|
|
/// <returns></returns>
|
|
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信息)
|
|
/// <summary>
|
|
/// 得到缓存的SKU信息
|
|
/// </summary>
|
|
/// <param name="skuId"></param>
|
|
/// <returns></returns>
|
|
public LxmSimpleGoodsResp GetCacheLxmSimpleGoodsResp(Guid skuId)
|
|
{
|
|
return CacheHelper.GetCacheValue<LxmSimpleGoodsResp>(
|
|
|
|
$"GetLxmSimpleGoodsResp-{skuId}",
|
|
() => { return GetLxmSimpleGoodsResp(skuId); },
|
|
3600
|
|
);
|
|
}
|
|
#endregion
|
|
}
|
|
}
|