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 platformSDKBusinessList; public ProductBusiness(IEnumerable 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>(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 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>>(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); } } }