|
@@ -0,0 +1,131 @@
|
|
|
+package controller
|
|
|
+
|
|
|
+import (
|
|
|
+ "github.com/gin-gonic/gin"
|
|
|
+ "trading-go/model"
|
|
|
+ "trading-go/response"
|
|
|
+)
|
|
|
+
|
|
|
+// GetAllGoods
|
|
|
+// @Tags 商品模块
|
|
|
+// @Summary 获取所有商品
|
|
|
+// @Produce application/json
|
|
|
+// @Success 200 {object} response.Response
|
|
|
+// @Router /goods [get]
|
|
|
+func GetAllGoods(c *gin.Context) {
|
|
|
+ var goods []model.GoodsSurface
|
|
|
+ goods = append(goods, model.GoodsSurface{})
|
|
|
+ goods = append(goods, model.GoodsSurface{})
|
|
|
+ response.Success(c.Writer, "success", goods)
|
|
|
+}
|
|
|
+
|
|
|
+// CreatGoods
|
|
|
+// @Tags 商品模块
|
|
|
+// @Summary 创建商品
|
|
|
+// @Accept application/json
|
|
|
+// @Produce application/json
|
|
|
+// @Param json body model.GoodsJson true "商品信息"
|
|
|
+// @Success 200 {object} response.Response
|
|
|
+// @Router /goods/create [post]
|
|
|
+func CreatGoods(c *gin.Context) {
|
|
|
+ response.Success(c.Writer, "success", nil)
|
|
|
+}
|
|
|
+
|
|
|
+// DGoods
|
|
|
+// @Tags 商品模块
|
|
|
+// @Summary 删除商品
|
|
|
+// @Produce application/json
|
|
|
+// @Param id path int64 true "商品id"
|
|
|
+// @Success 200 {object} response.Response
|
|
|
+// @Router /goods/delete/{id} [delete]
|
|
|
+func DGoods(c *gin.Context) {
|
|
|
+ response.Success(c.Writer, "success", nil)
|
|
|
+}
|
|
|
+
|
|
|
+// GetGoodsPage
|
|
|
+// @Tags 商品模块
|
|
|
+// @Summary 获取所有商品
|
|
|
+// @Produce application/json
|
|
|
+// @Param page path int true "页数"
|
|
|
+// @Param pageSize path int true "一页的大小"
|
|
|
+// @Success 200 {object} response.Response
|
|
|
+// @Router /goods/{page}/{pageSize} [get]
|
|
|
+func GetGoodsPage(c *gin.Context) {
|
|
|
+ var goods []model.GoodsSurface
|
|
|
+ var rsp response.PageResponse
|
|
|
+ goods = append(goods, model.GoodsSurface{})
|
|
|
+ goods = append(goods, model.GoodsSurface{})
|
|
|
+ rsp.Data = goods
|
|
|
+ response.Success(c.Writer, "success", rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// GetRecommend
|
|
|
+// @Tags 商品模块
|
|
|
+// @Summary 分页获取推荐商品
|
|
|
+// @Produce application/json
|
|
|
+// @Param id query int64 true "用户id"
|
|
|
+// @Param page path int true "页数"
|
|
|
+// @Param pageSize path int true "一页的大小"
|
|
|
+// @Success 200 {object} response.Response
|
|
|
+// @Router /goods/recommend/{page}/{pageSize} [get]
|
|
|
+func GetRecommend(c *gin.Context) {
|
|
|
+ var goods []model.GoodsSurface
|
|
|
+ var rsp response.PageResponse
|
|
|
+ goods = append(goods, model.GoodsSurface{})
|
|
|
+ goods = append(goods, model.GoodsSurface{})
|
|
|
+ rsp.Data = goods
|
|
|
+ response.Success(c.Writer, "success", rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// ReviseGoods
|
|
|
+// @Tags 商品模块
|
|
|
+// @Summary 修改商品信息
|
|
|
+// @Produce application/json
|
|
|
+// @Param json body model.Goods true "商品信息"
|
|
|
+// @Success 200 {object} response.Response
|
|
|
+// @Router /goods/revise [post]
|
|
|
+func ReviseGoods(c *gin.Context) {
|
|
|
+ response.Success(c.Writer, "success", nil)
|
|
|
+}
|
|
|
+
|
|
|
+// GetGoodDetail
|
|
|
+// @Tags 商品模块
|
|
|
+// @Summary 获取商品详细信息
|
|
|
+// @Produce application/json
|
|
|
+// @Param id path int64 true "商品id"
|
|
|
+// @Success 200 {object} response.Response
|
|
|
+// @Router /goods/detail/{id} [get]
|
|
|
+func GetGoodDetail(c *gin.Context) {
|
|
|
+ response.Success(c.Writer, "success", model.Goods{})
|
|
|
+}
|
|
|
+
|
|
|
+// GetUserGoods
|
|
|
+// @Tags 商品模块
|
|
|
+// @Summary 获取某个用户的所有商品
|
|
|
+// @Produce application/json
|
|
|
+// @Param id path int64 true "用户id"
|
|
|
+// @Success 200 {object} response.Response
|
|
|
+// @Router /goods/user/{id} [get]
|
|
|
+func GetUserGoods(c *gin.Context) {
|
|
|
+ var data []model.GoodsSurface
|
|
|
+ data = append(data, model.GoodsSurface{})
|
|
|
+ response.Success(c.Writer, "success", data)
|
|
|
+}
|
|
|
+
|
|
|
+// SearchGoods
|
|
|
+// @Tags 商品模块
|
|
|
+// @Summary 搜索商品并分页显示
|
|
|
+// @Produce application/json
|
|
|
+// @Param page path int true "页数"
|
|
|
+// @Param pageSize path int true "一页的大小"
|
|
|
+// @Param keyword query string true "搜素关键词"
|
|
|
+// @Success 200 {object} response.Response
|
|
|
+// @Router /goods/search/{page}/{pageSize} [get]
|
|
|
+func SearchGoods(c *gin.Context) {
|
|
|
+ var goods []model.GoodsSurface
|
|
|
+ var rsp response.PageResponse
|
|
|
+ goods = append(goods, model.GoodsSurface{})
|
|
|
+ goods = append(goods, model.GoodsSurface{})
|
|
|
+ rsp.Data = goods
|
|
|
+ response.Success(c.Writer, "success", rsp)
|
|
|
+}
|