diff --git a/config/config.go b/config/config.go index 8787697..1e5d415 100644 --- a/config/config.go +++ b/config/config.go @@ -10,7 +10,7 @@ import ( var ( PageSize uint = 10 - VisitorPageSize uint = 8 + VisitorPageSize uint = 10 Version = "0.1.2" GoflyConfig *Config ) diff --git a/controller/visitor.go b/controller/visitor.go index 94a9a1a..5244d39 100644 --- a/controller/visitor.go +++ b/controller/visitor.go @@ -147,8 +147,12 @@ func GetVisitor(c *gin.Context) { // @Router /visitors [get] func GetVisitors(c *gin.Context) { page, _ := strconv.Atoi(c.Query("page")) + pagesize, _ := strconv.Atoi(c.Query("pagesize")) + if pagesize == 0 { + pagesize = int(config.VisitorPageSize) + } kefuId, _ := c.Get("kefu_name") - vistors := models.FindVisitorsByKefuId(uint(page), config.VisitorPageSize, kefuId.(string)) + vistors := models.FindVisitorsByKefuId(uint(page), uint(pagesize), kefuId.(string)) count := models.CountVisitorsByKefuId(kefuId.(string)) c.JSON(200, gin.H{ "code": 200,