예제 #1
0
        /// <summary>
        /// 获取当前批次相关信息及对应套餐配置
        /// </summary>
        /// <param name="batchCode"></param>
        /// <returns></returns>
        public VipPaintPackageConfigForDetail GetPromotionConfigForDetail(string batchCode)
        {
            var result = null as VipPaintPackageConfigForDetail;

            try
            {
                result = dbScopeManagerConfigurationRead.Execute(conn =>
                                                                 DalVipPaintPackage.GetPackageConfigByBatchCode(conn, batchCode));
                if (result != null)
                {
                    using (var client = new PromotionClient())
                    {
                        var clientResult = client.GetCouponRule(result.RuleGUID);
                        clientResult.ThrowIfException(true);
                        if (clientResult.Result != null)
                        {
                            result.RuleId        = clientResult.Result.RuleID;
                            result.PromotionName = clientResult.Result.PromotionName;
                            result.Description   = clientResult.Result.Description;
                        }
                    }
                    result.VipUserName = new VipBaoYangPackageManager().GetAllBaoYangPackageUser()
                                         ?.FirstOrDefault(s => string.Equals(s.VipUserId, result.VipUserId.ToString()))?.VipUserName;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("GetPromotionConfigForDetail", ex);
            }
            return(result);
        }
 public static LotteryCouponModel GetCouponDetail(Guid couponId, string productGroupId = "")
 {
     using (var client = new PromotionClient())
     {
         var result = client.GetCouponRule(couponId);
         if (result.Success && result.Result != null)
         {
             return(new LotteryCouponModel
             {
                 ProductGroupId = productGroupId,
                 CouponId = couponId,
                 CouponDesc = result.Result.Description,
                 CouponCondition = $"满{result.Result.MinMoney}减{result.Result.Discount}",
                 UsefulLife = result.Result.Term == null ? $"{result.Result.ValiStartDate}到{result.Result.ValiEndDate}" : $"自领取之后{result.Result.Term}天有效"
             });
         }
     }
     return(null);
 }