This commit is contained in:
parent
481ebd18db
commit
4d6f4f45ee
@ -14,7 +14,7 @@ type ItemController struct {
|
|||||||
|
|
||||||
func (c *ItemController) BeforeActivation(b mvc.BeforeActivation) {
|
func (c *ItemController) BeforeActivation(b mvc.BeforeActivation) {
|
||||||
b.Handle("GET", "/detail/{id:uint}", "Detail")
|
b.Handle("GET", "/detail/{id:uint}", "Detail")
|
||||||
b.Handle("GET", "/list/{ttype:int}", "GetList")
|
b.Handle("GET", "/list/type/{ttype:int}", "GetListByType")
|
||||||
b.Handle("GET", "/search", "Search")
|
b.Handle("GET", "/search", "Search")
|
||||||
|
|
||||||
b.Handle("GET", "types", "GetTypes")
|
b.Handle("GET", "types", "GetTypes")
|
||||||
@ -56,8 +56,8 @@ func (c *ItemController) Detail(id uint) mvc.Result {
|
|||||||
// @Param type path string true "商品类型"
|
// @Param type path string true "商品类型"
|
||||||
// @Success 200 {object} []model.ItemModel "{["id":1],["id":2]}"
|
// @Success 200 {object} []model.ItemModel "{["id":1],["id":2]}"
|
||||||
// @Failure 400 {object} map[string]interface{} "{"msg": "错误信息","code":0}"
|
// @Failure 400 {object} map[string]interface{} "{"msg": "错误信息","code":0}"
|
||||||
// @Router /api/item/list/{type} [get]
|
// @Router /api/item/list/type/{type} [get]
|
||||||
func (c *ItemController) GetList(ttype int) mvc.Result {
|
func (c *ItemController) GetListByType(ttype int) mvc.Result {
|
||||||
items, e := c.Service.Item.GetItems(ttype)
|
items, e := c.Service.Item.GetItems(ttype)
|
||||||
if e.Error() {
|
if e.Error() {
|
||||||
return e.Response()
|
return e.Response()
|
||||||
|
@ -304,7 +304,7 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/item/list/{type}": {
|
"/api/item/list/type/{type}": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "通过类型获取相关商品列表",
|
"description": "通过类型获取相关商品列表",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
|
@ -298,7 +298,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/item/list/{type}": {
|
"/api/item/list/type/{type}": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "通过类型获取相关商品列表",
|
"description": "通过类型获取相关商品列表",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
|
@ -352,7 +352,7 @@ paths:
|
|||||||
summary: get item api
|
summary: get item api
|
||||||
tags:
|
tags:
|
||||||
- item api
|
- item api
|
||||||
/api/item/list/{type}:
|
/api/item/list/type/{type}:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
|
Loading…
Reference in New Issue
Block a user