public async ValueTask <CouponGetRuleModel> GetByPKIDAsync(int PKID, CancellationToken cancellationToken)
        {
            CouponGetRuleEntity entity = await _ICouponGetRuleRepository.GetByPKIDAsync(PKID, cancellationToken).ConfigureAwait(false);

            CouponGetRuleModel model = ObjectMapper.ConvertTo <CouponGetRuleEntity, CouponGetRuleModel>(entity);

            return(model);
        }
        /// <summary>
        /// 根据guid获取优惠券领取规则 【加缓存】
        /// </summary>
        /// <param name="GetRuleGUID"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task <CouponGetRuleModel> GetCouponGetRuleCahceByGuidAsync(Guid GetRuleGUID, CancellationToken cancellationToken)
        {
            CouponGetRuleEntity entity = new CouponGetRuleEntity();

            using (var client = _ICacheHelper.CreateCacheClient(GlobalConstant.RedisClient))
            {
                var result = await client.GetOrSetAsync(string.Format(GlobalConstant.RedisKeyForGetRule, GetRuleGUID),
                                                        async() => await _ICouponGetRuleRepository.GetCouponGetRuleByGuidAsync(GetRuleGUID, cancellationToken).ConfigureAwait(false),
                                                        GlobalConstant.RedisTTLForGetRule).ConfigureAwait(false);

                if (result.Success)
                {
                    entity = result.Value;
                }
                else
                {
                    entity = await _ICouponGetRuleRepository.GetCouponGetRuleByGuidAsync(GetRuleGUID, cancellationToken).ConfigureAwait(false);
                }
            }
            CouponGetRuleModel model = ObjectMapper.ConvertTo <CouponGetRuleEntity, CouponGetRuleModel>(entity);

            return(model);
        }
        /// <summary>
        /// 审核成功 同步到领取规则
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async ValueTask <int> SaveAuditToGetRuleAsync(GetCouponRuleAuditModel request, CancellationToken cancellationToken)
        {
            int pkid = 0;

            try
            {
                CouponGetRuleEntity entity = ObjectMapper.ConvertTo <GetCouponRuleAuditModel, CouponGetRuleEntity>(request);
                entity.PKID = request.GetCouponRulePKID;
                if (entity.PKID > 0)
                {
                    pkid = await _ICouponGetRuleRepository.UpdateAsync(entity, cancellationToken).ConfigureAwait(false) ? entity.PKID : 0;
                }
                else
                {
                    pkid = await _ICouponGetRuleRepository.CreateAsync(entity, cancellationToken).ConfigureAwait(false);
                }
                return(pkid);
            }
            catch (Exception ex)
            {
                _logger.Error($"UpdateCouponGetRuleAuditAsync Exception {JsonConvert.SerializeObject(request)}", ex);
                return(0);
            }
        }