本文整理汇总了Golang中gocms/models.Articlecategory类的典型用法代码示例。如果您正苦于以下问题:Golang Articlecategory类的具体用法?Golang Articlecategory怎么用?Golang Articlecategory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Articlecategory类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: GetData
func (this *ArtilcecategoryController) GetData() {
id, _ := strconv.Atoi(this.Ctx.Input.Param(":id"))
category := new(models.Articlecategory)
err := category.GetCategoryInfo(id)
if err != nil {
fmt.Println(err)
}
this.Data["json"] = category
this.ServeJson()
}
开发者ID:meilixueshan,项目名称:gocms,代码行数:10,代码来源:articlecategory.go
示例2: Edit
func (this *ArticleController) Edit() {
id := this.Ctx.Input.Param(":id")
articleCategory := new(models.Articlecategory)
categories := articleCategory.GetList()
this.Data["id"] = id
this.Data["categories"] = categories
this.TplNames = "admin/articleEdit.tpl"
}
开发者ID:meilixueshan,项目名称:gocms,代码行数:10,代码来源:article.go
示例3: Delete
func (this *ArtilcecategoryController) Delete() {
var ajaxResult models.AjaxResult
id := this.Ctx.Input.Param(":id")
categoryId, err := strconv.Atoi(id)
if err != nil {
ajaxResult = models.AjaxResult{Success: false}
ajaxResult.Error = err.Error()
} else {
category := new(models.Articlecategory)
ajaxResult = category.Delete(categoryId)
}
this.Data["json"] = ajaxResult
this.ServeJson()
}
开发者ID:meilixueshan,项目名称:gocms,代码行数:15,代码来源:articlecategory.go
示例4: Save
func (this *ArtilcecategoryController) Save() {
ajaxResult := new(models.AjaxResult)
category := new(models.Articlecategory)
err := json.Unmarshal(this.Ctx.Input.RequestBody, &category)
if err != nil {
ajaxResult.Error = err.Error()
} else {
err = category.Save()
if err != nil {
ajaxResult.Error = err.Error()
} else {
ajaxResult.Success = true
ajaxResult.Msg = &category
}
}
this.Data["json"] = ajaxResult
this.ServeJson()
}
开发者ID:meilixueshan,项目名称:gocms,代码行数:19,代码来源:articlecategory.go
示例5: Edit
func (this *ArtilcecategoryController) Edit() {
id := this.Ctx.Input.Param(":id")
articleCategory := new(models.Articlecategory)
if strings.Compare(id, "") == 0 {
this.Data["categories"] = articleCategory.GetList()
} else {
categoryId, err := strconv.Atoi(id)
if err != nil {
fmt.Println(err)
}
categories := articleCategory.GetListEncludesSelf(categoryId)
fmt.Println(categories)
this.Data["categories"] = categories
}
this.Data["id"] = id
this.TplNames = "admin/articleCategoryEdit.tpl"
}
开发者ID:meilixueshan,项目名称:gocms,代码行数:19,代码来源:articlecategory.go
示例6: Get
func (this *ArticleController) Get() {
articleCategory := new(models.Articlecategory)
categories := articleCategory.GetList()
this.Data["categories"] = categories
this.TplNames = "admin/article.tpl"
}
开发者ID:meilixueshan,项目名称:gocms,代码行数:6,代码来源:article.go
示例7: GetDataList
func (this *ArtilcecategoryController) GetDataList() {
articleCategory := new(models.Articlecategory)
categories := articleCategory.GetList()
this.Data["json"] = categories
this.ServeJson()
}
开发者ID:meilixueshan,项目名称:gocms,代码行数:6,代码来源:articlecategory.go
注:本文中的gocms/models.Articlecategory类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论