diff --git a/controller/item_controller.go b/controller/item_controller.go index 7958724..8d2bfd1 100644 --- a/controller/item_controller.go +++ b/controller/item_controller.go @@ -14,7 +14,7 @@ type ItemController struct { func (c *ItemController) BeforeActivation(b mvc.BeforeActivation) { 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", "types", "GetTypes") @@ -56,8 +56,8 @@ func (c *ItemController) Detail(id uint) mvc.Result { // @Param type path string true "商品类型" // @Success 200 {object} []model.ItemModel "{["id":1],["id":2]}" // @Failure 400 {object} map[string]interface{} "{"msg": "错误信息","code":0}" -// @Router /api/item/list/{type} [get] -func (c *ItemController) GetList(ttype int) mvc.Result { +// @Router /api/item/list/type/{type} [get] +func (c *ItemController) GetListByType(ttype int) mvc.Result { items, e := c.Service.Item.GetItems(ttype) if e.Error() { return e.Response() diff --git a/docs/docs.go b/docs/docs.go index 11fd975..74fde31 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -304,7 +304,7 @@ const docTemplate = `{ } } }, - "/api/item/list/{type}": { + "/api/item/list/type/{type}": { "get": { "description": "通过类型获取相关商品列表", "consumes": [ diff --git a/docs/swagger.json b/docs/swagger.json index 7acc4ea..c05bc4d 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -298,7 +298,7 @@ } } }, - "/api/item/list/{type}": { + "/api/item/list/type/{type}": { "get": { "description": "通过类型获取相关商品列表", "consumes": [ diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 1553c97..63d2846 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -352,7 +352,7 @@ paths: summary: get item api tags: - item api - /api/item/list/{type}: + /api/item/list/type/{type}: get: consumes: - application/json