package svc import ( "applet/app/db" "applet/app/e" "applet/app/utils" "github.com/gin-gonic/gin" ) func Cate(c *gin.Context) { storeId := c.GetHeader("store_id") if storeId == "" { storeId = "0" } if utils.StrToInt(storeId) > 0 { storeData := db.GetStoreIdEg(MasterDb(c), storeId) if storeData.StoreType == 0 { storeId = "0" } } cate := db.GetCate(MasterDb(c), storeId) 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 }