abiao лет назад: 3
Родитель
Сommit
b7d1e57087

+ 7 - 0
go/gopath/src/fohow.com/apps/controllers/product_controller/product_controller.go

@@ -557,3 +557,10 @@ func (self *ProductController) GetCommendWords() {
 	self.Data["json"] = &Ret{List: list}
 	self.ServeJSON()
 }
+
+//专区商品
+func (self *ProductController) SaleTypes() {
+	saleTypes := product_model.GetProductSaleZones()
+	self.Data["json"] = saleTypes
+	self.ServeJSON()
+}

+ 7 - 0
go/gopath/src/fohow.com/apps/models/product_model/product_sale_type.go

@@ -27,3 +27,10 @@ func GetProductSaleTypeById(id int64) *ProductSaleType {
 	}
 	return saleType
 }
+
+func GetProductSaleZones() (zones []*ProductSaleType) {
+	o := orm.NewOrm()
+	qs := o.QueryTable(new(ProductSaleType))
+	qs.OrderBy("id").All(&zones)
+	return zones
+}

+ 4 - 0
go/gopath/src/fohow.com/routers/routes.go

@@ -84,6 +84,10 @@ func init() {
 	//-----------商城相关 -----------
 	//首页频道栏目
 	beego.Router("/v1/categories", &category_controller.CategoryController{}, "get:Get")
+
+	//商品专区栏目
+	beego.Router("/v1/zones", &product_controller.ProductController{}, "get:SaleTypes")
+
 	//商品列表-精选推荐
 	beego.Router("/v1/products", &product_controller.ProductController{}, "get:Latest")
 	//商品分类