Example #1
0
func (this *TalkController) Talk() {
	//专题下二级页面
	talk := models.Talk{}
	allPage := math.Ceil(float64(talk.Count()) / 15)
	this.Data["allpage"] = allPage
	this.TplNames = ""
}
Example #2
0
func (this *TalkController) BuildTopic() {
	//创建专题
	talk := models.Talk{}
	talk.Nickname = "" //创建人昵称
	talk.Topic = ""    //用户创建专题
	talk.Short = ""    //话题简介
	talk.Pid = 0       //分类级别专题和单独的话题最高级别pid为0

}
Example #3
0
func (this *TalkController) ShowTopic() {
	//专题列表分页操作
	page, _ := this.GetInt("page")
	//查询前page~page+15个我的文章
	talk := models.Talk{}
	//fmt.Println(allPage)
	articles := talk.List(uint32((page-1)*15), uint32(page*15))
	this.Data["json"] = articles
	this.ServeJson()
}
Example #4
0
func (this *TalkController) Publish() {
	talk := models.Talk{}
	//发布话题
	status, _ := this.GetInt("status")
	if status == 0 {
		//判断传过来的status,如果为0则是单独的话题
		talk.Nickname = "" //发布人昵称
		talk.Talk = ""     //用户创建专题
		talk.Pid = 0       //分类级别专题和单独的话题最高级别pid为0
	} else {
		//判断传过来的status,如果不为0则是专题下的话题
		id, _ := this.GetInt("id")
		talk.Nickname = "" //发布人昵称
		talk.Talk = ""     //用户创建专题
		talk.Pid = id      //分类级别专题和单独的话题最高级别pid为0
	}
}