From ec657b9dcbbde04a21ae4fd2a8419a795386c7aa Mon Sep 17 00:00:00 2001 From: Sunpy Date: Thu, 13 Apr 2017 18:00:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Darm=2032=E4=B8=8B`/adminUser/?= =?UTF-8?q?index`=E5=81=87=E6=AD=BB=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 如果pageSize为0,则计算页数的时候会造成浮点数除0.0,由于浮点数除0得到的结果是`+Inf`,转换为整数后的结果是`2,147,483,647`,所以在渲染page.html模板时需要很长时间。 --- app/controllers/admin/AdminUserController.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/AdminUserController.go b/app/controllers/admin/AdminUserController.go index 6926a79..f996c47 100644 --- a/app/controllers/admin/AdminUserController.go +++ b/app/controllers/admin/AdminUserController.go @@ -18,7 +18,7 @@ var userPageSize = 10 func (c AdminUser) Index(sorter, keywords string, pageSize int) revel.Result { pageNumber := c.GetPage() - if userPageSize == 0 { + if pageSize == 0 { pageSize = userPageSize } sorterField, isAsc := c.getSorter("CreatedTime", false, []string{"email", "username", "verified", "createdTime", "accountType"})