Exemplo n.º 1
0
        /// <summary>获得淘宝商品的价格</summary>
        /// <param name="itemId">商品编号</param>
        /// <returns>价格和名称</returns>
        public static async Task <ItemPriceModel> GetTabaoPrice(string itemId)
        {
            IHttpProxyClient client = null;

            try
            {
                client = new HttpProxyClient();

                var result = await client.GetTaobaoPriceAsync(itemId);

                result.ThrowIfException(true);

                return(result.Result);
            }
            catch (Exception ex)
            {
                //Logger.Error(new LogModel { Message = "下载商品信息失败", RefNo = itemId }, ex);
                Logger.Info(new LogModel {
                    Message = ex.Message, RefNo = itemId
                });
                return(null);
            }
            finally
            {
                client?.Dispose();
            }
        }