步步为盈
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.

42 lines
2.4 KiB

using BBWY.Common.Models;
using BBWY.Server.Model.Dto;
using System.Collections.Generic;
using System.Linq;
namespace BBWY.Server.Business
{
public class ProductBusiness : IDenpendency
{
private IEnumerable<PlatformSDKBusiness> platformSDKBusinessList;
public ProductBusiness(IEnumerable<PlatformSDKBusiness> platformSDKBusinessList)
{
this.platformSDKBusinessList = platformSDKBusinessList;
}
public ProductListResponse GetProductList(SearchProductRequest searchProductRequest)
{
//var relayAPIHost = GetPlatformRelayAPIHost(searchProductRequest.Platform);
//var sendResult = restApiService.SendRequest(relayAPIHost, "api/PlatformSDK/GetProductList", searchProductRequest, GetYunDingRequestHeader(), HttpMethod.Post);
//if (sendResult.StatusCode != System.Net.HttpStatusCode.OK)
// throw new BusinessException(sendResult.Content) { Code = (int)sendResult.StatusCode };
//var response = JsonConvert.DeserializeObject<ApiResponse<ProductListResponse>>(sendResult.Content);
//if (!response.Success)
// throw new BusinessException(response.Msg) { Code = response.Code };
//return response.Data;
return platformSDKBusinessList.FirstOrDefault(p => p.Platform == searchProductRequest.Platform).GetProductList(searchProductRequest);
}
public IList<ProductSkuResponse> GetProductSkuList(SearchProductSkuRequest searchProductSkuRequest)
{
//var relayAPIHost = GetPlatformRelayAPIHost(searchProductSkuRequest.Platform);
//var sendResult = restApiService.SendRequest(relayAPIHost, "api/PlatformSDK/GetProductSkuList", searchProductSkuRequest, GetYunDingRequestHeader(), HttpMethod.Post);
//if (sendResult.StatusCode != System.Net.HttpStatusCode.OK)
// throw new BusinessException(sendResult.Content) { Code = (int)sendResult.StatusCode };
//var response = JsonConvert.DeserializeObject<ApiResponse<IList<ProductSkuResponse>>>(sendResult.Content);
//if (!response.Success)
// throw new BusinessException(response.Msg) { Code = response.Code };
//return response.Data;
return platformSDKBusinessList.FirstOrDefault(p => p.Platform == searchProductSkuRequest.Platform).GetProductSkuList(searchProductSkuRequest);
}
}
}