public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            string ip = IpUtil.GetClientIp(context.HttpContext);

            if (string.IsNullOrWhiteSpace(ip))
            {
                throw new HopexException($"无法取到来源IP,不允许访问");
            }

            if (_options.IpWhiteList == null || _options.IpWhiteList.Count == 0)
            {
                throw new HopexException("无法读取IP白名单配置");
            }

            if (!_options.IpWhiteList.Contains(ip))
            {
                throw new HopexException($"IP[{ip}]无权范围");
            }

            await next.Invoke();
        }
        /// <summary>
        /// 请求日志记录
        /// </summary>
        public async Task InvokeAsync(HttpContext context)
        {
            context.Items["CorrelationId"] = Guid.NewGuid().ToString();

            if (!context.Request.Path.HasValue || !context.Request.Path.Value.Contains("api/", StringComparison.InvariantCultureIgnoreCase))
            {
                await _next(context);

                return;
            }

            var request = await FormatRequest(context.Request);

            var ip              = IpUtil.GetClientIp(context);
            var userId          = context.User?.GetId();
            var packType        = context.Request.GetPackType();
            var converssionType = context.Request.GetConversionCurrency();

            var originalBodyStream = context.Response.Body;

            using (var responseBody = new MemoryStream())
            {
                context.Response.Body = responseBody;

                Stopwatch watch = Stopwatch.StartNew();

                await _next(context);

                var response = await FormatResponse(context.Response);

                await responseBody.CopyToAsync(originalBodyStream);

                watch.Stop();

                Log(ip, userId, packType.ToString(), converssionType, request, response, watch.ElapsedMilliseconds);
            }
        }