func (ar *ArticleResource) ArticlesList(c *iris.Context) {
page, _ := c.URLParamInt("page")
var articles []Article
var counts int64
ar.DB.Model(&Article{}).Count(&counts)
switch {
case page == 1:
ar.DB.Order("id desc").Limit(5).Find(&articles)
default:
ar.DB.Order("id desc").Limit(5).Offset(page * 5).Find(&articles)
}
c.JSON(iris.StatusOK, map[string]interface{}{"articles": &articles, "count":&counts})
}