Exemplo n.º 1
0
//添加
func (this *ArticleController) Add() {
	var list []*models.Tag
	var tag models.Tag

	var day = this.GetString("d")
	var month = this.GetString("m")

	tag.Query().OrderBy("-count").All(&list)
	this.Data["list"] = list
	this.Data["day"] = day
	this.Data["month"] = month

	this.display()
}
Exemplo n.º 2
0
//编辑
func (this *ArticleController) Edit() {
	var (
		list []*models.Tag
		tag  models.Tag
	)

	id, _ := this.GetInt64("id")
	post := models.Article{Id: id}
	if post.Read() != nil {
		this.Abort("404")
	}

	tag.Query().OrderBy("-count").All(&list)
	fmt.Println(list)

	this.Data["list"] = list
	this.Data["post"] = post
	this.display()
}
Exemplo n.º 3
0
//标签列表
func (this *TagController) List() {
	var page int
	var pagesize int = 10
	var list []*models.Tag
	var tag models.Tag

	if page, _ = this.GetInt("page"); page < 1 {
		page = 1
	}
	offset := (page - 1) * pagesize

	count, _ := tag.Query().Count()
	if count > 0 {
		tag.Query().OrderBy("-count").Limit(pagesize, offset).All(&list)
	}

	this.Data["count"] = count
	this.Data["list"] = list
	this.Data["pagebar"] = util.NewPager(page, int(count), pagesize, "/admin/tag", true).ToString()
	this.display("tag/list")
}