goodscontroller.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. package controller
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "trading-go/model"
  5. "trading-go/response"
  6. )
  7. // GetAllGoods
  8. // @Tags 商品模块
  9. // @Summary 获取所有商品
  10. // @Produce application/json
  11. // @Success 200 {object} response.Response
  12. // @Router /goods [get]
  13. func GetAllGoods(c *gin.Context) {
  14. var goods []model.GoodsSurface
  15. goods = append(goods, model.GoodsSurface{})
  16. goods = append(goods, model.GoodsSurface{})
  17. response.Success(c.Writer, "success", goods)
  18. }
  19. // CreatGoods
  20. // @Tags 商品模块
  21. // @Summary 创建商品
  22. // @Accept application/json
  23. // @Produce application/json
  24. // @Param json body model.GoodsJson true "商品信息"
  25. // @Success 200 {object} response.Response
  26. // @Router /goods/create [post]
  27. func CreatGoods(c *gin.Context) {
  28. response.Success(c.Writer, "success", nil)
  29. }
  30. // DGoods
  31. // @Tags 商品模块
  32. // @Summary 删除商品
  33. // @Produce application/json
  34. // @Param id path int64 true "商品id"
  35. // @Success 200 {object} response.Response
  36. // @Router /goods/delete/{id} [delete]
  37. func DGoods(c *gin.Context) {
  38. response.Success(c.Writer, "success", nil)
  39. }
  40. // GetGoodsPage
  41. // @Tags 商品模块
  42. // @Summary 获取所有商品
  43. // @Produce application/json
  44. // @Param page path int true "页数"
  45. // @Param pageSize path int true "一页的大小"
  46. // @Success 200 {object} response.Response
  47. // @Router /goods/{page}/{pageSize} [get]
  48. func GetGoodsPage(c *gin.Context) {
  49. var goods []model.GoodsSurface
  50. var rsp response.PageResponse
  51. goods = append(goods, model.GoodsSurface{})
  52. goods = append(goods, model.GoodsSurface{})
  53. rsp.Data = goods
  54. response.Success(c.Writer, "success", rsp)
  55. }
  56. // GetRecommend
  57. // @Tags 商品模块
  58. // @Summary 分页获取推荐商品
  59. // @Produce application/json
  60. // @Param id query int64 true "用户id"
  61. // @Param page path int true "页数"
  62. // @Param pageSize path int true "一页的大小"
  63. // @Success 200 {object} response.Response
  64. // @Router /goods/recommend/{page}/{pageSize} [get]
  65. func GetRecommend(c *gin.Context) {
  66. var goods []model.GoodsSurface
  67. var rsp response.PageResponse
  68. goods = append(goods, model.GoodsSurface{})
  69. goods = append(goods, model.GoodsSurface{})
  70. rsp.Data = goods
  71. response.Success(c.Writer, "success", rsp)
  72. }
  73. // ReviseGoods
  74. // @Tags 商品模块
  75. // @Summary 修改商品信息
  76. // @Produce application/json
  77. // @Param json body model.Goods true "商品信息"
  78. // @Success 200 {object} response.Response
  79. // @Router /goods/revise [post]
  80. func ReviseGoods(c *gin.Context) {
  81. response.Success(c.Writer, "success", nil)
  82. }
  83. // GetGoodDetail
  84. // @Tags 商品模块
  85. // @Summary 获取商品详细信息
  86. // @Produce application/json
  87. // @Param id path int64 true "商品id"
  88. // @Success 200 {object} response.Response
  89. // @Router /goods/detail/{id} [get]
  90. func GetGoodDetail(c *gin.Context) {
  91. response.Success(c.Writer, "success", model.Goods{})
  92. }
  93. // GetUserGoods
  94. // @Tags 商品模块
  95. // @Summary 获取某个用户的所有商品
  96. // @Produce application/json
  97. // @Param id path int64 true "用户id"
  98. // @Success 200 {object} response.Response
  99. // @Router /goods/user/{id} [get]
  100. func GetUserGoods(c *gin.Context) {
  101. var data []model.GoodsSurface
  102. data = append(data, model.GoodsSurface{})
  103. response.Success(c.Writer, "success", data)
  104. }
  105. // SearchGoods
  106. // @Tags 商品模块
  107. // @Summary 搜索商品并分页显示
  108. // @Produce application/json
  109. // @Param page path int true "页数"
  110. // @Param pageSize path int true "一页的大小"
  111. // @Param keyword query string true "搜素关键词"
  112. // @Success 200 {object} response.Response
  113. // @Router /goods/search/{page}/{pageSize} [get]
  114. func SearchGoods(c *gin.Context) {
  115. var goods []model.GoodsSurface
  116. var rsp response.PageResponse
  117. goods = append(goods, model.GoodsSurface{})
  118. goods = append(goods, model.GoodsSurface{})
  119. rsp.Data = goods
  120. response.Success(c.Writer, "success", rsp)
  121. }