/// <summary>
        /// 根据订单ID获取订单信息
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        private static async Task <OrderModel> FetchOrderInfoByID(int orderId)
        {
            OrderModel order = null;

            try
            {
                using (var orderClient = new OrderQueryClient())
                {
                    var fetchResult = await orderClient.FetchOrderInfoByIDAsync(orderId);

                    fetchResult.ThrowIfException(true);

                    if (fetchResult.Success)
                    {
                        order = fetchResult.Result;
                    }
                    else
                    {
                        Logger.Warn($"OrderQueryClient.FetchOrderInfoByIDAsync {orderId} 订单详情接口查询失败");
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error($"FetchOrderInfoByID 接口异常;异常信息:{ex.Message};堆栈信息:{ex.StackTrace}", ex);
            }
            return(order);
        }
Пример #2
0
        /// <summary>
        /// 获取订单信息(订单主信息和产品)
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public static async Task <OrderModel> FetchOrderInfoByID(int orderId)
        {
            OrderModel order = null;

            try
            {
                using (var orderClient = new OrderQueryClient())
                {
                    var fetchResult = await orderClient.FetchOrderInfoByIDAsync(orderId);

                    fetchResult.ThrowIfException(true);
                    order = fetchResult.Success ? fetchResult.Result : null;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("FetchOrderInfoByID 接口异常", ex);
            }
            return(order);
        }