MCPcopy Index your code
hub / github.com/TruthHun/BookStack / Categories

Method Categories

controllers/api/CommonController.go:566–591  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

564}
565
566func (this *CommonController) Categories() {
567
568 model := models.NewCategory()
569
570 pid, err := this.GetInt("pid")
571 if err != nil {
572 pid = -1
573 }
574 m := models.NewOption()
575 categories, _ := model.GetCates(pid, 1)
576 for idx, category := range categories {
577 if m.IsResponseEmptyForAPP(this.Version, category.Title) {
578 // 为0,APP端就不会显示该分类
579 category.Cnt = 0
580 }
581 if category.Icon != "" {
582 if category.Icon == "" {
583 category.Icon = "/static/images/cate.png"
584 }
585 category.Icon = this.completeLink(category.Icon)
586 categories[idx] = category
587 }
588 }
589
590 this.Response(http.StatusOK, messageSuccess, map[string]interface{}{"categories": categories})
591}
592
593// 【OK】
594func (this *CommonController) BookInfo() {

Callers

nothing calls this directly

Calls 6

GetCatesMethod · 0.95
IsResponseEmptyForAPPMethod · 0.95
NewCategoryFunction · 0.92
NewOptionFunction · 0.92
completeLinkMethod · 0.80
ResponseMethod · 0.80

Tested by

no test coverage detected