/// <summary> /// 获取页面url /// </summary> /// <param name="paging"></param> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> private static string GetPageUrl(this PagingModel paging, int pageIndex, int pageSize) { var result = paging.RequestUrl; var queryString = ""; if (paging.QueryParams.Count > 0) { foreach (var kvp in paging.QueryParams) { if (!string.IsNullOrWhiteSpace(kvp.Value) && !kvp.Key.CompareIgnoreCase("pageIndex") && !kvp.Key.CompareIgnoreCase("pagesize")) { queryString += $"{kvp.Key}={kvp.Value}&"; } } queryString = queryString.TrimEnd('&'); } if (!string.IsNullOrWhiteSpace(queryString)) { result = $"{result}?{queryString}"; } if (pageIndex > 1) { result = UrlHelper.AddQueryParamToUrl(result, "pageIndex", pageIndex.ToString()); } if (pageSize != PagingModel.MIN_PAGE_SIZE) { result = UrlHelper.AddQueryParamToUrl(result, "pageIndex", pageSize.ToString()); } return(result); }