public ExecuteResult<ProductInfoResponse> CreateCoupon(CreateCouponProductRequest request)
        {
            if (request == null)
            {
                return new ExecuteResult<ProductInfoResponse>(null) { StatusCode = StatusCode.ClientError, Message = "参数错误" };
            }
            var product = _productRepository.GetItem(request.ProductId);
            if (product == null)
            {
                return new ExecuteResult<ProductInfoResponse>(null) { StatusCode = StatusCode.ClientError, Message = "参数错误" };
            }

            //判断如果是v1.0版本 可以允许创建优惠券。

            ExecuteResult<CouponCodeResponse> coupon = null;
            if (request.Client_Version != "1.0")
            {
                //获取商品关联的活动
                var promotionEntity = _promotionService.GetFristNormalForProductId(product.Id);
                if (request.PromotionId == null || request.PromotionId.Value < 1)
                {

                    if (promotionEntity == null)
                    {
                        return new ExecuteResult<ProductInfoResponse>(null) { StatusCode = StatusCode.ClientError, Message = "当前商品没有参加活动" };
                    }

                    request.PromotionId = promotionEntity.Id;
                }
                else
                {
                    //判断
                    if (!_promotionService.Exists(request.PromotionId ?? 0, request.ProductId))
                    {
                        return new ExecuteResult<ProductInfoResponse>(null) { StatusCode = StatusCode.ClientError, Message = "当前商品没有参加该活动" };
                    }
                }
                using (var ts = new TransactionScope())
                {
                    coupon = _couponDataService.CreateCoupon(new CouponCouponRequest
                    {
                        AuthUid = request.AuthUser.Id,
                        PromotionId = promotionEntity.Id,
                        ProductId = request.ProductId,
                        SourceType = (int)SourceType.Promotion,
                        Token = request.Token,
                        AuthUser = request.AuthUser,
                        Method = request.Method,
                        Client_Version = request.Client_Version
                    });

                    if (!coupon.IsSuccess)
                    {
                        return new ExecuteResult<ProductInfoResponse>(null)
                        {
                            Message = coupon.Message,
                            StatusCode = coupon.StatusCode
                        };
                    }

                    promotionEntity = _promotionRepo.SetCount(PromotionCountType.InvolvedCount, promotionEntity.Id, 1);

                    product = _productRepository.SetCount(ProductCountType.InvolvedCount, product.Id, 1);

                    var response = MappingManager.ProductInfoResponseMapping(product);
                    response.CouponCodeResponse = coupon.Data;

                    if (request.AuthUser != null)
                    {
                        response = IsR(response, request.AuthUser, product.Id);
                    }
                    ts.Complete();
                    return new ExecuteResult<ProductInfoResponse>(response);


                }
            }
            else
            {
                return new ExecuteResult<ProductInfoResponse>(null) { StatusCode = StatusCode.ClientError, Message = "参数错误" };
            }

        }
        public ActionResult Coupon(CreateCouponProductRequest request, int? authuid, UserModel authUser)
        {
            request.AuthUid = authuid.Value;
            request.AuthUser = authUser;
            if (System.String.Compare(request.Method, DefineRestfulMethod.Create, System.StringComparison.OrdinalIgnoreCase) == 0)
            {
                var result = this._productDataService.CreateCoupon(request);
                /*
                if (request.IsPass == 1 && result.Data != null && result.Data.CouponCodeResponse != null)
                {
                    var code = result.Data.CouponCodeResponse;
                    
                    result.Data.CouponCodeResponse.Pass = _passHelper.GetPass(ControllerContext.HttpContext, code.Id,
                                                                              code.CouponId, code.User_Id);
                   
                }
                */
                return new RestfulResult
                {
                    Data = result
                };
            }

            return new RestfulResult { Data = new ExecuteResult { StatusCode = StatusCode.ClientError, Message = "参数错误" } };
        }