package svc

import (
	"applet/app/db"
	"applet/app/e"
	"applet/app/utils"
	"github.com/gin-gonic/gin"
)

func Cate(c *gin.Context) {
	cate := db.GetCate(MasterDb(c), "0")
	cateList := make([]map[string]string, 0)
	if cate != nil {
		for _, v := range *cate {
			tmp := map[string]string{
				"id":   utils.IntToStr(v.Id),
				"name": v.Title,
			}
			cateList = append(cateList, tmp)
		}
	}
	e.OutSuc(c, cateList, nil)
	return
}
