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

43 lines
2.4 KiB

2 years ago
using BBWY.Common.Models;
3 years ago
using BBWY.Server.Model.Dto;
using System.Collections.Generic;
2 years ago
using System.Linq;
3 years ago
namespace BBWY.Server.Business
{
2 years ago
public class ProductBusiness : IDenpendency
3 years ago
{
2 years ago
private IEnumerable<PlatformSDKBusiness> platformSDKBusinessList;
public ProductBusiness(IEnumerable<PlatformSDKBusiness> platformSDKBusinessList)
3 years ago
{
2 years ago
this.platformSDKBusinessList = platformSDKBusinessList;
3 years ago
}
public ProductListResponse GetProductList(SearchProductRequest searchProductRequest)
{
2 years ago
//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);
3 years ago
}
public IList<ProductSkuResponse> GetProductSkuList(SearchProductSkuRequest searchProductSkuRequest)
{
2 years ago
//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);
3 years ago
}
}
}