public async Task <MessageModel <string> > SaveData(ApiResourceDto request)
        {
            if (request != null && request.Id == 0)
            {
                IdentityServer4.Models.ApiResource apiResource = new IdentityServer4.Models.ApiResource()
                {
                    Name        = request?.Name,
                    DisplayName = request?.DisplayName,
                    Description = request?.Description,
                    Enabled     = true,
                    UserClaims  = request?.UserClaims?.Split(","),
                    Scopes      = request?.Scopes?.Split(","),
                };

                var result = (await _configurationDbContext.ApiResources.AddAsync(apiResource.ToEntity()));
                await _configurationDbContext.SaveChangesAsync();
            }

            if (request != null && request.Id > 0)
            {
                var modelEF = (await _configurationDbContext.ApiResources
                               .Include(d => d.UserClaims)
                               .Include(d => d.Scopes)
                               .ToListAsync()).FirstOrDefault(d => d.Id == request.Id);

                modelEF.Name        = request?.Name;
                modelEF.DisplayName = request?.DisplayName;
                modelEF.Description = request?.Description;

                {
                    var apiResourceClaim = new List <IdentityServer4.EntityFramework.Entities.ApiResourceClaim>();
                    if (!string.IsNullOrEmpty(request?.UserClaims))
                    {
                        request?.UserClaims.Split(",").Where(s => s != "" && s != null).ToList().ForEach(s =>
                        {
                            apiResourceClaim.Add(new IdentityServer4.EntityFramework.Entities.ApiResourceClaim()
                            {
                                ApiResource   = modelEF,
                                ApiResourceId = modelEF.Id,
                                Type          = s
                            });
                        });
                        modelEF.UserClaims = apiResourceClaim;
                    }
                }


                var apiResourceScopes = new List <IdentityServer4.EntityFramework.Entities.ApiResourceScope>();
                if (!string.IsNullOrEmpty(request?.Scopes))
                {
                    request?.Scopes.Split(",").Where(s => s != "" && s != null).ToList().ForEach(s =>
                    {
                        apiResourceScopes.Add(new IdentityServer4.EntityFramework.Entities.ApiResourceScope()
                        {
                            ApiResource   = modelEF,
                            ApiResourceId = modelEF.Id,
                            Scope         = s
                        });
                    });
                    modelEF.Scopes = apiResourceScopes;
                }


                var result = (_configurationDbContext.ApiResources.Update(modelEF));
                await _configurationDbContext.SaveChangesAsync();
            }


            return(new MessageModel <string>()
            {
                success = true,
                msg = "添加成功",
            });
        }