修改分页条数

pull/23/head
陶士涵 4 years ago
parent 38ab39ed1b
commit f3c6c4c7dc

@ -10,7 +10,7 @@ import (
var (
PageSize uint = 10
VisitorPageSize uint = 8
VisitorPageSize uint = 10
Version = "0.1.2"
GoflyConfig *Config
)

@ -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,

Loading…
Cancel
Save